Ejemplo n.º 1
0
Archivo: main.cpp Proyecto: jpn/openmw
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Now we make sure the current dir is set to application path
    QDir dir(QCoreApplication::applicationDirPath());

    #if defined(Q_OS_MAC)
    if (dir.dirName() == "MacOS") {
        dir.cdUp();
        dir.cdUp();
        dir.cdUp();
    }
    #endif

    QDir::setCurrent(dir.absolutePath());

    // Load the stylesheet
    QFile file("./launcher.qss");

    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    app.setStyleSheet(styleSheet);

    MainDialog dialog;
    return dialog.exec();

}
Ejemplo n.º 2
0
int WINAPI _tWinMain(HINSTANCE  hInstance,
                     HINSTANCE  /*hPrevInstance*/,
                     LPTSTR     lpstrCmdLine,
                     int        nCmdShow)
{

    g_hInstance = hInstance;

	HRESULT hr =    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

    if (FAILED(hr))
    {
        MessageBox(NULL, TEXT("CoInitialize failed."), NULL, MB_ICONSTOP);
        return 1;
    }

	MainDialog *pDlg = new MainDialog();
	if (pDlg == NULL)
	{
        MessageBox(NULL, TEXT("Out of memory."), NULL, MB_ICONSTOP);
	}
	else
	{
		pDlg->ShowDialog(hInstance, NULL);

		delete pDlg;
	}




    CoUninitialize();

    return 0;
}
Ejemplo n.º 3
0
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpCmdLine*/, int nCmdShow)

{

	CPaintManagerUI::SetInstance(hInstance);
	CWndShadow::Initialize(hInstance);
	CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath() + _T("\\FileTree\\"));
	//CPaintManagerUI::SetResourceZip(_T("Control.zip"),true);

	HRESULT Hr = ::CoInitialize(NULL);
	if( FAILED(Hr) ) return 0;
	
	MainDialog* pFrame = new MainDialog();
	if( pFrame == NULL ) 
		return 0;

	pFrame->Create(NULL, _T("TokenControl"), 
		UI_WNDSTYLE_FRAME,
		UI_WNDSTYLE_EX_FRAME, 0, 0, 300, 500);

	pFrame->CenterWindow();
	::ShowWindow(*pFrame, SW_SHOW);
	CPaintManagerUI::MessageLoop();

	::CoUninitialize();
	return 0;
}
Ejemplo n.º 4
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
 	MSG msg = {0};
	
	INITCOMMONCONTROLSEX icex;
	DWORD dwICC = ICC_ANIMATE_CLASS | \
							ICC_BAR_CLASSES | \
							ICC_COOL_CLASSES | \
							ICC_DATE_CLASSES | \
							ICC_LISTVIEW_CLASSES | \
							ICC_PROGRESS_CLASS | \
							ICC_TAB_CLASSES | \
							ICC_TREEVIEW_CLASSES | \
							ICC_UPDOWN_CLASS | \
							ICC_USEREX_CLASSES | \
							ICC_WIN95_CLASSES;

	icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
	icex.dwICC  = dwICC;
	::InitCommonControlsEx(&icex);

	if(CheckInstance() == TRUE) return FALSE;

	MainDialog mainDlg;
	return (int)mainDlg.Create(hInstance, NULL);
};
Ejemplo n.º 5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainDialog w;
    w.show();

    return a.exec();
}
Ejemplo n.º 6
0
	BOOL InitInstance()
	{
		Session::InitDB();
		MainDialog dlg;
		m_pMainWnd = &dlg;
		dlg.DoModal();
		return TRUE;
	}
