Hi Db,
Making the following change switches off SplashImages when no Windows are active:
If Title= ;If title is blank,. then
{
Return ;return, do nothing
}
changed to
If Title= ;If title is blank,. then
{
SplashImage 1:Off ;Turn off Wincover 1
SplashImage 2:off
SplashImage 3:off
Return ;return
}
However restoring another minimized window terminates the script leaving the Calculator running without covering SplashImages when the Calculator is again restored.
This problem still needs to be solved.
Cheers.
Cover.bmp is a grey rectangle W230 H170:
Run, %SystemRoot%\System32\calc.exe
WinWaitActive, Calculator
ControlGet, hWndNewParent, Hwnd,,, Calculator
WinGetPos, X, Y,,, Calculator
x:=X+55
y:=Y+140
SplashImage, cover.bmp, B X%x% Y%y%
ControlGet, hWndChild, Hwnd,,, SplashImage
DllCall("SetParent", hWndChild, hWndNewParent)
Sleep, 10000
SplashImage, Off
I'm try to get the SplashImage to move with Calculator when I drag Calculator.
What did I do wrong?
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:
#SingleInstance Force
#NoEnv
SetBatchLines -1
#Persistent
/*WinGet, id, list, , , Program Manager ; Close all windows
Loop, %id%
{
StringTrimRight, this_id, id%a_index%, 0
WinGetTitle, this_title, ahk_id %this_id%
winclose,%this_title%
}
*/
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
;WinSet....
;SplashImage, , B w175 h165 x55 y125 CWSilver, , , SICalcCover
SetTimer Follow, 100
Follow:
IfWinNotExist ahk_pid %PID%
{
Winshow ahk_class Shell_TrayWnd
ExitApp ; Calc has been closed
}
Return
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?