[Done]ProgramID() is wrong for UWP apps

Found an issue in the documentation ? Please report it here !

Moderator: Documentation Editors

Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

[Done]ProgramID() is wrong for UWP apps

Post by Dude »

Just found out today that the ProgramID() returned for RunProgram() is not the correct process ID ("PID") for UWP apps, like the Win 10 Calculator. It works correctly for standard Win32 apps, though.

Code: Select all

run=RunProgram("calc.exe","","",#PB_Program_Open)
Debug ProgramID(run) ; Doesn't match PID from Task Manager.
I did some research and the reason for this is that UWP apps are launched by ApplicationFrameHost.exe (AFH), and that's the PID that ProgramID() is getting. I guess this is not technically wrong, but since Calculator's PID doesn't match Task Manager, then it's probably not the right result to return? Ideally, ProgramID() should match Task Manager, no matter whether the run program was UWP or Win32 type.
fryquez
Enthusiast
Enthusiast
Posts: 219
Joined: Mon Dec 21, 2015 8:12 pm

Re: ProgramID() is wrong for UWP apps

Post by fryquez »

No bug, ProgramID() returns the PID of the program that is started by RunProgram().

There are many cases where Windows does intercept a CreateProcess call and
there is no way for PureBasic to follow that chain.

But a remark in the help file should be added. + 1
Little John
Addict
Addict
Posts: 4021
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: ProgramID() is wrong for UWP apps

Post by Little John »

fryquez wrote:But a remark in the help file should be added.
I agree.
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: ProgramID() is wrong for UWP apps

Post by Dude »

I think the behavior of PureBasic should change, because this is an important issue for apps that interact with windows.

I'll let this screenshot of Task Manager and TaskList (DOS command) explain better: https://i.imgur.com/cdo0Dix.png :(
Fred
Administrator
Administrator
Posts: 14422
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: ProgramID() is wrong for UWP apps

Post by Fred »

I don't think it's PureBasic role to workaround apps launched by wrappers. A note could be put in the doc though
ebs
Enthusiast
Enthusiast
Posts: 482
Joined: Fri Apr 25, 2003 11:08 pm

Re: ProgramID() is wrong for UWP apps

Post by ebs »

Can anyone suggest a method to run another UWP app (Windows Camera) and be able to determine when it closes?
Post Reply