BOOL CTemplateCADApp::InitInstance() { // 假如應用程式資訊清單指定使用 ComCtl32.dll 6 (含) 以後版本, // 來啟動視覺化樣式,在 Windows XP 上,則需要 InitCommonControls()。 // 否則任何視窗的建立都將失敗。 INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // 設定要包含所有您想要用於應用程式中的 // 通用控制項類別。 InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); InitializeConfig(); AfxEnableControlContainer(); // 建立殼層管理員,以防對話方塊包含 // 任何殼層樹狀檢視或殼層清單檢視控制項。 CShellManager *pShellManager = new CShellManager; // 標準初始設定 // 如果您不使用這些功能並且想減少 // 最後完成的可執行檔大小,您可以 // 從下列程式碼移除不需要的初始化常式, // 變更儲存設定值的登錄機碼 // TODO: 您應該適度修改此字串 // (例如,公司名稱或組織名稱) SetRegistryKey(_T("本機 AppWizard 所產生的應用程式")); CTemplateCADDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置於使用 [確定] 來停止使用對話方塊時 // 處理的程式碼 int a = 0; } else if (nResponse == IDCANCEL) { // TODO: 在此放置於使用 [取消] 來停止使用對話方塊時 // 處理的程式碼 int b = 0; } // 刪除上面所建立的殼層管理員。 if (pShellManager != NULL) { delete pShellManager; } // 因為已經關閉對話方塊,傳回 FALSE,所以我們會結束應用程式, // 而非提示開始應用程式的訊息。 return FALSE; }
//--------------------------------------------------------------------------- bool __fastcall TConfSettingsForm::SelectFile() { if(OpenDialog->Execute()) { return InitializeConfig(OpenDialog->FileName); } return false; }
bool HookMozillaFirefox() { WCHAR nspr4[] = {'n','s','p','r','4','.','d','l','l',0}; WCHAR ssl3[] = {'s','s','l','3','.','d','l','l', 0 }; if ( CheckInCurrentDir( nspr4 ) && CheckInCurrentDir( ssl3 ) ) { //UnhookFF(); InitFFGlobalData(); InitializeConfig(); InitScreenLib(); return HookMozillaApi(); } return false; }
int _stdc main(int argc, char *argv[]) { char *p; NW(__fd2n); #if defined(__FLAT__) && !defined(UNIX) Hello("SQUISH/386", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #elif defined(LINUX) Hello("SQUISH/LINUX", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #elif defined(UNIX) Hello("SQUISH/UNIX", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #else Hello("SQUISH", "SquishMail Conference Processor", version, "1990, " THIS_YEAR); #endif #ifdef OS_2 /* Serialize Squish's execution */ BbsSemSerialize("/sem/squish/default", "BBSSEM"); #endif #ifdef __WATCOMC__ setbuf(stdout, NULL); #endif #ifdef DMALLOC /*dmalloc_on(TRUE);*/ #endif #ifdef DJ dj=fopen("dj.log", "a"); #endif #ifdef UNIX if (!getenv("SQUISH")) putenv("SQUISH=" INSTALL_PREFIX "/etc/squish.cfg"); #endif if (!fexist(ar.cfgname) && (p=getenv("SQUISH")) != NULL) (void)strcpy(ar.cfgname, p); #if defined(__MSDOS__) && !defined(__FLAT__) install_24(); (void)atexit(uninstall_24); #endif if (argc < 2) usage(); Initialize_Variables(); /* Use the SQUISH environment variable to locate config file, if necessary */ p=getenv("SQUISH"); if (p && !fexist(ar.cfgname)) /* as long as there's no squish.cfg in cwd */ (void)strcpy(ar.cfgname, p); ParseArgs(&ar, (byte **)argv); /* Command-line arguments */ /* strcpy(ar.cfgname,"Squish.Cfg");*/ Parse_Config(ar.cfgname); /* parse squish.cfg and areas.bbs */ /* { NETADDR bill={1,249,1,0}; if (DestIsHereA(&bill)) printf("!!! This copy of Squish is registered to Bill Cassidy !!!\n"); } */ Parse_Areas(*ar.areasbbs ? ar.areasbbs : config.areasbbs); /* If a log-file override was specified on the command line */ if (*ar.logfile) { if (config.logfile) free(config.logfile); config.logfile=sstrdup(ar.logfile); } InitializeConfig(); /* Initialize configuration */ if (ar.action==ACTION_GET || ar.action==ACTION_SEND || ar.action==ACTION_UPDATE || ar.action==ACTION_POLL) { config.flag &= ~FLAG_ADDMODE; HandleAttReqPoll(ar.action, ar.toscan); } else SquishSquashCycle(); #ifdef DJ if (dj) fclose(dj); #endif CleanupConfig(); (void)printf("\n" SQNAME ": Done!\n"); return (erl_max ? ERL_MAXMSGS : erl_echo ? ERL_TOSS_ECHO : erl_net ? ERL_TOSS_NET : erl_sent ? ERL_SENT_ECHO : ERL_NONE); }