Results 1 to 5 of 5

Thread: what is the code to launch a file?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    what is the code to launch a file?

    Hi guys, is it possible that when command1 is pressed, it opens the file c:\test.pdf

  2. #2
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: what is the code to launch a file?

    Code:
    Shell "Explorer " & """C:\test.pdf"""

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

    Re: what is the code to launch a file?

    Check out the "ShellExecute"-API
    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

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

    Re: what is the code to launch a file?

    There really hasn't been a need to resort to an API Declare for some time:
    Code:
        'Reference to Microsoft Shell Controls and Automation,
        'Shell version 5.0 or later (WinMe, Win2K, or later):
        With New Shell32.Shell
            .ShellExecute "C:\test.pdf" 'Additional optional arguments can be supplied.
        End With
    Shell.ShellExecute method

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

    Re: what is the code to launch a file?

    Quote Originally Posted by dilettante View Post
    There really hasn't been a need to resort to an API Declare for some time:
    Code:
        'Reference to Microsoft Shell Controls and Automation,
        'Shell version 5.0 or later (WinMe, Win2K, or later):
        With New Shell32.Shell
            .ShellExecute "C:\test.pdf" 'Additional optional arguments can be supplied.
        End With
    Shell.ShellExecute method
    Probably because i use a TypeLib for all API's, so i don't have to reference COM-Wrappers for those like Shell.
    The Win-API is kind of second nature for me (except the GDI-API's --> Grafix is just something i have two left hands )
    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

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