I am unable to get any information about a started program

Just starting out? Need help? Post your questions and find answers here.
artnat
User
User
Posts: 12
Joined: Sun Nov 10, 2024 3:34 pm

I am unable to get any information about a started program

Post by artnat »

I found myself unable to get information about a program started with RunProgram.
Too make things simple I wrote the following code lines:

Code: Select all

p.l = RunProgram("C:\Users\hd\Desktop\DesktopOK_x64.exe", "", "", #PB_Program_Open)
Debug p
If IsProgram(p)
  Debug "ok"
Else 
  Debug "not valid"
EndIf
The program desktopOK is started.

The debug output is:
-1311699904
not valid

Whatever of the functions

IsProgram(); ProgramID(); ProgramRunning(); WaitProgram(); KillProgram(); ProgramExitCode(); CloseProgram()

I try, I always get the error line: Not a valid program.

What am I doing wrong?
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: I am unable to get any information about a started program

Post by Bisonte »

and if you are using : p.i and not p.l as Return Value ?

You get a handle... so if you are on a 64Bit use for handles always Integer.... not long !
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
artnat
User
User
Posts: 12
Joined: Sun Nov 10, 2024 3:34 pm

Re: I am unable to get any information about a started program

Post by artnat »

Many t hanks to Bisonte: I didn't think of a 64 bit handle. Now it works.
Post Reply