Skip to main content
Email Password   helpLost your password?
Screenshot -

Introduction

I am currently working on an Advanced text editor, and I was looking for a way to implement the Window's shell context menu in my code. I came across Andreas Johansson's WebLog which provided me with the answer. He took some of the code that Steven Roebert created and placed it in one file for ease of use. His code had several errors that were easily corrected, and now I am posting the finished product.

Using the Code

The code is pretty straightforward to use:

  1. Add the ShellContextMenu.cs file to your project.
  2. Create a new instance of the ShellContextMenu class.
  3. Call the ShowContextMenu method with the proper arguments.
    1. FileInfo/DirectoryInfo Array - A list of files/directories that need the Context Menu
    2. Point - Point to Display Context Menu
    // Sample code

    ShellContextMenu ctxMnu = new ShellContextMenu();
    FileInfo[] arrFI = new FileInfo[1];
    arrFI[0] = new FileInfo(this.treeMain.SelectedNode.Tag.ToString());
    ctxMnu.ShowContextMenu(arrFI, this.PointToScreen(new Point(e.X, e.Y)));

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralGreat! Pin
Jose M. Menendez Poó
11:19 27 May '08  
GeneralGreat, but needs a bit tweaking Pin
ZeroXX
13:08 24 Mar '08  
QuestionRe: Great, but needs a bit tweaking Pin
seguso
8:48 20 Aug '09  
GeneralShort and Sweet Pin
The_Mega_ZZTer
17:39 10 Dec '07  


Last Updated 27 May 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009