int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow ) { MSG msg; #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); #endif if( !initApplication(hInstance) ) return FALSE; HANDLE hMutex = CreateMutex(NULL,NULL,className); if(ERROR_ALREADY_EXISTS == GetLastError()){ if( lpCmdLine[0]!='\0'){ HWND hWin=FindWindow( className, NULL ); if( hWin ){ SendMessage( hWin, WM_COMMAND, ID_END, 0 ); } }else{ return FALSE; } } HANDLE hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR) ); CoInitialize(NULL); readProfile(); if( !OpenPackFile() ) return FALSE; if( !InitInstance(hInstance,nCmdShow) ) return FALSE; SystemInit(lpCmdLine); WINNLSEnableIME(sysInf.hWnd,FALSE); TIMECAPS tc; timeGetDevCaps(&tc,sizeof(tc)); timeBeginPeriod(tc.wPeriodMin); while(FALSE==sysInf.bGameEnd){ BOOL bGotMsg; if(sysInf.bIsActive || lpMovie || !sysInf.bBackStop){ bGotMsg = PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE); }else{ bGotMsg = GetMessage( &msg, NULL, 0U, 0U ); } if(bGotMsg){ if(TranslateAccelerator( sysInf.hWnd, (HACCEL)hAccel, &msg ))continue; TranslateMessage(&msg); DispatchMessage(&msg); } if(sysInf.bIsActive || lpMovie || !sysInf.bBackStop){ mainLoop(); } } WINNLSEnableIME(sysInf.hWnd,TRUE); timeEndPeriod(tc.wPeriodMin); writeProfile(); cleanup(); CoUninitialize(); CloseHandle(hMutex); return msg.wParam; } // WinMain
EL::Value CompilationConfigWriter::writeProfiles(const Model::CompilationConfig& config) const { EL::ArrayType array; for (size_t i = 0; i < config.profileCount(); ++i) { const Model::CompilationProfile* profile = config.profile(i); array.push_back(writeProfile(profile)); } return EL::Value(array); }
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine,int nCmdShow ) { MSG msg; if( !initApplication(hInstance) ) return FALSE; HANDLE hMutex = CreateMutex(NULL,NULL,className); if(ERROR_ALREADY_EXISTS == GetLastError())return FALSE; HANDLE hAccel = LoadAccelerators( hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR) ); CoInitialize(NULL); readProfile(); if( !OpenPackFile() ) return FALSE; if( !InitInstance(hInstance,nCmdShow) ) return FALSE; SystemInit(); WINNLSEnableIME(sysInf.hWnd,FALSE); TIMECAPS tc; timeGetDevCaps(&tc,sizeof(tc)); timeBeginPeriod(tc.wPeriodMin); while(FALSE==sysInf.bGameEnd){ BOOL bGotMsg; if(sysInf.bIsActive || lpMovie || lpStaffRoll){ bGotMsg = PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE); }else{ bGotMsg = GetMessage( &msg, NULL, 0U, 0U ); } if(bGotMsg){ if(TranslateAccelerator( sysInf.hWnd, (HACCEL)hAccel, &msg ))continue; TranslateMessage(&msg); DispatchMessage(&msg); } if(sysInf.bIsActive || sysInf.execMode==movie_mode || lpStaffRoll){ mainLoop(); } } WINNLSEnableIME(sysInf.hWnd,TRUE); timeEndPeriod(tc.wPeriodMin); writeProfile(); cleanup(); CoUninitialize(); CloseHandle(hMutex); if(CheckWinExec()){ WinExec2( str_winpath, str_winexec ); } return msg.wParam; } // WinMain
static void saveIni(HWND hwnd) { char buffer[512]; CNRINFO cnrInfo; HINI inifile; inifile = openProfile(INIFILE); if(inifile) { getText(WinWindowFromID(hwnd, CB_GRABBER), CBID_EDIT, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Grabber", buffer,0); getText(WinWindowFromID(hwnd, CB_DRIVE), CBID_EDIT, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Drive", buffer,0); getText(hwnd, EF_TEMPDIR, buffer, sizeof(buffer)); writeProfile(inifile,"CD","TempDir", buffer,0); getText(hwnd, EF_CUSTOMCD, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Custom", buffer,0); *buffer = getCheck(hwnd, CB_SUPERGRAB); writeProfile(inifile,"CD","SuperGrab", buffer, 1); *buffer = getCheck(hwnd, CB_USECDDB); writeProfile(inifile,"CD","Use CDDB", buffer, 1); getText(hwnd, EF_TITLE, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Title", buffer,0); getText(hwnd, EF_ARTIST, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Artist", buffer,0); getText(hwnd, EF_COMMENTS, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Comments", buffer,0); getText(hwnd, EF_GENRE, buffer, sizeof(buffer)); writeProfile(inifile,"CD","Category", buffer,0); cnrInfo.cb = sizeof(cnrInfo); WinSendDlgItemMsg(hwnd,CT_TRACK,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),MPFROMLONG(sizeof(cnrInfo))); writeProfile(inifile,"CD","ContainerInfo", &cnrInfo, sizeof(cnrInfo)); closeProfile(inifile); } }