What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Visual Basic and Registry

Visual Basic and Registry
Author: Message:
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. Undecided  Visual Basic and Registry
How would I make my VB program handle out side commands? Such as, I would like to when I right click a file and click my program in the right click menu it will send a command to my program and my program will handle that file as coded in the program.

So far, I got my program to show in the right click menu by editing the registry. I have it now so it opens my program. But what I really want is when my program is click in the right click menu; I want that file that was right clicked to be moved to a different folder in the computer.

How could I set it up so my program will get the file name of the right clicked file and do the required commands coded in the program to handle that file?

I’m using Win XP.
[Image: top.gif]
12-13-2004 11:28 PM
Profile PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Visual Basic and Registry
I have never used the right-click menu, but I believe that thats how windows is doing it because there cant be any other way!
Anyway, I believe that windows passes as a parametr the full path & the filename of the file to your program.
So, put
code:
MsgBox Command$
in your Form_Load sub, and see what parametr is passed to your program.
By doing this, I guess that you will understand what you have to do ;)

Beware in quotin marks!
I think Windows put quoting marks at the beggining and the ending if the path or filename have spaces.
So be sure to handle the filename with and without quotes :)

many typos in the post :dodgy:
YouTube closed-captions ripper (also allows you to download videos!)
12-14-2004 05:54 AM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Visual Basic and Registry
also make sure your program can handle multiple files!... When using the right-click menu, Windows can paste more then 1 filename. Your program should be able to cope with that. Even if your program only needs 1 filename, it should be aware of this so you don't end up trying to move the file ""filename number 1.doc" "filename number 2.txt"" for example.

This post was edited on 12-14-2004 at 09:04 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-14-2004 09:04 AM
Profile PM Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: Visual Basic and Registry
Yea I have the Command$ coded in my program. What I want to know is how I tell my program the file path of the file that is right clicked and my program is clicked in the menu.

Here is what I got in the start up of my program:


code:
Sub Main()
Dim FSO, FS
If Command$ <> "" Then
Set FSO = CreateObject("Scripting.FileSystemObject")
FS = FSO.MoveFile(Replace(Command$, Chr(34), vbNullString), "c:\Destroyer Deleted Files\")
FS = FSO.MoveFolder(Replace(Command$, Chr(34), vbNullString), "c:\Destroyer Deleted Files\")
    Else
        Form1.Show
    End If
End Sub

That code there only moves the file if it is dragged overtop of my program. Not right clicked.

How could I change that to do both? Right click and drag overtop.
[Image: top.gif]
12-14-2004 10:15 PM
Profile PM Web Find Quote Report
Sk3tch
Veteran Member
*****

Avatar
We are Samurai, the keyboard cowboys

Posts: 1675
Reputation: 4
38 / Male / –
Joined: Jul 2003
RE: Visual Basic and Registry
Omg.. its been a while since i did stuff like this.. eehhmm..

the solution is not in your program, its in the Reg if im correct.

Whats your key, shell set as? Its should be something like this:
(Say its a text file)
HKEY_CLASSES_ROOT\txtfile\shell\"Open This.. " (Or whatever the key)

Then have the sub keys in "Open This.. " as:
command and ddeexec..  so you have those 2.

Make the Value in the "command" as the route to your program:

"C:\Documents and Settings\Sketch\Desktop\TEST.exe"
but then at the end add "%1" so you get:

"C:\Documents and Settings\Sketch\Desktop\TEST.exe""%1"

Make the ddeexec Value as:  Open("%1")

Now, in the key ddeexec add to more:  application and topic

In application give the app name (I think thats correct)
Then in topic put:  system


Now i haven't done this for ages so i could be wrong on some parts, but i think thats the basic jist of it. Try it out :-/
Sk3tch@Microsoft.com - Email
- 53 6B 33 74 63 68 34 64@hotmail.com - Messenger
12-15-2004 01:04 AM
Profile E-Mail PM Web Find Quote Report
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. RE: Visual Basic and Registry
you've lost me, sorry.

Is the ddeexec supost to be my program name? and could you explain a little more about the reg keys I need to enter and where the Open("%1") goes.



Oh and I want it to be in every file I right click on including folders not just txtfiles.



*Forget my last post ^^^ I figured it out. It worked. Thanks!


**Ok say now if I want an icon next to my program name in the right click menu how would I add one?

This post was edited on 12-15-2004 at 03:18 AM by DJeX.
[Image: top.gif]
12-15-2004 03:01 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On