call an executable that is installed from the microsoft store?
Hello, is it possible to call an executable that is installed from the microsoft store? For example WhatsApp.exe, I did not find any way to do it (at least without having to change some permission)
Re: call an executable that is installed from the microsoft store?
I haven't done it but I'd start trying by creating a shortcut to the app, and then look at the shortcut and put everything in it into a Shell command, surrounding the argument with quotes.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Re: call an executable that is installed from the microsoft store?
Originally Posted by dilettante
Where did people get the notion to say "call" when they mean "run" instead? Is this textspeak or an artifact of Google Translate?
Never mind, that since we're here in the VB6-section it pretty much has to be "run", since there are also 64-Bit-Apps in the Store, and you have to jump through a lot of hoops to "call" such from vb6
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Re: call an executable that is installed from the microsoft store?
Originally Posted by dilettante
Where did people get the notion to say "call" when they mean "run" instead? Is this textspeak or an artifact of Google Translate?
Personally, I think the best term would be "shell" or "shell to". I thought that "jump" might be an appropriate term since there's no "return", but our code keeps running as well, so maybe "spawn", as in spawn another thread or another process?
And, we must keep in mind that we're interacting with the OS because we're not going to someplace already in memory ... we're loading more code from disk, which is precisely what OSs were initially designed to do. DOS = disk operating system. Yeah, they've become complete GUIs in the decades since, but their core function is interaction between executing code and our disk system.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
the shortcut shows this location but, it seems not to be a traditional shortcut, I couldn't get what you see through code.
Code:
Private Sub Form_Load()
MsgBox GetLnkTarget("C:\Users\Leandro\OneDrive\Escritorio\WhatsApp - Acceso directo.lnk")
End Sub
Private Function GetLnkTarget(ByVal sPath As String) As String
Dim WSH As Object
Dim oShellLnk As Object
Set WSH = CreateObject("WScript.Shell")
Set oShellLnk = WSH.CreateShortcut(sPath)
GetLnkTarget = oShellLnk.TargetPath
Set WSH = Nothing
Set oShellLnk = Nothing
End Function
The only temporary solution is to run the shortcut with ShellExecute,but I already depend on creating the shortcut
Last edited by LeandroA; Jan 26th, 2023 at 06:53 AM.
Re: call an executable that is installed from the microsoft store?
Looks like this is the official way:
Code:
Private Declare Function CoAllowSetForegroundWindow Lib "ole32" (pUnk As Any, plvReserved As Any) As Long
Dim pAppActivator As New ApplicationActivationManager
Dim pUnk As oleexp.IUnknown
Dim pid As Long
Set pUnk = pAppActivator
CoAllowSetForegroundWindow pUnk, ByVal 0&
pAppActivator.ActivateApplication StrPtr("App User Model Id"), StrPtr("arguments"), AO_NONE, pid
The required interface/coclass isn't in the current public version of oleexp, I'm attaching a beta version of the next release containing it.
Looks like you can get the app user model id by appending the family name with ! and the name from AppxManifest.xml in it's folder.
Re: call an executable that is installed from the microsoft store?
Code:
Use explorer "netflix:\"
(this is the command for running netflix, from cmd.exe, from start (windows key + R)
You can use shell() (from vb6) but you have to check two times:
If Is64bit Then Wow64EnableWow64FsRedirection False
put the sell( ) here
If Is64bit Then Wow64EnableWow64FsRedirection True
Code:
Public Declare Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" (ByVal Enable As Boolean) As Boolean
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function IsWow64Process Lib "kernel32" (ByVal hProc As Long, bWow64Process As Boolean) As Long
Public Function Is64bit() As Boolean
Static m As Boolean, used As Boolean
If used Then
Else
If GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process") > 0 Then
IsWow64Process GetCurrentProcess(), m
used = True
End If
End If
Is64bit = m
End Function
Re: call an executable that is installed from the microsoft store?
Originally Posted by fafalone
Looks like this is the official way:
Code:
Private Declare Function CoAllowSetForegroundWindow Lib "ole32" (pUnk As Any, plvReserved As Any) As Long
Dim pAppActivator As New ApplicationActivationManager
Dim pUnk As oleexp.IUnknown
Dim pid As Long
Set pUnk = pAppActivator
CoAllowSetForegroundWindow pUnk, ByVal 0&
pAppActivator.ActivateApplication StrPtr("App User Model Id"), StrPtr("arguments"), AO_NONE, pid
The required interface/coclass isn't in the current public version of oleexp, I'm attaching a beta version of the next release containing it.
Looks like you can get the app user model id by appending the family name with ! and the name from AppxManifest.xml in it's folder.
Excellent, I was almost sure that the only way would be through oleexp, but I had no idea how.
I tell you using the CoAllowSetForegroundWindow vb6 api it crashes, and without calling that api it works fine.
I have a query for you, I should open a new thread but I think it will be a quick answer, I am currently making use of your work with SHDoDragDrop, what I do is automate DragDrop on web.whatsapp.com that is on a web browser (in my case chrome) this works fine both in the ide and compiled, now within WhatsAppDesktop it does not allow me to drop from the ide and this is because I have vb6.exe with administrator privileges, just to clear my doubt, it is possible that there may be some way that work between applications with different privileges?
Re: call an executable that is installed from the microsoft store?
Originally Posted by georgekar
Code:
Use explorer "netflix:\"
(this is the command for running netflix, from cmd.exe, from start (windows key + R)
You can use shell() (from vb6) but you have to check two times:
If Is64bit Then Wow64EnableWow64FsRedirection False
put the sell( ) here
If Is64bit Then Wow64EnableWow64FsRedirection True
Code:
Public Declare Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" (ByVal Enable As Boolean) As Boolean
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare Function IsWow64Process Lib "kernel32" (ByVal hProc As Long, bWow64Process As Boolean) As Long
Public Function Is64bit() As Boolean
Static m As Boolean, used As Boolean
If used Then
Else
If GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process") > 0 Then
IsWow64Process GetCurrentProcess(), m
used = True
End If
End If
Is64bit = m
End Function
thanks, interesting
For now I am going to choose ShellExecuteW since it is easier for me to use its api and be able to send unicode parameters
Re: call an executable that is installed from the microsoft store?
Originally Posted by LeandroA
Excellent, I was almost sure that the only way would be through oleexp, but I had no idea how.
I tell you using the CoAllowSetForegroundWindow vb6 api it crashes, and without calling that api it works fine.
I have a query for you, I should open a new thread but I think it will be a quick answer, I am currently making use of your work with SHDoDragDrop, what I do is automate DragDrop on web.whatsapp.com that is on a web browser (in my case chrome) this works fine both in the ide and compiled, now within WhatsAppDesktop it does not allow me to drop from the ide and this is because I have vb6.exe with administrator privileges, just to clear my doubt, it is possible that there may be some way that work between applications with different privileges?
Yes. You must install it to Program Files (x86) and have uiAccess=True in the manifest.
For that API, I refuse to let Windows Store on my computer so couldn't test the declare; try ByVal pUnk As Any or ByVal pUnk As oleexp.IUnknown.
Private Declare Function CoAllowSetForegroundWindow Lib "ole32" (ByVal pUnk As Any, ByVal plvReserved As Any) As Long
With ByVal It doesn't crash, but I'm not sure if it's doing its job since I don't notice a difference if I use it or not, it works fine with or without it, and it always opens as a Foreground Window
As for the manifest, I couldn't make it work, if I put uiAccess="true" when running the application it gives me "The server has returned a reference", I put the executable in C:\Program Files (x86) but it gives the same error .
Re: call an executable that is installed from the microsoft store?
Oops yeah sorry forgot that part. Absolutely ridiculous the hoops you have to go through for drag drop these days. I can understand not letting an admin app drop on an unprivileged app, but why shouldn't unprivileged apps be able to drop on admin apps?
Re: call an executable that is installed from the microsoft store?
Hello. The IDE runs fine without admin rights, it just need admin rights when needs to register a new component.
(I usually run the IDE as non-admin BTW).