使用Internet浏览器的客户区填充窗口的客户区

时间:2013-06-28 00:10:09

标签: c++ c winapi browser window

我正在开发一个程序,它将创建一个没有标题栏的窗口,其中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);
    }
}

按预期工作,但现在最困难的事情 - 我希望窗口在其客户区域中打开一个网站。我认为维护网站功能的最佳方法是通过浏览器打开它。肯定有一种方法可以将互联网浏览器绘制到我的窗口中,但我想不出任何一种,我也无法在MSDN中找到它。有谁知道怎么做?

1 个答案:

答案 0 :(得分:0)

当然可能,但不是微不足道的。嵌入WebKit。

Microsoft解决方案是将Trident作为ActiveX组件嵌入。