HICON UserGetWindowIcon(HWND hwnd) { HICON hIcon = 0; SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (PDWORD_PTR)&hIcon); if (!hIcon) hIcon = UserGetProp(hwnd, gpsi->atomIconSmProp); if (!hIcon) hIcon = UserGetProp(hwnd, gpsi->atomIconProp); if (!hIcon) hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICONSM); if (!hIcon) hIcon = (HICON)GetClassLongPtr(hwnd, GCL_HICON); if (!hIcon && (GetWindowLongW( hwnd, GWL_STYLE ) & DS_MODALFRAME)) { if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. } return hIcon; }
HICON FASTCALL NC_IconForWindow( PWND pWnd ) { HICON hIcon = 0; // First thing to do, init the Window Logo icons. if (!gpsi->hIconSmWindows) co_IntSetWndIcons(); if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconSmProp); if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp); if (!hIcon) hIcon = pWnd->pcls->hIconSm; if (!hIcon) hIcon = pWnd->pcls->hIcon; if (!hIcon && pWnd->style & DS_MODALFRAME) { if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small if (!hIcon) hIcon = gpsi->hIconWindows; // Reg size. hIcon = (HICON)1; } return hIcon; }
DWORD APIENTRY NtUserCallHwnd( HWND hWnd, DWORD Routine) { switch (Routine) { case HWND_ROUTINE_GETWNDCONTEXTHLPID: { PWND Window; DWORD HelpId; UserEnterShared(); if (!(Window = UserGetWindowObject(hWnd))) { UserLeave(); return 0; } HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp, TRUE); UserLeave(); return HelpId; } case HWND_ROUTINE_REGISTERSHELLHOOKWINDOW: if (IntIsWindow(hWnd)) return IntRegisterShellHookWindow(hWnd); return FALSE; break; case HWND_ROUTINE_DEREGISTERSHELLHOOKWINDOW: if (IntIsWindow(hWnd)) return IntDeRegisterShellHookWindow(hWnd); return FALSE; case HWND_ROUTINE_SETMSGBOX: { PWND Window; UserEnterExclusive(); if ((Window = UserGetWindowObject(hWnd))) { Window->state |= WNDS_MSGBOX; } UserLeave(); return FALSE; } } STUB; return 0; }
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) { HICON hIconRet; if ( wParam > ICON_SMALL2 ) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } switch(wParam) { case ICON_BIG: hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp); break; case ICON_SMALL: case ICON_SMALL2: hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp); break; default: break; } return (LRESULT)hIconRet; }
// WM_SETICON LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) { HICON hIcon, hIconSmall, hIconOld; if ( wParam > ICON_SMALL2 ) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } hIconSmall = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp); hIcon = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp); hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall; switch(wParam) { case ICON_BIG: hIcon = (HICON)lParam; break; case ICON_SMALL: hIconSmall = (HICON)lParam; break; case ICON_SMALL2: ERR("FIXME: Set ICON_SMALL2 support!\n"); default: break; } NtUserSetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp, hIcon); NtUserSetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp, hIconSmall); if ((pWnd->style & WS_CAPTION ) == WS_CAPTION) UserPaintCaption(UserHMGetHandle(pWnd)); /* Repaint caption */ return (LRESULT)hIconOld; }
HWND FASTCALL UserGethWnd( HDC hdc, PWNDOBJ *pwndo) { XCLIPOBJ* Clip; PWND Wnd; HWND hWnd; hWnd = IntWindowFromDC(hdc); if (hWnd && (Wnd = UserGetWindowObject(hWnd))) { Clip = (XCLIPOBJ*)UserGetProp(Wnd, AtomWndObj, TRUE); if ( Clip && Clip->Hwnd == hWnd ) { if (pwndo) *pwndo = &Clip->WndObj; } } return hWnd; }