Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 22nd January 2003, 03:45   #1
honold
Member
 
Join Date: Jun 2002
Posts: 56
OT: registering a shell extension

i would like to register an EXTENSION-SPECIFIC shell extension to a right-click menu; namely, when one right-clicks on a .iso image i would like a 'burn image' option which would execute the app i want (cdrecord).

i traced around misc existing ones in my registry, but they all seem to reference specifically-named 'keys' like {1111-0000-AAAA-FFFF-DDDD}, so i'm a bit lost. i've got the sample listed below, but i don't know how to generate a UNIQUE key for any system.

- edit:

i got even further now, found i can use uuidgen or guidgen (wonder what the difference is) from the ms platform sdk to make these. is this my only way? would i have to include this in my installer, pipe the output to a file, read in the file, etc?

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.zzz]
@ = "zzzfile"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\zzzfile]
@ = "a zzz file"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\zzzfile\shellex\
ContextMenuHandlers\{11111...}]
@ = ""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{11111...}]
@ = "a zzz file"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{11111...}\InProcServer32]
@ = "c:\\myshellextension.dll"
"ThreadingModel" = "Apartment"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
Shell Extensions\Approved]
"{11111...}" = "a zzz file handler"
honold is offline   Reply With Quote
Old 22nd January 2003, 10:02   #2
virtlink
Major Dude
 
virtlink's Avatar
 
Join Date: Sep 2002
Location: At [4C69:6E6B]
Posts: 561
To create a file association, do the following in NSIS:
PHP Code:
WriteRegStr HKCR ".xxx" "" "MyApp.Document"
WriteRegStr HKCR "MyApp.Document" "" "MyApp Document"
WriteRegStr HKCR "MyApp.Document\\shell\\open\\command" "" 'c:\\LongPathname\\Myapp.exe "%1"' 
Replace "MyApp.Document" by an identifier for the association, usually applicationname+".Document"
Replace ".xxx" with the extention (don't forget the '.' in front of it)
Replace "MyApp Document" by a title for the association.
Replace "c:\LongPathname\Myapp.exe %1" by your program path (don't forget the '%1' after it, else the filename will not be passed trough to the program).

To create an extra submenuitem, use this code:
PHP Code:
WriteRegStr HKCR "MyApp.Document\\shell\\menuitem name\\command" "" 'c:\\LongPathname\\2ndMyapp.exe "%1"' 
This line is basically the same as the last line of my other code, but i've replaced "open" in the keyname with "menuitem name". Tou can use any name for a menu, just replace "menuitem name" with it, for example: "Burn this CD".

"I'll quote you when you say something memorable."
- Claudia Pelsmaeker
virtlink is offline   Reply With Quote
Old 22nd January 2003, 13:30   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You can also replace the "open" in "MyApp.Document\shell\open\command" to add more commands such as burn for example. NSIS does this (compile nsi script) so you can find an example in makensis.nsi.

If you want to create a more serious shell extension look at:

http://www.codeproject.com/shell/shellextguideindex.asp

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd January 2003, 13:54   #4
virtlink
Major Dude
 
virtlink's Avatar
 
Join Date: Sep 2002
Location: At [4C69:6E6B]
Posts: 561
KiCHiK, you repeated me. The last two lines of my post said the same.

"I'll quote you when you say something memorable."
- Claudia Pelsmaeker
virtlink is offline   Reply With Quote
Old 22nd January 2003, 14:05   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Oops

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd January 2003, 17:02   #6
honold
Member
 
Join Date: Jun 2002
Posts: 56
wow awesome!

is there a way to pipe commands in this? like blah blah blah blah %1;pause, to add a pause after it?

i know i can use a batch file for that, but it seems a bit unclean
honold is offline   Reply With Quote
Old 22nd January 2003, 17:07   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
I don't think so. Windows does not support such a sophisticated command line parsing. You can write a little silent NSIS installer to do that. I wouldn't recommend on a batch file because it will open up a DOS window.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd January 2003, 19:15   #8
honold
Member
 
Join Date: Jun 2002
Posts: 56
ok what about the HKCR\*\shellex\ContextMenuHandlers? it looks like those require guids

this also makes me wonder how winamp2 has the right-click play/enqueue in winamp shell extensions without being present in this key
honold is offline   Reply With Quote
Old 22nd January 2003, 21:32   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
Those keys relate to more serious shell extension with sub menus, drag & drop suppport and more. The link I gave above is about those extensions.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump