Now do I stop more than 1 copy of exe opening? Ie when you double click on the shortcut a second time it maximizes the window rather than open a new one?
Module('winapi')
FindWindow(<*cstring>,*cstring),unsigned,pascal,raw,name('FindWindowA')
End
The first parameter is the name of the class, for a clarion application it will be something like ClaWin and a lot of figures... ie Clawin8388608Class1
The second parameter is the title of the window (in the title bar.)
if you pass a NULL to the calss name then windows then this api will look through all the classes.. otherwise it will search everywhere.
If it still does not work then try this other method, it loop through all the opened windows (visible or not) until it finds a clarion program, then checks that it is the one you are interrested in.
module('winapi')
GetClassName(UNSIGNED,*CSTRING,SIGNED),SIGNED,PASCAL,RAW,NAME('GetClassNameA')
GetWindowText(Long,Long,SIGNED),SIGNED,PASCAL,RAW,NAME('GetWindowTextA')
End
FindWindowName = 'The title of of the window to close'
Loop WindowHandle = 1 To 0FFFFh
rlen# = GetWindowText(WindowHandle,Address(WindowTitle),200)
If rlen# Then
ret# = GetClassName(WindowHandle,ClassName,200)
If (Sub(ClassName,1,6) = 'ClaWin') And Clip(WindowTitle) = FindWindowName) Then
MESSAGE('You cannot run more than one instance of ' & FindWindowName)
Return
End
End
End
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.