Results 1 to 19 of 19

Thread: call an executable that is installed from the microsoft store?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    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)
    leandroascierto.com Visual Basic 6 projects

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    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.

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: call an executable that is installed from the microsoft store?

    Where did people get the notion to say "call" when they mean "run" instead? Is this textspeak or an artifact of Google Translate?

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,269

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by dilettante View Post
    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

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by dilettante View Post
    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    Thanks for your answers, I give up, I did many tests and none were successful, for now I'm going to leave this aside, thanks for your time.
    leandroascierto.com Visual Basic 6 projects

  7. #7
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: call an executable that is installed from the microsoft store?

    ShellExecute "open" "ms-windows-store:PDP?PFN=" & PackageFamilyName

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by fafalone View Post
    ShellExecute "open" "ms-windows-store:PDP?PFN=" & PackageFamilyName
    Code:
    ShellExecute Me.hwnd, "open", "ms-windows-store:PDP?PFN=" & "5319275A.WhatsAppDesktop_cv1g1gvanyjgm", "", "", 0
    This opens the Microsoft store with said application but does not run the application
    Name:  store.jpg
Views: 512
Size:  30.6 KB

    I also tried something like this, but without success
    Code:
    ShellExecute Me.hwnd, "open", "5319275A.WhatsAppDesktop_cv1g1gvanyjgm!App", "", "", 0
    Name:  property.jpg
Views: 565
Size:  47.4 KB

    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.
    leandroascierto.com Visual Basic 6 projects

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    ooo solved with this, thanks

    Code:
    ShellExecute Me.hwnd, "Open", "whatsapp://", "", "", 0
    However, it's weird how this works, it's still a mystery how to run these kinds of applications.

    I see that it also works for spotify

    Code:
    ShellExecute Me.hwnd, "Open", "spotify://", "", "", 0
    leandroascierto.com Visual Basic 6 projects

  10. #10
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    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.

    For info on that and enumerating all the installed store apps, see this:
    https://stackoverflow.com/questions/...ndows-8-and-10
    Attached Files Attached Files
    Last edited by fafalone; Jan 26th, 2023 at 09:32 AM.

  11. #11
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,312

    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

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by fafalone View Post
    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.

    For info on that and enumerating all the installed store apps, see this:
    https://stackoverflow.com/questions/...ndows-8-and-10

    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?
    leandroascierto.com Visual Basic 6 projects

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by georgekar View Post
    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

    ShellExecute mHwnd, StrPtr("Open"), StrPtr("whatsapp://send?phone=" & PhoneNumber & "&text=" & Text), 0, 0, 1
    leandroascierto.com Visual Basic 6 projects

  14. #14
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by LeandroA View Post
    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.

    Code:
    	<asmv2:trustInfo>
    		<asmv2:security>
    			<asmv2:requestedPrivileges>
    				<asmv2:requestedExecutionLevel level="requireAdministrator" uiAccess="true"/>
    			</asmv2:requestedPrivileges>
    		</asmv2:security>
    	</asmv2:trustInfo>
    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.

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    441

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by fafalone View Post
    Yes. You must install it to Program Files (x86) and have uiAccess=True in the manifest.

    Code:
    	<asmv2:trustInfo>
    		<asmv2:security>
    			<asmv2:requestedPrivileges>
    				<asmv2:requestedExecutionLevel level="requireAdministrator" uiAccess="true"/>
    			</asmv2:requestedPrivileges>
    		</asmv2:security>
    	</asmv2:trustInfo>
    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 .
    leandroascierto.com Visual Basic 6 projects

  16. #16
    PowerPoster VanGoghGaming's Avatar
    Join Date
    Jan 2020
    Location
    Eve Online - Mining, Missions & Market Trading!
    Posts
    2,644

    Re: call an executable that is installed from the microsoft store?

    uiAccess="true" works only if your executable is signed with a certificate.

  17. #17
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    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?

  18. #18
    PowerPoster
    Join Date
    Feb 2017
    Posts
    5,700

    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).

  19. #19
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: call an executable that is installed from the microsoft store?

    Quote Originally Posted by fafalone View Post
    Absolutely ridiculous the hoops you have to go through for drag drop these days.
    Indeed - though from what I read in other developer-forums, there's salvation possible via:
    ChangeWindowMessageFilter ... https://learn.microsoft.com/en-us/wi...wmessagefilter

    Where one can specify the relevant messages (like WM_COPYDATA, WM_DROPFILES, WM_COPYGLOBALDATA)
    along with the MSGFLT_ADD flag.

    The currently recommended variant of this is the hWnd-specific one: ChangeWindowMessageFilterEx

    Olaf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width