Jump to content

Redirect exit code of the AutoIt window


Recommended Posts

Hi,

Here is a script which destroys the AutoIt Window, there is many issues that can understand and fix except that the application won't exit with the Exit code.

Is there any way to "redirect" the exit code to terminate the application?

There should be a main function in the internal autoit code, no way to make it exit?

Here is the script :

;you will need to kill the autoit3 process.

#include <WinAPI.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

Global $_hWndProc = DllCallbackRegister("WM_HANDLER", "int", "hwnd;int;wparam;lparam")

AutoItWinSetTitle("Wndtmp_")
$hWnd = WinGetHandle("Wndtmp_")

_WinAPI_SetWindowLong($hWnd, $GWL_WNDPROC, DllCallbackGetPtr($_hWndProc))
_WinAPI_DestroyWindow($hWnd)
;also destroys:
;tray icon, hotkeys, wm messages (in particular Exit), more things?

Exit ;does not work

Func WM_HANDLER($hWnd, $iMsg, $wParam, $lParam)
    Switch $iMsg
        Case $WM_CLOSE
            Return False
    EndSwitch

    Return _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam)
EndFunc   ;==>WM_HANDLER

My purpose for this is insignificant, but I would be interested to know if it's possible.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...