How to close a previous instance?
Posted: Thu Jul 31, 2014 10:22 pm
Hi there!
I use this code to check if an instance is already open but, everytime I click on the program I get a warning about the opened instance but every new instance doesn`t close and it remains opened.
How Can I do to close every new instance? :o
Many thanks!
`detects if a form is alread open, run it twice to see the effect
Declare findwindow as "FindWindowA" of "user32"
Classname as string
Windowname as string
result as integer
end declare
object myform as form
center
caption="myform"
end object
detect
myform.showmodal
sub detect
findwindow.classname="TForm1"
findwindow.windowname="myform"
findwindow.execute
if findwindow.result>0 then
showmessage "This window is already open"
end if
end sub
I use this code to check if an instance is already open but, everytime I click on the program I get a warning about the opened instance but every new instance doesn`t close and it remains opened.
How Can I do to close every new instance? :o
Many thanks!
`detects if a form is alread open, run it twice to see the effect
Declare findwindow as "FindWindowA" of "user32"
Classname as string
Windowname as string
result as integer
end declare
object myform as form
center
caption="myform"
end object
detect
myform.showmodal
sub detect
findwindow.classname="TForm1"
findwindow.windowname="myform"
findwindow.execute
if findwindow.result>0 then
showmessage "This window is already open"
end if
end sub