Library tutorials & articles

File Assocation

Command Line Parameters

You will have noticed that so far your program does not open the file. Explorer passes the file path to your program when it starts, and you can access this through the Command$ function.

Private Sub Form_Load()
    '// check command line argument:
    If Command$ <> Empty Then
        '// we have a file to open
        OpenFile Command$ '// call your openfile procedure
    End If
End Su
b

Comments

  1. 19 Sep 2006 at 22:17

    Hi Can you please also tell how to do it in .Net using VB.Net or C# ...

  2. 16 Aug 2005 at 23:14

    This looks like it could be the answer to my problem, but in case i stuff it up somehow could you tell me how to reverse the changes that are made to the registry by this code please?
    Thanks

  3. 09 Aug 2005 at 08:36

    please help me..,
    i have problem, i can't load file word (*.doc) from vb, can u tell me how to do it??
    thx b4.
    please send ur coding to niel_onggan@yahoo.com

  4. 29 Apr 2003 at 15:21

    That's your procedure that does whatever when its been given a filename (ie loading the file into a textbox or something)

  5. 24 Apr 2003 at 19:32

    The code is working fine, except for the OpenFile bit.
    The comment says to call your openfile procedure.
    What is the OpenFile command?

  6. 20 Apr 2003 at 13:03

    In using implimens this process into an application, I noticed the following line:


    ret = RegSetValue&(lphKey, "shellopencommand", REGSZ, sKeyValue, MAXPATH)


    did not properly register the association. I am using Windows 98 and had to change the above line to:


    ret = RegSetValue&(lphKey, "shell\open\command", REGSZ, sKeyValue, MAXPATH)


    to get it to work properly.

  7. 01 Jan 1999 at 00:00

    This thread is for discussions of File Assocation.

Leave a comment

Sign in or Join us (it's free).