示例#1
0
/*
 * WinMain - main entry point
 */
int WINMAINENTRY WinMain( HINSTANCE currinst, HINSTANCE previnst,
                          LPSTR cmdline, int cmdshow )
{
    MSG         msg;

    cmdline = cmdline;
#if defined( __NT__ ) && !defined( __WATCOMC__ )
    _argc = __argc;
    _argv = __argv;
#endif
    WRInit();

    if( _argc > 1 ) {
        parseArgs( _argc, _argv );
    }

    if( !imgEditInit( currinst, previnst, cmdshow ) ) {
        if( ImgedIsDDE ) {
            IEDDEDumpConversation( currinst );
        }
        return( 0 );
    }

    if( ImgedIsDDE ) {
        if( IEDDEStart( currinst ) ) {
            if( !IEDDEStartConversation() ) {
                WImgEditError( WIE_DDE_INIT_FAILED, NULL );
                PostMessage( HMainWindow, WM_CLOSE, (WPARAM)1, 0 );
            }
        } else {
            WImgEditError( WIE_DDE_INIT_FAILED, NULL );
            PostMessage( HMainWindow, WM_CLOSE, (WPARAM)1, 0 );
        }
    }

    IEEnableMenuInput( TRUE );

    if( _argc > 1 ) {
        parseCmdLine( _argc, _argv );
    }

    while( GetMessage( &msg, (HWND)NULL, 0, 0 ) ) {
        if( !TranslateMDISysAccel( ClientWindow, &msg ) &&
            !TranslateAccelerator( HMainWindow, hAccel, &msg ) ) {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
    }

    if( ImgedIsDDE ) {
        IEDDEEndConversation();
        IEDDEEnd();
    }

    imgEditFini();
    WRFini();
    return( 1 );

} /* WinMain */
示例#2
0
/*
 * main - main entry point for PM
 */
int main( int argc, char *argv[] )
{
    HMQ         hmq;
    QMSG        qmsg;
    HAB         hab;

    hab = WinInitialize( 0 );
    if(!hab) {
        DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR);
        DosExit(EXIT_PROCESS, RETURN_ERROR);
    }

    hmq = WinCreateMsgQueue( hab, 0 );
    if(!hmq) {
        DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR);
        WinTerminate(hab);
        DosExit(EXIT_PROCESS, RETURN_ERROR);
    }

    if( !imgEditInit( hab ) ) {
        DosBeep(BEEP_WARN_FREQ, BEEP_WARN_DUR);
        WinTerminate(hab);
        DosExit(EXIT_PROCESS, RETURN_ERROR);
    }

    IEEnableMenuInput( TRUE );

    if( argc > 1 ) {
        parseCmdLine( argc, argv );
    }

    while ( WinGetMsg(hab, &qmsg, 0, 0, 0) ) {
        WinDispatchMsg( hab, &qmsg );
    }

    imgeditFini( hmq );

    return 0;
} /* main */