Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Window classes functions |
| 3 | * |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 4 | * Copyright 1993, 1996 Alexandre Julliard |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 5 | * 1998 Juergen Schmied (jsch) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 6 | * |
| 7 | * FIXME: In win32 all classes are local. They are registered at |
| 8 | * program start. Processes CANNOT share classes. (Source: some |
| 9 | * win31->NT migration book) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 10 | * |
| 11 | * FIXME: There seems to be a general problem with hInstance in WINE |
Andreas Mohr | 1af53cb | 2000-12-09 03:15:32 +0000 | [diff] [blame] | 12 | * classes are getting registered with wrong hInstance. |
Alexandre Julliard | bd34d4f | 1995-06-20 19:08:12 +0000 | [diff] [blame] | 13 | */ |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 14 | |
François Gouget | 1425941 | 2001-11-06 20:57:11 +0000 | [diff] [blame] | 15 | #include "config.h" |
Francois Gouget | 386cf6e | 2001-10-14 16:25:47 +0000 | [diff] [blame] | 16 | #include "wine/port.h" |
| 17 | |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 18 | #include <stdlib.h> |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 19 | #include <string.h> |
Francois Gouget | 386cf6e | 2001-10-14 16:25:47 +0000 | [diff] [blame] | 20 | |
Marcus Meissner | 317af32 | 1999-02-17 13:51:06 +0000 | [diff] [blame] | 21 | #include "wine/winbase16.h" |
Alexandre Julliard | c7e7df8 | 2000-08-14 14:41:19 +0000 | [diff] [blame] | 22 | #include "winerror.h" |
| 23 | #include "windef.h" |
| 24 | #include "wingdi.h" |
| 25 | #include "wine/winuser16.h" |
| 26 | #include "wine/unicode.h" |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 27 | #include "heap.h" |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 28 | #include "win.h" |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 29 | #include "user.h" |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 30 | #include "controls.h" |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 31 | #include "dce.h" |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 32 | #include "winproc.h" |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 33 | #include "debugtools.h" |
Alexandre Julliard | 8d24ae6 | 1994-04-05 21:42:43 +0000 | [diff] [blame] | 34 | |
Alexandre Julliard | c7e7df8 | 2000-08-14 14:41:19 +0000 | [diff] [blame] | 35 | DEFAULT_DEBUG_CHANNEL(class); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 37 | typedef struct tagCLASS |
| 38 | { |
| 39 | struct tagCLASS *next; /* Next class */ |
| 40 | struct tagCLASS *prev; /* Prev class */ |
| 41 | UINT cWindows; /* Count of existing windows */ |
| 42 | UINT style; /* Class style */ |
| 43 | HWINDOWPROC winprocA; /* Window procedure (ASCII) */ |
| 44 | HWINDOWPROC winprocW; /* Window procedure (Unicode) */ |
| 45 | INT cbClsExtra; /* Class extra bytes */ |
| 46 | INT cbWndExtra; /* Window extra bytes */ |
| 47 | LPWSTR menuName; /* Default menu name (Unicode followed by ASCII) */ |
| 48 | struct tagDCE *dce; /* Class DCE (if CS_CLASSDC) */ |
| 49 | HINSTANCE hInstance; /* Module that created the task */ |
| 50 | HICON hIcon; /* Default icon */ |
| 51 | HICON hIconSm; /* Default small icon */ |
| 52 | HCURSOR hCursor; /* Default cursor */ |
| 53 | HBRUSH hbrBackground; /* Default background */ |
| 54 | ATOM atomName; /* Name of the class */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 55 | } CLASS; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 56 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 57 | static CLASS *firstClass; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 58 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 59 | /*********************************************************************** |
| 60 | * get_class_ptr |
| 61 | */ |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 62 | static CLASS *get_class_ptr( HWND hwnd, BOOL write_access ) |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 63 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 64 | WND *ptr = WIN_GetPtr( hwnd ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 65 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 66 | if (ptr) |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 67 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 68 | if (ptr != WND_OTHER_PROCESS) return ptr->class; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 69 | if (IsWindow( hwnd )) /* check other processes */ |
| 70 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 71 | if (write_access) |
| 72 | { |
| 73 | /* modifying classes in other processes is not allowed */ |
| 74 | SetLastError( ERROR_ACCESS_DENIED ); |
| 75 | return NULL; |
| 76 | } |
| 77 | FIXME( "reading from class of other process window %04x\n", hwnd ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 78 | /* DbgBreakPoint(); */ |
| 79 | } |
| 80 | } |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 81 | SetLastError( ERROR_INVALID_WINDOW_HANDLE ); |
| 82 | return NULL; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | |
| 86 | /*********************************************************************** |
| 87 | * release_class_ptr |
| 88 | */ |
| 89 | inline static void release_class_ptr( CLASS *ptr ) |
| 90 | { |
| 91 | USER_Unlock(); |
| 92 | } |
| 93 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 94 | |
| 95 | /*********************************************************************** |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 96 | * CLASS_GetProc |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 97 | * |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 98 | * Get the class winproc for a given proc type |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 99 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 100 | static WNDPROC16 CLASS_GetProc( CLASS *classPtr, WINDOWPROCTYPE type ) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 101 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 102 | HWINDOWPROC proc = classPtr->winprocA; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 103 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 104 | if (classPtr->winprocW) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 105 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 106 | /* if we have a Unicode proc, use it if we have no ASCII proc |
| 107 | * or if we have both and Unicode was requested |
| 108 | */ |
| 109 | if (!proc || type == WIN_PROC_32W) proc = classPtr->winprocW; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 110 | } |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 111 | return WINPROC_GetProc( proc, type ); |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | |
| 115 | /*********************************************************************** |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 116 | * CLASS_SetProc |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 117 | * |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 118 | * Set the class winproc for a given proc type. |
| 119 | * Returns the previous window proc. |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 120 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 121 | static WNDPROC16 CLASS_SetProc( CLASS *classPtr, WNDPROC newproc, WINDOWPROCTYPE type ) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 122 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 123 | HWINDOWPROC *proc = &classPtr->winprocA; |
| 124 | WNDPROC16 ret; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 125 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 126 | if (classPtr->winprocW) |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 127 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 128 | /* if we have a Unicode proc, use it if we have no ASCII proc |
| 129 | * or if we have both and Unicode was requested |
| 130 | */ |
| 131 | if (!*proc || type == WIN_PROC_32W) proc = &classPtr->winprocW; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 132 | } |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 133 | ret = WINPROC_GetProc( *proc, type ); |
| 134 | WINPROC_SetProc( proc, (HWINDOWPROC)newproc, type, WIN_PROC_CLASS ); |
| 135 | /* now free the one that we didn't set */ |
| 136 | if (classPtr->winprocA && classPtr->winprocW) |
| 137 | { |
| 138 | if (proc == &classPtr->winprocA) |
| 139 | { |
| 140 | WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS ); |
| 141 | classPtr->winprocW = 0; |
| 142 | } |
| 143 | else |
| 144 | { |
| 145 | WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS ); |
| 146 | classPtr->winprocA = 0; |
| 147 | } |
| 148 | } |
| 149 | return ret; |
Alexandre Julliard | b817f4f | 1996-03-14 18:08:34 +0000 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | |
| 153 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 154 | * CLASS_GetMenuNameA |
| 155 | * |
| 156 | * Get the menu name as a ASCII string. |
| 157 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 158 | inline static LPSTR CLASS_GetMenuNameA( CLASS *classPtr ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 159 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 160 | if (!HIWORD(classPtr->menuName)) return (LPSTR)classPtr->menuName; |
| 161 | return (LPSTR)(classPtr->menuName + strlenW(classPtr->menuName) + 1); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 162 | } |
| 163 | |
| 164 | |
| 165 | /*********************************************************************** |
| 166 | * CLASS_GetMenuNameW |
| 167 | * |
| 168 | * Get the menu name as a Unicode string. |
| 169 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 170 | inline static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 171 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 172 | return classPtr->menuName; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | |
| 176 | /*********************************************************************** |
| 177 | * CLASS_SetMenuNameA |
| 178 | * |
| 179 | * Set the menu name in a class structure by copying the string. |
| 180 | */ |
| 181 | static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name ) |
| 182 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 183 | if (HIWORD(classPtr->menuName)) SEGPTR_FREE( classPtr->menuName ); |
| 184 | if (HIWORD(name)) |
| 185 | { |
| 186 | DWORD lenA = strlen(name) + 1; |
| 187 | DWORD lenW = MultiByteToWideChar( CP_ACP, 0, name, lenA, NULL, 0 ); |
| 188 | classPtr->menuName = SEGPTR_ALLOC( lenA + lenW*sizeof(WCHAR) ); |
| 189 | MultiByteToWideChar( CP_ACP, 0, name, lenA, classPtr->menuName, lenW ); |
| 190 | memcpy( classPtr->menuName + lenW, name, lenA ); |
| 191 | } |
| 192 | else classPtr->menuName = (LPWSTR)name; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | |
| 196 | /*********************************************************************** |
| 197 | * CLASS_SetMenuNameW |
| 198 | * |
| 199 | * Set the menu name in a class structure by copying the string. |
| 200 | */ |
| 201 | static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) |
| 202 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 203 | if (HIWORD(classPtr->menuName)) SEGPTR_FREE( classPtr->menuName ); |
| 204 | if (HIWORD(name)) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 205 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 206 | DWORD lenW = strlenW(name) + 1; |
| 207 | DWORD lenA = WideCharToMultiByte( CP_ACP, 0, name, lenW, NULL, 0, NULL, NULL ); |
| 208 | classPtr->menuName = SEGPTR_ALLOC( lenA + lenW*sizeof(WCHAR) ); |
| 209 | memcpy( classPtr->menuName, name, lenW*sizeof(WCHAR) ); |
| 210 | WideCharToMultiByte( CP_ACP, 0, name, lenW, |
| 211 | (char *)(classPtr->menuName + lenW), lenA, NULL, NULL ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 212 | } |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 213 | else classPtr->menuName = (LPWSTR)name; |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | |
| 217 | /*********************************************************************** |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 218 | * CLASS_FreeClass |
| 219 | * |
| 220 | * Free a class structure. |
| 221 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 222 | static BOOL CLASS_FreeClass( CLASS *classPtr ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 223 | { |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 224 | TRACE("%p\n", classPtr); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 225 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 226 | /* Check if we can remove this class */ |
| 227 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 228 | if (classPtr->cWindows > 0) |
| 229 | { |
| 230 | SetLastError( ERROR_CLASS_HAS_WINDOWS ); |
| 231 | return FALSE; |
| 232 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 233 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 234 | /* Remove the class from the linked list */ |
| 235 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 236 | if (classPtr->next) classPtr->next->prev = classPtr->prev; |
| 237 | if (classPtr->prev) classPtr->prev->next = classPtr->next; |
| 238 | else firstClass = classPtr->next; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 239 | |
| 240 | /* Delete the class */ |
| 241 | |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 242 | if (classPtr->dce) DCE_FreeDCE( classPtr->dce ); |
Huw D M Davies | 2f245af | 2000-09-12 23:38:33 +0000 | [diff] [blame] | 243 | if (classPtr->hbrBackground > (HBRUSH)(COLOR_GRADIENTINACTIVECAPTION + 1)) |
| 244 | DeleteObject( classPtr->hbrBackground ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 245 | GlobalDeleteAtom( classPtr->atomName ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 246 | WINPROC_FreeProc( classPtr->winprocA, WIN_PROC_CLASS ); |
| 247 | WINPROC_FreeProc( classPtr->winprocW, WIN_PROC_CLASS ); |
| 248 | HeapFree( GetProcessHeap(), 0, classPtr->menuName ); |
| 249 | HeapFree( GetProcessHeap(), 0, classPtr ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 250 | return TRUE; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | |
| 254 | /*********************************************************************** |
| 255 | * CLASS_FreeModuleClasses |
| 256 | */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 257 | void CLASS_FreeModuleClasses( HMODULE16 hModule ) |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 258 | { |
| 259 | CLASS *ptr, *next; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 260 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 261 | TRACE("0x%08x\n", hModule); |
| 262 | |
| 263 | USER_Lock(); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 264 | for (ptr = firstClass; ptr; ptr = next) |
| 265 | { |
| 266 | next = ptr->next; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 267 | if (ptr->hInstance == hModule) CLASS_FreeClass( ptr ); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 268 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 269 | USER_Unlock(); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | |
| 273 | /*********************************************************************** |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 274 | * CLASS_FindClassByAtom |
| 275 | * |
| 276 | * Return a pointer to the class. |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 277 | * hinstance has been normalized by the caller. |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 278 | * |
| 279 | * NOTES |
| 280 | * 980805 a local class will be found now if registred with hInst=0 |
| 281 | * and looed up with a hInst!=0. msmoney does it (jsch) |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 282 | * |
| 283 | * Local class registered with a USER instance handle are found as if |
| 284 | * they were global classes. |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 285 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 286 | static CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE hinstance ) |
| 287 | { |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 288 | CLASS * class, *tclass = 0, *user_class = 0; |
| 289 | HINSTANCE16 hUser = GetModuleHandle16("USER"); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 290 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 291 | TRACE("0x%08x 0x%08x\n", atom, hinstance); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 292 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 293 | /* First search task-specific classes */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 294 | |
| 295 | for (class = firstClass; (class); class = class->next) |
| 296 | { |
| 297 | if (class->style & CS_GLOBALCLASS) continue; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 298 | if (class->atomName == atom) |
| 299 | { |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 300 | if (hinstance==class->hInstance || hinstance==0xffff) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 301 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 302 | TRACE("-- found local %p\n", class); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 303 | return class; |
| 304 | } |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 305 | if (class->hInstance == 0) tclass = class; |
| 306 | else if(class->hInstance == hUser) |
| 307 | { |
| 308 | user_class = class; |
| 309 | } |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 310 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 311 | } |
| 312 | |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 313 | /* Then search global classes */ |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 314 | |
| 315 | for (class = firstClass; (class); class = class->next) |
| 316 | { |
| 317 | if (!(class->style & CS_GLOBALCLASS)) continue; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 318 | if (class->atomName == atom) |
| 319 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 320 | TRACE("-- found global %p\n", class); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 321 | return class; |
| 322 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 323 | } |
| 324 | |
Joshua Thielen | d9ed57a | 2001-11-16 18:11:43 +0000 | [diff] [blame] | 325 | /* Check if there was a local class registered with USER */ |
| 326 | if( user_class ) |
| 327 | { |
| 328 | TRACE("--found local USER class %p\n", user_class); |
| 329 | return user_class; |
| 330 | } |
| 331 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 332 | /* Then check if there was a local class with hInst=0*/ |
| 333 | if ( tclass ) |
| 334 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 335 | WARN("-- found local Class registred with hInst=0\n"); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 336 | return tclass; |
| 337 | } |
| 338 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 339 | TRACE("-- not found\n"); |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 340 | return 0; |
| 341 | } |
| 342 | |
| 343 | |
| 344 | /*********************************************************************** |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 345 | * CLASS_RegisterClass |
| 346 | * |
| 347 | * The real RegisterClass() functionality. |
| 348 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 349 | static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE hInstance, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 350 | DWORD style, INT classExtra, INT winExtra ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 351 | { |
| 352 | CLASS *classPtr; |
| 353 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 354 | TRACE("atom=0x%x hinst=0x%x style=0x%lx clExtr=0x%x winExtr=0x%x\n", |
| 355 | atom, hInstance, style, classExtra, winExtra ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 356 | |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 357 | /* Check if a class with this name already exists */ |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 358 | classPtr = CLASS_FindClassByAtom( atom, hInstance ); |
| 359 | if (classPtr) |
| 360 | { |
| 361 | /* Class can be created only if it is local and */ |
| 362 | /* if the class with the same name is global. */ |
| 363 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 364 | if ((style & CS_GLOBALCLASS) || !(classPtr->style & CS_GLOBALCLASS)) |
| 365 | { |
| 366 | SetLastError( ERROR_CLASS_ALREADY_EXISTS ); |
| 367 | return NULL; |
| 368 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | /* Fix the extra bytes value */ |
| 372 | |
| 373 | if (classExtra < 0) classExtra = 0; |
| 374 | else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 375 | WARN("Class extra bytes %d is > 40\n", classExtra); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 376 | if (winExtra < 0) winExtra = 0; |
| 377 | else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */ |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 378 | WARN("Win extra bytes %d is > 40\n", winExtra ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 379 | |
| 380 | /* Create the class */ |
| 381 | |
Alexandre Julliard | d44e495 | 2001-08-20 18:09:39 +0000 | [diff] [blame] | 382 | classPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLASS) + classExtra ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 383 | if (!classPtr) return NULL; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 384 | classPtr->style = style; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 385 | classPtr->cbWndExtra = winExtra; |
| 386 | classPtr->cbClsExtra = classExtra; |
| 387 | classPtr->hInstance = hInstance; |
| 388 | classPtr->atomName = atom; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 389 | classPtr->dce = (style & CS_CLASSDC) ? DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL; |
Alexandre Julliard | 2c69f6d | 1996-09-28 18:11:01 +0000 | [diff] [blame] | 390 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 391 | /* Other non-null values must be set by caller */ |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 392 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 393 | if ((classPtr->next = firstClass)) firstClass->prev = classPtr; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 394 | firstClass = classPtr; |
| 395 | return classPtr; |
| 396 | } |
| 397 | |
| 398 | |
| 399 | /*********************************************************************** |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 400 | * CLASS_UnregisterClass |
| 401 | * |
| 402 | * The real UnregisterClass() functionality. |
| 403 | */ |
| 404 | static BOOL CLASS_UnregisterClass( ATOM atom, HINSTANCE hInstance ) |
| 405 | { |
| 406 | CLASS *classPtr; |
| 407 | BOOL ret = FALSE; |
| 408 | |
| 409 | USER_Lock(); |
| 410 | if (atom && |
| 411 | (classPtr = CLASS_FindClassByAtom( atom, hInstance )) && |
Bill Medland | 0ca07c9 | 2001-11-20 18:53:16 +0000 | [diff] [blame^] | 412 | (!hInstance || classPtr->hInstance == hInstance)) |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 413 | { |
| 414 | ret = CLASS_FreeClass( classPtr ); |
| 415 | } |
| 416 | else SetLastError( ERROR_CLASS_DOES_NOT_EXIST ); |
| 417 | |
| 418 | USER_Unlock(); |
| 419 | return ret; |
| 420 | } |
| 421 | |
| 422 | |
| 423 | /*********************************************************************** |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 424 | * CLASS_RegisterBuiltinClass |
| 425 | * |
| 426 | * Register a builtin control class. |
| 427 | * This allows having both ASCII and Unicode winprocs for the same class. |
| 428 | */ |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 429 | ATOM CLASS_RegisterBuiltinClass( const struct builtin_class_descr *descr ) |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 430 | { |
| 431 | ATOM atom; |
| 432 | CLASS *classPtr; |
| 433 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 434 | if (!(atom = GlobalAddAtomA( descr->name ))) return 0; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 435 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 436 | if (!(classPtr = CLASS_RegisterClass( atom, 0, descr->style, 0, descr->extra ))) |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 437 | { |
| 438 | GlobalDeleteAtom( atom ); |
| 439 | return 0; |
| 440 | } |
| 441 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 442 | classPtr->hCursor = LoadCursorA( 0, descr->cursor ); |
| 443 | classPtr->hbrBackground = descr->brush; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 444 | |
Alexandre Julliard | 91222da | 2000-12-10 23:01:33 +0000 | [diff] [blame] | 445 | if (descr->procA) WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)descr->procA, |
| 446 | WIN_PROC_32A, WIN_PROC_CLASS ); |
| 447 | if (descr->procW) WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)descr->procW, |
| 448 | WIN_PROC_32W, WIN_PROC_CLASS ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 449 | return atom; |
| 450 | } |
| 451 | |
| 452 | |
| 453 | /*********************************************************************** |
| 454 | * CLASS_AddWindow |
| 455 | * |
| 456 | * Add a new window using this class, and return the necessary |
| 457 | * information for creating the window. |
| 458 | */ |
| 459 | CLASS *CLASS_AddWindow( ATOM atom, HINSTANCE inst, WINDOWPROCTYPE type, |
| 460 | INT *winExtra, WNDPROC *winproc, DWORD *style, struct tagDCE **dce ) |
| 461 | { |
| 462 | CLASS *class; |
| 463 | if (type == WIN_PROC_16) inst = GetExePtr(inst); |
| 464 | |
| 465 | if (!(class = CLASS_FindClassByAtom( atom, inst ))) return NULL; |
| 466 | class->cWindows++; |
| 467 | |
| 468 | if (type == WIN_PROC_32W) |
| 469 | { |
| 470 | if (!(*winproc = class->winprocW)) *winproc = class->winprocA; |
| 471 | } |
| 472 | else |
| 473 | { |
| 474 | if (!(*winproc = class->winprocA)) *winproc = class->winprocW; |
| 475 | } |
| 476 | *winExtra = class->cbWndExtra; |
| 477 | *style = class->style; |
| 478 | *dce = class->dce; |
| 479 | return class; |
| 480 | } |
| 481 | |
| 482 | |
| 483 | /*********************************************************************** |
| 484 | * CLASS_RemoveWindow |
| 485 | * |
| 486 | * Remove a window from the class window count. |
| 487 | */ |
| 488 | void CLASS_RemoveWindow( CLASS *cls ) |
| 489 | { |
| 490 | if (cls && cls->cWindows) cls->cWindows--; |
| 491 | } |
| 492 | |
| 493 | |
| 494 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 495 | * RegisterClass (USER.57) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 496 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 497 | ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 498 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 499 | ATOM atom; |
| 500 | CLASS *classPtr; |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 501 | int iSmIconWidth, iSmIconHeight; |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 502 | HINSTANCE16 hInstance=GetExePtr(wc->hInstance); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 503 | |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 504 | if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 505 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 506 | wc->cbClsExtra, wc->cbWndExtra ))) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 507 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 508 | GlobalDeleteAtom( atom ); |
| 509 | return 0; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 510 | } |
| 511 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 512 | TRACE("atom=%04x wndproc=%08lx hinst=%04x " |
Patrik Stridvall | a9a671d | 1999-04-25 19:01:52 +0000 | [diff] [blame] | 513 | "bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 514 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 515 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 516 | wc->cbWndExtra, classPtr, |
| 517 | HIWORD(wc->lpszClassName) ? |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 518 | (char *)MapSL(wc->lpszClassName) : "" ); |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 519 | |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 520 | iSmIconWidth = GetSystemMetrics(SM_CXSMICON); |
| 521 | iSmIconHeight = GetSystemMetrics(SM_CYSMICON); |
| 522 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 523 | classPtr->hIcon = wc->hIcon; |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 524 | classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON, |
| 525 | iSmIconWidth, iSmIconHeight, |
| 526 | LR_COPYFROMRESOURCE); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 527 | classPtr->hCursor = wc->hCursor; |
| 528 | classPtr->hbrBackground = wc->hbrBackground; |
Alexandre Julliard | f0b2354 | 1993-09-29 12:21:49 +0000 | [diff] [blame] | 529 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 530 | WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, |
| 531 | WIN_PROC_16, WIN_PROC_CLASS ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 532 | CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) ); |
Gavriel State | c77c592 | 1998-11-15 09:21:17 +0000 | [diff] [blame] | 533 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 534 | return atom; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | |
| 538 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 539 | * RegisterClassA (USER32.@) |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 540 | * RETURNS |
| 541 | * >0: Unique identifier |
| 542 | * 0: Failure |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 543 | */ |
Patrik Stridvall | 2b3aa61 | 2000-12-01 23:58:28 +0000 | [diff] [blame] | 544 | ATOM WINAPI RegisterClassA( const WNDCLASSA* wc ) /* [in] Address of structure with class data */ |
Alexandre Julliard | f681cd0 | 2000-08-23 19:18:44 +0000 | [diff] [blame] | 545 | { |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 546 | ATOM atom; |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 547 | int iSmIconWidth, iSmIconHeight; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 548 | CLASS *classPtr; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 549 | |
Alexandre Julliard | f681cd0 | 2000-08-23 19:18:44 +0000 | [diff] [blame] | 550 | if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0; |
| 551 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 552 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 553 | wc->cbClsExtra, wc->cbWndExtra ))) |
| 554 | { |
| 555 | GlobalDeleteAtom( atom ); |
| 556 | return 0; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 557 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 558 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 559 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 560 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 561 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
Alexandre Julliard | 641ee76 | 1997-08-04 16:34:36 +0000 | [diff] [blame] | 562 | wc->cbWndExtra, classPtr, |
| 563 | HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 564 | |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 565 | iSmIconWidth = GetSystemMetrics(SM_CXSMICON); |
| 566 | iSmIconHeight = GetSystemMetrics(SM_CYSMICON); |
| 567 | |
| 568 | classPtr->hIcon = wc->hIcon; |
| 569 | classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON, |
| 570 | iSmIconWidth, iSmIconHeight, |
| 571 | LR_COPYFROMRESOURCE); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 572 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 573 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 574 | |
| 575 | WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, |
| 576 | WIN_PROC_32A, WIN_PROC_CLASS ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 577 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
| 578 | return atom; |
| 579 | } |
| 580 | |
| 581 | |
| 582 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 583 | * RegisterClassW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 584 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 585 | ATOM WINAPI RegisterClassW( const WNDCLASSW* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 586 | { |
| 587 | ATOM atom; |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 588 | int iSmIconWidth, iSmIconHeight; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 589 | CLASS *classPtr; |
| 590 | |
Alexandre Julliard | f681cd0 | 2000-08-23 19:18:44 +0000 | [diff] [blame] | 591 | if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0; |
| 592 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 593 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 594 | wc->cbClsExtra, wc->cbWndExtra ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 595 | { |
| 596 | GlobalDeleteAtom( atom ); |
| 597 | return 0; |
| 598 | } |
| 599 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 600 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 601 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 602 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 603 | wc->cbWndExtra, classPtr ); |
| 604 | |
Pierre Mageau | 4ac8db7 | 1999-09-04 11:16:48 +0000 | [diff] [blame] | 605 | iSmIconWidth = GetSystemMetrics(SM_CXSMICON); |
| 606 | iSmIconHeight = GetSystemMetrics(SM_CYSMICON); |
| 607 | |
| 608 | classPtr->hIcon = wc->hIcon; |
| 609 | classPtr->hIconSm = CopyImage(wc->hIcon, IMAGE_ICON, |
| 610 | iSmIconWidth, iSmIconHeight, |
| 611 | LR_COPYFROMRESOURCE); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 612 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 613 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 614 | |
| 615 | WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc, |
| 616 | WIN_PROC_32W, WIN_PROC_CLASS ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 617 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
| 618 | return atom; |
| 619 | } |
| 620 | |
| 621 | |
| 622 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 623 | * RegisterClassEx (USER.397) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 624 | */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 625 | ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 626 | { |
| 627 | ATOM atom; |
| 628 | CLASS *classPtr; |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 629 | HINSTANCE16 hInstance = GetExePtr( wc->hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 630 | |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 631 | if (!(atom = GlobalAddAtomA( MapSL(wc->lpszClassName) ))) return 0; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 632 | if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 633 | wc->cbClsExtra, wc->cbWndExtra ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 634 | { |
| 635 | GlobalDeleteAtom( atom ); |
| 636 | return 0; |
| 637 | } |
| 638 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 639 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 640 | atom, (DWORD)wc->lpfnWndProc, hInstance, |
| 641 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 642 | wc->cbWndExtra, classPtr ); |
| 643 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 644 | classPtr->hIcon = wc->hIcon; |
| 645 | classPtr->hIconSm = wc->hIconSm; |
| 646 | classPtr->hCursor = wc->hCursor; |
| 647 | classPtr->hbrBackground = wc->hbrBackground; |
| 648 | |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 649 | WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, |
| 650 | WIN_PROC_16, WIN_PROC_CLASS ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 651 | CLASS_SetMenuNameA( classPtr, MapSL(wc->lpszMenuName) ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 652 | return atom; |
| 653 | } |
| 654 | |
| 655 | |
| 656 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 657 | * RegisterClassExA (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 658 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 659 | ATOM WINAPI RegisterClassExA( const WNDCLASSEXA* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 660 | { |
| 661 | ATOM atom; |
| 662 | CLASS *classPtr; |
| 663 | |
Alexandre Julliard | f681cd0 | 2000-08-23 19:18:44 +0000 | [diff] [blame] | 664 | if (!(atom = GlobalAddAtomA( wc->lpszClassName ))) return 0; |
| 665 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 666 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 667 | wc->cbClsExtra, wc->cbWndExtra ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 668 | { |
| 669 | GlobalDeleteAtom( atom ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 670 | return 0; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 671 | } |
| 672 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 673 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 674 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 675 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 676 | wc->cbWndExtra, classPtr ); |
| 677 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 678 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 679 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 680 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 681 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 682 | WINPROC_SetProc( &classPtr->winprocA, (HWINDOWPROC)wc->lpfnWndProc, |
| 683 | WIN_PROC_32A, WIN_PROC_CLASS ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 684 | CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); |
| 685 | return atom; |
| 686 | } |
| 687 | |
| 688 | |
| 689 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 690 | * RegisterClassExW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 691 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 692 | ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 693 | { |
| 694 | ATOM atom; |
| 695 | CLASS *classPtr; |
| 696 | |
Alexandre Julliard | f681cd0 | 2000-08-23 19:18:44 +0000 | [diff] [blame] | 697 | if (!(atom = GlobalAddAtomW( wc->lpszClassName ))) return 0; |
| 698 | |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 699 | if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style, |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 700 | wc->cbClsExtra, wc->cbWndExtra ))) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 701 | { |
| 702 | GlobalDeleteAtom( atom ); |
| 703 | return 0; |
| 704 | } |
| 705 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 706 | TRACE("atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 707 | atom, (DWORD)wc->lpfnWndProc, wc->hInstance, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 708 | wc->hbrBackground, wc->style, wc->cbClsExtra, |
| 709 | wc->cbWndExtra, classPtr ); |
| 710 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 711 | classPtr->hIcon = (HICON16)wc->hIcon; |
| 712 | classPtr->hIconSm = (HICON16)wc->hIconSm; |
| 713 | classPtr->hCursor = (HCURSOR16)wc->hCursor; |
| 714 | classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 715 | WINPROC_SetProc( &classPtr->winprocW, (HWINDOWPROC)wc->lpfnWndProc, |
| 716 | WIN_PROC_32W, WIN_PROC_CLASS ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 717 | CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); |
| 718 | return atom; |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | |
| 722 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 723 | * UnregisterClass (USER.403) |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 724 | */ |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 725 | BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 726 | { |
Alexandre Julliard | b849d79 | 2000-02-13 13:56:13 +0000 | [diff] [blame] | 727 | return UnregisterClassA( className, GetExePtr( hInstance ) ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 728 | } |
| 729 | |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 730 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 731 | * UnregisterClassA (USER32.@) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 732 | * |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 733 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 734 | BOOL WINAPI UnregisterClassA( LPCSTR className, HINSTANCE hInstance ) |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 735 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 736 | TRACE("%s %x\n",debugres_a(className), hInstance); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 737 | return CLASS_UnregisterClass( GlobalFindAtomA( className ), hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 738 | } |
| 739 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 740 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 741 | * UnregisterClassW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 742 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 743 | BOOL WINAPI UnregisterClassW( LPCWSTR className, HINSTANCE hInstance ) |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 744 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 745 | TRACE("%s %x\n",debugres_w(className), hInstance); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 746 | return CLASS_UnregisterClass( GlobalFindAtomW( className ), hInstance ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 747 | } |
| 748 | |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 749 | |
| 750 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 751 | * GetClassWord (USER32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 752 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 753 | WORD WINAPI GetClassWord( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 754 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 755 | CLASS *class; |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 756 | WORD retvalue = 0; |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 757 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 758 | if (offset < 0) return GetClassLongA( hwnd, offset ); |
| 759 | |
| 760 | TRACE("%x %x\n",hwnd, offset); |
| 761 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 762 | if (!(class = get_class_ptr( hwnd, FALSE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 763 | |
| 764 | if (offset <= class->cbClsExtra - sizeof(WORD)) |
| 765 | retvalue = GET_WORD((char *)(class + 1) + offset); |
| 766 | else |
| 767 | SetLastError( ERROR_INVALID_INDEX ); |
| 768 | release_class_ptr( class ); |
Guy Albertelli | 2fa281f | 1999-04-24 11:54:40 +0000 | [diff] [blame] | 769 | return retvalue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 770 | } |
| 771 | |
| 772 | |
| 773 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 774 | * GetClassLong (USER.131) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 775 | */ |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 776 | LONG WINAPI GetClassLong16( HWND16 hwnd16, INT16 offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 777 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 778 | CLASS *class; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 779 | LONG ret; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 780 | HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */ |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 781 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 782 | TRACE("%x %d\n",hwnd, offset); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 783 | |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 784 | switch( offset ) |
| 785 | { |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 786 | case GCL_WNDPROC: |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 787 | if (!(class = get_class_ptr( hwnd, FALSE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 788 | ret = (LONG)CLASS_GetProc( class, WIN_PROC_16 ); |
| 789 | release_class_ptr( class ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 790 | return ret; |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 791 | case GCL_MENUNAME: |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 792 | ret = GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 793 | return (LONG)SEGPTR_GET( (void *)ret ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 794 | default: |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 795 | return GetClassLongA( hwnd, offset ); |
Alexandre Julliard | 1e9ac79 | 1996-06-06 18:38:27 +0000 | [diff] [blame] | 796 | } |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 797 | } |
| 798 | |
| 799 | |
| 800 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 801 | * GetClassLongA (USER32.@) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 802 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 803 | LONG WINAPI GetClassLongA( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 804 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 805 | CLASS *class; |
| 806 | LONG retvalue = 0; |
| 807 | |
| 808 | TRACE("%x %d\n", hwnd, offset); |
| 809 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 810 | if (!(class = get_class_ptr( hwnd, FALSE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 811 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 812 | if (offset >= 0) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 813 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 814 | if (offset <= class->cbClsExtra - sizeof(LONG)) |
| 815 | retvalue = GET_DWORD((char *)(class + 1) + offset); |
| 816 | else |
| 817 | SetLastError( ERROR_INVALID_INDEX ); |
| 818 | release_class_ptr( class ); |
| 819 | return retvalue; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 820 | } |
Alexandre Julliard | d44e495 | 2001-08-20 18:09:39 +0000 | [diff] [blame] | 821 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 822 | switch(offset) |
| 823 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 824 | case GCL_HBRBACKGROUND: |
| 825 | retvalue = (LONG)class->hbrBackground; |
| 826 | break; |
| 827 | case GCL_HCURSOR: |
| 828 | retvalue = (LONG)class->hCursor; |
| 829 | break; |
| 830 | case GCL_HICON: |
| 831 | retvalue = (LONG)class->hIcon; |
| 832 | break; |
| 833 | case GCL_HICONSM: |
| 834 | retvalue = (LONG)class->hIconSm; |
| 835 | break; |
| 836 | case GCL_STYLE: |
| 837 | retvalue = (LONG)class->style; |
| 838 | break; |
| 839 | case GCL_CBWNDEXTRA: |
| 840 | retvalue = (LONG)class->cbWndExtra; |
| 841 | break; |
| 842 | case GCL_CBCLSEXTRA: |
| 843 | retvalue = (LONG)class->cbClsExtra; |
| 844 | break; |
| 845 | case GCL_HMODULE: |
| 846 | retvalue = (LONG)class->hInstance; |
| 847 | break; |
| 848 | case GCL_WNDPROC: |
| 849 | retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32A ); |
| 850 | break; |
| 851 | case GCL_MENUNAME: |
| 852 | retvalue = (LONG)CLASS_GetMenuNameA( class ); |
| 853 | break; |
| 854 | case GCW_ATOM: |
| 855 | retvalue = (DWORD)class->atomName; |
| 856 | break; |
| 857 | default: |
| 858 | SetLastError( ERROR_INVALID_INDEX ); |
| 859 | break; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 860 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 861 | release_class_ptr( class ); |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 862 | return retvalue; |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 863 | } |
| 864 | |
| 865 | |
| 866 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 867 | * GetClassLongW (USER32.@) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 868 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 869 | LONG WINAPI GetClassLongW( HWND hwnd, INT offset ) |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 870 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 871 | CLASS *class; |
Francois Boisvert | 6b1b41c | 1999-03-14 17:25:32 +0000 | [diff] [blame] | 872 | LONG retvalue; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 873 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 874 | if (offset != GCL_WNDPROC && offset != GCL_MENUNAME) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 875 | return GetClassLongA( hwnd, offset ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 876 | |
| 877 | TRACE("%x %d\n", hwnd, offset); |
| 878 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 879 | if (!(class = get_class_ptr( hwnd, FALSE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 880 | |
| 881 | if (offset == GCL_WNDPROC) |
| 882 | retvalue = (LONG)CLASS_GetProc( class, WIN_PROC_32W ); |
| 883 | else /* GCL_MENUNAME */ |
| 884 | retvalue = (LONG)CLASS_GetMenuNameW( class ); |
| 885 | |
| 886 | release_class_ptr( class ); |
| 887 | return retvalue; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | |
| 891 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 892 | * SetClassWord (USER32.@) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 893 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 894 | WORD WINAPI SetClassWord( HWND hwnd, INT offset, WORD newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 895 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 896 | CLASS *class; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 897 | WORD retval = 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 898 | |
| 899 | if (offset < 0) return SetClassLongA( hwnd, offset, (DWORD)newval ); |
| 900 | |
| 901 | TRACE("%x %d %x\n", hwnd, offset, newval); |
| 902 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 903 | if (!(class = get_class_ptr( hwnd, TRUE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 904 | |
| 905 | if (offset <= class->cbClsExtra - sizeof(WORD)) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 906 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 907 | void *ptr = (char *)(class + 1) + offset; |
| 908 | retval = GET_WORD(ptr); |
| 909 | PUT_WORD( ptr, newval ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 910 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 911 | else SetLastError( ERROR_INVALID_INDEX ); |
| 912 | |
| 913 | release_class_ptr( class ); |
Alexandre Julliard | 401710d | 1993-09-04 10:09:32 +0000 | [diff] [blame] | 914 | return retval; |
| 915 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 916 | |
| 917 | |
| 918 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 919 | * SetClassLong (USER.132) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 920 | */ |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 921 | LONG WINAPI SetClassLong16( HWND16 hwnd16, INT16 offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 922 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 923 | CLASS *class; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 924 | LONG retval; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 925 | HWND hwnd = (HWND)(ULONG_PTR)hwnd16; /* no need for full handle */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 926 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 927 | TRACE("%x %d %lx\n", hwnd, offset, newval); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 928 | |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 929 | switch(offset) |
| 930 | { |
| 931 | case GCL_WNDPROC: |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 932 | if (!(class = get_class_ptr( hwnd, TRUE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 933 | retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_16 ); |
| 934 | release_class_ptr( class ); |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 935 | return retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 936 | case GCL_MENUNAME: |
Alexandre Julliard | d23a82b | 2001-09-19 20:37:04 +0000 | [diff] [blame] | 937 | newval = (LONG)MapSL( newval ); |
| 938 | /* fall through */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 939 | default: |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 940 | return SetClassLongA( hwnd, offset, newval ); |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 941 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | |
| 945 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 946 | * SetClassLongA (USER32.@) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 947 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 948 | LONG WINAPI SetClassLongA( HWND hwnd, INT offset, LONG newval ) |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 949 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 950 | CLASS *class; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 951 | LONG retval = 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 952 | |
| 953 | TRACE("%x %d %lx\n", hwnd, offset, newval); |
| 954 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 955 | if (!(class = get_class_ptr( hwnd, TRUE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 956 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 957 | if (offset >= 0) |
| 958 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 959 | if (offset <= class->cbClsExtra - sizeof(LONG)) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 960 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 961 | void *ptr = (char *)(class + 1) + offset; |
| 962 | retval = GET_DWORD(ptr); |
| 963 | PUT_DWORD( ptr, newval ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 964 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 965 | else SetLastError( ERROR_INVALID_INDEX ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 966 | } |
| 967 | else switch(offset) |
| 968 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 969 | case GCL_MENUNAME: |
| 970 | CLASS_SetMenuNameA( class, (LPCSTR)newval ); |
| 971 | retval = 0; /* Old value is now meaningless anyway */ |
| 972 | break; |
| 973 | case GCL_WNDPROC: |
| 974 | retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32A ); |
| 975 | break; |
| 976 | case GCL_HBRBACKGROUND: |
| 977 | retval = (LONG)class->hbrBackground; |
| 978 | class->hbrBackground = newval; |
| 979 | break; |
| 980 | case GCL_HCURSOR: |
| 981 | retval = (LONG)class->hCursor; |
| 982 | class->hCursor = newval; |
| 983 | break; |
| 984 | case GCL_HICON: |
| 985 | retval = (LONG)class->hIcon; |
| 986 | class->hIcon = newval; |
| 987 | break; |
| 988 | case GCL_HICONSM: |
| 989 | retval = (LONG)class->hIconSm; |
| 990 | class->hIconSm = newval; |
| 991 | break; |
| 992 | case GCL_STYLE: |
| 993 | retval = (LONG)class->style; |
| 994 | class->style = newval; |
| 995 | break; |
| 996 | case GCL_CBWNDEXTRA: |
| 997 | retval = (LONG)class->cbWndExtra; |
| 998 | class->cbWndExtra = newval; |
| 999 | break; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1000 | case GCL_HMODULE: |
| 1001 | retval = (LONG)class->hInstance; |
| 1002 | class->hInstance = newval; |
| 1003 | break; |
| 1004 | case GCW_ATOM: |
| 1005 | retval = (DWORD)class->atomName; |
| 1006 | class->atomName = newval; |
| 1007 | break; |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1008 | case GCL_CBCLSEXTRA: /* cannot change this one */ |
| 1009 | SetLastError( ERROR_INVALID_PARAMETER ); |
| 1010 | break; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1011 | default: |
| 1012 | SetLastError( ERROR_INVALID_INDEX ); |
| 1013 | break; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1014 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1015 | release_class_ptr( class ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1016 | return retval; |
| 1017 | } |
| 1018 | |
| 1019 | |
| 1020 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1021 | * SetClassLongW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1022 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1023 | LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1024 | { |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1025 | CLASS *class; |
Alexandre Julliard | 3051b64 | 1996-07-05 17:14:13 +0000 | [diff] [blame] | 1026 | LONG retval; |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1027 | |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1028 | if (offset != GCL_WNDPROC && offset != GCL_MENUNAME) |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1029 | return SetClassLongA( hwnd, offset, newval ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1030 | |
| 1031 | TRACE("%x %d %lx\n", hwnd, offset, newval); |
| 1032 | |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1033 | if (!(class = get_class_ptr( hwnd, TRUE ))) return 0; |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1034 | |
| 1035 | if (offset == GCL_WNDPROC) |
| 1036 | retval = (LONG)CLASS_SetProc( class, (WNDPROC)newval, WIN_PROC_32W ); |
| 1037 | else /* GCL_MENUNAME */ |
| 1038 | { |
| 1039 | CLASS_SetMenuNameW( class, (LPCWSTR)newval ); |
| 1040 | retval = 0; /* Old value is now meaningless anyway */ |
Alexandre Julliard | 2d93d00 | 1996-05-21 15:01:41 +0000 | [diff] [blame] | 1041 | } |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1042 | release_class_ptr( class ); |
| 1043 | return retval; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1044 | } |
| 1045 | |
| 1046 | |
| 1047 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1048 | * GetClassNameA (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1049 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1050 | INT WINAPI GetClassNameA( HWND hwnd, LPSTR buffer, INT count ) |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1051 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1052 | INT ret = GlobalGetAtomNameA( GetClassLongA( hwnd, GCW_ATOM ), buffer, count ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1053 | |
| 1054 | TRACE("%x %s %x\n",hwnd, debugstr_a(buffer), count); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1055 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | |
| 1059 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1060 | * GetClassNameW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1061 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1062 | INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count ) |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1063 | { |
Alexandre Julliard | 8fd26b9 | 2001-10-15 17:56:45 +0000 | [diff] [blame] | 1064 | INT ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), buffer, count ); |
Alexandre Julliard | e6d90ea | 2001-10-09 23:27:17 +0000 | [diff] [blame] | 1065 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1066 | TRACE("%x %s %x\n",hwnd, debugstr_w(buffer), count); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1067 | return ret; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1068 | } |
| 1069 | |
| 1070 | |
| 1071 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1072 | * GetClassInfo (USER.404) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1073 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1074 | BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1075 | { |
| 1076 | ATOM atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1077 | CLASS *classPtr; |
Alexandre Julliard | 3ed37e0 | 1994-11-07 18:20:42 +0000 | [diff] [blame] | 1078 | |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1079 | TRACE("%x %s %p\n",hInstance, debugres_a(MapSL(name)), wc); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1080 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1081 | hInstance = GetExePtr( hInstance ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1082 | if (!(atom = GlobalFindAtomA( MapSL(name) )) || |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 1083 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance ))) |
| 1084 | return FALSE; |
| 1085 | if ((hInstance != classPtr->hInstance) && |
| 1086 | !(classPtr->style & CS_GLOBALCLASS)) /*BWCC likes to pass hInstance=0*/ |
| 1087 | return FALSE; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1088 | wc->style = (UINT16)classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1089 | wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1090 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 1091 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
Joshua Thielen | 40a35aa | 2001-11-05 23:49:54 +0000 | [diff] [blame] | 1092 | wc->hInstance = classPtr->style & CS_GLOBALCLASS ? GetModuleHandle16("USER") : (HINSTANCE16)classPtr->hInstance; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1093 | wc->hIcon = classPtr->hIcon; |
| 1094 | wc->hCursor = classPtr->hCursor; |
| 1095 | wc->hbrBackground = classPtr->hbrBackground; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1096 | wc->lpszClassName = name; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1097 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 1098 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 1099 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
| 1100 | return TRUE; |
| 1101 | } |
| 1102 | |
| 1103 | |
| 1104 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1105 | * GetClassInfoA (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1106 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1107 | BOOL WINAPI GetClassInfoA( HINSTANCE hInstance, LPCSTR name, |
| 1108 | WNDCLASSA *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1109 | { |
| 1110 | ATOM atom; |
| 1111 | CLASS *classPtr; |
| 1112 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1113 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1114 | |
| 1115 | /* workaround: if hInstance=NULL you expect to get the system classes |
| 1116 | but this classes (as example from comctl32.dll SysListView) won't be |
Andreas Mohr | 2caee71 | 2000-07-16 15:44:22 +0000 | [diff] [blame] | 1117 | registered with hInstance=NULL in WINE because of the late loading |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1118 | of this dll. fixes file dialogs in WinWord95 (jsch)*/ |
| 1119 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1120 | if (!(atom=GlobalFindAtomA(name)) || !(classPtr=CLASS_FindClassByAtom(atom,hInstance))) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1121 | return FALSE; |
| 1122 | |
Noomen Hamza | 1040eaf | 2000-07-09 12:21:07 +0000 | [diff] [blame] | 1123 | if (!(classPtr->style & CS_GLOBALCLASS) && |
| 1124 | classPtr->hInstance && |
| 1125 | (hInstance != classPtr->hInstance)) |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1126 | { |
| 1127 | if (hInstance) return FALSE; |
Noomen Hamza | 1040eaf | 2000-07-09 12:21:07 +0000 | [diff] [blame] | 1128 | WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",name); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1129 | } |
| 1130 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1131 | wc->style = classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1132 | wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1133 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1134 | wc->cbWndExtra = classPtr->cbWndExtra; |
Noomen Hamza | 1040eaf | 2000-07-09 12:21:07 +0000 | [diff] [blame] | 1135 | wc->hInstance = hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1136 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1137 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1138 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1139 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1140 | wc->lpszClassName = name; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1141 | return TRUE; |
| 1142 | } |
| 1143 | |
| 1144 | |
| 1145 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1146 | * GetClassInfoW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1147 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1148 | BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name, |
| 1149 | WNDCLASSW *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1150 | { |
| 1151 | ATOM atom; |
| 1152 | CLASS *classPtr; |
| 1153 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1154 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1155 | |
Marcus Meissner | 43806217 | 1999-09-03 12:28:20 +0000 | [diff] [blame] | 1156 | if ( !(atom=GlobalFindAtomW(name)) || |
| 1157 | !(classPtr=CLASS_FindClassByAtom(atom,hInstance)) |
| 1158 | ) |
Alexandre Julliard | 2197901 | 1997-03-05 08:22:35 +0000 | [diff] [blame] | 1159 | return FALSE; |
| 1160 | |
Noomen Hamza | 1040eaf | 2000-07-09 12:21:07 +0000 | [diff] [blame] | 1161 | if (!(classPtr->style & CS_GLOBALCLASS) && |
| 1162 | classPtr->hInstance && |
| 1163 | (hInstance != classPtr->hInstance)) |
| 1164 | { |
| 1165 | if (hInstance) return FALSE; |
| 1166 | WARN("systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",debugstr_w(name)); |
Marcus Meissner | 43806217 | 1999-09-03 12:28:20 +0000 | [diff] [blame] | 1167 | } |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1168 | wc->style = classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1169 | wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1170 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1171 | wc->cbWndExtra = classPtr->cbWndExtra; |
Noomen Hamza | 1040eaf | 2000-07-09 12:21:07 +0000 | [diff] [blame] | 1172 | wc->hInstance = hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1173 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1174 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1175 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1176 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1177 | wc->lpszClassName = name; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1178 | return TRUE; |
| 1179 | } |
| 1180 | |
| 1181 | |
| 1182 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1183 | * GetClassInfoEx (USER.398) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1184 | * |
| 1185 | * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the |
| 1186 | * same in Win16 as in Win32. --AJ |
| 1187 | */ |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1188 | BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1189 | { |
| 1190 | ATOM atom; |
| 1191 | CLASS *classPtr; |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 1192 | |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1193 | TRACE("%x %s %p\n",hInstance,debugres_a( MapSL(name) ), wc); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1194 | |
Alexandre Julliard | 808cb04 | 1995-08-17 17:11:36 +0000 | [diff] [blame] | 1195 | hInstance = GetExePtr( hInstance ); |
Alexandre Julliard | 982a223 | 2000-12-13 20:20:09 +0000 | [diff] [blame] | 1196 | if (!(atom = GlobalFindAtomA( MapSL(name) )) || |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1197 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 1198 | (hInstance != classPtr->hInstance)) return FALSE; |
| 1199 | wc->style = classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1200 | wc->lpfnWndProc = CLASS_GetProc( classPtr, WIN_PROC_16 ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1201 | wc->cbClsExtra = (INT16)classPtr->cbClsExtra; |
| 1202 | wc->cbWndExtra = (INT16)classPtr->cbWndExtra; |
| 1203 | wc->hInstance = (HINSTANCE16)classPtr->hInstance; |
| 1204 | wc->hIcon = classPtr->hIcon; |
| 1205 | wc->hIconSm = classPtr->hIconSm; |
| 1206 | wc->hCursor = classPtr->hCursor; |
| 1207 | wc->hbrBackground = classPtr->hbrBackground; |
| 1208 | wc->lpszClassName = (SEGPTR)0; |
| 1209 | wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); |
| 1210 | if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ |
| 1211 | wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1212 | wc->lpszClassName = name; |
James Hatheway | 9fa09e7 | 2000-06-18 17:19:38 +0000 | [diff] [blame] | 1213 | |
| 1214 | /* We must return the atom of the class here instead of just TRUE. */ |
| 1215 | return atom; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1216 | } |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1217 | |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1218 | |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1219 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1220 | * GetClassInfoExA (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1221 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1222 | BOOL WINAPI GetClassInfoExA( HINSTANCE hInstance, LPCSTR name, |
| 1223 | WNDCLASSEXA *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1224 | { |
| 1225 | ATOM atom; |
| 1226 | CLASS *classPtr; |
| 1227 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1228 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1229 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1230 | if (!(atom = GlobalFindAtomA( name )) || |
Alexandre Julliard | a0d7731 | 1998-09-13 16:32:00 +0000 | [diff] [blame] | 1231 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) |
| 1232 | /*|| (hInstance != classPtr->hInstance) */ ) return FALSE; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1233 | wc->style = classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1234 | wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32A ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1235 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1236 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1237 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1238 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1239 | wc->hIconSm = (HICON)classPtr->hIconSm; |
| 1240 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1241 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1242 | wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1243 | wc->lpszClassName = name; |
| 1244 | |
James Hatheway | 9fa09e7 | 2000-06-18 17:19:38 +0000 | [diff] [blame] | 1245 | /* We must return the atom of the class here instead of just TRUE. */ |
| 1246 | return atom; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1247 | } |
| 1248 | |
| 1249 | |
| 1250 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1251 | * GetClassInfoExW (USER32.@) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1252 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1253 | BOOL WINAPI GetClassInfoExW( HINSTANCE hInstance, LPCWSTR name, |
| 1254 | WNDCLASSEXW *wc ) |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1255 | { |
| 1256 | ATOM atom; |
| 1257 | CLASS *classPtr; |
| 1258 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1259 | TRACE("%x %p %p\n",hInstance, name, wc); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1260 | |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1261 | if (!(atom = GlobalFindAtomW( name )) || |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1262 | !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || |
| 1263 | (hInstance != classPtr->hInstance)) return FALSE; |
| 1264 | wc->style = classPtr->style; |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1265 | wc->lpfnWndProc = (WNDPROC)CLASS_GetProc( classPtr, WIN_PROC_32W ); |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1266 | wc->cbClsExtra = classPtr->cbClsExtra; |
| 1267 | wc->cbWndExtra = classPtr->cbWndExtra; |
| 1268 | wc->hInstance = classPtr->hInstance; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1269 | wc->hIcon = (HICON)classPtr->hIcon; |
| 1270 | wc->hIconSm = (HICON)classPtr->hIconSm; |
| 1271 | wc->hCursor = (HCURSOR)classPtr->hCursor; |
| 1272 | wc->hbrBackground = (HBRUSH)classPtr->hbrBackground; |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1273 | wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); |
Alexandre Julliard | 9877906 | 2000-12-07 23:39:16 +0000 | [diff] [blame] | 1274 | wc->lpszClassName = name; |
| 1275 | |
James Hatheway | 9fa09e7 | 2000-06-18 17:19:38 +0000 | [diff] [blame] | 1276 | /* We must return the atom of the class here instead of just TRUE. */ |
| 1277 | return atom; |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 1278 | } |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1279 | |
| 1280 | |
Alexandre Julliard | f899ef0 | 2001-07-23 00:04:00 +0000 | [diff] [blame] | 1281 | #if 0 /* toolhelp is in kernel, so this cannot work */ |
| 1282 | |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1283 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1284 | * ClassFirst (TOOLHELP.69) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1285 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1286 | BOOL16 WINAPI ClassFirst16( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1287 | { |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1288 | TRACE("%p\n",pClassEntry); |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1289 | pClassEntry->wNext = 1; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1290 | return ClassNext16( pClassEntry ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1291 | } |
| 1292 | |
| 1293 | |
| 1294 | /*********************************************************************** |
Patrik Stridvall | 2ece70e | 2000-12-22 01:38:01 +0000 | [diff] [blame] | 1295 | * ClassNext (TOOLHELP.70) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1296 | */ |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1297 | BOOL16 WINAPI ClassNext16( CLASSENTRY *pClassEntry ) |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1298 | { |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1299 | int i; |
| 1300 | CLASS *class = firstClass; |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1301 | |
Alexandre Julliard | 359f497e | 1999-07-04 16:02:24 +0000 | [diff] [blame] | 1302 | TRACE("%p\n",pClassEntry); |
Alexandre Julliard | 767e6f6 | 1998-08-09 12:47:43 +0000 | [diff] [blame] | 1303 | |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1304 | if (!pClassEntry->wNext) return FALSE; |
| 1305 | for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next; |
| 1306 | if (!class) |
| 1307 | { |
| 1308 | pClassEntry->wNext = 0; |
| 1309 | return FALSE; |
| 1310 | } |
Alexandre Julliard | 1285c2f | 1996-05-06 16:06:24 +0000 | [diff] [blame] | 1311 | pClassEntry->hInst = class->hInstance; |
Alexandre Julliard | 2ace16a | 1996-04-28 15:09:19 +0000 | [diff] [blame] | 1312 | pClassEntry->wNext++; |
Alexandre Julliard | a396029 | 1999-02-26 11:11:13 +0000 | [diff] [blame] | 1313 | GlobalGetAtomNameA( class->atomName, pClassEntry->szClassName, |
Alexandre Julliard | e2bfa4c | 1996-05-16 18:21:06 +0000 | [diff] [blame] | 1314 | sizeof(pClassEntry->szClassName) ); |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 1315 | return TRUE; |
| 1316 | } |
Alexandre Julliard | f899ef0 | 2001-07-23 00:04:00 +0000 | [diff] [blame] | 1317 | #endif |