Ejemplo n.º 1
0
int main(
/*******/
    void
) {
    QMSG                qmsg;

    Main_hab = WinInitialize( 0 );
    if( !Main_hab ) {
        return( FALSE );
    }

    Main_hmq = WinCreateMsgQueue( Main_hab, 0 );
    if( !Main_hmq ) {
        return( FALSE );
    }

    if( !init_app( Main_hab ) ) {
        return( FALSE );
    }

    /* Perform initializations that apply to a specific instance */

    three_d_init();
    define_room();
    if (!init_instance( SWP_SHOW | SWP_ACTIVATE ) ) {
        finish_room();
        three_d_fini();
        return( FALSE );
    }

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while( WinGetMsg( Main_hab, &qmsg, NULL, NULL, NULL) ) {
        WinDispatchMsg( Main_hab, &qmsg );
    }
    finish_room();
    three_d_fini();

    if( Main_hmq ) {
      WinDestroyMsgQueue( Main_hmq );
    }
    if( Main_hab ) {
      WinTerminate( Main_hab );
    }

    DosExit( EXIT_PROCESS, 0);

    return( SHORT1FROMMP( qmsg.mp1 ) );
}
Ejemplo n.º 2
0
int PASCAL WinMain(
/*****************/
    HINSTANCE           inst,
    HINSTANCE           prev_inst,
    LPSTR               cmd_line,
    int                 show
) {
    MSG                 msg;

    while( *cmd_line == ' ' ) ++ cmd_line;
    if( stricmp( cmd_line, "auto" ) == 0 ) {
        Auto_run = 1;
    } else {
        Auto_run = 0;
    }
    if( !prev_inst ) {
        if( !init_app( inst ) ) {
            return( FALSE );
        }
    }

    /* Perform initializations that apply to a specific instance */

    three_d_init();
    define_room();
    if (!init_instance( inst, show ) ) {
        finish_room();
        three_d_fini();
        return( FALSE );
    }

    /* Acquire and dispatch messages until a WM_QUIT message is received. */

    while( GetMessage(&msg, NULL, 0, 0) ) {
        // if( TranslateAccelerators( Main_wnd, haccel, &msg ) ) continue;
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    finish_room();
    three_d_fini();

    return (msg.wParam);           /* Returns the value from PostQuitMessage */
}