I'm trying to add a Windows Shell shortcut (right click context menu item) so anywhere in Windows, when I have text selected this item will appear. I cannot find the Registry item to alter/add or what to put there to get this to occur.
The selected text needs to also be passed to my application as an argument some how. I will be selecting some ID numbers, then manipulating those in the project.
Any assistance is greatly appreciated.
As far as I know, there is no way to create the shell extension which will allow you to inject into the any textbox's context menu.
The most you can do is to hook up the window creating API, filter out everything except context menu creation (WPF windows go down) and then do whatever you want to.
Related
I am making an advanced clipboard program, and I managed to do the part where it remembers a list of copied items, but I need to manage that content being pasted in as well.
I tried and failed to find a way to detect a paste from the clipboard, so now I'm trying to add the copied out items to a context menu dropdown item in the Windows context menu.
So far however I only managed to find a way to add items to the Folder key in regedit, which doesn't help when I need to paste in text into a textbox, or notepad.
Is there a way to do that?
I'm working in C# in .NET 4.0 on a Win 8.1 x64 PC
EDIT:
My point is to gather everything that is being copied/cut to the clipboard, and then to be able to paste specific lines from that list into an editable text container.
Either in automatically in the same/reverse order of them being copied or manually via a dropdown menu in the windows context menu, containing each line on my list.
I have a desktop app which after taking input from the user displays a list of files and folder(using a ListBox).
I want that when the user right clicks on any item in the ListBox, the right click menu of windows explorer should display.
I know I will have to use P/Invoke for this, but I am unable to find any relevant information such as which dll I have to use or which function I have to call.
Can anybody help me with that?
So this question is very old but has no accepted answer. I dont think Visionstar understood the issue OP is having.
My understanding is that you have an application running, and you would like to add an option in the WINDOWS EXPLORER's right-click menu. Not in your own application's context menu.
I do not think you can achieve this within your own application, however, what you can do is add an item in the Windows explorer's context menu (nothing to do with your application, you can just do that in windows; see link below) that you can setup to call a little script you would make (literally a little batch file... but could be a .net app too). That little script can take care of warning you main application. By creating a text file, or json file in a hot folder, or some other mechanism you would have to come up with.
Adding an item in the windows' contextual menu:
How add context menu item to Windows Explorer for folders
If you need to deploy this to other PCs, you can make a add_menu.reg file to make it simpler. I'll let you Google that one, but I think it's as simpe as a right-click -> export key in your regedit.
You will need to code it yourself, there is no embedded way simply add a OS-Contextmenu to it,because you have programmed the listbox, so you have to append some contextmenu to the listitem-rightclicks
Here are examples/guidance for adding a context menu:
http://msdn.microsoft.com/en-us/library/aa984254%28v=vs.71%29.aspx
http://social.msdn.microsoft.com/Forums/windows/en-US/790cd8be-0ba8-4f10-95a8-c88f1023d6e7/how-can-i-create-a-rightclick-menu-i-c?forum=winforms
Displaying the default right-click context menu is pretty straightforward and fairly well documented here and elsewhere on the web.
I based one largely off of Andreas Johansson's framework
How to show system menu of a file in C#
http://windows-tech.info/19/e5ad8751fc63816b.php).
My app provides a simple explorer-like view to display some custom attributes (thanks Windows for getting rid of IColumn). The right click context menu works great.
However, I'm now finding myself really wanting the right-drag context menu (Copy here, Move here, Create shortcuts here, cancel, plus any additional add on handlers like TSVN).
I assumed that there would be an additional flag I could add to QueryContextMenu uFlags, but alas I don't see one. Is there an alternative to QueryContextMenu to extract the menu items that are relevant to the right-drag menus?
I have just started coding in C#, and have been attempting to make a GUI application. I made a menu strip and wrote some code for one of the menu items. The method for clicking that menu item was automatically named "openToolStripMenuItem_Click".
In the properties I decided to change the name of the menu item from "open" to "save", but the method name remains the same, which is quite irritating. How do I get it to automatically adjust the method names when I rename a control?
This is not done automatically. A good way is to right-click the method name and use refactor + rename.
I want to add a custom menu item to the menu that appears when a user selects some text and right clicks. I searched a lot but did not get any answer. Maybe I did not put in the right keyword.
Is it possible to do this?
If this is possible, I want to do this for all applications in windows whenever the user selects text. Is there a universal way to do it or will have to write code specific to the application?
I am using C#.
I don't think you can do that universally in all windows apps. But it is certainly possible to do in your own app using a popup menu.
I've also tried a way to add an item to the standard ContextMenu and failed. From my point of view, the only solution is to set the TextBox's ContextMenuStrip property to an instance of the ContextMenuStrip class and implement both standard and your custom menu items. It is easy to mimic standard operation, since the TextBox class provides all required methods: Cut, Copy, Paste, SelectAll.
The universal way is basically writing a "custom shell extension".
There is an article on CodeProject about how to do this.
http://www.codeproject.com/Articles/174369/How-to-Write-Windows-Shell-Extension-with-NET-Lang
The other way to do this is to build this into your application. For example you might have a text editor and you'll want to highlight a word and get a definition for that word. To do this you'll need to implement a context menu.
The VERY BASIC concept is detailed over on CodeReview.StackExchange.
https://codereview.stackexchange.com/questions/3983/c-programatically-creating-context-menu