static INT_PTR WINAPI warning_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { if(!init_warning_dialog(hwnd, (install_ctx_t*)lparam)) EndDialog(hwnd, 0); return TRUE; } case WM_COMMAND: switch(wparam) { case ID_AXINSTALL_INSTALL_BTN: { install_ctx_t *ctx = GetPropW(hwnd, ctxW); if(ctx) ctx->cancel = FALSE; EndDialog(hwnd, 0); return FALSE; } case IDCANCEL: EndDialog(hwnd, 0); return FALSE; } case WM_TIMER: update_counter(GetPropW(hwnd, ctxW), hwnd); return TRUE; } return FALSE; }
/*********************************************************************** * ColorDlgProc32 [internal] * */ static INT_PTR CALLBACK ColorDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { int res; LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); if (message != WM_INITDIALOG) { if (!lpp) return FALSE; res = 0; if (CC_HookCallChk(lpp->lpcc)) res = CallWindowProcA( (WNDPROC)lpp->lpcc->lpfnHook, hDlg, message, wParam, lParam); if ( res ) return res; } /* FIXME: SetRGB message if (message && message == msetrgb) return HandleSetRGB(hDlg, lParam); */ switch (message) { case WM_INITDIALOG: return CC_WMInitDialog(hDlg, wParam, lParam); case WM_NCDESTROY: DeleteDC(lpp->hdcMem); DeleteObject(lpp->hbmMem); HeapFree(GetProcessHeap(), 0, lpp); RemovePropW( hDlg, szColourDialogProp ); break; case WM_COMMAND: if (CC_WMCommand( hDlg, wParam, lParam, HIWORD(wParam), (HWND) lParam)) return TRUE; break; case WM_PAINT: if (CC_WMPaint(hDlg)) return TRUE; break; case WM_LBUTTONDBLCLK: if (CC_MouseCheckResultWindow(hDlg, lParam)) return TRUE; break; case WM_MOUSEMOVE: if (CC_WMMouseMove(hDlg, lParam)) return TRUE; break; case WM_LBUTTONUP: /* FIXME: ClipCursor off (if in color graph)*/ if (CC_WMLButtonUp(hDlg)) return TRUE; break; case WM_LBUTTONDOWN:/* FIXME: ClipCursor on (if in color graph)*/ if (CC_WMLButtonDown(hDlg, lParam)) return TRUE; break; } return FALSE ; }
BOOL WINAPI GetWindowSubclass (HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID, DWORD_PTR *pdwRef) { const SUBCLASS_INFO *stack; const SUBCLASSPROCS *proc; TRACE ("(%p, %p, %lx, %p)\n", hWnd, pfnSubclass, uID, pdwRef); /* See if we have been called for this window */ stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; proc = stack->SubclassProcs; while (proc) { if ((proc->id == uID) && (proc->subproc == pfnSubclass)) { *pdwRef = proc->ref; return TRUE; } proc = proc->next; } return FALSE; }
/*********************************************************************** * COMCTL32_SubclassProc (internal) * * Window procedure for all subclassed windows. * Saves the current subclassing stack position to support nested messages */ static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LPSUBCLASS_INFO stack; LPSUBCLASSPROCS proc; LRESULT ret; TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; } /* Save our old stackpos to properly handle nested messages */ proc = stack->stackpos; stack->stackpos = stack->SubclassProcs; stack->running++; ret = DefSubclassProc(hWnd, uMsg, wParam, lParam); stack->running--; stack->stackpos = proc; if (!stack->SubclassProcs && !stack->running) { TRACE("Last Subclass removed, cleaning up\n"); /* clean up our heap and reset the original window procedure */ if (IsWindowUnicode (hWnd)) SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); Free (stack); RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; }
static LRESULT WINAPI shell_embedding_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { WebBrowser *This; static const WCHAR wszTHIS[] = {'T','H','I','S',0}; if(msg == WM_CREATE) { This = *(WebBrowser**)lParam; SetPropW(hwnd, wszTHIS, This); }else { This = GetPropW(hwnd, wszTHIS); } switch(msg) { case WM_SIZE: return resize_window(This, LOWORD(lParam), HIWORD(lParam)); case WM_DOCHOSTTASK: return process_dochost_tasks(&This->doc_host); case WM_SETFOCUS: notify_on_focus(This, TRUE); break; case WM_KILLFOCUS: notify_on_focus(This, FALSE); break; } return DefWindowProcW(hwnd, msg, wParam, lParam); }
static void LLabel_OnPaint(HWND hwnd) { PAINTSTRUCT ps; RECT rc; int state; HFONT hFont; int style = DT_SINGLELINE | DT_VCENTER; BeginPaint(hwnd, &ps); GetClientRect(hwnd, &rc); state = SaveDC(ps.hdc); SetBkMode(ps.hdc, TRANSPARENT); hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4)); SelectFont(ps.hdc, hFont); SetTextColor(ps.hdc, RGB(0, 0, 255)); if(IsWindowUnicode(hwnd)){ if(GetPropW(hwnd, LL_ALIGNW)) style |= DT_RIGHT; else style |= DT_LEFT; DrawTextW(ps.hdc, (wchar_t *)GetWindowLongPtrW(hwnd, 0), -1, &rc, style); } else{ if(GetProp(hwnd, LL_ALIGN)) style |= DT_RIGHT; else style |= DT_LEFT; DrawText(ps.hdc, (char *)GetWindowLongPtr(hwnd, 0), -1, &rc, style); } RestoreDC(ps.hdc, state); DeleteFont(hFont); EndPaint(hwnd, &ps); }
static void SetLLTextW(HWND hwnd, wchar_t * lpText){ wchar_t * pText; SIZE sz; HDC hdc; int state; HFONT hFont; RECT rc; GetWindowRect(hwnd, &rc); MapWindowPoints(HWND_DESKTOP, GetParent(hwnd), (LPPOINT)&rc, 2); pText = (wchar_t *)GetWindowLongPtrW(hwnd, 0); if(pText) free(pText); pText = (wchar_t *)calloc(wcslen(lpText) + 2, sizeof(wchar_t)); wcscpy(pText, lpText); SetWindowLongPtrW(hwnd, 0, (LONG_PTR)pText); hdc = GetDC(hwnd); state = SaveDC(hdc); hFont = CreateFontIndirectW((LPLOGFONTW)GetWindowLongPtrW(hwnd, 4)); SelectFont(hdc, hFont); GetTextExtentPoint32W(hdc, lpText, wcslen(lpText) + 1, &sz); RestoreDC(hdc, state); ReleaseDC(hwnd, hdc); DeleteFont(hFont); if(GetPropW(hwnd, LL_ALIGNW)) SetWindowPos(hwnd, 0, rc.right - sz.cx, rc.top, sz.cx, sz.cy, SWP_SHOWWINDOW); else SetWindowPos(hwnd, 0, 0, 0, sz.cx, sz.cy, SWP_NOMOVE | SWP_SHOWWINDOW); }
static LRESULT HostWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { WNDPROC fnOldProc; fnOldProc = (WNDPROC)GetPropW(hwnd, WNDPROP_SCCTRLW); if (!fnOldProc) return DefWindowProcW(hwnd, uMsg, wParam, lParam); switch (uMsg) { case WM_NCDESTROY: // detach RemovePropW(hwnd, WNDPROP_SCCTRLW); CallWindowProcW(fnOldProc, hwnd, uMsg, wParam, lParam); SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)fnOldProc); return 0; case WM_ERASEBKGND: if (wParam) { RECT rc; if (GetClientRect(hwnd, &rc)) { SetBkColor((HDC)wParam, ml_color(WADLG_WNDBG)); ExtTextOutW((HDC)wParam, 0, 0, ETO_OPAQUE, &rc, L"", 0, 0); } } return 1; case WM_SETFOCUS: if (htmlControl) { htmlControl->setFocus(TRUE); return 0; } break; } return CallWindowProcW(fnOldProc, hwnd, uMsg, wParam, lParam); }
void ThemeDetroyWndContext(HWND hWnd) { PWND_CONTEXT pContext; DWORD ProcessId; /*Do not destroy WND_CONTEXT of a window that belong to another process */ GetWindowThreadProcessId(hWnd, &ProcessId); if(ProcessId != GetCurrentProcessId()) { return; } pContext = (PWND_CONTEXT)GetPropW(hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext)); if(pContext == NULL) { return; } if(pContext->HasThemeRgn) { user32ApiHook.SetWindowRgn(hWnd, 0, TRUE); } HeapFree(GetProcessHeap(), 0, pContext); SetPropW( hWnd, (LPCWSTR)MAKEINTATOM(atWndContrext), NULL); }
/*********************************************************************** * CC_WMMouseMove [internal] */ static LRESULT CC_WMMouseMove( HWND hDlg, LPARAM lParam ) { LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); int r, g, b; if (lpp->capturedGraph) { int *ptrh = NULL, *ptrs = &lpp->l; if (lpp->capturedGraph == 0x2c6) { ptrh = &lpp->h; ptrs = &lpp->s; } if (CC_MouseCheckColorGraph( hDlg, lpp->capturedGraph, ptrh, ptrs, lParam)) { r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l); g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l); b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l); lpp->lpcc->rgbResult = RGB(r, g, b); CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult); CC_EditSetHSL(hDlg,lpp->h, lpp->s, lpp->l); CC_PaintCross(hDlg, lpp->h, lpp->s); CC_PaintTriangle(hDlg, lpp->l); CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); } else { ReleaseCapture(); lpp->capturedGraph = 0; } return 1; } return 0; }
/*********************************************************************** * CC_SwitchToFullSize [internal] */ static void CC_SwitchToFullSize( HWND hDlg, COLORREF result, LPCRECT lprect ) { int i; LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); EnableWindow( GetDlgItem(hDlg, 0x2cf), FALSE); CC_PrepareColorGraph(hDlg); for (i = 0x2bf; i < 0x2c5; i++) ShowWindow( GetDlgItem(hDlg, i), SW_SHOW); for (i = 0x2d3; i < 0x2d9; i++) ShowWindow( GetDlgItem(hDlg, i), SW_SHOW); ShowWindow( GetDlgItem(hDlg, 0x2c9), SW_SHOW); ShowWindow( GetDlgItem(hDlg, 0x2c8), SW_SHOW); ShowWindow( GetDlgItem(hDlg, 1090), SW_SHOW); if (lprect) SetWindowPos(hDlg, 0, 0, 0, lprect->right-lprect->left, lprect->bottom-lprect->top, SWP_NOMOVE|SWP_NOZORDER); ShowWindow( GetDlgItem(hDlg, 0x2be), SW_SHOW); ShowWindow( GetDlgItem(hDlg, 0x2c5), SW_SHOW); CC_EditSetRGB(hDlg, result); CC_EditSetHSL(hDlg, lpp->h, lpp->s, lpp->l); ShowWindow( GetDlgItem( hDlg, 0x2c6), SW_SHOW); UpdateWindow( GetDlgItem(hDlg, 0x2c6) ); }
static LRESULT WINAPI nsembed_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { NSContainer *This; nsresult nsres; static const WCHAR wszTHIS[] = {'T','H','I','S',0}; if(msg == WM_CREATE) { This = *(NSContainer**)lParam; SetPropW(hwnd, wszTHIS, This); }else { This = (NSContainer*)GetPropW(hwnd, wszTHIS); } switch(msg) { case WM_SIZE: TRACE("(%p)->(WM_SIZE)\n", This); nsres = nsIBaseWindow_SetSize(This->window, LOWORD(lParam), HIWORD(lParam), TRUE); if(NS_FAILED(nsres)) WARN("SetSize failed: %08lx\n", nsres); } return DefWindowProcW(hwnd, msg, wParam, lParam); }
static HMODULE load_desktop_driver( HWND hwnd ) { static const WCHAR display_device_guid_propW[] = { '_','_','w','i','n','e','_','d','i','s','p','l','a','y','_', 'd','e','v','i','c','e','_','g','u','i','d',0 }; static const WCHAR key_pathW[] = { 'S','y','s','t','e','m','\\', 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'C','o','n','t','r','o','l','\\', 'V','i','d','e','o','\\','{',0}; static const WCHAR displayW[] = {'}','\\','0','0','0','0',0}; static const WCHAR driverW[] = {'G','r','a','p','h','i','c','s','D','r','i','v','e','r',0}; HMODULE ret = 0; HKEY hkey; DWORD size; WCHAR path[MAX_PATH]; WCHAR key[(sizeof(key_pathW) + sizeof(displayW)) / sizeof(WCHAR) + 40]; UINT guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW )); USER_CheckNotLock(); strcpy( driver_load_error, "The explorer process failed to start." ); /* default error */ if (!guid_atom) { SendMessageW( hwnd, WM_NULL, 0, 0 ); /* wait for the desktop process to be ready */ guid_atom = HandleToULong( GetPropW( hwnd, display_device_guid_propW )); } memcpy( key, key_pathW, sizeof(key_pathW) ); if (!GlobalGetAtomNameW( guid_atom, key + strlenW(key), 40 )) return 0; strcatW( key, displayW ); if (RegOpenKeyW( HKEY_LOCAL_MACHINE, key, &hkey )) return 0; size = sizeof(path); if (!RegQueryValueExW( hkey, driverW, NULL, NULL, (BYTE *)path, &size )) { if (!(ret = LoadLibraryW( path ))) ERR( "failed to load %s\n", debugstr_w(path) ); TRACE( "%s %p\n", debugstr_w(path), ret ); } else { size = sizeof(driver_load_error); RegQueryValueExA( hkey, "DriverError", NULL, NULL, (BYTE *)driver_load_error, &size ); } RegCloseKey( hkey ); return ret; }
static LPWSTR UXTHEME_GetWindowProperty(HWND hwnd, ATOM aProp, LPWSTR pszBuffer, int dwLen) { ATOM atValue = (ATOM)(size_t)GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(aProp)); if(atValue) { if(GetAtomNameW(atValue, pszBuffer, dwLen)) return pszBuffer; TRACE("property defined, but unable to get value\n"); } return NULL; }
/*********************************************************************** * CC_WMLButtonUp [internal] */ LRESULT CC_WMLButtonUp( HWND hDlg, WPARAM wParam, LPARAM lParam ) { LPCCPRIV lpp = (LPCCPRIV) GetPropW( hDlg, szColourDialogProp ); if (lpp->capturedGraph) { lpp->capturedGraph = 0; ReleaseCapture(); CC_PaintCross(hDlg, lpp->h, lpp->s); return 1; } return 0; }
/*********************************************************************** * UPDOWN_Buddy_SubclassProc used to handle messages sent to the buddy * control. */ static LRESULT CALLBACK UPDOWN_Buddy_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { WNDPROC superClassWndProc = (WNDPROC)GetPropW(hwnd, BUDDY_SUPERCLASS_WNDPROC); TRACE("hwnd=%p, wndProc=%p, uMsg=%04x, wParam=%08lx, lParam=%08lx\n", hwnd, superClassWndProc, uMsg, wParam, lParam); if (uMsg == WM_KEYDOWN) { HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); UPDOWN_KeyPressed(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); } else if (uMsg == WM_MOUSEWHEEL) { HWND upDownHwnd = GetPropW(hwnd, BUDDY_UPDOWN_HWND); UPDOWN_MouseWheel(UPDOWN_GetInfoPtr(upDownHwnd), (int)wParam); } return CallWindowProcW( superClassWndProc, hwnd, uMsg, wParam, lParam); }
/*********************************************************************** * GetWindowTheme (UXTHEME.@) * * Retrieve the last theme opened for a window. * * PARAMS * hwnd [I] window to retrieve the theme for * * RETURNS * The most recent theme. */ HTHEME WINAPI GetWindowTheme(HWND hwnd) { TRACE("(%p)\n", hwnd); if(!IsWindow(hwnd)) { SetLastError(E_HANDLE); return NULL; } return GetPropW(hwnd, (LPCWSTR)MAKEINTATOM(atWindowTheme)); }
/*********************************************************************** * CC_WMLButtonUp [internal] */ static LRESULT CC_WMLButtonUp( HWND hDlg ) { LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); if (lpp->capturedGraph) { lpp->capturedGraph = 0; ReleaseCapture(); CC_PaintCross(hDlg, lpp->h, lpp->s); return 1; } return 0; }
/************************************************************************* * BrsFolderDlgProc32 (not an exported API function) */ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { browse_info *info; TRACE("hwnd=%p msg=%04x 0x%08lx 0x%08lx\n", hWnd, msg, wParam, lParam ); if (msg == WM_INITDIALOG) return BrsFolder_OnCreate( hWnd, (browse_info*) lParam ); info = (browse_info*) GetPropW( hWnd, szBrowseFolderInfo ); switch (msg) { case WM_NOTIFY: return BrsFolder_OnNotify( info, (UINT)wParam, (LPNMHDR)lParam); case WM_COMMAND: return BrsFolder_OnCommand( info, wParam ); case BFFM_SETSTATUSTEXTA: TRACE("Set status %s\n", debugstr_a((LPSTR)lParam)); SetWindowTextA(GetDlgItem(hWnd, IDD_STATUS), (LPSTR)lParam); break; case BFFM_SETSTATUSTEXTW: TRACE("Set status %s\n", debugstr_w((LPWSTR)lParam)); SetWindowTextW(GetDlgItem(hWnd, IDD_STATUS), (LPWSTR)lParam); break; case BFFM_ENABLEOK: TRACE("Enable %ld\n", lParam); EnableWindow(GetDlgItem(hWnd, 1), (lParam)?TRUE:FALSE); break; case BFFM_SETOKTEXT: /* unicode only */ TRACE("Set OK text %s\n", debugstr_w((LPWSTR)wParam)); SetWindowTextW(GetDlgItem(hWnd, 1), (LPWSTR)wParam); break; case BFFM_SETSELECTIONA: return BrsFolder_OnSetSelectionA(info, (LPVOID)lParam, (BOOL)wParam); case BFFM_SETSELECTIONW: return BrsFolder_OnSetSelectionW(info, (LPVOID)lParam, (BOOL)wParam); case BFFM_SETEXPANDED: /* unicode only */ return BrsFolder_OnSetExpanded(info, (LPVOID)lParam, (BOOL)wParam, NULL); } return FALSE; }
/*********************************************************************** * CC_WMLButtonDown [internal] */ static LRESULT CC_WMLButtonDown( HWND hDlg, LPARAM lParam ) { LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); int r, g, b, i; i = 0; if (CC_MouseCheckPredefColorArray(lpp, hDlg, 0x2d0, 6, 8, lParam)) i = 1; else if (CC_MouseCheckUserColorArray(lpp, hDlg, 0x2d1, 2, 8, lParam)) i = 1; else if (CC_MouseCheckColorGraph(hDlg, 0x2c6, &lpp->h, &lpp->s, lParam)) { i = 2; lpp->capturedGraph = 0x2c6; } else if (CC_MouseCheckColorGraph(hDlg, 0x2be, NULL, &lpp->l, lParam)) { i = 2; lpp->capturedGraph = 0x2be; } if ( i == 2 ) { SetCapture(hDlg); r = CC_HSLtoRGB('R', lpp->h, lpp->s, lpp->l); g = CC_HSLtoRGB('G', lpp->h, lpp->s, lpp->l); b = CC_HSLtoRGB('B', lpp->h, lpp->s, lpp->l); lpp->lpcc->rgbResult = RGB(r, g, b); } if ( i == 1 ) { r = GetRValue(lpp->lpcc->rgbResult); g = GetGValue(lpp->lpcc->rgbResult); b = GetBValue(lpp->lpcc->rgbResult); lpp->h = CC_RGBtoHSL('H', r, g, b); lpp->s = CC_RGBtoHSL('S', r, g, b); lpp->l = CC_RGBtoHSL('L', r, g, b); } if (i) { CC_EditSetRGB(hDlg, lpp->lpcc->rgbResult); CC_EditSetHSL(hDlg,lpp->h, lpp->s, lpp->l); CC_PaintCross(hDlg, lpp->h, lpp->s); CC_PaintTriangle(hDlg, lpp->l); CC_PaintSelectedColor(hDlg, lpp->lpcc->rgbResult); return TRUE; } return FALSE; }
static void _replaceOnce(HWND hwnd){ int index1, index2, count; HWND hEdit = (HWND)GetPropW(hwnd, EDIT_PROP); PSUGGESTION ps; count = SendDlgItemMessageW(hwnd, IDC_LST_MISPRINTS, LB_GETCOUNT, 0, 0); index1 = SendDlgItemMessageW(hwnd, IDC_LST_MISPRINTS, LB_GETCURSEL, 0, 0); index2 = SendDlgItemMessageW(hwnd, IDC_LST_SUGGESTIONS, LB_GETCURSEL, 0, 0); if(index1 == LB_ERR || index2 == LB_ERR) return; ps = (PSUGGESTION)SendDlgItemMessageW(hwnd, IDC_LST_MISPRINTS, LB_GETITEMDATA, index1, 0); _replaceInEdit(hwnd, hEdit, ps, index1, index2, count); _removeEntry(hwnd, index1, count); }
/* * @implemented */ HANDLE WINAPI GetPropA(HWND hWnd, LPCSTR lpString) { PWSTR lpWString; UNICODE_STRING UString; HANDLE Ret; if (HIWORD(lpString)) { RtlCreateUnicodeStringFromAsciiz(&UString, (LPSTR)lpString); lpWString = UString.Buffer; if (lpWString == NULL) { return(FALSE); } Ret = GetPropW(hWnd, lpWString); RtlFreeUnicodeString(&UString); } else { Ret = GetPropW(hWnd, (LPWSTR)lpString); } return(Ret); }
BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID) { LPSUBCLASS_INFO stack; LPSUBCLASSPROCS prevproc = NULL; LPSUBCLASSPROCS proc; BOOL ret = FALSE; TRACE ("(%p, %p, %lx)\n", hWnd, pfnSubclass, uID); /* Find the Subclass to remove */ stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; proc = stack->SubclassProcs; while (proc) { if ((proc->id == uID) && (proc->subproc == pfnSubclass)) { if (!prevproc) stack->SubclassProcs = proc->next; else prevproc->next = proc->next; if (stack->stackpos == proc) stack->stackpos = stack->stackpos->next; Free (proc); ret = TRUE; break; } prevproc = proc; proc = proc->next; } if (!stack->SubclassProcs && !stack->running) { TRACE("Last Subclass removed, cleaning up\n"); /* clean up our heap and reset the original window procedure */ if (IsWindowUnicode (hWnd)) SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); Free (stack); RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; }
static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HTMLDocumentObj *This; static const WCHAR wszTHIS[] = {'T','H','I','S',0}; if(msg == WM_CREATE) { This = *(HTMLDocumentObj**)lParam; SetPropW(hwnd, wszTHIS, This); }else { This = GetPropW(hwnd, wszTHIS); } switch(msg) { case WM_CREATE: This->hwnd = hwnd; break; case WM_PAINT: paint_document(This); break; case WM_SIZE: TRACE("(%p)->(WM_SIZE)\n", This); if(This->nscontainer) { INT ew=0, eh=0; if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) { ew = GetSystemMetrics(SM_CXEDGE); eh = GetSystemMetrics(SM_CYEDGE); } SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh, LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh, SWP_NOZORDER | SWP_NOACTIVATE); } break; case WM_TIMER: return on_timer(This); case WM_SETFOCUS: TRACE("(%p) WM_SETFOCUS\n", This); nsIWebBrowserFocus_Activate(This->nscontainer->focus); break; case WM_MOUSEACTIVATE: return MA_ACTIVATE; } return DefWindowProcW(hwnd, msg, wParam, lParam); }
/*********************************************************************** * FontFamilyEnumProc (COMMDLG.19) */ INT16 WINAPI FontFamilyEnumProc16( SEGPTR logfont, SEGPTR metrics, UINT16 nFontType, LPARAM lParam ) { HWND hwnd=HWND_32(LOWORD(lParam)); HWND hDlg=GetParent(hwnd); LPCHOOSEFONT16 lpcf; LOGFONT16 *lplf = MapSL( logfont ); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); ENUMLOGFONTEXW elf32w; NEWTEXTMETRICEXW nmtrx32w; lpcf = (LPCHOOSEFONT16)GetPropW(hDlg, strWineFontData16); FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); return AddFontFamily(&elf32w, &nmtrx32w, nFontType, (LPCHOOSEFONTW)lpcf->lpTemplateName, hwnd,NULL); }
/*********************************************************************** * AtlAxGetHost [atl100.@] * */ HRESULT WINAPI AtlAxGetHost(HWND hWnd, IUnknown **host) { IOCS *This; TRACE("(%p, %p)\n", hWnd, host); *host = NULL; This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW ); if ( !This ) { WARN("No container attached to %p\n", hWnd ); return E_FAIL; } return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, &IID_IUnknown, (void**)host); }
/*********************************************************************** * AtlAxGetControl [atl100.@] * */ HRESULT WINAPI AtlAxGetControl(HWND hWnd, IUnknown **pUnk) { IOCS *This; TRACE( "(%p, %p)\n", hWnd, pUnk ); *pUnk = NULL; This = (IOCS*) GetPropW( hWnd, wine_atl_iocsW ); if ( !This || !This->control ) { WARN("No control attached to %p\n", hWnd ); return E_FAIL; } return IOleObject_QueryInterface( This->control, &IID_IUnknown, (void**) pUnk ); }
/*********************************************************************** * CC_PaintUserColorArray [internal] * Paint the 16 user-selected colors */ static void CC_PaintUserColorArray( HWND hDlg, int rows, int cols, const COLORREF *lpcr ) { HWND hwnd = GetDlgItem(hDlg, 0x2d1); RECT rect, blockrect; HDC hdc; HBRUSH hBrush; int dx, dy, i, j, k; LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); GetClientRect(hwnd, &rect); dx = rect.right / cols; dy = rect.bottom / rows; k = rect.left; hdc = GetDC(hwnd); if (hdc) { hBrush = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND); if (!hBrush) hBrush = GetSysColorBrush(COLOR_BTNFACE); FillRect( hdc, &rect, hBrush ); for (j = 0; j < rows; j++) { for (i = 0; i < cols; i++) { hBrush = CreateSolidBrush(lpcr[i+j*cols]); if (hBrush) { blockrect.left = rect.left; blockrect.top = rect.top; blockrect.right = rect.left + dx - DISTANCE; blockrect.bottom = rect.top + dy - DISTANCE; FillRect(hdc, &blockrect, hBrush); DrawEdge(hdc, &blockrect, BDR_SUNKEN, BF_RECT); DeleteObject(hBrush); } rect.left += dx; } rect.top += dy; rect.left = k; } ReleaseDC(hwnd, hdc); } if (lpp->hwndFocus == hwnd) CC_DrawCurrentFocusRect(lpp); }
/*********************************************************************** * CC_PaintTriangle [internal] */ static void CC_PaintTriangle( HWND hDlg, int y) { HDC hDC; long temp; int w = LOWORD(GetDialogBaseUnits()) / 2; POINT points[3]; int height; int oben; RECT rect; HBRUSH hbr; HWND hwnd = GetDlgItem(hDlg, 0x2be); LPCCPRIV lpp = GetPropW( hDlg, szColourDialogProp ); if (IsWindowVisible( GetDlgItem(hDlg, 0x2c6))) /* if full size */ { GetClientRect(hwnd, &rect); height = rect.bottom; hDC = GetDC(hDlg); points[0].y = rect.top; points[0].x = rect.right; /* | /| */ ClientToScreen(hwnd, points); /* | / | */ ScreenToClient(hDlg, points); /* |< | */ oben = points[0].y; /* | \ | */ /* | \| */ temp = (long)height * (long)y; points[0].x += 1; points[0].y = oben + height - temp / (long)MAXVERT; points[1].y = points[0].y + w; points[2].y = points[0].y - w; points[2].x = points[1].x = points[0].x + w; hbr = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND); if (!hbr) hbr = GetSysColorBrush(COLOR_BTNFACE); FillRect(hDC, &lpp->old3angle, hbr); lpp->old3angle.left = points[0].x; lpp->old3angle.right = points[1].x + 1; lpp->old3angle.top = points[2].y - 1; lpp->old3angle.bottom= points[1].y + 1; hbr = SelectObject(hDC, GetStockObject(BLACK_BRUSH)); Polygon(hDC, points, 3); SelectObject(hDC, hbr); ReleaseDC(hDlg, hDC); } }
LRESULT WINAPI DefSubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { LPSUBCLASS_INFO stack; LRESULT ret; TRACE ("(%p, 0x%08x, 0x%08lx, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); /* retrieve our little stack from the Properties */ stack = GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; } /* If we are at the end of stack then we have to call the original * window procedure */ if (!stack->stackpos) { if (IsWindowUnicode (hWnd)) ret = CallWindowProcW (stack->origproc, hWnd, uMsg, wParam, lParam); else ret = CallWindowProcA (stack->origproc, hWnd, uMsg, wParam, lParam); } else { const SUBCLASSPROCS *proc = stack->stackpos; stack->stackpos = stack->stackpos->next; /* call the Subclass procedure from the stack */ ret = proc->subproc (hWnd, uMsg, wParam, lParam, proc->id, proc->ref); } return ret; }