开发者

Close a window (via it's window handle) without closing the process that owns it

开发者 https://www.devze.com 2023-02-27 11:48 出处:网络
I\'m trying to close individual windows from a processes whose code I do not have access to. The program spawns what look like internet explorer windows upon a button push, but they do not create an i

I'm trying to close individual windows from a processes whose code I do not have access to. The program spawns what look like internet explorer windows upon a button push, but they do not create an iexplorer.exe process (they all apparently live inside the application process). I've managed to get the process handle and the window handles for each "fake" IE window via some API calls, but I can't figure out how to close just a given window in a process.

I've tried

SendMessage(WindowHandles[i], 0x0010, 0, 0);

which is the WM_CLOSE message, but it closes all the windows in the process and ends the process. Is there a way to programmatically do something similar to what happens when I press the X at the top right corner of the window? The window isn't performing any computation or effecting any other memory spaces so I can end it however I want, but everything I've tried everything I know how to do (DestroyWindow; wh开发者_运维技巧ich returned error 5 permission denied, WM_CLOSE; which works but closes the process, WM_QUIT; which gives error 2 file not found and does nothing).

Any ideas?


You could send a SW_HIDE should technically work, although it wont close them, you can find more info at http://msdn.microsoft.com/en-us/library/ms633548(v=vs.85).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号