I couldn't get the SetParent based solution to work.
Nor could I get the "timingloop" based solution, where the Calculator is minimised when another window becomes active, to work satisfactorily.
One reasons I'm not satisfied is that having the script minimise the window then puts it under the control of the task bar button Calculator icon. Then if you press the Calculator icon the script locks up and Calculator stays minimized.
Another reason I'd prefer to explore a different solution is aesthetic. It's impossible to remove the jerkiness from the cover movement when the Calculator is dragged.
The approach I exploring now avoids the Calculator window being de-activated or moved by:
- Closing all windows b4 starting the Calculator script,
- Hiding the Task Bar,
- Removing the Calculator Menu Bar,
- Placing an Splashimage over the Title Bar.
Here is the code. As you can see the "close all windows" part has been commented out for convenience while I'm trying to fix/develop other parts of the script:
/*WinGet, id, list, , , Program Manager ; Close all windows
StringTrimRight, this_id, id%a_index%, 0
WinGetTitle, this_title, ahk_id %this_id%
WinHide ahk_class Shell_TrayWnd
Run calc.exe, , , PID
WinWait ahk_pid %PID%
DllCall("SetMenu", uint, WinExist(), uint, 0) ; Remove menu bar of "last found window".
WinMove, ahk_pid %PID%,,0, 0 ; Move the Calculator window to the top left corner.
SplashImage, , B w455 h30 x0 y0 CWBlue, , , SICalcCover
;SplashImage, , B w175 h165 x55 y125 CWSilver, , , SICalcCover
SetTimer Follow, 100
IfWinNotExist ahk_pid %PID%
Winshow ahk_class Shell_TrayWnd
ExitApp ; Calc has been closed
I'm trying to work out how I can make a transparent hole over the Calculator Close button because you can still drag by clicking on the right hand edge of the title bar. Does anyone know how to make a hole in a SplashImage?
I'm also trying to get multiple SplashImages working. Only the title bar cover works at the moment. Doublebogey are you there? Do you have any suggestions on this?