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
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
void AdpReader::readProject() { while (!atEnd()) { readNext(); if (isStartElement()) { QString s = name().toString().toLower(); if (s == QLatin1String("profile")) { readProfile(); } else if (s == QLatin1String("dcf")) { QString ref = attributes().value(QLatin1String("ref")).toString(); addFile(ref); m_contents.append(ContentItem(attributes().value(QLatin1String("title")).toString(), ref, 0)); readDCF(); } else { raiseError(); } } } }
static void loadIni(HWND hwnd) { char buffer[512]; CNRINFO cnrInfo; HINI inifile; inifile = openProfile(INIFILE); if(inifile) { if(readProfile(inifile,"CD","Grabber",buffer,sizeof(buffer), TRUE)) setText(WinWindowFromID(hwnd, CB_GRABBER), CBID_EDIT, buffer); if(readProfile(inifile,"CD","Drive",buffer,sizeof(buffer), TRUE)) setText(WinWindowFromID(hwnd, CB_DRIVE), CBID_EDIT, buffer); if(readProfile(inifile,"CD","TempDir",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_TEMPDIR, buffer); if(readProfile(inifile,"CD","Custom",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_CUSTOMCD, buffer); if(readProfile(inifile,"CD","SuperGrab",buffer,1, FALSE)) setCheck(hwnd, CB_SUPERGRAB, *buffer); if(readProfile(inifile,"CD","Use CDDB",buffer,1, FALSE)) setCheck(hwnd, CB_USECDDB, *buffer); if(readProfile(inifile,"CD","Title",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_TITLE, buffer); if(readProfile(inifile,"CD","Artist",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_ARTIST, buffer); if(readProfile(inifile,"CD","Comments",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_COMMENTS, buffer); if(readProfile(inifile,"CD","Category",buffer,sizeof(buffer), TRUE)) setText(hwnd, EF_GENRE, buffer); if(readProfile(inifile,"CD","ContainerInfo",&cnrInfo,sizeof(cnrInfo), FALSE)) WinSendDlgItemMsg(hwnd,CT_TRACK,CM_SETCNRINFO, MPFROMP(&cnrInfo), MPFROMLONG(CMA_XVERTSPLITBAR | CMA_FLWINDOWATTR)); miniIcons = (cnrInfo.flWindowAttr & CV_MINI) ? TRUE : FALSE; closeProfile(inifile); } }