3 * Copyright 1994, Bob Amstadt
9 #include <X11/Xresource.h>
18 #define SPY_MAX_MSGNUM 0x0232
20 const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
38 "WM_CLOSE", /* 0x10 */
54 "WM_SETCURSOR", /* 0x20 */
70 "WM_SETFONT", /* 0x30 */
71 "WM_GETFONT", NULL, NULL, NULL, NULL, NULL, NULL,
72 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
75 NULL, NULL, NULL, NULL, NULL, NULL,
76 "WM_WINDOWPOSCHANGING", /* 0x0046 */
77 "WM_WINDOWPOSCHANGED", /* 0x0047 */
78 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
81 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
82 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
85 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
86 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
89 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
90 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
93 "WM_NCCREATE", /* 0x0081 */
94 "WM_NCDESTROY", /* 0x0082 */
95 "WM_NCCALCSIZE", /* 0x0083 */
96 "WM_NCHITTEST", /* 0x0084 */
97 "WM_NCPAINT", /* 0x0085 */
98 "WM_NCACTIVATE", /* 0x0086 */
99 "WM_GETDLGCODE", /* 0x0087 */
100 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
103 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
104 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
107 "WM_NCMOUSEMOVE", /* 0x00A0 */
108 "WM_NCLBUTTONDOWN", /* 0x00A1 */
109 "WM_NCLBUTTONUP", /* 0x00A2 */
110 "WM_NCLBUTTONDBLCLK", /* 0x00A3 */
111 "WM_NCRBUTTONDOWN", /* 0x00A4 */
112 "WM_NCRBUTTONUP", /* 0x00A5 */
113 "WM_NCRBUTTONDBLCLK", /* 0x00A6 */
114 "WM_NCMBUTTONDOWN", /* 0x00A7 */
115 "WM_NCMBUTTONUP", /* 0x00A8 */
116 "WM_NCMBUTTONDBLCLK", /* 0x00A9 */
117 NULL, NULL, NULL, NULL, NULL, NULL,
120 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
121 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
124 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
125 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
128 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
129 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
132 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
133 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
136 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
137 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
139 "WM_KEYDOWN", /* 0x0100 */
140 "WM_KEYUP", /* 0x0101 */
141 "WM_CHAR", /* 0x0102 */
142 "WM_DEADCHAR", /* 0x0103 */
143 "WM_SYSKEYDOWN", /* 0x0104 */
144 "WM_SYSKEYUP", /* 0x0105 */
145 "WM_SYSCHAR", /* 0x0106 */
146 "WM_SYSDEADCHAR", /* 0x0107 */
147 "WM_KEYLAST", /* 0x0108 */
148 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
150 "WM_INITDIALOG", /* 0x0110 */
151 "WM_COMMAND", /* 0x0111 */
152 "WM_SYSCOMMAND", /* 0x0112 */
153 "WM_TIMER", /* 0x0113 */
154 "WM_HSCROLL", /* 0x0114 */
155 "WM_VSCROLL", /* 0x0115 */
157 "WM_SYSTIMER", /* 0x0118 */
158 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
161 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
162 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
165 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
166 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
169 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
170 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
173 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
174 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
177 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
178 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
181 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
182 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
185 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
186 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
189 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
190 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
193 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
194 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
197 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
198 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
201 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
202 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
205 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
206 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
209 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
210 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
213 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
216 "WM_MOUSEMOVE", /* 0x0200 */
217 "WM_LBUTTONDOWN", /* 0x0201 */
218 "WM_LBUTTONUP", /* 0x0202 */
219 "WM_LBUTTONDBLCLK", /* 0x0203 */
220 "WM_RBUTTONDOWN", /* 0x0204 */
221 "WM_RBUTTONUP", /* 0x0205 */
222 "WM_RBUTTONDBLCLK", /* 0x0206 */
223 "WM_MBUTTONDOWN", /* 0x0207 */
224 "WM_MBUTTONUP", /* 0x0208 */
225 "WM_MBUTTONDBLCLK", /* 0x0209 */
226 NULL, NULL, NULL, NULL, NULL, NULL,
228 "WM_PARENTNOTIFY", /* 0x0210 */
230 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
231 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
234 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
235 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
239 "WM_ENTERSIZEMOVE", /* 0x0231 */
240 "WM_EXITSIZEMOVE" /* 0x0232 */
243 char SpyFilters[256];
244 char SpyIncludes[256];
248 /**********************************************************************
251 void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
259 if (msg > SPY_MAX_MSGNUM || MessageTypeNames[msg] == NULL)
260 sprintf(msg_name, "%04x", msg);
262 strcpy(msg_name, MessageTypeNames[msg]);
264 strcat(msg_name, ";");
266 if ((strlen(SpyIncludes) == 0 || strstr(SpyIncludes, msg_name) != NULL) &&
267 strstr(SpyFilters, msg_name) == NULL)
269 msg_name[strlen(msg_name) - 1] = '\0';
270 fprintf(SpyFp, "%04.4x %20.20s %04.4x %04.4x %08.8x\n",
271 hwnd, msg_name, msg, wParam, lParam);
276 /**********************************************************************
286 if (Options.spyFilename == NULL)
288 GetPrivateProfileString("spy", "file", "", filename, sizeof(filename),
292 strncpy(filename, Options.spyFilename, 100);
294 if (strcasecmp(filename, "CON") == 0)
296 else if (strlen(filename))
297 SpyFp = fopen(filename, "a");
304 GetPrivateProfileString("spy", "exclude", "", SpyFilters,
305 sizeof(SpyFilters), WINE_INI);
306 GetPrivateProfileString("spy", "include", "", SpyIncludes,
307 sizeof(SpyIncludes), WINE_INI);