Re: argv revisited



On 04/30/2016 11:25 PM, Andrew Robinson wrote:
My initial request for help in this forum was that main(argc,argv) only
returned garbage instead of the command line when using the 32-bit version of
GTK+ v3.18 on a 64-bit Windows7 OS. This forum was unable to offer any expert
help or advice on this matter so I put it aside. A few days later I thought
about it and realized that main(argc,argv) implies that the args for the
command line are on the stack, but that is only true for Linux or Windows
command line apps. The correct interface for Windows is
main(hWnd,uMsg,wParam,lParam), hence the reason I couldn't get the command
line args with GTK+ in Windows. I was following GTKs code examples without
realizing that they were inapplicable.

Since this forum was no help in addressing my original problem, I then
submitted a similar issue to the Gnome forum. I told them I was attempting
cross-OS programming for Windows and Linux, so while I could use GetCommandA()
or GetCommandW() to get the command line, there were still issues since
GetCommandW() was based on Windows being UTF16 and GTK+/Linux were UTF8. Gnome
said that they had a cross-OS function for that: g_win32_get_command_line().

Now my new problem I had was either locating a Win32 version of GTK+ greater
than v3.18 or locating a version of libglib.dll greater than v2.40. It isn't
going to happen. The GTK+ project itself does not support Win32 or Win64,
expecting the developer to install MSYS2 and then ... nothing. The GTK+
project gives no further instructions on what to do next. Getting the Linux
binaries for GTK+ in MSYS2 seems easy, but I don't want the Linux binaries, I
want the Windows binaries. I would compile my own binaries for Windows but
there is little reliable and complete information out there on how to do it
and what is there isn't credible. From what I understand, compiling binaries
for Win32 is a very time consuming and tedious project, so I knew if I had any
problems compiling it, I would not receive any help from the GTK+ (or probably
even the GNOME) community in resolving them.

While GNOME was more knowledgeable than the GTK+ Dev forum, they still did not
address the rest of the issues I discussed. For one thing, the GTK+
documentation should state it that all their code examples are only applicable
to Linux or the console version Windows apps, since main(argc,argv) does not
apply to non-console version of Windows apps. Second, GNOME did not mention
the corresponding function for the file chooser, when a file name has UTF16
characters in it. Gnome closed out my bug report before I had a chance to
confirm it, so that was rude of them.
Mr. Robinson,

Your problem about using UTF16 is related to the fact you are using
windows os and not linux or unix or macos x.  All the others use utf-8
EXCEPT WINDOWS.  There are functions to convert to and from whatever
strings you need.  Look up internationalization stuff, texttools. UTF16
is akin to what windows calls wchar(wide char) by the way.  That should
nudge you in the right direction for that.

Also be careful what functions you use in window to debug print your
strings.
i.e. wprintf != printf.
use wprintf with wchar string
use printf with ascii strings
etc...



I am still not going to pursue using GTK+ in this project of mine, having
moved on to a better supported and more mature GUI toolkit, but I thought that
any feedback, even negative feedback, would be a good thing, since there might
be other people out there like me that aren't getting answers to simple
problems like this one.

Now they know.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]