One copy of the program?
Re: One copy of the program?
Which is fine for Windows, but not Linux.
Re: One copy of the program?
Check proccess list to find running copy
run ps -aux (linux/macosx) or tasklist (windows, may be blocked by admin or viruses) in hte hidden console and try to find unique application name in console output
run ps -aux (linux/macosx) or tasklist (windows, may be blocked by admin or viruses) in hte hidden console and try to find unique application name in console output
Re: One copy of the program?
Compile and try to run twice.
ps -aux Works on the same principle 
Code: Select all
Procedure GetRunningProgramm(prog.s)
Protected RegEx.i = CreateRegularExpression(#PB_Any, "[0-9]+")
Protected Directory.s = "/proc"
Protected ExamDir.i = ExamineDirectory(#PB_Any, Directory, "*.*")
Protected OutFile.i
Protected Sum.i=0
If RegEx And ExamDir
While NextDirectoryEntry(ExamDir)
If MatchRegularExpression(RegEx, DirectoryEntryName(ExamDir))
OutFile = ReadFile(#PB_Any,Directory+"/"+DirectoryEntryName(ExamDir)+"/cmdline")
If OutFile
If FindString(ReadString(OutFile), prog, 1)
Sum + 1
EndIf
CloseFile(OutFile)
EndIf
EndIf
Wend
FinishDirectory(ExamDir)
EndIf
ProcedureReturn Sum
EndProcedure
If GetRunningProgramm(ProgramFilename())>1
MessageRequester("","yes working")
Else
MessageRequester("","no working")
EndIfLinux Mint Maya(Mate), x86, PureBasic 5.00(5.10b1)