Ejemplo n.º 7
0
int main(int argc, char *argv[]) 
{
  // Setting up the app
  QApplication CsvParser(argc, argv);

  MainDialog *dialog = new MainDialog;
  dialog->show();
  return CsvParser.exec();
}
Ejemplo n.º 8
0
int main(int argc, char** argv)
{
    Database database("address_book_db", "root", "wwwggg");
    if (!database.isOpen())
        return 1;

    QApplication app(argc, argv);
    MainDialog mainDialog;
    mainDialog.show();
    return app.exec();
}
Ejemplo n.º 9
0
int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QTextCodec::setCodecForCStrings (QTextCodec::codecForName("UTF-8"));
    MainDialog m;
    m.show();
	
    if ( startMainApp() == 0 )
    {
        //we are closing!
    }
	
    return 0;
}
Ejemplo n.º 10
0
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, INT /*nCmdShow*/)
{
    (void)HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);

    // Initialize the COM library.
    HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);

    if (FAILED(hr))
    {
        MessageBox(NULL, L"CoInitialize failed.", NULL, MB_ICONSTOP);
        return 0;
    }

    // Initialize the common control library.
    INITCOMMONCONTROLSEX icc;
    icc.dwSize = sizeof(icc);
    icc.dwICC = ICC_STANDARD_CLASSES | ICC_BAR_CLASSES;
    if (!InitCommonControlsEx(&icc))
    {
        MessageBox(NULL, L"InitCommonControlsEx failed.", NULL, MB_ICONSTOP);
        CoUninitialize();
        return 0;
    }

    // Initialize our custom slider class.
    hr = Slider_Init(); 
    if (FAILED(hr))
    {
        MessageBox(NULL, L"Slider_Init failed.", NULL, MB_ICONSTOP);
        CoUninitialize();
        return 0;
    }

    // Create and show the dialog.
    MainDialog *pDlg = new (std::nothrow) MainDialog();
    if (pDlg == NULL)
    {
        MessageBox(NULL, L"Out of memory.", NULL, MB_ICONSTOP);
    }
    else
    {
        pDlg->ShowDialog(hInstance);

        delete pDlg;
    }

    CoUninitialize();
    return 0;
}
Ejemplo n.º 11
0
int main(int argc, char *argv[])
{
    SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
    if (SDL_Init(SDL_INIT_VIDEO) != 0)
    {
        qDebug() << "SDL_Init failed: " << QString::fromStdString(SDL_GetError());
        return 0;
    }

    QApplication app(argc, argv);

    // Now we make sure the current dir is set to application path
    QDir dir(QCoreApplication::applicationDirPath());

#ifdef Q_OS_MAC
    if (dir.dirName() == "MacOS") {
        dir.cdUp();
        dir.cdUp();
        dir.cdUp();
    }

    // force Qt to load only LOCAL plugins, don't touch system Qt installation
    QDir pluginsPath(QCoreApplication::applicationDirPath());
    pluginsPath.cdUp();
    pluginsPath.cd("Plugins");

    QStringList libraryPaths;
    libraryPaths << pluginsPath.path() << QCoreApplication::applicationDirPath();
    app.setLibraryPaths(libraryPaths);
#endif

    QDir::setCurrent(dir.absolutePath());

    // Support non-latin characters
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

    MainDialog mainWin;

    if (mainWin.setup()) {
        mainWin.show();
    } else {
        return 0;
    }

    int returnValue = app.exec();
    SDL_Quit();
    return returnValue;
}
Ejemplo n.º 12
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    if (!openConnection())
        return -1;

    MainDialog mainDialog;
    mainDialog.setTitle("Статистика филиала \"МЦ АУВД\"");
    mainDialog.showMaximized();

    app.exec();

    if (!closeConnection())
        return -1;

    return 0;
}
// Do main dialog, return TRUE if canceled
BOOL DoMainDialog(BOOL &optionPlaceStructs, BOOL &optionProcessStatic, BOOL &optionOverwriteComments, BOOL &optionAudioOnDone, BOOL &optionClean, BOOL &optionFullClear)
{
    MainDialog dlg = MainDialog(optionPlaceStructs, optionProcessStatic, optionOverwriteComments, optionAudioOnDone, optionClean, optionFullClear);
    if (dlg.exec())
    {
        #define CHECKSTATE(obj,var) var = dlg.obj->isChecked()
        CHECKSTATE(checkBox1, optionPlaceStructs);
        CHECKSTATE(checkBox2, optionProcessStatic);
        CHECKSTATE(checkBox3, optionOverwriteComments);
        CHECKSTATE(checkBox4, optionAudioOnDone);
        CHECKSTATE(checkBox5, optionClean);
        CHECKSTATE(checkBox6, optionFullClear);
        #undef CHECKSTATE

        return(FALSE);
    }
    return(TRUE);
}
Ejemplo n.º 14
0
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int show)
{
	MainDialog dlg;
	WTL::CMessageLoop loop;
	int ret = 1;
	
	CoInitialize(NULL);
	_Module.Init(NULL, hinst);
	_Module.AddMessageLoop(&loop);
	if(dlg.Create(NULL)) {
		dlg.ShowWindow(show);
		ret = loop.Run();
	}
	_Module.RemoveMessageLoop();
	_Module.Term();
	CoUninitialize();
	
	return ret;
}
Ejemplo n.º 15
0
BOOL CalculatorApp::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));

	// 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("Calculator-Framebassman"));

	MainDialog dlg;
	m_pMainWnd = &dlg;
    dlg.DoModal();
	return FALSE;
}
BOOL AudioQualityIdentificationApp::InitInstance()
{
    assert(!atExit);
    atExit = new base::AtExitManager;

    SetErrorMode(SEM_NOGPFAULTERRORBOX);
    SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);

    // 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 initControls;
    initControls.dwSize = sizeof(initControls);

    // Set this to include all the common control classes you want to use
    // in your application.
    initControls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&initControls);

    CWinApp::InitInstance();

    MainDialog dialog;
    m_pMainWnd = &dialog;
    INT_PTR response = dialog.DoModal();
    if (response == IDOK) {
        // TODO: Place code here to handle when the dialog is
        // dismissed with OK
    } else if (response == IDCANCEL) {
        // TODO: Place code here to handle when the dialog is
        // dismissed with Cancel
    }

    // Since the dialog has been closed, return FALSE so that we exit the
    //  application, rather than start the application's message pump.
    return FALSE;
}
Ejemplo n.º 17
0
int main(int argc, char *argv[])
{
	#if defined ENABLE_CRT_MEM_LEAK
	#if defined _DEBUG
	// 内存检测
	EnableMemLeakCheck();
	//_CrtSetBreakAlloc(78314);
	#endif
	#endif
	//QTextCodec *gbk = QTextCodec::codecForName("gb18030");
	//QTextCodec *gbk = QTextCodec::codecForName("GB2312");
	//QTextCodec *gbk = QTextCodec::codecForName("system");
	//QTextCodec *gbk = QTextCodec::codecForName("GBK");
	//QTextCodec *utf8 = QTextCodec::codecForName("UTF-8");
    //QTextCodec::setCodecForTr(gbk);
    //QTextCodec::setCodecForLocale(gbk);
	//QTextCodec::setCodecForLocale(utf8);
    //QTextCodec::setCodecForCStrings(gbk);
	//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));

	#if QT_VERSION < QT_VERSION_CHECK(5,0,0)   
	#if defined(_MSC_VER) && (_MSC_VER < 1600)	//VS版本低于VS2010    
		QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));
	#else    
		QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
	#endif    
	#else
		// 设置本地 Qt 认为的编码为 UTF-8,但是 VS 中文本地仍然是 GB2312 编码
		QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));	// 执行编码需要 UTF-8,不要再设置别的编码
	#endif

    QApplication app(argc, argv);
    MainDialog window;
    window.show();
    return app.exec();
}
Ejemplo n.º 18
0
Bool SubDialogTest::RestoreLayout(void* secret)
{
	return dlg.RestoreLayout(ID_SUBDIALOGTEST, 0, secret);
}
Ejemplo n.º 19
0
void MainFrame::OnClick(TNotifyUI& msg)
{
	WindowImplBase::OnClick(msg);
	if (_tcsicmp(msg.pSender->GetName(), kHideLeftMainPannelControlName) == 0)
	{
		CControlUI* left_main_pannel = m_PaintManager.FindControl(kLeftMainPannelControlName);
		CControlUI* hide_left_main_pannel = m_PaintManager.FindControl(kHideLeftMainPannelControlName);
		CControlUI* show_left_main_pannel = m_PaintManager.FindControl(kShowLeftMainPannelControlName);
		if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL))
		{
			hide_left_main_pannel->SetVisible(false);
			left_main_pannel->SetVisible(false);
			show_left_main_pannel->SetVisible(true);
		}
	}
	else if (_tcsicmp(msg.pSender->GetName(), kShowLeftMainPannelControlName) == 0)
	{
		CControlUI* left_main_pannel = m_PaintManager.FindControl(kLeftMainPannelControlName);
		CControlUI* hide_left_main_pannel = m_PaintManager.FindControl(kHideLeftMainPannelControlName);
		CControlUI* show_left_main_pannel = m_PaintManager.FindControl(kShowLeftMainPannelControlName);
		if ((left_main_pannel != NULL) && (show_left_main_pannel != NULL) && (hide_left_main_pannel != NULL))
		{
			hide_left_main_pannel->SetVisible(true);
			left_main_pannel->SetVisible(true);
			show_left_main_pannel->SetVisible(false);
		}
	}
	else if (_tcsicmp(msg.pSender->GetName(), kSignatureTipsControlName) == 0)
	{
		msg.pSender->SetVisible(false);
		CEditUI* signature = static_cast<CEditUI*>(m_PaintManager.FindControl(kSignatureControlName));
		if (signature != NULL)
		{
			signature->SetText(msg.pSender->GetText());
			signature->SetVisible(true);
		}
	}
	else if (_tcsicmp(msg.pSender->GetName(), kSearchEditTipControlName) == 0)
	{
		msg.pSender->SetVisible(false);
		CEditUI* search_edit = static_cast<CEditUI*>(m_PaintManager.FindControl(kSearchEditControlName));
		if (search_edit != NULL)
		{
			search_edit->SetText(msg.pSender->GetText());
			search_edit->SetVisible(true);
		}
	}
	else if (_tcsicmp(msg.pSender->GetName(), kChangeBkSkinControlName) == 0)
	{
		CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
		if (background != NULL)
		{
			TCHAR szBuf[MAX_PATH] = { 0 };
			++bk_image_index_;
			if (kBackgroundSkinImageCount < bk_image_index_)
				bk_image_index_ = 0;

			_stprintf_s(szBuf, MAX_PATH - 1, _T("file='bg%d.png' corner='600,200,1,1'"), bk_image_index_);

			background->SetBkImage(szBuf);

			SkinChangedParam param;
			CControlUI* background = m_PaintManager.FindControl(kBackgroundControlName);
			if (background != NULL)
			{
				param.bkcolor = background->GetBkColor();
				if (_tcslen(background->GetBkImage()) > 0)
				{
					_stprintf_s(szBuf, MAX_PATH - 1, _T("bg%d.png"), bk_image_index_);
				}

				param.bgimage = szBuf;
			}
			skin_changed_observer_.Broadcast(param);
		}
	}
	else if (_tcsicmp(msg.pSender->GetName(), kChangeColorSkinControlName) == 0)
	{
		CDuiRect rcWindow;
		GetWindowRect(m_hWnd, &rcWindow);
		rcWindow.top = rcWindow.top + msg.pSender->GetPos().bottom;
		new ColorSkinWindow(this, rcWindow);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("phone")))
	{
		logic::GetLogic()->asynNotifyObserver(module::KEY_LOGIN_USERID,10);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQpalycenter")))
	{
		logic::GetLogic()->removeObserver(this);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("MainMenu")))
	{
		CMenuWnd* pMenu = new CMenuWnd(m_hWnd);
		DuiLib::CPoint point = msg.ptMouse;
		ClientToScreen(m_hWnd, &point);
		STRINGorID xml(_T("menutest.xml"));
		pMenu->Init(NULL, xml, _T("xml"), point);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("ToolsBtn")))//设置按钮
	{
		MakeGroupWnd* pFrame = new MakeGroupWnd();
		if (pFrame == NULL) return;
		pFrame->Create(NULL, _T("MakeGroupWnd"), UI_WNDSTYLE_FRAME, WS_EX_STATICEDGE | WS_EX_APPWINDOW, 0, 0, 600, 800);
		pFrame->CenterWindow();
		pFrame->ShowWindow(true);

	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQSafeBtn")))//安全中心
	{
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("messageCenterBtn")))//消息中心
	{
		FloatWnd* pFloatWnd = new FloatWnd();
		if (pFloatWnd == NULL) return;
		pFloatWnd->Create(m_hWnd, _T("FloatWnd"), UI_WNDSTYLE_FRAME|WS_THICKFRAME,  WS_EX_TOOLWINDOW | WS_EX_TOPMOST| WS_EX_STATICEDGE, 0, 0, 0, 0);
		//pFloatWnd->ShowWindow(true);
		pFloatWnd->BringToTop();
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QzoneBtn")))
	{

	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("QQTradeCenterBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("paipaiBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("PaiPaiChongzhiBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("addBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("friend_circleBtn")))
	{
		LoginWnd* pLoginWnd = new LoginWnd();
		if (pLoginWnd == NULL) return;
		pLoginWnd->Create(NULL, _T("LoginWnd"), /*WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS*/UI_WNDSTYLE_FRAME | WS_POPUP, 0/*WS_EX_LAYERED*/, 0, 0, 0, 0);
		pLoginWnd->CenterWindow();
		pLoginWnd->ShowWindow(true); 
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("mailBtn")))
	{
		MainDialog* pMainDialog = new MainDialog();
		if (pMainDialog == NULL) return;
		pMainDialog->Create(NULL, _T("MainDialog"), UI_WNDSTYLE_FRAME | WS_POPUP, 0, 0, 0, 0, 0);
		pMainDialog->CenterWindow();
		pMainDialog->ShowWindow(true);
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("XiaoYouBtn")))
	{
		int n = 0;
		n++;
	}
	else if (0 == _tcsicmp(msg.pSender->GetName(), _T("sosoBtn")))
	{
		int n = 0;
		n++;
	}
}
Ejemplo n.º 20
0
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPWSTR /*lpCmdLine*/, INT /*nCmdShow*/)
{
    // Create and show the dialog, we changed the application to support Modeless dialog
    MainDialog *pDlg = new (std::nothrow) MainDialog();
    if (pDlg == NULL)
    {
        MessageBox(NULL, TEXT("Out of memory."), NULL, MB_ICONSTOP);
    }
    else
    {
        // create and show window
        pDlg->ShowDialog(hInstance);
    }

    MSG msg = {};

    HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_MODELESS_DLG_ACCL));

    /* while (TRUE)
    {
        if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
        {
            if (Msg.message == WM_QUIT)
                break;
            else
            {
                if (Msg.message == WM_KEYDOWN || Msg.message == WM_LBUTTONDOWN)
                {
                    if (Msg.wParam == VK_END)
                        Msg.wParam = VK_TAB;
                    if (!IsDialogMessage(hwnd, &Msg))
                    {
                        TranslateMessage(&Msg);
                        DispatchMessage(&Msg);
                    }
                }
            }// els
        }
    }*/

    /*iRet = GetMessage(&msg, NULL, 0, 0);
    We need to pre translate keyboard events here, so can't use GetMessage

    solution is to use PeekMessage, ref: http://stackoverflow.com/questions/2441457/keyboard-input-the-win32-message-loop
    */
    __pragma(warning(disable:4127))

    while (TRUE)
    { 
        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
            if (msg.message == WM_QUIT) {
                PostQuitMessage(0);
                break;
            }

            if (msg.message != WM_INITDIALOG) {
                if (msg.message == WM_KEYUP) {
                    if (pDlg != NULL)
                    {
                        pDlg->ProcessMessage(pDlg->m_hDlg, msg.message, msg.wParam, msg.lParam);
                    }
                }
            }
            
            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg) || !IsDialogMessage(pDlg->GetHwnd(), &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    }

    // time to destroy the dialog box
    delete pDlg;

    return msg.wParam;
}
Ejemplo n.º 21
0
int SmartWinMain( SmartWin::Application & app )
{
	MainDialog nd;
	nd.createDialog(IDD_MAINDLG);
	return 0;
}
Ejemplo n.º 22
0
Bool SubDialogTest::Execute(BaseDocument* doc)
{
	return dlg.Open(DLG_TYPE_ASYNC, ID_SUBDIALOGTEST, -1, -1);
}
Ejemplo n.º 23
0
BOOL Application::InitInstance()
{
  // 如果一个运行在 Windows XP 上的应用程序清单指定要
	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// 将它设置为包括所有要在应用程序中使用的
	// 公共控件类。
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

  HANDLE hMutex = CreateMutex(NULL, TRUE, APPID);
  if (hMutex == NULL) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_ICONERROR | MB_OK);
    return FALSE;
  }
  if (GetLastError() == ERROR_ALREADY_EXISTS) {
    // application already running.
    return FALSE;
  }

	AfxEnableControlContainer();


	// 标准初始化
	// 如果未使用这些功能并希望减小
	// 最终可执行文件的大小,则应移除下列
	// 不需要的特定初始化例程
	// 更改用于存储设置的注册表项
	// TODO:  应适当修改该字符串,
	// 例如修改为公司或组织名
	SetRegistryKey(_T("ZMVision"));

  CoInitialize(NULL);

  if (!GuiResources::GetInstance()->Init()) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_OK | MB_ICONERROR);
    return FALSE;
  }

  for (int i = 1; i < __argc; i++) {
    if (_tcscmp(__targv[i], _T("-skipupdate")) == 0) {
      skipUpdate_ = true;
    }
  }

  if (WorkingParameters::GetInstance()->IsFTPInfoBlank())
  {
	  CInputNameKey inputDlg;
	  if (inputDlg.DoModal() != IDOK)
	  {
		  return FALSE;
	  }
  }

  SplashScreen splash;
  if (splash.DoModal() != IDOK) {
    return FALSE;
  }

  LoginDialog login;
  if (login.DoModal() != IDOK) {
    return FALSE;
  }

  if (!DebugLogger::GetInstance()->Init()) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_OK | MB_ICONERROR);
    return FALSE;
  }

	MainDialog dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO:  在此放置处理何时用
		//  “确定”来关闭对话框的代码
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO:  在此放置处理何时用
		//  “取消”来关闭对话框的代码
	}
	else if (nResponse == -1)
	{
		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
	}


	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
	//  而不是启动应用程序的消息泵。
	return FALSE;
}