我正在开发一个程序,该程序将创建一个没有标题栏的窗口,该窗口的 WM_CLOSE 消息过程设置为返回 0。到目前为止,我得到了这个:
LRESULT CALLBACK WindowEventProc(HWND hWindow, UINT uMsg,WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT Paint;
HDC hdc;
switch (uMsg)
{
case WM_DESTOY:
PostQuitMessage (0);
return 0;
case WM_CLOSE:
return 0;
case WM_PAINT:
hdc=BeginPaint(hWindow,&Paint);
//here should go the code for painting
EndPaint(hWindow, &Paint);
return 0L;
}
return DefWindowProc(hWindow, uMsg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow)
{
GetDesktopSize(h,w);
WNDCLASSEX KlasaOkna;
ZeroMemory (&KlasaOkna, sizeof(WNDCLASSEX));
KlasaOkna.cbSize = sizeof(WNDCLASSEX);
KlasaOkna.hInstance = hInstance;
KlasaOkna.lpfnWndProc = WindowEventProc;
KlasaOkna.lpszClassName = Name.c_str();
KlasaOkna.hCursor = LoadCursor(NULL, IDC_ARROW);
KlasaOkna.hIcon = LoadIcon(NULL, IDI_APPLICATION);
KlasaOkna.hbrBackground = (HBRUSH) COLOR_WINDOW;
RegisterClassEx (&KlasaOkna);
HWND hwn;
hwn = CreateWindowEx(NULL,Name.c_str(),"",WS_MYSET,0,0,w,h,NULL,NULL,hInstance,NULL);
SetWindowPos(hwn,HWND_TOPMOST,0,0,w,h,NULL);
SetWindowLong(hwn, GWL_STYLE, 0);
ShowWindow (hwn, SW_SHOWMAXIMIZED);
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
它按预期工作,但现在最难的是 - 我希望窗口在其客户区域中打开一个网站。我认为维护网站功能的最佳方式是通过浏览器打开它。肯定有一种方法可以将 Internet 浏览器绘制到我的窗口中,但我想不出任何方法,我也无法在 MSDN 中找到它。有谁知道该怎么做?