BOOL CFaceEncryptApp::InitInstance()
{
//AfxMessageBox("InitInstance()");
{ // BLOCK: doc template registration
// Register the document template. Document templates serve
// as the connection between documents, frame windows and views.
// Attach this form to another document or frame window by changing
// the document or frame class in the constructor below.
CSingleDocTemplate* pNewDocTemplate = new CSingleDocTemplate(
IDR_CHOOSEOPERATION_TMPL,
RUNTIME_CLASS(CFaceEncryptDoc), // document class
RUNTIME_CLASS(CMainFrame), // frame class
RUNTIME_CLASS(CChooseOperation)); // view class
AddDocTemplate(pNewDocTemplate);
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CFaceEncryptDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CFaceEncryptView));
AddDocTemplate(pDocTemplate);
// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(TRUE);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// Enable drag/drop open
m_pMainWnd->DragAcceptFiles();
return TRUE;
}
BOOL CFPAnalysisApp::InitInstance()
{
// CG: The following block was added by the Splash Screen component.
\
{
\
CCommandLineInfo cmdInfo;
\
ParseCommandLine(cmdInfo);
\
\
CSplashWnd::EnableSplashScreen(cmdInfo.m_bShowSplash);
\
}
AfxEnableControlContainer();
//m_dlgSkin.Create(IDD_SKINDIALOG_DIALOG);
//m_pSkin = m_dlgSkin.GetDlgItem(IDC_SKIN2)->GetControlUnknown();
//m_dlgAgent.Create(IDD_AGENT_DIALOG);
//m_theAgent.Probe(&m_dlgAgent.m_Agent);
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Fingerprint Analysis 1.00"));
LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_FPANALTYPE,
RUNTIME_CLASS(CFPAnalysisDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CFPAnalysisView));
AddDocTemplate(pDocTemplate);
EnableShellOpen();
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
//Drag & Drop support
m_pMainWnd->DragAcceptFiles();
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// no new document at start-up
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->CenterWindow();
pMainFrame->UpdateWindow();
pMainFrame->SetTitle("Fingerprint Analysis");
return TRUE;
}
BOOL CLibraryApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
//Login Dialog
CLoginDlg cLoginDlg;
/*
if(cLoginDlg.DoModal() != IDOK)
return false;
*/
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CLibraryDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CLibraryView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
if(!cLoginDlg.IsUserType())
{
CMenu *menu = m_pMainWnd->GetMenu();
menu->DeleteMenu(0,MF_BYPOSITION);
m_pMainWnd->DrawMenuBar(); //ÖØ»æ²Ëµ¥À¸
}
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
BOOL CApp::InitInstance()
{
if(!CDCGFApp::InitInstance()) return FALSE;
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
/*
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
*/
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("DEAD:CODE"));
LoadStdProfileSettings(8); // Load standard INI file options (including MRU)
CDCGFStringTable::Init();
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_PROJECTYPE,
RUNTIME_CLASS(CProjectDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CProjectView));
AddDocTemplate(pDocTemplate);
// create main MDI Frame window
CMainFrame* pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = pMainFrame;
// Enable drag/drop open
//m_pMainWnd->DragAcceptFiles();
// This code replaces the MFC created menus with
// the Ownerdrawn versions
static UINT toolbars[]={
IDR_MAINFRAME, IDR_TOOLBAR_2
};
pDocTemplate->m_hMenuShared=pMainFrame->NewMenu(IDR_PROJECTYPE, toolbars, 2);
pMainFrame->m_hMenuDefault=pMainFrame->NewDefaultMenu(IDR_MAINFRAME, toolbars, 2);
/*
CDCGFStringTable::LocMenu(CMenu::FromHandle(pMainFrame->m_hMenuDefault));
CDCGFStringTable::LocMenu(CMenu::FromHandle(pDocTemplate->m_hMenuShared));
*/
// This simulates a window being opened if you don't have
// a default window displayed at startup
pMainFrame->OnUpdateFrameMenu(pMainFrame->m_hMenuDefault);
// Enable DDE Execute open
EnableShellOpen();
RegisterShellFileTypes(FALSE);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if(cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew)
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The main window has been initialized, so show and update it.
pMainFrame->ShowWindow(SW_SHOWMAXIMIZED);
pMainFrame->UpdateWindow();
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNothing)
{
DoSomeNagging();
if(GetRegInt(HKEY_CURRENT_USER, DCGF_TOOLS_REG_PATH, "AutoCheckUpdates", 1))
{
pMainFrame->CheckForUpdates(true);
}
}
pMainFrame->UpdateMenuURL(pMainFrame->GetMenu());
return TRUE;
}
//.........这里部分代码省略.........
}
return FALSE;
}
if (CAppUtils::GetMsysgitVersion() < 0x01070a00)
{
int ret = CMessageBox::ShowCheck(NULL, IDS_PROC_OLDMSYSGIT, IDS_APPNAME, 1, IDI_EXCLAMATION, IDS_PROC_GOTOMSYSGITWEBSITE, IDS_ABORTBUTTON, IDS_IGNOREBUTTON, _T("OldMsysgitVersionWarning"), IDS_PROC_NOTSHOWAGAINIGNORE);
if (ret == 1)
{
CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
ShellExecute(NULL, NULL, _T("http://code.google.com/p/msysgit/"), NULL, NULL, SW_SHOW);
return FALSE;
}
else if (ret == 2)
{
CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
return FALSE;
}
}
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX used = {
sizeof(INITCOMMONCONTROLSEX),
ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_COOL_CLASSES | ICC_DATE_CLASSES |
ICC_HOTKEY_CLASS | ICC_INTERNET_CLASSES | ICC_LISTVIEW_CLASSES |
ICC_NATIVEFNTCTL_CLASS | ICC_PAGESCROLLER_CLASS | ICC_PROGRESS_CLASS |
ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES | ICC_UPDOWN_CLASS |
ICC_USEREX_CLASSES | ICC_WIN95_CLASSES
};
InitCommonControlsEx(&used);
AfxOleInit();
AfxEnableControlContainer();
AfxInitRichEdit2();
CWinAppEx::InitInstance();
SetRegistryKey(_T("TortoiseGit"));
AfxGetApp()->m_pszProfileName = _tcsdup(_T("TortoiseProc")); // w/o this ResizableLib will store data under TortoiseGitProc which is not compatible with older versions
CCmdLineParser parser(AfxGetApp()->m_lpCmdLine);
hWndExplorer = NULL;
CString sVal = parser.GetVal(_T("hwnd"));
if (!sVal.IsEmpty())
hWndExplorer = (HWND)_ttoi64(sVal);
while (GetParent(hWndExplorer)!=NULL)
hWndExplorer = GetParent(hWndExplorer);
if (!IsWindow(hWndExplorer))
{
hWndExplorer = NULL;
}
// if HKCU\Software\TortoiseGit\Debug is not 0, show our command line
// in a message box
if (CRegDWORD(_T("Software\\TortoiseGit\\Debug"), FALSE)==TRUE)
AfxMessageBox(AfxGetApp()->m_lpCmdLine, MB_OK | MB_ICONINFORMATION);
if ( parser.HasKey(_T("path")) && parser.HasKey(_T("pathfile")))
{
CMessageBox::Show(NULL, IDS_ERR_INVALIDPATH, IDS_APPNAME, MB_ICONERROR);
return FALSE;
}
CTGitPath cmdLinePath;
CTGitPathList pathList;
BOOL CWinLauncher2App::InitInstance() {
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// Create the shell manager, in case the dialog contains
// any shell tree view or shell list view controls.
CShellManager *pShellManager = new CShellManager;
// Activate "Windows Native" visual manager for enabling themes in MFC controls
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// Set CWinApp default registry key. Must be consistent with all apps using findjava2.
SetRegistryKey(_T("Android-FindJava2"));
// Use VERSIONINFO.FileDescription as the canonical app name
initUtils(NULL);
CLauncherCmdLineInfo cmdLine;
ParseCommandLine(cmdLine);
if (cmdLine.mDoHelp) {
const TCHAR *msg =
_T("WinLauncher2 [/7|/f|/h]\r\n")
_T("/7 : Requires Java 1.7 instead of 1.6\r\n")
_T("/f : Force UI\r\n")
_T("/h : Help\r\n");
AfxMessageBox(msg);
return FALSE; // quit without starting MFC app msg loop
}
CJavaFinder javaFinder(JAVA_VERS_TO_INT(1, cmdLine.mDoJava1_7 ? 7 : 6));
CJavaPath javaPath = javaFinder.getRegistryPath();
if (cmdLine.mDoForceUi || javaPath.isEmpty()) {
javaPath.clear();
CFindJava2Dlg dlg;
dlg.setJavaFinder(&javaFinder);
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK) {
// Use choice selected by user and save in registry.
javaPath = dlg.getSelectedPath();
javaFinder.setRegistryPath(javaPath);
} else if (nResponse == IDCANCEL) {
// Canceled by user, exit silently.
} else if (nResponse == -1) {
TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
}
}
if (!javaPath.isEmpty()) {
// TODO actually launch configured app instead of just printing path.
CString msg(_T("PLACEHOLDER TODO run app using "));
msg.Append(javaPath.mPath);
AfxMessageBox(msg);
}
// Delete the shell manager created above.
if (pShellManager != NULL) {
delete pShellManager;
}
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
BOOL KSceneEditorApp::InitInstance()
{
BOOL bResult = false;
BOOL bRetCode = false;
HRESULT hr = E_FAIL;
char* pszRetCWD = NULL;
IRecorderFactory* piRecorderFactory = NULL;
CMultiDocTemplate* pDocTemplate = NULL;
MFCFramework::CMainFrame* pMainFrame = NULL;
KGLOG_PARAM LogParam;
char szCWD[MAX_PATH];
CCommandLineInfo cmdInfo;
//使用Dummper
m_hDummperModule = LoadLibrary(_T("dumper.dll"));
pszRetCWD = getcwd(szCWD, sizeof(szCWD));
KGLOG_PROCESS_ERROR(pszRetCWD);
g_SetRootPath();
g_SetFindFileMode(TRUE);
g_SetFilePath("");
g_LoadPackageFiles("config.ini", "PackFile");
memset(&LogParam, 0, sizeof(LogParam));
snprintf(LogParam.szPath,sizeof(LogParam.szPath),"%s\\logs",szCWD);
LogParam.szPath[sizeof(LogParam.szPath) - 1] = '\0';
strcpy(LogParam.szIdent, "SceneEditor");
LogParam.nMaxLineEachFile = 65536;
LogParam.Options = (KGLOG_OPTIONS)KGLOG_OPTION_FILE;
bRetCode = KGLogInit(LogParam, NULL);
KGLOG_PROCESS_ERROR(bRetCode);
m_bLogInitFlag = true;
bRetCode = KMemory::Initialize("SceneEditor.memory");
KGLOG_PROCESS_ERROR(bRetCode);
m_bMemoryInitFlag = true;
g_cEditorDirectory.Load();
{
TCHAR AppDir[256] = {0};
GetCurrentDirectory(256, AppDir);
wsprintf(g_szDefWorkDirectory,"%s\\",AppDir);
wsprintf(g_szDefExeDirectory,"%s\\",AppDir);
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(10); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
pDocTemplate = new CMultiDocTemplate(
IDR_SCENEETYPE,
RUNTIME_CLASS(KSceneEditorDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(KSceneEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_MESHETYPE,
RUNTIME_CLASS(KSceneModelEditorDoc),
RUNTIME_CLASS(KSceneModelEditorFrameWnd), // custom MDI child frame
RUNTIME_CLASS(KSceneModelEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDS_OBJECTTYPE,
RUNTIME_CLASS(KSceneObjectEditorDoc),
RUNTIME_CLASS(KSceneObjectEditorFrameWnd), // custom MDI child frame
RUNTIME_CLASS(KSceneObjectEditorView));
pDocTemplate->SetContainerInfo(IDR_SCENEETYPE_CNTR_IP);
AddDocTemplate(pDocTemplate);
pDocTemplate = new CMultiDocTemplate(
IDR_SFXEDITOR,
RUNTIME_CLASS(KSceneSFXEditorDoc),
RUNTIME_CLASS(KSceneSFXEditorFrame), // custom MDI child frame
RUNTIME_CLASS(KSceneSFXEditorView));
pDocTemplate->SetContainerInfo(IDR_SFXEDITOR);
AddDocTemplate(pDocTemplate);
//.........这里部分代码省略.........
BOOL CbaltoshopApp::InitInstance()
{
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControlsEx()가 필요합니다.
// InitCommonControlsEx()를 사용하지 않으면 창을 만들 수 없습니다.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 응용 프로그램에서 사용할 모든 공용 컨트롤 클래스를 포함하도록
// 이 항목을 설정하십시오.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
// OLE 라이브러리를 초기화합니다.
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// 표준 초기화
// 이들 기능을 사용하지 않고 최종 실행 파일의 크기를 줄이려면
// 아래에서 필요 없는 특정 초기화
// 루틴을 제거해야 합니다.
// 해당 설정이 저장된 레지스트리 키를 변경하십시오.
// TODO: 이 문자열을 회사 또는 조직의 이름과 같은
// 적절한 내용으로 수정해야 합니다.
SetRegistryKey(_T("로컬 응용 프로그램 마법사에서 생성된 응용 프로그램"));
LoadStdProfileSettings(4); // MRU를 포함하여 표준 INI 파일 옵션을 로드합니다.
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// 응용 프로그램의 문서 템플릿을 등록합니다. 문서 템플릿은
// 문서, 프레임 창 및 뷰 사이의 연결 역할을 합니다.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CbaltoshopDoc),
RUNTIME_CLASS(CMainFrame), // 주 SDI 프레임 창입니다.
RUNTIME_CLASS(CbaltoshopView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 표준 셸 명령, DDE, 파일 열기에 대한 명령줄을 구문 분석합니다.
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 명령줄에 지정된 명령을 디스패치합니다.
// 응용 프로그램이 /RegServer, /Register, /Unregserver 또는 /Unregister로 시작된 경우 FALSE를 반환합니다.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 창 하나만 초기화되었으므로 이를 표시하고 업데이트합니다.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// 접미사가 있을 경우에만 DragAcceptFiles를 호출합니다.
// SDI 응용 프로그램에서는 ProcessShellCommand 후에 이러한 호출이 발생해야 합니다.
return TRUE;
}
BOOL CPBXClientApp::InitInstance()
{
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(REG_KEY_APP);
CString lang = GetProfileString("Settings", "Language", "");
SetLanguage(lang);
CString cmdLine = this->m_lpCmdLine;
HWND hwnd = FindWindow(NULL, _T("BSOC Main Application Window"));
m_bShellOpenFile = FALSE;
m_bAllowCmdLineOriginate = 1;
m_bDeveloperVersion = TRUE;
if (cmdLine.Left(9).MakeLower()=="originate") {
Semaphore s(ORIGINATE_FILE_MUTEX);
CStdioFile debugFile(::theApp.GetInstallDir()+"\\originate.tmp", CFile::modeCreate | CFile::modeWrite);
debugFile.SeekToEnd();
debugFile.WriteString(cmdLine);
debugFile.Close();
return TRUE;
}
if (hwnd!=NULL) { //only one instance of OutCALL can be run
CString str;
str.Format(_("%s is already running."), APP_NAME);
MessageBox(NULL, str, APP_NAME, MB_ICONINFORMATION | MB_OK);
return FALSE;
}
WSADATA WSAData = { 0 };
if ( 0 != WSAStartup( WSA_VERSION, &WSAData ) )
{
// Tell the user that we could not find a usable
// WinSock DLL.
if ( LOBYTE( WSAData.wVersion ) != LOBYTE(WSA_VERSION) ||
HIBYTE( WSAData.wVersion ) != HIBYTE(WSA_VERSION) )
::MessageBox(NULL, _("Incorrect version of WS2_32.dll found."), APP_NAME, MB_OK | MB_ICONERROR);
WSACleanup( );
return FALSE;
}
if (_tcscmp(this->m_lpCmdLine, _T("background"))==0) {
Sleep(10000);
} else if (cmdLine!="") {
m_bShellOpenFile = TRUE;
ReadConfigFile(cmdLine);
}
AfxOleInit();
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CMainFrame* pFrame = new CMainFrame;
m_pMainWnd = pFrame;
pFrame->CreateDatabaseTable("RecivedCalls", "CREATE TABLE RecivedCalls(Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("PlacedCalls", "CREATE TABLE PlacedCalls(Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("MissedCalls", "CREATE TABLE MissedCalls(NewCall NUMERIC, Date TEXT, Time TEXT, Callee TEXT, CallerID TEXT, Sec NUMERIC)");
pFrame->CreateDatabaseTable("Contacts", "CREATE TABLE Contacts(Title TEXT, FirstName TEXT, MiddleName TEXT, LastName TEXT, Suffix TEXT, CompanyName TEXT, Assistant TEXT, Business TEXT, Business2 TEXT, BusinessFax TEXT, Callback TEXT, Car TEXT, Company TEXT, Home TEXT, Home2 TEXT, HomeFax TEXT, ISDN TEXT, Mobile TEXT, Other TEXT, OtherFax TEXT, Pager TEXT, PrimaryTel TEXT, Radio TEXT, Telex TEXT, TTYTDD TEXT)");
// create and load the frame with its resources
int left = (GetSystemMetrics(SM_CXSCREEN)-500)/2;
int top = (GetSystemMetrics(SM_CYSCREEN)-500)/2;
pFrame->LoadFrame(IDR_MAINFRAME,
WS_OVERLAPPEDWINDOW | WS_MINIMIZE | FWS_ADDTOTITLE, NULL,
NULL);
pFrame->MoveWindow(left, top, left+500, top+500);
// The one and only window has been initialized, so show and update it.
pFrame->ShowWindow(SW_HIDE);
pFrame->UpdateWindow();
//pFrame->SetWindowPos(&pFrame->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
this->m_pMainWnd = pFrame;
// To create the main window, this code creates a new frame window
// object and then sets it as the application's main window object.
IntegrateIntoOutlook();
//.........这里部分代码省略.........
BOOL CVecDemoApp::InitInstance()
{
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
if (!AfxOleInit())
{
AfxMessageBox("Ole Initialization Failed");
return FALSE;
}
HDC hdc=GetDC(NULL);
ASSERT(hdc!=NULL);
int bpp = GetDeviceCaps(hdc, BITSPIXEL);
ReleaseDC(NULL, hdc);
if(bpp <= 8)
{
AfxMessageBox("This application requires more then 256 colors.");
return FALSE;
}
#if _MSC_VER<8
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Monfort Software"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CVecDemoDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CVecDemoView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// main frame will not show itself on creation
m_nCmdShow = SW_HIDE;
// Dispatch commands specified on the command line
BOOL bFileOpen = FALSE;
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen)
{
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNew;
bFileOpen = TRUE;
}
if (!ProcessShellCommand(cmdInfo))
return FALSE;
((CMainFrame*)m_pMainWnd)->LoadWorkspace();
// show the main frame with the size that we loded from the registery
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
if(bFileOpen)
{
POSITION pos = pDocTemplate->GetFirstDocPosition();
pDocTemplate->GetNextDoc(pos)->OnOpenDocument(cmdInfo.m_strFileName);
}
else
{
POSITION pos = pDocTemplate->GetFirstDocPosition();
CVecDemoDoc* pAlbDoc = (CVecDemoDoc*)pDocTemplate->GetNextDoc(pos);
pos = pAlbDoc->GetFirstViewPosition();
CVecDemoView* pVecDemoView = (CVecDemoView*) pAlbDoc->GetNextView(pos);
pVecDemoView->ClearDocument();
}
return TRUE;
}
BOOL CMiniDebuggerApp::InitInstance()
{
// InitCommonControlsEx() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// Set this to include all the common control classes you want to use
// in your application.
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need
// Change the registry key under which our settings are stored
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(4); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMiniDebuggerDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMiniDebuggerView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line. Will return FALSE if
// app was launched with /RegServer, /Register, /Unregserver or /Unregister.
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// call DragAcceptFiles only if there's a suffix
// In an SDI app, this should occur after ProcessShellCommand
return TRUE;
}
请发表评论