On 11/6/05, Tor Lillqvist <[EMAIL PROTECTED]> wrote:
> > Another solution for applications is to look at argv[0]. On
> > Windows this is always (I think) the full path to the .exe.
>
> Looking at argv[0] is really not recommended on Windows. If memory
> serves me right, if the path to the application has spaces in it, it
> might even be that depending on the phase of the moon, argv[0]
> contains only the part up to the (first) space, the rest is in
> argv[1..n], and crap like that. Remember that the real Win32 API to
> start a process doesn't pass an argument vector to the process like
> Unix does, it passes a command line. It's then the startup code in the
> C runtime (which on Windows isn't unique, there are several
> alternative ones, even from Microsoft, that an app might be linked
> with) that tries its best to construct an argv from the command line,
> and sometimes the result is far from perfect.

That's interesting, thank you. I have some #ifdef WIN32 code in main()
which someone sent me which seems to do something mysterious with
argv[] and I guess this is it. I was put off
g_win32_get_package_installation_directory() by talk of the registry,
but if that's optional, I guess I should use that.

John
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to