Results 1 to 5 of 5

Thread: using %1

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Israel
    Posts
    79

    Post

    when i right click a file and then open it then the command that windows gets is something like: notepad.exe %1, in which the %1 is the file that i clicked.

    question, how can i use the %1 file in my visual basic program ?

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Here is an example where the file is autoexec.bat
    Code:
    Dim RetVal As Integer
    RetVal = Shell("C:\WINDOWS\NOTEPAD.EXE C:\AUTOEXEC.BAT", 1)
    ------------------
    Marty
    Why is it called lipstick if you can still move your lips?

  3. #3
    Junior Member
    Join Date
    Jun 1999
    Location
    Victoria, Australia
    Posts
    23

    Post

    put this code in the load form of ur vb app.

    code:
    if command$ <> "" then msgbox command$


    'then when u got ur program, edit the reg
    ' eg. C:\myapp.exe %1

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 1999
    Location
    Israel
    Posts
    79

    Post

    i surely did not ask the right questiuon...

    i right click a file(any file)

    and choose - something, (i can put my program to run from the right click menu)

    i want that my program will run and inside, use the file that i clicked . . . how do i do that ?

  5. #5
    Junior Member
    Join Date
    Jun 1999
    Location
    Victoria, Australia
    Posts
    23

    Post

    say u want to make ur own text editor??
    use the above code to get the file when it is right clicked on. Once u have the file, do what ever u want to do wif it - then edit the reg
    HKEY_CLASSES_ROOT\txtfile\shell\open\command

    and put the name of ur app followed by the %1
    eg. C:\myapp.exe %1

    contact me for any further queries
    ICQ: 29792493

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