It is currently Sat Dec 07, 2019 8:25 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: ProgramID() is wrong for UWP apps
PostPosted: Mon Dec 02, 2019 1:38 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1904
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:
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: ProgramID() is wrong for UWP apps
PostPosted: Mon Dec 02, 2019 4:52 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Dec 21, 2015 8:12 pm
Posts: 146
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


Top
 Profile  
Reply with quote  
 Post subject: Re: ProgramID() is wrong for UWP apps
PostPosted: Mon Dec 02, 2019 8:07 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3715
Location: Berlin, Germany
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


Top
 Profile  
Reply with quote  
 Post subject: Re: ProgramID() is wrong for UWP apps
PostPosted: Wed Dec 04, 2019 9:00 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1904
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 :(


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye