The example above fails for me with "User lib function not found", presumably because the proper dll names have been left off the declarations for GetActiveWindow and SetWindowPos (unless I am being dumb), they should be:
When fixed it does work very well! Thanks loads.
[Edit] Hmm the close detection only works for the X button, it doesn't work for Alt+F4 or if the user clicks the system menu and selects close. Any ideas?
[Edit2] Also it is a shame to have to include another .dll just to detect if the X is clicked. Surely there is another way to do this with user32 or kernal32 etc?
GetActiveWindow%():"GetActiveWindow" SetWindowLong%(hWnd%,Val%,Long%):"SetWindowLongA" GetWindowLong%(hWnd%,Val%):"GetWindowLongA" SetWindowPos%(hWnd%,hAfter%,x%,y%,cx%,cy%,flags%):"SetWindowPos"
When fixed it does work very well! Thanks loads.
[Edit] Hmm the close detection only works for the X button, it doesn't work for Alt+F4 or if the user clicks the system menu and selects close. Any ideas?
[Edit2] Also it is a shame to have to include another .dll just to detect if the X is clicked. Surely there is another way to do this with user32 or kernal32 etc?