Home » U++ Library support » TopWindow&PopUp, TrayIcon » Double-click a file and open the App
Double-click a file and open the App [message #20985] |
Thu, 23 April 2009 18:59 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
I am using an app derived from TopWindow and I want it to be able to open my document type by double-clicking on the file in windows (not sure if linux works this way too). I've tried looking for command line arguments but there don't seem to be any nor any way to process a filename in TopWindow.
I'm clearly barking up the wrong tree here. Any clues would be greatly appreciated.
Just to be clear, I want to add the kind of behaviour that is exemplified by double-clicking a Word document and Word opening with the document loaded.
Cheers,
Nick
[Updated on: Thu, 23 April 2009 19:00] Report message to a moderator
|
|
|
Re: Double-click a file and open the App [message #21029 is a reply to message #20985] |
Mon, 27 April 2009 13:13 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
There are two parts to this:
1- Telling windows to start your app when a certain document type is double clicked. This is presumably controlled by there registry, but there may well be some sort of Windows API call to do it for you. There should be plenty of info on the 'net.
2- Accessing the command line can be done using CammandLine(). I assume this is how Windows passes the filename, though I'm not certain.
[Updated on: Mon, 27 April 2009 18:21] Report message to a moderator
|
|
|
Re: Double-click a file and open the App [message #21037 is a reply to message #21029] |
Tue, 28 April 2009 03:47 |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
Hmmm, not sure why it wasn't working before but for reference, in WIN32 at least (Vista 64), the following code works
GUI_APP_MAIN
{
const Vector<String>& cmdline = CommandLine();
int argc = cmdline.GetCount();
OpenWind prog;
DUMP(argc);
if(argc)
{
DUMP(cmdline[0]);
prog.OpenS(cmdline[0]);
}
prog.Zoomable().Sizeable().Run();
}
Thanks.
|
|
|
Goto Forum:
Current Time: Thu Mar 28 13:24:29 CET 2024
Total time taken to generate the page: 0.00972 seconds
|