|
Please search on msdn first .....
then search on google .....
followed by looking in the previous posts ......
If you still do not get answers, post a message here ...
Regards,
Bhupi Bhai.
|
|
|
|
|
I had posted this message only after searching in google and msdn..
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
-- modified at 5:19 Wednesday 3rd January, 2007
Thanks & Regards,
Venkat
|
|
|
|
|
What you are talking about is called Windows Shell programming -not context menu -. In CodeProject there is a very good section about Shell programming. i think you can find the anwer there. Click here[^].
Regards
|
|
|
|
|
I agree that this is windows shell programming. In that path is generated by args[0]. 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?
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(false);
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?
Thanks & Regards,
Venkat
|
|
|
|
|
Venkatesh.P wrote: How to assign that value to the textbox?
Simple. In your Main method
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1(args[0]));
}
and in Modify your form constructor to this
Form1(string thePath)
{
MyFileName = thePath;
}
PS.
The first argument would be the path to your exe file BTW, and the second argument is the "%1" command which is used to instruct the program to open the file -not print it for example-. The Thrid argument -i.e. args[2]- I bilieve is what you are looking for. Try to show them one by one in MessageBox s ro see the value of each before deciding which to pass to the Form's constructor.
Regards
|
|
|
|
|
Well, I've found several INI Readers here, which helped, but they didn't solve my real problem.
My INI file I have (which I cannot change, I only read from it), has stuff like this:
[Section]<br />
Key=Value<br />
Key=Value2<br />
Key=Value3<br />
Key=Value4<br />
Key=Value5
etc... Same key, but 5 different values. Every INI Reader I've seen so far, will only read the first one.
Does anyone have any solution?
Secondly, In my dialog I have this listview, which I want to fill from a self-made method. The listview is simply called "listView1", but whenever I try to use that name in my method (i.e. listView1.Items.Add("Test");) I get this error:
An object reference is required for the nonstatic field, method, or property 'WindowsApplication1.Form1.listView1'
What do I need to do to make it work :p
|
|
|
|
|
(1) You have done you own version of INI file, so you have to make a reader for that...
(2) I don't know (maybe posting the code will help).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
(1) No, I haven't. As I specific earlier, the INI file is made by an external program (a game, to be specific).
(2) What code? the INI Reader I found?
|
|
|
|
|
(1) OK, my hypothesys was wrong, you didn't write that. Anyway, IMHO, you have to write a reader for such non-compliant INI file.
(2) That was referring to the listview trouble you experienced.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
(1) Well, any tips? :p
(2) errr.. I deleted it because I couldn't get it, but I used something like this (well it had more, but this suffices to prodouce the same error):
public static void LoadFavorites()<br />
{<br />
listView1.Add.Items("test");<br />
}
|
|
|
|
|
2) In case the method is static you cannot access instance variables.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
(1) The Windows API GetPrivateProfileSection loads a buffer will all section content (keys are NULL separated). I don't know if it will be of any help to you.
(2) Ok, let's forget about it...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
A) The only built-in way I know of to read an INI file is with the Windows API and P/Invoke:
<br />
[System.Runtime.InteropServices.DllImport ( "kernel32" , SetLastError=true , EntryPoint="GetPrivateProfileString" )]<br />
private unsafe static extern uint<br />
API_GetPrivateProfileString<br />
(<br />
string lpAppName <br />
,<br />
string lpKeyName <br />
,<br />
string lpDefault <br />
,<br />
byte* lpReturnedString <br />
,<br />
int nSize <br />
,<br />
string lpFileName<br />
) ;<br />
<br />
public unsafe static int<br />
GetPrivateProfileString<br />
(<br />
string lpAppName <br />
,<br />
string lpKeyName <br />
,<br />
string lpDefault <br />
,<br />
out string lpReturnedString <br />
,<br />
int nSize <br />
,<br />
string lpFileName<br />
)<br />
{<br />
int result ;<br />
byte[] temp = new byte [ nSize ] ;<br />
<br />
fixed ( byte* ptemp = temp )<br />
{<br />
result = (int) API_GetPrivateProfileString<br />
(<br />
lpAppName <br />
,<br />
lpKeyName <br />
,<br />
lpDefault <br />
,<br />
ptemp <br />
,<br />
nSize <br />
,<br />
lpFileName<br />
) ;<br />
}<br />
<br />
lpReturnedString = PIEBALD.Lib.LibStr.FromByteArray ( temp , true ).Substring ( 0 , result ) ;<br />
<br />
return ( result ) ;<br />
}<br />
B) You need to provide a reference to an instance to listView1.Items.Add(), the literal "Test" won't work.
|
|
|
|
|
Yeah I managed to fix no 2.
As for the first one, that still doesn't help...
What I need is something that can read INI Files using:
FileName, Secion Name, Key Name, and N.
N being the Nth matching key...
Any ideas?
|
|
|
|
|
how to access my outlook express from my application,sending mail ,checking mail...
ravi
|
|
|
|
|
Up to my knowledge, Outlook Express does not support automation by itself.
Therefore, you might find this link[^] useful.
SkyWalker
|
|
|
|
|
here we have to pay to download it..???
any other solution do u have...??pls suggest to me..
ravi
|
|
|
|
|
Not everything in the world is taken for free
SkyWalker
|
|
|
|
|
As regards sending mail from your application....
If you make it a web application - you've got the HTML "Mailto" - option.
- Or had you already considered that ...
|
|
|
|
|
Hi All,
Anyone know of any code tidy-up tools?
I want to group all my member declarations, all my properties, all my methods together, rather than the higgledy-piggledy mess they're in now.
Is there anything out there to help?
|
|
|
|
|
Nope, I don't think so.
It's just us who can take care of this .... manually :->
Regards,
Bhupi Bhai.
|
|
|
|
|
If you don't have time to do it right, when will you have time to do it over?
Or consider putting each in its own file?
|
|
|
|
|
hello to all friends ;
i need to use ipx connection in my (C#) project , but there is a problem , if any can help me with a little project (describing the use of ipx ) i will be grateful.
-- modified at 6:36 Wednesday 3rd January, 2007
|
|
|
|
|
Using .net 2.0
Is it possible to have a stored procedure with several select statements so that a dataset can be populated with all of the select statements. So the dataset will end up with several tables (One table for one select statement).
At present I use the dataadapter to fill the dataset. I do this for each stored procedure which holds a select statement each.
But rather than repeating this method several times (One for each select), I would like to do all this in one stored procedure and populate a dataset with the results of these tables.
Is this to do with MultipleResultSet (MRS)?
Any suggestions please?
Thanks
|
|
|
|
|