Ich bin ein großer PB Fan....
Ich habe folgendes Problem. Ich benutze RunProgram_ um die Programm ID zurück zu bekommen wenn ich einen
MSaccess MDB über Purebasic starte. Das funktioniert auch.
Aber wenn ich nun eine zweite Access MDB starte dann bekomme ich 0 zurück was definitiv falsch ist.
Kann mir jemand einen Tipp geben?
Danke
Marc
Zur info so Schaut der code aus den ich dazu verwende (nicht von mir entwickelt)
Code: Alles auswählen
EnableExplicit
Define ProcessID
#kExit_Code_Error=1
#kExit_Code_Success=0
Procedure SetPriority(ProgramID.l, PriorityLevel.l)
Protected ProcessHandle.l
ProcessHandle = OpenProcess_(#PROCESS_DUP_HANDLE | #PROCESS_SET_INFORMATION, #True, ProgramID)
If ProcessHandle
SetPriorityClass_(ProcessHandle, PriorityLevel)
CloseHandle_(ProcessHandle)
EndIf
EndProcedure
Procedure GetProcessId_(hProcess)
Static *pGetProcessId
Protected *func = AllocateMemory(13)
PokeS(*func, "GetProcessId", -1, #PB_Ascii)
If Not *pGetProcessId
*pGetProcessId=GetProcAddress_(GetModuleHandle_("kernel32.dll"),*func)
EndIf
If Not *pGetProcessId
ProcedureReturn 0
EndIf
FreeMemory(*func)
ProcedureReturn CallFunctionFast(*pGetProcessId,hProcess)
EndProcedure
Procedure RunProgram_(ProgramName.s, Parameter.s="", WorkingDirectory.s="", Visible=#SW_SHOW)
Protected ShellExInfo.SHELLEXECUTEINFO
ShellExInfo\cbSize=SizeOf(ShellExInfo)
ShellExInfo\fMask=#SEE_MASK_NOCLOSEPROCESS
ShellExInfo\lpVerb=@"Open"
ShellExInfo\lpFile=@ProgramName.s
ShellExInfo\lpParameters=@Parameter.s
ShellExInfo\lpDirectory=@WorkingDirectory.s
ShellExInfo\nShow=Visible
ShellExecuteEx_(@ShellExInfo)
ProcedureReturn GetProcessId_(ShellExInfo\hProcess)
EndProcedureCode-Tags hinzugefügt
16.03.2015
RSBasic