143 |
vchannel_unblock(); |
vchannel_unblock(); |
144 |
} |
} |
145 |
|
|
146 |
|
static HWND |
147 |
|
get_parent(HWND hwnd) |
148 |
|
{ |
149 |
|
LONG style; |
150 |
|
HWND parent; |
151 |
|
|
152 |
|
style = GetWindowLong(hwnd, GWL_STYLE); |
153 |
|
|
154 |
|
if (style & (WS_POPUP | DS_MODALFRAME)) |
155 |
|
{ |
156 |
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
157 |
|
|
158 |
|
if (parent) |
159 |
|
{ |
160 |
|
style = GetWindowLong(parent, GWL_STYLE); |
161 |
|
if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE)) |
162 |
|
parent = NULL; |
163 |
|
} |
164 |
|
|
165 |
|
if (!parent) |
166 |
|
parent = GetWindow(hwnd, GW_OWNER); |
167 |
|
|
168 |
|
if (parent) |
169 |
|
{ |
170 |
|
style = GetWindowLong(parent, GWL_STYLE); |
171 |
|
if (((style & WS_CHILD) && !(style & WS_POPUP)) || !(style & WS_VISIBLE)) |
172 |
|
parent = NULL; |
173 |
|
} |
174 |
|
|
175 |
|
if (!parent) |
176 |
|
parent = (HWND) - 1; |
177 |
|
} |
178 |
|
else |
179 |
|
parent = NULL; |
180 |
|
|
181 |
|
return parent; |
182 |
|
} |
183 |
|
|
184 |
static LRESULT CALLBACK |
static LRESULT CALLBACK |
185 |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
wndproc_hook_proc(int code, WPARAM cur_thread, LPARAM details) |
186 |
{ |
{ |
206 |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
207 |
goto end; |
goto end; |
208 |
|
|
209 |
if (style & WS_POPUP) |
parent = get_parent(hwnd); |
|
{ |
|
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
|
|
if (!parent) |
|
|
parent = (HWND) - 1; |
|
|
} |
|
|
else |
|
|
parent = NULL; |
|
210 |
|
|
211 |
switch (msg) |
switch (msg) |
212 |
{ |
{ |
218 |
{ |
{ |
219 |
unsigned short title[150]; |
unsigned short title[150]; |
220 |
int state; |
int state; |
221 |
|
DWORD pid; |
222 |
|
int flags; |
223 |
|
|
224 |
vchannel_write("CREATE", "0x%p,0x%p,0x%x", hwnd, parent, 0); |
GetWindowThreadProcessId(hwnd, &pid); |
225 |
|
|
226 |
|
flags = 0; |
227 |
|
if (style & DS_MODALFRAME) |
228 |
|
flags |= SEAMLESS_CREATE_MODAL; |
229 |
|
|
230 |
|
vchannel_write("CREATE", "0x%08lx,0x%08lx,0x%08lx,0x%08x", |
231 |
|
(long) hwnd, (long) pid, (long) parent, |
232 |
|
flags); |
233 |
|
|
234 |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
GetWindowTextW(hwnd, title, sizeof(title) / sizeof(*title)); |
235 |
|
|
311 |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
if ((style & WS_CHILD) && !(style & WS_POPUP)) |
312 |
goto end; |
goto end; |
313 |
|
|
314 |
if (style & WS_POPUP) |
parent = get_parent(hwnd); |
|
{ |
|
|
parent = (HWND) GetWindowLong(hwnd, GWL_HWNDPARENT); |
|
|
if (!parent) |
|
|
parent = (HWND) - 1; |
|
|
} |
|
|
else |
|
|
parent = NULL; |
|
315 |
|
|
316 |
switch (msg) |
switch (msg) |
317 |
{ |
{ |