#include #include "webpage.h" LRESULT CALLBACK Dlg_Proc( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam ) { switch ( wMsg ) { case WM_CREATE: if( EmbedBrowserObject(hWnd) ) return -1; ++WindowCount; break; case WM_SHOWWINDOW: AttachSink(hWnd); break; case WM_SIZE: HWND cw,pw; pw = hWnd; int i; i = 0; do { cw = FindWindowEx(pw, 0, 0, 0); if( cw ) { i++; RECT rect; GetClientRect(pw, &rect); MoveWindow(cw, 0, 0, rect.right, rect.bottom, 1); pw = cw; } } while ( cw && (i < 2) ); break; case WM_CLOSE: SendMessage(hWnd, WM_DESTROY, 0, 0); break; case WM_DESTROY: UnEmbedBrowserObject(hWnd); --WindowCount; if ( !WindowCount ) PostQuitMessage(0); break; default: return DefWindowProc(hWnd, wMsg, wParam, lParam); } return 0; } int WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in_opt LPSTR lpCmdLine, __in int nShowCmd ) { MSG msg; if ( OleInitialize(NULL) == S_OK ) { WNDCLASSEX wc; ZeroMemory(&wc,sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hInstance = hInstance; wc.lpfnWndProc = Dlg_Proc; wc.lpszClassName = &ClassName[0]; RegisterClassEx(&wc); if( (msg.hwnd = CreateWindowEx(0, &ClassName[0], "News", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_DESKTOP, NULL, hInstance, 0)) ) { DisplayHTMLPage(msg.hwnd, "http://www.freedomworld.ru"); ShowWindow(msg.hwnd, SW_SHOW); UpdateWindow(msg.hwnd); } while(GetMessage(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessage(&msg); } OleUninitialize(); } return 0; }