Announcement

Collapse
No announcement yet.

SHELL (more likely Start > Run...)

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

  • SHELL (more likely Start > Run...)

    Hi guys!

    I have a question for you.
    I have a little application with a textbox on it... I type "commands" in the textbox and when I press RETURN they get executed.

    I'm using the SHELL() function, I know it is async but thats what I need.
    I know that by using SHELL() I'm limited to ENVIRON$(PATH) or else I have to type the full command line of the application, no problem with this too!!

    The only problem I have is that it won't work with URLs or email addresses.
    I wanted it to work like the Windows shell utility that stays in the Start Menu > Run...

    In the windows utility I can type "www.powerbasic.com" and it opens my browser and loads PB homepage.
    Or I type "mailto:[email protected]" and it opens outlook.

    Any clues on how I can make my textbox behave like this?

    Thanks!!

    ------------------

  • #2
    SHELL "start http://www.powerbasic.com/"

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      Code:
      '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      '  ShellDocument
      '  opens a document with a registered extension
      '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      sub ShellDocument alias "ShellDocument" (ByVal sFile as String) export
      
        ShellExecute 0, ByVal %null, sFile + $nul, ByVal %null, ByVal %null, _
            %SW_NORMAL
      
      end sub
      best regards,
      don

      ------------------
      Don Dickinson
      Author of ddoc Print and Preview A dll-based print-preview engine for windows
      www.greatwebdivide.com
      Author of Tsunami Tcp Data Server
      http://ttds.greatwebdivide.com
      Don Dickinson
      www.greatwebdivide.com

      Comment


      • #4
        and if you want, you can even wait for the command to complete..

        win 32: monitor process with shellexecuteex june 22, 2001

        mcm

        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Thank you very much for your help guys!!
          Tom's code didn't work but Don's is just great!

          ------------------

          Comment


          • #6
            Works under Windows 2000. What OS are you using?

            ------------------
            Tom Hanlin
            PowerBASIC Staff

            Comment


            • #7
              tom, i ran across that myself .. an o/s without start.exe
              unfortunately i can't remember what the o/s was
              --don

              ------------------
              Don Dickinson
              Author of ddoc Print and Preview A dll-based print-preview engine for windows
              www.greatwebdivide.com
              Author of Tsunami Tcp Data Server
              http://ttds.greatwebdivide.com
              Don Dickinson
              www.greatwebdivide.com

              Comment


              • #8
                >an o/s without start.exe

                Wouldn't a start.exe be pretty close to ..

                Code:
                FUNCTION PbMain() AS LONG
                
                  ShellExecute "open" ... COMMAND$....
                
                END FUNCTION
                ???

                MCM
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment

                Working...
                X