Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
How to fetch the value on the click of Context Menu Item.
CE
9y
445
1
Reply
I have a created a custom context menu on right click of any file/folder - "Universal Send to" as part of main context menu in the registry using Microsoft.Win32 class in C#.
The sub menu items to this menu are the names of PC's in the network and I've coded such that they get added dynamically whenever a device is detected in the network.
I have added a property 'IP address' to its sub context menu item in the registry. I have a single executable (-FileTransfer.exe) for all the context items (like HomePC, OfficePC, etc..), that transfers the file/folder to the selected PC.
However, I am not able to make it work for dynamic Pc's as I am not able to fetch the IP address for the selected device and pass the same as a parameter to the executable.
Below are some snapshots of what I have made so far.
C# Code snippet: (Hardcoded HomePC in registry now for test purpose):
RegistryKey
key
;
key
=
Registry
.
ClassesRoot
.
CreateSubKey
(@
"*\shell\UniSendTo"
);
string
MUIVerb
=
"Universal Send To"
;
string
ExtendedSubCommandsKey
=
@
"*\shell\UniSendTo\MainMenu"
;
key
.
SetValue
(
"MUIVerb"
,
MUIVerb
);
key
.
SetValue
(
"ExtendedSubCommandsKey"
,
ExtendedSubCommandsKey
);
RegistryKey
key1
=
Registry
.
ClassesRoot
.
CreateSubKey
(@
"*\shell\UniSendTo\MainMenu"
);
key1
=
Registry
.
ClassesRoot
.
CreateSubKey
(@
"*\shell\UniSendTo\MainMenu\shell"
);
RegistryKey
key2
=
Registry
.
ClassesRoot
.
CreateSubKey
(@
"*\shell\UniSendTo\MainMenu\shell\HomePC"
);
string
MUIVerb1
=
"Home PC"
;
key2
.
SetValue
(
"MUIVerb"
,
MUIVerb1
);
string
ip
=
"192.168.1.22"
;
key2
.
SetValue
(
"IP"
,
ip
);
RegistryKey
key3
=
Registry
.
ClassesRoot
.
CreateSubKey
(@
"*\shell\UniSendTo\MainMenu\shell\HomePC\command"
);
key3
.
SetValue
(
""
,@
"H:\ERT\FileTransfer.exe"
);
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
banking system
Get only date in datetime string.