_Daniel
(Just in Town)
2016-11-13 04:05 AM
Messagebox and lost focus

Hi All.
I need a recommendation on how to keep focus during a SHELL and MessageBox routine.
I've got a cmd window with a messagebox popup timed for 6secs and IF the user does a mouse click anywhere off the message box during those 6secs the script just idles and doesn't proceed. (And on first test run it happened...)
I tried 'SetFocus' and that didn't work. Also tried to use the minimizeall UDF and wasn't able to get that to work.

Thanks, _Dan

 Code:

(CODE Snippet)
; >>> Messagebox to keep the user informed...
$Holding =  MessageBox("Please wait, 
Need to check for Workstations still running Silly Old Access97 Program
before continuing with BackUps...
-=-=-=-=-=-=-=-=-=-=-=-=-=-",+"Checking Workstations ---", 64, 6)
tried SetFocus ("wkix32.exe") here...
; ======================================================================================
<clipped......>
$Not_Running = 0	
$List_Em = ""
   SHELL "PSList.exe \\workstation01 sillyoldprogram.exe  -nobanner"	; >>> ws One
	IF @ERROR = 0 $Dash_00 = "Yes" else $Dash_00 = "Nada"
    endif



Glenn BarnasAdministrator
(KiX Supporter)
2016-11-13 02:22 PM
Re: Messagebox and lost focus

Hey Dan - Welcome to KORG!

Your style value (third parameter) is 64, which is:
  • "OK" button
  • "Information" symbol
  • First button is default
  • Application Modal

Try adding 4096 to the style value to change to System Modal. The values are cumulative, and if you only define one, the defaults are set for all others. App modal allows other apps to run, System Modal forces the Kix script to stay in focus.

Glenn


JochenAdministrator
(KiX Supporter)
2016-11-15 04:20 PM
Re: Messagebox and lost focus

mumble .. there was a nice list by Shawn of all those modal values, even the undocumented ones .. Wonder if they are still valid.

Lemme search for that one -.-


JochenAdministrator
(KiX Supporter)
2016-11-15 04:24 PM
Re: Messagebox and lost focus

there you go : http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=82022#Post82022

_Daniel
(Just in Town)
2016-11-16 07:24 PM
Re: Messagebox and lost focus

Thanks Gang! That made it better. The messagebox window doesn't disappear.
It does stay on top.
Still though if the user clicks off somewhere else the messagebox loses focus but does
stay on top.
The (6) second timer becomes inactive, so the user _has_ to select the 'OK' button.
After (6) seconds the focus seems to switch to the CMD window...

I didn't mentioned it above but I'm launching the script with wkix32.exe.

_Dan