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
App Running ?
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- Enthusiast
- Posts: 115
- Joined: Wed Jun 02, 2004 10:17 pm
- Location: New Caledonia (South Pacific)
- Contact:
The zip pointed by the link seems to be incompleted (error while opening the file)
So, I find a shorter solution:
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)
....
....
Don't try - DO it !
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 ).
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 ).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
> 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).
> 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).
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.