PDA

Click to See Complete Forum and Search --> : using %1


mrz
Jan 24th, 2000, 12:31 AM
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 ?

MartinLiss
Jan 24th, 2000, 12:42 AM
Here is an example where the file is autoexec.bat
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?

VB-LEANER
Jan 24th, 2000, 12:42 AM
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

mrz
Jan 24th, 2000, 12:47 AM
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 ?

VB-LEANER
Jan 24th, 2000, 12:59 AM
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