 |
| 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
|
|
|
|

January 3rd, 2007, 07:42 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 3rd, 2007, 08:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
%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)
|
|

January 3rd, 2007, 10:06 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Thank you. How to pass the args[0] to the textbox in the tab control?
Please Help
|
|

January 3rd, 2007, 10:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|
|

January 3rd, 2007, 10:18 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 3rd, 2007, 10:31 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|
|

January 4th, 2007, 02:57 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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
|
|

January 4th, 2007, 03:02 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
Can you show the registry entry for the MyContext handler?
When you debug does args[0] contain anything at all?
--
Joe ( Microsoft MVP - XML)
|
|

January 4th, 2007, 03:13 AM
|
|
Authorized User
|
|
Join Date: Feb 2006
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
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..
|
|
 |