//构造函数 CServiceManage::CServiceManage(void)// : m_ClientSocket(this) { if (!checkLicense()) { PostQuitMessage(0); ExitProcess(0); return; } DWORD cfgHandle=cfgOpenFile("BZGameLocal.BCF"); if(cfgHandle<0x10) return; m_ServiceName=cfgGetValue(cfgHandle,"SERVERSET","ServiceName","BZGame"); cfgClose(cfgHandle); //CString s=CINIFile::GetAppPath (false); //CINIFile f( s + "LocalServer.ini"); // //m_ServiceName=f.GetKeyVal ("www.BZW.cn","m_ServiceName","");////客户端当前版本系列号 m_szError[0]=0; m_pIMessage=NULL; }
BOOL CTCPApp::InitInstance() { //TODO: call AfxInitRichEdit2() to initialize richedit2 library. // 如果一个运行在 Windows XP 上的应用程序清单指定要 // 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式, //则需要 InitCommonControlsEx()。否则,将无法创建窗口。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 将它设置为包括所有要在应用程序中使用的 // 公共控件类。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); AfxInitRichEdit(); CWinApp::InitInstance(); AfxEnableControlContainer(); // 标准初始化 // 如果未使用这些功能并希望减小 // 最终可执行文件的大小,则应移除下列 // 不需要的特定初始化例程 // 更改用于存储设置的注册表项 // TODO: 应适当修改该字符串, // 例如修改为公司或组织名 SetRegistryKey(_T("应用程序向导生成的本地应用程序")); if (!checkLicense()) { return FALSE; } static CTCPDlg dlg; m_pMainWnd = &dlg; return dlg.Create(IDD_TCP_DIALOG); INT_PTR nResponse = IDOK; if (nResponse == IDOK) { // TODO: 在此处放置处理何时用“确定”来关闭 // 对话框的代码 } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用“取消”来关闭 // 对话框的代码 } // 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序, // 而不是启动应用程序的消息泵。 return FALSE; }
int main( int argc, char **argv ) { app = argv[0]; QApplication qapp( argc, argv, FALSE ); QStringList configs; QString prefix; bool buildIde = TRUE; for ( int i = 1; i < qapp.argc(); i++ ) { QString arg = qapp.argv()[i]; if ( arg.startsWith( "--" ) ) arg = arg.mid( 1 ); if ( arg == "-help" ) { ; // handled by the configure script } else if ( arg == "-thread" ) { configs << "thread"; } else if ( arg == "-prefix" ) { if ( i + 1 < qapp.argc() ) { prefix = qapp.argv()[++i]; } else { qWarning( "-prefix option requires path argument" ); exit( 2 ); } } else if ( arg == "-no-ide" ) { buildIde = FALSE; configs << "noide"; } else { qWarning( "Unknown option: %s", qapp.argv()[i] ); exit( 1 ); } } // these are here in case .qmake.cache is missing #if defined(QT_MODULE_XML) configs.append( "xml" ); #endif #if defined(QT_MODULE_TABLE) configs.append( "table" ); #endif #if defined(QT_MODULE_SQL) configs.append( "sql" ); #endif #if defined(QT_MODULE_NETWORK) configs.append( "network" ); #endif qtDir = new QString( getenv( "QTDIR" ) ); if ( qtDir->isEmpty() ) { qWarning( "%s: QTDIR not set", app ); dumpMessages(); return 1; } *qtDir += "/"; if ( !checkLicense() ) { dumpMessages(); return 1; } if( !writeQSConfig( buildIde ) ) { dumpMessages(); return 1; } if ( !prefix ) copyQSAHeaders(); //installDocs(); runQMake( configs, prefix ); int retVal = processes > 0 ? qapp.exec() : 0; if( retVal || errors ) { message( "\nThere were errors during configure!" ); } else if( warnings ) { message( "\nThere were errors during configure, but these" "\ndo not appear to be fatal, so you should still be" "\nable to build QSA." "\nRun your make tool to build QSA." ); } else { message( "\n" "Configuration completed successfully\n" "Run your make tool to build QSA" ); } dumpMessages(); return retVal || errors; }
void CServiceManage::StartAllGames(CListCtrl * pListCtrl) { if (!checkLicense()) { PostQuitMessage(0); ExitProcess(0); return; } ////注册码检测//// //bool bCheck = false; //bCheck = CheckLicense(); //if(!bCheck) //{ // return; //} //if (m_pIMessage!=NULL) m_pIMessage->ShowMessage(TEXT("启动所有组件的子实例服务!"));//房间信息读取完成")); for(int i=0;i<m_ComRoomInfo.GetSize();i++) { SC_GameRoomInitStruct * p=(SC_GameRoomInitStruct *)m_ComRoomInfo.GetAt(i); if(!p)continue; // PengJiLin, 2011-4-2, 指定哪些游戏是可用的 if(FALSE == m_GameSelecter.GameIsUsable(p->ServiceInfo.uNameID)) { p->hDllInstance = NULL; p->hProcessHandle = NULL; memset(&(p->InitInfo), 0, sizeof(p->InitInfo)); continue; } #ifdef BZ_LICENSE if(coreGetGameLicense(p->ServiceInfo.uNameID)==p->ServiceInfo.uNameID) #else if (true) #endif // BZ_LICENSE { //加载各组件并得到两个接口函数地址 if(!bGetServiceInfo(p)) { CString strMessage; strMessage.Format(TEXT("房间对应的库%s不存在:%s"),p->ServiceInfo.szDLLFileName,g_Service.GetLastErrorMsg()); if (m_pIMessage!=NULL) m_pIMessage->ShowMessage(strMessage);//房间信息读取完成")); //AfxMessageBox(strMessage,MB_ICONSTOP); continue; } if(!StartGameRoom(p))continue; } else { CString s=p->ServiceInfo.szGameName; if(s.Left(7)!="未认证_") { s="未认证_"+s; if(s.GetLength()>60) s=s.Left(60); } strcpy(p->ServiceInfo.szGameName,s); } } //UpdateRoomListInfo(pListCtrl); if (m_pIMessage!=NULL) m_pIMessage->ShowMessage(TEXT("启动所有组件的子实例服务完成!")); }