Solved

Right Click Context - Passing Parameters

Posted on 1998-07-11
6
138 Views
Last Modified: 2011-09-20
hi all

I would like to know the exact steps in producing the following:

By right-clicking on a drive, .lnk, .exe, .dll or any other file or icon, the explorer popup menu shows me a menu selection called 'testing sxh'.

When 'testing sxh' is selected, the resultant selected object's parameters are passed to a program which displays a form showing the object name and it's path.

Also i would like to know the exact registry entries (shell, shellex etc) and any CLSID keys.

The receiving program must be a .exe and not a .dll

:edited text:
Must be Delphi 3 for win95/win98
:end edited text:

awaiting your comments

regards

sxh
0
Comment
Question by:sxh
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:sxh
ID: 1357723
Edited text of question
0
 
LVL 2

Expert Comment

by:freter
ID: 1357724
An example of how to create a shell context handler is shipped with Delphi 3. Just take a look at the samples. I think the project in question is located somewhere in the Shell Extensions subfolder.

Regards,
Freter
0
 
LVL 1

Author Comment

by:sxh
ID: 1357725
hi Freter

I looked at the samples available before posting this question and found that:

1. they are both .dll files with exported functions

2. the contmenu.dpr only compiles dpr files when selected, it  does not support selection of any type of object.

3. the copyhook.dpr just hooks into some standard file  processing features.

4. the projects have pre-made .reg files created which do not say why the keys included are being used and for what purpose, eg where would i place a key ContextMenuHandler for .lnk files.

What parameters would i need to specify in the shell\command value, I have seen some that say;
     
     myprog.exe /idlist, "%1", "%L".

what does the /idlist mean, is it something to do with enumeration of the IDLIST ?.

regards

sxh

 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
nova666 earned 500 total points
ID: 1357726
You must add some registry entries (.REG file syntax):

(HKCR = HKEY_CLASSES_ROOT)

[HKCR\*\shell\testing.shx]
@="Testing SHX"

[HKCR\*\shell\testing.shx\command]
@="c:\\shellext.exe \"%1\""

Same like '*' for 'Drive', 'Directory' and 'InternetShortcut'.
(These items don't display the extension when it is only registered for '*', and maybe some others also don't do.)

Then you need to write the program. It puts the ParamStr(1) into a TLabel's Caption or a TEdit's Text property, which is on a form.

That's it!

Example at http://www.geocities.com/~jmehnle/shellext.zip
(The example automatically registers the shell extension, read the README.TXT and view the source!)

0
 
LVL 1

Author Comment

by:sxh
ID: 1357727
Thanks nova666

That answered my question and I award you the points.

There is one question though, when a .lnk file is selected, it shows the name of the penultimate file and not the .lnk file name and path. eg .lnk = myprog.lnk -> myprog.exe, the program shows myprog.exe not myprog.lnk.

regards

sxh
0
 
LVL 1

Expert Comment

by:nova666
ID: 1357728
You can of course add the registry settings for 'lnkfile', too:

[HKCR\lnkfile\shell\testing.shx]
@="Testing SHX"

[HKCR\lnkfile\shell\testing.shx\command]
@="c:\\shellext.exe \"%1\""

If you do so, the option "Testing SHX" appears twice in the context menu, one time for the .LNK file itself, and another time for the file the shortcut points to. I don't know how to turn this off..... sorry!

nova666

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to draw animated progressbar in Tvirtualstringtree 5 116
Mydac connection data base issue 3 139
When i run adoquery my application freezes 26 150
Base1 Encode/Decode 3 67
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now