TokGajah Posted April 6, 2009 Share Posted April 6, 2009 Hi allCurrently i have two way to restart my explorer.exe. EitherProcessClose("explorer.exe")orWinKill("[CLASS:Progman]", "") WinKill("[CLASS:Shell_TrayWnd]", "")The second script i made after made some reading in hereThe question is what does the WinKill & ProcessClose function do at API level? So far i could guest that WinClose function will sending WM_Close. Does the WinKill sending the WM_Quit message and ProcessClose sending the WM_Destroy? The reason for above question is that currently i'm making a script to close the shell explorer.exe politely based on a msdn blog article. I could make a keyboard simulation to achieve the objective but i wish to do it more geeky way if possible. Link to comment Share on other sites More sharing options...
bo8ster Posted April 6, 2009 Share Posted April 6, 2009 Have you tried looking at the source? Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
monoceres Posted April 6, 2009 Share Posted April 6, 2009 (edited) I think ProcessClose() calls TerminateProcess() at once while WinKill first tries to kill the window by sending something like WM_CLOSE and if that doesn't work it finds the ID of the process that owns the window and then terminates it with TerminateProcess. Edited April 6, 2009 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
bo8ster Posted April 6, 2009 Share Posted April 6, 2009 Thanks monoceres for the info, I tried to find the info myself out of curiosity. Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic] Link to comment Share on other sites More sharing options...
monoceres Posted April 6, 2009 Share Posted April 6, 2009 Thanks monoceres for the info, I tried to find the info myself out of curiosity.Well I'm only guessing. It seems to be the logical way of doing it.If you really want to know what happens behind the scenes I suggest you spy on autoit while you do the call. This can be done with the api hooking script in my sig. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
TokGajah Posted April 7, 2009 Author Share Posted April 7, 2009 (edited) Thank you all for the replyHave you tried looking at the source?Autoit is close source, and even there is a source code i don't have the capability to trace and understand the code.Well I'm only guessing. It seems to be the logical way of doing it.If you really want to know what happens behind the scenes I suggest you spy on autoit while you do the call. This can be done with the api hooking script in my sig.That is a great idea but again it is still beyond my capability. It will be great if we know more the details about this functions from the autoit developers. Edited April 7, 2009 by TokGajah Link to comment Share on other sites More sharing options...
monoceres Posted April 7, 2009 Share Posted April 7, 2009 After hooking a script that calls WinKill() and monitoring the incoming messages in the target window I came up with the following:AutoIt sends the WM_CLOSE message to the target window.Waits approximately 500 ms for the window to close.If the window still haven't close AutoIt tries to terminate the process by calling the TeriminateProcess() api.Gives up Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
trancexx Posted April 7, 2009 Share Posted April 7, 2009 (edited) After hooking a script that calls WinKill() and monitoring the incoming messages in the target window I came up with the following:AutoIt sends the WM_CLOSE message to the target window.Waits approximately 500 ms for the window to close.If the window still haven't close AutoIt tries to terminate the process by calling the TeriminateProcess() api.Gives upIsn't this guy great?edit:monoceres, you should do more stuff like this Edited April 7, 2009 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
TokGajah Posted April 7, 2009 Author Share Posted April 7, 2009 Yes he is Thank you very much monoceres. It will be benefits to the others. I have flag this post as problem solved. Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now