Re: Progress leads to 2 more questions, hopefully last ones!



John Miskinis wrote:
> Note that I copied the "other" required DLLs from my CYGWIN
> tree (libXext, libX11, iconv-2, etc.)

I've made a win32 version of my gtk app fairly painlessly using tor's
pre-built libraries and the mingw environment, I don't know if you've looked
into that. The most painful bit was adjusting the file name handling :/

> Q2: Is it normal to get a "MS-DOS type" blank window along with
>    the GTK+ based app's window?  It's OK (a nit), but I'm not
>    sure if it is an indication of something else that I've done
>    wrong.

The blank window is for stdin and stdout (I think). You need to build with
-mwindows and replace main() with WinMain() to get rid of it.

I was given this scrap of code by a very kind person on gtk-list (name
forgotten, sorry)

#ifdef HAVE_WINDOWS_H 
/* Get non-cmd line args on win32.
 */
static int
breakargs( char *program, char *line, char **argv )
{
        int argc = 1;

        argv[0] = program;

        while( *line && argc < MAX_SYSTEM - 1 ) {
                while( *line && isspace( *line ) )
                        line++;

                if( *line == '"' ) {
                        /* Windows-95 quoted arguments 
                         */
                        char *start = line + 1;
                        char *end = start;

                        while( *end && *end != '"' )
                                end++;

                        if( *end == '"' ) {
                                *end = '\0';
                                argv[argc++] = start;
                                line = end + 1;
                                continue;
                        }
                }

                if( *line ) {
                        argv[argc++] = line;
                        while( *line && !isspace( *line ) )
                                line++;

                        if( *line )
                                *line++ = '\0';
                }
        }

        /* add trailing NULL pointer to argv 
         */
        argv[argc] = NULL;

        return( argc );
}

int WINAPI
WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
        LPSTR lpszCmdLine, int nShowCmd )
{
        char *argv[MAX_SYSTEM];
        int  argc;
        TCHAR program[MAXPATHLEN];

        GetModuleFileName( hInstance, program, sizeof(program) );
        argc = breakargs( (char *) program, lpszCmdLine, argv );

        return( main( argc, argv ) );
}
#endif /*HAVE_WINDOWS_H*/

John



========================================================== 

Madame de Pompadour 
Images of a Mistress 

16 October 2002 - 12 January 2003 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/pompadour/default.htm



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