LRESULT CALLBACK Announcements::AnnounceWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult; BOOL bHandled; Announcements* ann = (Announcements*)GetWindowLongPtr(hwnd, GWLP_USERDATA); lResult = HTMLayoutProcND(hwnd,message,wParam,lParam, &bHandled); if(bHandled) { return lResult; } switch(message) { case WM_NCCREATE: ann = (Announcements*)((CREATESTRUCT *) lParam)->lpCreateParams; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) ann); break; //case WM_COMMAND: // if(((HWND)lParam) && (HIWORD(wParam) == BN_CLICKED)) // i=1; //case WM_LBUTTONUP: // i=1; } return DefWindowProc(hwnd, message, wParam, lParam); }
LRESULT CALLBACK window::win_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult; BOOL bHandled; // HTMLayout + // HTMLayout could be created as separate window // using CreateWindow API. // But in this case we are attaching HTMLayout functionality // to the existing window delegating windows message handling to // HTMLayoutProcND function. lResult = HTMLayoutProcND(hwnd,message,wParam,lParam, &bHandled); if(bHandled) return lResult; // HTMLayout - window* me = self(hwnd); switch (message) { case WM_NCHITTEST: if(me) return me->hit_test( GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) ); break; case WM_NCCALCSIZE: return 0; // we have no non-client areas. case WM_NCPAINT: return 0; // we have no non-client areas. case WM_NCACTIVATE: return (wParam == 0)? TRUE : FALSE; // we have no non-client areas. case WM_GETMINMAXINFO: { LRESULT lr = DefWindowProcW(hwnd, message, wParam, lParam); MINMAXINFO* pmmi = (MINMAXINFO*)lParam; pmmi->ptMinTrackSize.x = ::HTMLayoutGetMinWidth(hwnd); RECT rc; GetWindowRect(hwnd,&rc); pmmi->ptMinTrackSize.y = ::HTMLayoutGetMinHeight(hwnd, rc.right - rc.left); return lr; } case WM_CLOSE: ::DestroyWindow(hwnd); return 0; case WM_DESTROY: delete me; // delete window instance! self(hwnd,0); PostQuitMessage(0); return 0; } return DefWindowProcW(hwnd, message, wParam, lParam); }
LRESULT CMFCMDIPrintPreviewView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // HTMLayout + // HTMLayout could be created as separate window // using CreateWindow API. // But in this case we are attaching HTMLayout functionality // to the existing window delegating windows message handling to // HTMLayoutProcND function. BOOL bHandled = FALSE; LRESULT lResult = HTMLayoutProcND(m_hWnd,message,wParam,lParam, &bHandled); if(bHandled) return lResult; return CView::WindowProc(message, wParam, lParam); }
LRESULT CALLBACK ZDForm::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { /*PAINTSTRUCT ps; HDC hdc;*/ LRESULT lResult; BOOL bHandled = FALSE; // HTMLayout + // HTMLayout could be created as separate window // using CreateWindow API. // But in this case we are attaching HTMLayout functionality // to the existing window delegating windows message handling to // HTMLayoutProcND function. lResult = HTMLayoutProcND(hWnd,message,wParam,lParam, &bHandled); if(bHandled) return lResult; // HTMLayout - switch (message) { /*case WM_PAINT: hdc = BeginPaint(hWnd, &ps); { RECT r; GetClientRect(hWnd,&r); HBRUSH hb = CreateSolidBrush(0xffffffff); FillRect(hdc,&r,hb); DeleteObject(hb); } // TODO: Add any drawing code here... EndPaint(hWnd, &ps); break;*/ case WM_CREATE: { //EnableBlurBehind ( hWnd ); UIToolKits uit; uit.SetAeroTransparentBack ( hWnd ); // Normally HTMLayout sends its notifications // to its parent. // In this particular case we are using callback function to receive and // and handle notification. Don't bother the desktop window (parent of this window) // by our notfications. ZDForm* form = (ZDForm*)GetZDApplication()->GetZDObject(hWnd); HTMLayoutSetCallback(hWnd,form->HTMLayoutNotifyHandler,hWnd); // attach DOM events handler so we will be able to receive DOM events like BUTTON_CLICK, HYPERLINK_CLICK, etc. //HTMLayoutWindowAttachEventHandler( hWnd, // DOMEventsHandler.element_proc, // &DOMEventsHandler, // DOMEventsHandler.subscribed_to); htmlayout::attach_event_handler(hWnd, form); WCHAR path[2048] = L"file://"; GetModuleFileNameW(NULL, &path[7], 2048 - 7); PBYTE pb; DWORD cb; if(form->GetHtmlResource(form->m_zdHtmlRes,pb,cb)) HTMLayoutLoadHtmlEx(hWnd,pb,cb,path); // we use path here so all relative links in the document will resolved against it. } break; case WM_ERASEBKGND: return TRUE; // as HTMLayout will draw client area in full case WM_DESTROY: { PostQuitMessage(0); } break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }