Page 1 of 1
Posted: Sun Nov 17, 2002 7:30 pm
by BackupUser
Restored from previous forum. Originally posted by Rings.
I released a new LIBRARY with only one new Function for Purebasic-Windows-Version.
Its Called AppRunning(Appname.s) and its tells you if one or more instances of your exe are already running.It depends not on Windows, so you can use it also with Console-appz and different EXE also .
The Complete LIB/Function comes with Purebasic.example,readymade EXE and a full documented Sourcecode (only 60 lines) in NASM-Assembler-Syntax.
download on the resourcesite in the asm-lib sections or directly
under
http://www.reelmediaproductions.com/pb/ ... unning.zip
Its a long way to the top if you wanna .....CodeGuru
Posted: Sun Nov 17, 2002 7:38 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.
Very nice example to learn writing a library, thx for sharing Rings.
And a cool new function also
Regards,
Berikco
http://www.benny.zeb.be
Posted: Mon Nov 18, 2002 11:03 am
by BackupUser
Restored from previous forum. Originally posted by Rings.
I did a update,hope that is soon available on the resourcesite
(if paul beats the Dragon

)
I have done a bugfixing and a bit renaming (thx Danilo for you Hints!)
so if you update , delete the older 'app' library in Purebasic-Userlibraries directory first!
Its a long way to the top if you wanna .....CodeGuru
Posted: Wed Jun 22, 2005 10:54 pm
by zapman*
The zip pointed by the link seems to be incompleted (error while opening the file)
So, I find a shorter solution:
Code: Select all
#ProgName = "MyProgram"
;
Procedure IsLaunched (Name$)
Handle=0
Hwnd = FindWindow_( 0, 0 )
While Hwnd <> 0
Txt.s = Space(256)
GetWindowText_(Hwnd, Txt, 256)
Hwnd = GetWindow_(Hwnd, #GW_HWNDNEXT)
If Left(Txt,Len(nom$)) = Name$
Handle=Hwnd
Hwnd=0
EndIf
Wend
ProcedureReturn (Handle)
EndProcedure
;
If IsLaunched (#ProgName)
End
EndIf
OpenWindow(0,PosX,PosY,420,280,#PB_Window_ScreenCentered,#ProgName)
....
....
Posted: Thu Jun 23, 2005 12:24 am
by PB
Checking by the window name is not 100% foolproof. Some people use
apps which change the window title (such as adding date/time) and thus
two or more instances of your app will be able to be run if you check by
name alone. For 100% accuracy, you need to use a mutex, which is in
the FAQ (
viewtopic.php?t=4876 ).
Posted: Thu Jun 23, 2005 12:41 am
by Dare2
Hi PB,
OT, but the request is not important enough to create a wishlist thread.
Can you use your mod powers to make all the Questions in the FAQ bold, so they stand out? Just a little nicety.
Thanks!
Posted: Thu Jun 23, 2005 4:42 am
by PB
> Can you use your mod powers to make all the Questions in the FAQ
> bold, so they stand out? Just a little nicety.
Okay, on the weekend I'll see how I can improve the FAQ (probably with
some more questions/answers too).
Posted: Thu Jun 23, 2005 2:35 pm
by Dare2
PB wrote:Okay, on the weekend I'll see how I can improve the FAQ (probably with some more questions/answers too).
Champion! Thanks.
