Home » U++ Library support » U++ Widgets - General questions or Mixed problems » GUI app arguments?
GUI app arguments? [message #30419] |
Wed, 29 December 2010 18:50  |
kbyte
Messages: 87 Registered: July 2008
|
Member |
|
|
Hi
How can we get application arguments sent fromWwindows when running the application?
by other words, using UPP for building Windows GUI apps, where is the argc and argv?
Kim
|
|
|
Re: GUI app arguments? [message #30420 is a reply to message #30419] |
Wed, 29 December 2010 19:29   |
|
Hi Kim,
There is a function CommandLine() which returns the command line arguments. Typical usage is something like:
GUI_APP_MAIN{
const Vector<String>& cmd=CommandLine();
for(int i = 0; i < cmd.GetCount(); i++){
//do something with the argument cmd[i]
}
}
Note, that there is a little difference from argv - the vector returned by CommandLine() does not start with the name of the program. The rest of the arguments is left as is, only the zeroth element of argv is omitted. If you need to know the name under which the app was invoked, you can get that by calling GetExeTitle().
Best regards,
Honza
PS: I forgot to mention that CommandLine() of course works also in console applications. The usage is the same as in the example above, just use CONSOLE_APP_MAIN macro instead of GUI_APP_MAIN.
[Updated on: Wed, 29 December 2010 19:56] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri May 09 13:30:51 CEST 2025
Total time taken to generate the page: 0.00904 seconds
|