/* * 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 */
/* * IEDDEDumpConversation */ BOOL IEDDEDumpConversation( HINSTANCE inst ) { HCONV hconv; HSZ hservice; HSZ htopic; BOOL ok; ok = IEDDEStart( inst ); if( ok ) { hservice = DdeCreateStringHandle( IdInst, WRE_SERVICE_NAME, CP_WINANSI ); ok = (hservice != (HSZ)NULL); } if( ok ) { htopic = DdeCreateStringHandle( IdInst, WRE_IMAGE_DUMP, CP_WINANSI ); ok = (htopic != (HSZ)NULL); } if( ok ) { // We expect the server to reject this connect attempt. // If it doesn't, then we terminate the conversation. hconv = DdeConnect( IdInst, hservice, htopic, (LPVOID)NULL ); if( hconv != (HCONV)NULL ) { DdeDisconnect( hconv ); } } if( hservice != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, hservice ); } if( htopic != (HSZ)NULL ) { DdeFreeStringHandle( IdInst, htopic ); } IEDDEEnd(); if( !ok ) { IEDisplayErrorMsg( WIE_DDEINITTITLE, WIE_DDETERMINATIONMSG, MB_OK | MB_ICONINFORMATION ); } return( ok ); } /* IEDDEDumpConversation */