how to output filename in win Topic is solved
how to output filename in win
Hello everyone. Finally, my program (* .exe) will output the output file (* .fbmr). I double-click the output file icon but (badly) open the empty program. Example: wxFormBuilder is a (very good) program. Project is an output file (* .fbp). I, as a user, click on the project icon and open the file. All data will be loaded. Not me. An empty output file opens even if you double-click the icon for example a1.fbmr. What returns to a1.fbmr and how do I open it when I double-click the a1.fbmr icon?
Re: how to output filename in win
The full path of the file you clicked on will be passed as parameter to your application. Use argc/argv to get it.
This also happens when the user drags one or more files onto the exe itself (or a link to it), in which case you could receive multiple files.
This also happens when the user drags one or more files onto the exe itself (or a link to it), in which case you could receive multiple files.
Use the source, Luke!
Re: how to output filename in win
Hello, Doublemax. Thank you very much for your answer. Can I ask for some instructions (example)? I'm worried about the different options, and my head is getting around. I'm trying different things, and nothing makes sense to me. I wanted to paste the vector m_filesFromCmdLine into MyApp :: OnInit () and initialize the file to start. The more I think about it, the more frustrating - if I do not know how to do it.
Re: how to output filename in win
Put this code into your OnInit() method and you should see what happens:
Code: Select all
if( argc > 1 )
{
for(int i=1; i<argc; i++)
{
wxLogMessage("arg %d = %s", i, argv[i] );
}
}
Use the source, Luke!
Re: how to output filename in win
Doublemax, hi. Message is: arg 1 = D:\A1.FBMR. This is OK, it's true. And how do I load the current A1 file into my program?
Re: how to output filename in win
You must have a function to load a file somewhere in your program? Just take that filename and load it.
Use the source, Luke!
Re: how to output filename in win
When I run the program, apriory it's empty. Then I will run "NewFile or OpenFile ... When I wanted to run OnOpenFile (event) from myApp :: OnInit (), I got an error message that 'event' was not declared in this scope ...
Re: how to output filename in win
So I wanted to find a procedure that opens a file from MyApp :: OnInit () but did not find
Re: how to output filename in win
You have to refactor your code so that you can call the function that loads a file from different places.
E.g. you have a method MyFrame::LoadFile( wxString pathname ) that actually loads the file. And you call this method from OnOpenFile() and from MyApp::OnInit()
E.g. you have a method MyFrame::LoadFile( wxString pathname ) that actually loads the file. And you call this method from OnOpenFile() and from MyApp::OnInit()
Use the source, Luke!
Re: how to output filename in win
It works, thanks very much.