Announcement

Collapse
No announcement yet.

RUN and Start

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RUN and Start

    Rather than using the Start menu or pinning an icon to the TaskBar, I wanted to open the built-in Windows 10 camera app from within a PowerBASIC app. I ran across two approaches (see the image below).

    The command prompt approach is easy enough, but I'm not that familiar with "start" and I certainly do not remember seeing a command line with a ":" at the end.

    Code:
    iReturn& = Shell ("cmd /C start microsoft.windows.camera:", 0)

    I definitely don't know how to do the equivalent of "Run", again with the ":" at the end. Can I do that within PowerBASIC? I tried a couple of simple SHELL and they fail.

    Code:
    iReturn& = Shell ("run microsoft.windows.camera:", 1)
    iReturn& = Shell ("microsoft.windows.camera:", 1)


    Click image for larger version  Name:	pb_2231.jpg Views:	0 Size:	57.9 KB ID:	805667

  • #2
    Do they fail with an error or just fail as in do nothing that you can detect?
    Rod
    I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

    Comment


    • #3
      microsoft.windows.camera: (with a colon is a URI (Universal Resource Identifier) not an application name.

      It should be a "registered" URI on your computer.

      Camera is not an executable application, it's a windows "app" that in invoked through Launcher / Runtime Broker

      Comment


      • #4
        Start is an internal command in the CMD shell.

        PB's SHELL Function can use it with a URI as in..
        Code:
        #DIM All
        #COMPILE EXE
         
        FUNCTION PBMAIN()
         LOCAL UriCommand AS STRING, PID As Dword
         
          UriCommand = "microsoft.windows.camera:"  ' Uniform Resource Identifier (URI) command
         
          PID = Shell ("cmd" & " /C Start " & UriCommand, 0)
         
        END FUNCTION
        '------------------/PBMain
        More info on URIs here:

        https://www.tenforums.com/tutorials/...dows-10-a.html
        https://docs.microsoft.com/en-us/win...h-app-with-uri
        Rgds, Dave

        Comment


        • #5
          Originally posted by Dave Biggs View Post
          Thanks!
          That's a very useful link. I've just bookmarked it.

          Comment


          • #6
            Howdy, Dave!

            The example you provided looks like the one I had in the OP. Am I missing something you've added?

            And yes, thanks for the link.


            Howdy, Stuart!

            Camera is not an executable application, it's a windows "app" that in invoked through Launcher / Runtime Broker
            An app is not an application? Content here ... https://www.digitalcitizen.life/wind...m-application/

            I'm not sure that's quite accurate. It may not have the extension EXE, but it is definitely an executable application.

            From that link I gave it seems that Win10 puts constraints on what an app can do, permissions it can have and other limitations (both in design and at runtime). It's like a limited-capability-EXE that has to get approval from its parent (the RunTime Broker) to play on the playground.

            Comment


            • #7
              That raises the question ... can we write an "app" with PowerBASIC?

              And, why would we? The answer being to put an app on the MS Store and make $$ ?

              Comment


              • #8
                Looking around the site at the link Dave gave ...

                https://docs.microsoft.com/en-us/win...your-first-app

                It seems that "apps" are a .NET thing. No PowerBASIC allowed.

                Comment


                • #9
                  Hi Gary
                  C++ native code is allowed, I guess that by native it means not .NET
                  as the salmon fish is compelled to go back to it's birthplace to spawn, so comes a day when man is compelled to go back to it's source.. GOD

                  Comment


                  • #10
                    Microsoft announced MSIX several years ago and it looks like a way that any Win32 developer can publish their "apps" on the Windows Store.

                    I have no personal experience with MSIX -- just bringing to your attention.

                    https://docs.microsoft.com/en-us/win.../tool-overview
                    https://www.BcxBasicCoders.com
                    BCX BASIC to C/C++ for Windows

                    Comment


                    • #11
                      Originally posted by Gary Beene View Post
                      [B]H
                      An app is not an application? Content here ... https://www.digitalcitizen.life/wind...m-application/

                      I'm not sure that's quite accurate. It may not have the extension EXE, but it is definitely an executable application.
                      I didn't say an "an app is not an application"
                      Guess it depends on how you choose to interpret "Camera is not an executable application"

                      Open camera and look at task manager. You will see "Camera" does not have a PID, and that under it are two entries:"Camera" and "Runtime Broker".
                      Look at the properties of "Camera" - you will see that it is a "file folder" not an application.
                      Go to the target folder and you will find there is an executable named "WindowsCamera'. Not "microsoft.windows.camera:" or "camera.exe".
                      But - try running "WindowsCamera.exe" from the CLI.

                      As I said "it's a windows "app" that in invoked through Launcher / Runtime Broker"

                      As a matter of interest, ProcExp shows "Camera" running under SvcHost with a commandline of:
                      "C:\Program Files\WindowsApps\Microsoft.WindowsCamera_2020.504.60.0_x64__8wekyb3d8bbwe\WindowsCamera.exe" -ServerName:App.AppX3wjje43c7tprx3dar9vyjkqx3g35smht.mca

                      (You have to "Run As Administrator" to even see the "Camera" entry under SvcHost.)


                      Comment


                      • #12
                        Originally posted by Gary Beene View Post
                        Looking around the site at the link Dave gave ...

                        https://docs.microsoft.com/en-us/win...your-first-app

                        It seems that "apps" are a .NET thing. No PowerBASIC allowed.
                        They are a UWP/WInRT thing, not a .NET thing. https://docs.microsoft.com/en-us/win...platform-guide

                        Comment


                        • #13
                          Howdy, Stuart!

                          Yep, it's an interesting new topic. I'm not likely to pursue writing an app, but knowing a little about them is useful. I need to go through all of the links more carefully and digest the materials.

                          Thanks for your comments!

                          Comment

                          Working...
                          X