• Dialog box display in the same screen as the window it talks about.
• Window's application name is now displayed in the dialog box.
• When a window is set alwaysOnTop, it's tranparency is a little modified.
john_c wrote: ↑19 Jul 2022, 18:52
The problem is that I want to easily distinguish between always-on-top and normal windows when I look on the screen.
Code: Select all
^SPACE::{
;➽ Toggle window always-on-top.
if not winID := winExist('A') {
; If you right-click a tray icon, key-escape the menu and ^Space, you will arrive here.
errorBeep
return
}
if winGetExStyle(winID) & 0x8 { ; 0x8 • WS_EX_TOPMOST
if askBox( "Free on-top?" ) {
winSetAlwaysOnTop false, winID
checkIt false
}
} else {
if askBox( "Keep on-top?" ) {
winSetAlwaysOnTop true, winID
checkIt true
}
}
checkIt( TrueFalse ){
;➽ Check alwaysOnTop setting is done.
; FilesExplorer windows (maybe others) don't toggle always-on-top style.
if TrueFalse=((winGetExStyle(winID) & 0x8)>0) {
winSetTransparent TrueFalse?225:255, winID ; 255 • opaque
toggleBeep TrueFalse
} else
errorBeep
}
askBox( msg ){
;➽ Ask confirmation.
; One more Space to confirm.
txt := appName() " :" '`n`n'
. winGetTitle(winID) '`n`n'
. msg
return 'ok'=msgBox(txt, "Always-on-top", "OKCancel Icon! 4096 Default1 Owner" winID)
}
appName(){
;➽ Get application name.
; "sublime_text.exe" → "Sublime Text"
splitPath winGetProcessName(winID) ,,,, &name
return strTitle( strReplace(name, "_", " ") )
}
}
toggleBeep( OnOff ) {
;➽ GlobalApp for set/unset, up/down … onSettings feed back.
OnOff
? soundBeep( 2500, 90 )
: soundBeep( 450, 110 )
}
errorBeep() {
;➽ GlobalApp errors feed back.
soundBeep( 170, 120 )
}