My goal is to let the user minimize an application that uses a dialog box. I've got that covered with IntControl (49, 1, 0, 0, 0) ; allow minimize dialog box
When the user hits a hot key, the application will try to start. Currently I am manually making this happen with Windows shortcut and setting the Windows shortcut key. But even that is not working consistently. Sometimes it does and sometimes not.
.
If the application is already running, I don't want a second copy to be loaded.
When the application starts I want it to check to see if it is already running and if so, to do a Winshow of the running version and then exit.
I am trying to use Winexist, Wintitle, and winGetActive, and WinIdGet to make this happen -- to no avail. I had this working many years ago, but I think Windows 10 is making this a challenge.
Any ideas?
Have no idea what you have tried but this standard example works just fine on Windows 10.
WinHide('') ; Hide WinBatch box (not absolutley necessary.)
strTitle = 'Single Instance Example'
; Prevent a second instance of the dialog.
if WinExist(strTitle)
;;WinShow(strTitle)
WinActivate(strTitle)
exit
endif
SininstFormat=`WWWDLGED,6.2`
SininstCaption=strTitle
SininstX=3183
SininstY=164
SininstWidth=227
SininstHeight=220
SininstNumControls=002
SininstProcedure=`DEFAULT`
SininstFont=`DEFAULT`
SininstTextColor=`DEFAULT`
SininstBackground=`DEFAULT,DEFAULT`
SininstConfig=0
SininstDPI=`192,10,20`
Sininst001=`026,172,050,016,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
Sininst002=`138,172,050,016,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
IntControl (49, 1, 0, 0, 0)
ButtonPushed=Dialog("Sininst")
Thanks. That works. :)