Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 3rd, 2007, 07:42 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default Windows Explorer context menu path?

I have a windows based application in c#. On Windows explorer context menu i added one context menu item named "MyContext" . when the user right clicks on a file or folder, i have "MyContext" menu(This is the context menu item that i have added to the windows explorer context menu). When i click "MyContext" menu, i have to execute one application. In that application page load, i want to get the file or folder path that the user right clicked.

How to get that file path?? Please help


 
Old January 3rd, 2007, 08:10 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

%1 in the shell registry entry gives you the file path. Then in your app use the args[] parameter of the Main method. args[0] will contain the path.

--

Joe (Microsoft MVP - XML)
 
Old January 3rd, 2007, 10:06 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

Thank you. How to pass the args[0] to the textbox in the tab control?
Please Help

 
Old January 3rd, 2007, 10:10 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I've no idea, what textbox and what tab control?
Please try reading your question before you post and think if someone could answer it when not knowing anything about your system.

--

Joe (Microsoft MVP - XML)
 
Old January 3rd, 2007, 10:18 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

I am sorry. I have an application, which contains a tab control. inside the tabcontrol i am having a textbox. I am getting the string args[0] value from the program.cs file. I want to assign the string args[0] value to the textbox. How to assign that value to the textbox?
Sorry for the last post

 
Old January 3rd, 2007, 10:31 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In the Main method do something like:
Code:
txtMyTextBox.Text = args[0];
If you need more tell me the name of your textbox and show the Main method as it is now.

--

Joe (Microsoft MVP - XML)
 
Old January 4th, 2007, 02:57 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

This is the program.cs file

static class Program
    {
public static string pathkey;

        public static string path
        {
            get
            {
                return pathkey;
            }
            set
            {
                pathkey = value;
            }
        }
[STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(fals e);
            Application.Run(new Form1());
            Form1 objform = new Form1();
            try
            {
             Program.pathkey= args[0].ToString ();
            
            }
            catch (Exception ex)
            {
            }

Form1.cs
*********
In my form1 load, i am assigning the value to the textbox

txtLocation.Text = Program.pathkey.ToString();

But i am not able to get the value?

In registry i have the entry as C:\Documents and Settings\venkadeshp\My Documents\Visual Studio 2005\Projects\HCI_DMS ConsoleApplication\bin\Debug\HCI_DMS ConsoleApplication.exe %1 . But i couldnt find the file path in the string args[0] in the program.cs main function?

Please help
 
Old January 4th, 2007, 03:02 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you show the registry entry for the MyContext handler?
When you debug does args[0] contain anything at all?

--

Joe (Microsoft MVP - XML)
 
Old January 4th, 2007, 03:13 AM
Authorized User
 
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Hannibal
Default

In the Registry entry, i have the Data as MyContext, and in the command i have the Data as C:\Documents and Settings\venkadeshp\My Documents\Visual Studio 2005\Projects\HCI_DMS ConsoleApplication\bin\Debug\HCI_DMS ConsoleApplication.exe %1.
args[0] returns empty here..






Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 15 Context Menu - Element Menu Items Razzy The Pug BOOK: Ivor Horton's Beginning Visual C++ 2005 2 November 9th, 2008 03:53 PM
Need help in context menu Hannibal General .NET 0 January 3rd, 2007 12:24 AM
Context Menu ? zoltac007 BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 June 7th, 2006 05:44 PM
Manager/Admin context path problem Vegtabill BOOK: Professional Apache Tomcat 1 October 24th, 2005 11:44 PM
Context Menu JMorrell Beginning VB 6 2 February 18th, 2005 09:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.