Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
kbyte is currently offline  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 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

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

Re: GUI app arguments? [message #30422 is a reply to message #30420] Wed, 29 December 2010 21:25 Go to previous message
kbyte is currently offline  kbyte
Messages: 87
Registered: July 2008
Member
Hi Honza
Very good explanation! Thank you so much!

Kim
Previous Topic: Accessing printer properties
Next Topic: PrintJob does not works on "large project"
Goto Forum:
  


Current Time: Fri Mar 29 06:28:32 CET 2024

Total time taken to generate the page: 0.02054 seconds