|
Hi,
I want my application to process multiple files, which it shall receive via the Windows-Explorer context menu entry "Open with...". I checked the command-line arguments, but the string[] has always just a length of 1 and string[0] only contains the first of all selected filenames.
How can I get all filenames which were selected when "Open with..." was clicked?
Thanks in advance,
Alex
|
|
|
|
|
To go more into detail: Am I right that I have to look for the selected filenames in the command line parameters?
Hasn´t anybody an idea? I don´t think that I am the only one who wants to receive multiple files using command line parameters...
|
|
|
|
|
Hi,
FYI: I have an "Open with myprog" added to the Explorer's context menu
(installed by adding some registry entries).
When I select two files in Explorer and apply "Open with myprog", Explorer
calls my program twice, once for each file (rather than once with a list of files).
|
|
|
|
|
Hm, thanks for this info, I already assumed that. I blocked opening multiple instances of my program the following way:
public static void Main(string[] args)
{
Process[] processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
if (processes.GetLength(0) > 1)
{
IntPtr hwnd;
if (processes[0].MainWindowHandle == Process.GetCurrentProcess().MainWindowHandle)
hwnd = processes[1].MainWindowHandle;
else
hwnd = processes[0].MainWindowHandle;
if (IsIconic(hwnd) == true)
ShowWindow(hwnd, 9);
else
SetForegroundWindow(hwnd);
}
else
{
Application.Run(new myApp(args));
}
}
Do you know a way to send the new args to the previous instance from which I have the handle? Or is there another common method to solve this problem?
|
|
|
|
|
Hi,
my app is singleton too. It is based on a mutex, not process names.
a second (third) instance sends its command line to the original instance,
using named pipes (and several P/Invoke calls).
(actually I believe the singleton behavior could now be based on the result of
CreateNamedPipe rather than a separate mutex).
BTW an earlier version used sockets to send the cmd line, but that kept
triggering my FireWall (McAfee).
|
|
|
|
|
In my project I have been working on a class that will extract files from a zip, then import all data in those files using SQLBulkCopy into the database. While importing the data I need to know the Information about that particular file(Name, Count\Index). So to do this I need to use events. I have been working at this, got my properties, delegate and event written. All seems to be good, then I try to use the event and I ran into some snags. It turns out that I don't have anything assigned to handle OnImportFile. Below is my delegate and event in my class.
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);
public event GNISImportFileEventHandler OnImportFile;
So to assign something on handle OnImportFile I have this:
OnImportFile += new GNISImportFileEventHandler(OnImportFile);
From the articles I have been reading this is the correct way to set something to handle my event, but I get the exception "Delegate to an instance method cannot have null 'this'." Any suggestions or an article that covers this issue would be greatly appreciated. Cheers
|
|
|
|
|
I think any msdn article on event handlers should help you out. But from the code it looks like you are trying to assign the event itself as the handler. Normally you would write a method which has the same signture as your delegate. That method will be your event handler. Something like
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);<br />
public event GNISImportFileEventHandler OnImportFile;<br />
<br />
public void myGNISImportFileEventHandler(object sender, ImportFileEventArgs e)<br />
{<br />
}
And you would add the handler like:
myObj.OnImportFile += new GNISImportFileEventHandler(myGNISImportFileEventHandler);
modified: added "myObj." Assuming myObj is the object of your ImportFile class. It could be this. if you are adding it to the same object (which is really not needed since you can just call the method directly..
|
|
|
|
|
Thank you very much for your reply I can now use my event, I understand where I went wrong - I can't use the event as the handler. Thank you very much. One more question for you, How would I use this on a form outside of the class(in a different project) but in the same solution.
|
|
|
|
|
Just add a reference to this project from the other project. (right click on project- add reference..)
|
|
|
|
|
Hi,
I am using TreeView control in C# form application.
This contains no. of nodes and their child node. I want to traverse entire tree view and edit some properties dynamically.
What is the method in C# to traverse TreeView?
Thanks.
Gajesh
|
|
|
|
|
You will have to write a recursive function to traverse all the nodes in a tree view.
|
|
|
|
|
Hi all
i got an html table in an aspx page and i need to parse data from each td and save to database. Any ideas!!!!
|
|
|
|
|
Repost
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
If you are asking how to get the text out of the TD, then use the innertext property of the TD. Make the TD "runat=server" and give it an ID.
|
|
|
|
|
There are many data access layer tools , so I do not know where to start . I just want to get out of repetitive boiler plate coding . But I have a few requirments:-
1) Works with MsSQL . ( Virtually all should)
2) Produce C# code (Again - all should)
3) Must produce a data object that maps onto a row of a table .( This has been the stumbling block)
4) The data object must have no references to any DB/connection . I.e pure data . Maybe a few Ctors , ideally a struct , but if a class must support ICloneable .
5) Icing on the cake is if the data object overrides = in order to make a value comparison ( I know MS advise against it but its useful).
6) Collections of the data objects would be nice
Why the 1:1 row to object ? Well I found over the years that if I put all my effort into a normalised DB then the code almost falls into place if I produce a 1:1 row - > object . Then I use an object that maps to a table or stored procs in order to communicate with the underlying tables . Not haveing any reference to the DB in the data object means it is as light as possible in the GUI
|
|
|
|
|
|
Guten Tag,
If I have an excel Worksheet instance say sheet1 and a DataTable instance dt1, how do I add a row to the sheet1 row by row instead
of iterating to each row and iterating to each cell within that row in the dt1? I want to be able to do this because it seems it would be faster as such. 5K rows of 20 columns each takes about 12 minutes saving to an excel file in my machine using the latter method.
Thanks for any guidance.
-- modified at 9:37 Wednesday 9th May, 2007
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
i have a problem to record the desktop as Avi or Mpeg file How can i record the desktop
any Idea or source ?
With thanks
MHF
|
|
|
|
|
|
I think you should use some screen recorder, which can help you capture whatever streaming video and audio files on your screen, and it can help you record full screen. If you want to get the video to standard video format, it also can help you capture video to avi, so that you can export it to your portable device or upload to some video sharing website.
|
|
|
|
|
HI!
i am generating a license key for my software. i am using System.Security.Cryptography.TrippleDES encryption technique.
i am generating a 25-digit random number and a 25-bit string which represents the features of application.
First i am interlacing both strings and then encrypting them using TrippleDES algo. But the encrypted string which is returned by the function Encrypt(), i.e. also my license key is more than 150 characters long, which is ofcourse too long for a license key.
Can any one give me idea how can i generate a shorter license key, about 25-30 characters long...should i change the encryption algo or do something else...?
Thanks in advance..
Regards,
Affan Ahmad Toor
.....................................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Affan Toor wrote: First i am interlacing both strings and then encrypting them using TrippleDES algo. But the encrypted string which is returned by the function Encrypt(), i.e. also my license key is more than 150 characters long, which is ofcourse too long for a license key.
You can store the key in a file and which can be read by your program, it could be a flat file or an xml file. I have seen a few companies use this technique to send long encrypted licenses.
|
|
|
|
|
Hi!
thanks for reply...
i think you did'nt got my point, my problem is not that i dont know how or where to store such long license key, infact i want my license key to be as short as 25-30 characters...
Do you know any way to do it?
Thanks in advance...
Regards,
Affan Ahmad Toor
.....................................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
Hi everyone!
I am searching for a tag cloud control. Is there something compareable available as source, or would I have to do this completely on my own?
So far I only found source that generates HTML, but I would like to use such a cloud on a form, so I prefer GDI+ drawing instead of markup output.
I tried on my own a little bit, but it looks kind of ugly - depending on the tags it shows. Animating it in sense of slowly changing the single priorities flickers and leads to line-jumps in my implementation, argh.
I have not found the perfect algorithm to arrange tags always on the same place so it looks good even when they reach maximum or minimum size. And public available algorithms always focus on markup output instead of sizes or areas where I could draw my tags in.
Hints are welcome, example implementations would even be loved.
Roland
|
|
|
|
|
Mkay... completely no answers. What a pity, so I will stick on the ugly ones I made myself. :-p
If I should find some additional time and it results in a super tag cloud for C# I will let you know.
Roland
|
|
|
|