本文整理汇总了C++中MainFrame::CreateEx方法的典型用法代码示例。如果您正苦于以下问题:C++ MainFrame::CreateEx方法的具体用法?C++ MainFrame::CreateEx怎么用?C++ MainFrame::CreateEx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainFrame
的用法示例。
在下文中一共展示了MainFrame::CreateEx方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
int App::Run(LPCTSTR /*lpstrCmdLine*/, int nCmdShow)
{
if (!ParseCommandLine())
return 0;
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
MainFrame wndMain;
if (!m_cszFilename.IsEmpty())
wndMain.OpenFileAtStart(m_cszFilename);
if (wndMain.CreateEx() == nullptr)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
return nRet;
}
示例2: Run
/// runs GeoTagTool main frame window
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
MainFrame wndMain;
if (wndMain.CreateEx() == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
int ret = theLoop.Run();
_Module.RemoveMessageLoop();
return ret;
}
示例3: Run
static int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
checkCommonControls();
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CEdit dummy;
CWindow splash;
CRect rc;
rc.bottom = GetSystemMetrics(SM_CYFULLSCREEN);
rc.top = (rc.bottom / 2) - 80;
rc.right = GetSystemMetrics(SM_CXFULLSCREEN);
rc.left = rc.right / 2 - 85;
dummy.Create(NULL, rc, _T(APPNAME) _T(" ") _T(VERSIONSTRING), WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
ES_CENTER | ES_READONLY, WS_EX_STATICEDGE);
splash.Create(_T("Static"), GetDesktopWindow(), splash.rcDefault, NULL, WS_POPUP | WS_VISIBLE | SS_USERITEM | WS_EX_TOOLWINDOW);
splash.SetFont((HFONT)GetStockObject(DEFAULT_GUI_FONT));
HDC dc = splash.GetDC();
rc.right = rc.left + 350;
rc.bottom = rc.top + 120;
splash.ReleaseDC(dc);
splash.HideCaret();
splash.SetWindowPos(NULL, &rc, SWP_SHOWWINDOW);
splash.SetWindowLongPtr(GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(&splashCallback));
splash.CenterWindow();
sTitle = _T(VERSIONSTRING) _T(" ") _T(CONFIGURATION_TYPE);
splash.SetFocus();
splash.RedrawWindow();
WinUtil::preInit();
startup(callBack, (void*)splash.m_hWnd);
if(BOOLSETTING(PASSWD_PROTECT)) {
PassDlg dlg;
dlg.description = TSTRING(PASSWORD_DESC);
dlg.title = TSTRING(PASSWORD_TITLE);
dlg.ok = TSTRING(UNLOCK);
if(dlg.DoModal(/*m_hWnd*/) == IDOK){
tstring tmp = dlg.line;
if (tmp != Text::toT(Util::base64_decode(SETTING(PASSWORD)))) {
ExitProcess(1);
}
}
}
splash.DestroyWindow();
dummy.DestroyWindow();
if(ResourceManager::getInstance()->isRTL()) {
SetProcessDefaultLayout(LAYOUT_RTL);
}
MainFrame wndMain;
rc = wndMain.rcDefault;
if( (SETTING(MAIN_WINDOW_POS_X) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_POS_Y) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_SIZE_X) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_SIZE_Y) != CW_USEDEFAULT) ) {
rc.left = SETTING(MAIN_WINDOW_POS_X);
rc.top = SETTING(MAIN_WINDOW_POS_Y);
rc.right = rc.left + SETTING(MAIN_WINDOW_SIZE_X);
rc.bottom = rc.top + SETTING(MAIN_WINDOW_SIZE_Y);
// Now, let's ensure we have sane values here...
if( (rc.left < 0 ) || (rc.top < 0) || (rc.right - rc.left < 10) || ((rc.bottom - rc.top) < 10) ) {
rc = wndMain.rcDefault;
}
}
int rtl = ResourceManager::getInstance()->isRTL() ? WS_EX_RTLREADING : 0;
if(wndMain.CreateEx(NULL, rc, 0, rtl | WS_EX_APPWINDOW | WS_EX_WINDOWEDGE) == NULL) {
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
if(BOOLSETTING(MINIMIZE_ON_STARTUP)) {
wndMain.ShowWindow(SW_SHOWMINIMIZED);
} else {
wndMain.ShowWindow(((nCmdShow == SW_SHOWDEFAULT) || (nCmdShow == SW_SHOWNORMAL)) ? SETTING(MAIN_WINDOW_STATE) : nCmdShow);
}
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
dummy.Create(NULL, rc, _T(APPNAME) _T(" ") _T(VERSIONSTRING), WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
ES_CENTER | ES_READONLY, WS_EX_STATICEDGE);
splash.Create(_T("Static"), GetDesktopWindow(), splash.rcDefault, NULL, WS_POPUP | WS_VISIBLE | SS_USERITEM | WS_EX_TOOLWINDOW);
//.........这里部分代码省略.........
示例4: Run
//.........这里部分代码省略.........
configuration.m_clientId = APPNAME " V:" VERSIONSTRING;
configuration.m_queueManagerVersion = VERSIONSTRING;
configuration.m_settingsManagerVersion = Util::toString(BUILDID);
configuration.m_mainHub = PeersUtils::PEERS_HUB;
if (!g_DisableSplash) {
splash.init();
Application::startup(splash.getCallback(), &configuration);
}
else {
class NOPCallback : public ProgressCallback {
public:
virtual void showMessage(const tstring&) { }
} nop;
Application::startup(&nop, &configuration);
}
PreviewApplication::List lst = FavoriteManager::getInstance()->getPreviewApps();
if (lst.empty()) {
FavoriteManager::getInstance()->addPreviewApp("VLC", ".\\VLC\\VLCPortable.exe", "%[file]", "avi;divx;mpg;mpeg");
}
else if (lst.size() == 1 && (Util::stricmp(lst[0]->getApplication(),"AVIPreview.exe") == 0
|| Util::stricmp(lst[0]->getApplication(),".\\AVIPreview.exe") == 0)) {
PreviewApplication fixed(*lst[0]);
fixed.setName("VLC");
fixed.setApplication(".\\VLC\\VLCPortable.exe");
FavoriteManager::getInstance()->updatePreviewApp(0, fixed);
}
if (BOOLSETTING(DOWNLOAD_DIRECTORY_SHORTCUT)) {
const string path = SETTING(DOWNLOAD_DIRECTORY);
File::ensureDirectory(path);
Shortcut::createDesktopShortcut(Text::toT(path), _T("Загрузки Peers"));
}
/*
if (Util::readRegistryBoolean(_T("SiteShortcut"), true)) {
TCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, MAX_PATH);
int iconIndex = 0;
for (int i = 0; i < IDI_SITE_SHORTCUT; ++i) {
if (LoadIcon(_Module.GetResourceInstance(), MAKEINTRESOURCE(i)) != NULL) {
++iconIndex;
}
}
Shortcut::createInternetShortcut(_T("http://www.cn.ru/"), _T("Портал cn.ru"), path, iconIndex);
}
*/
ChatBot::newInstance(); // !SMT!-CB
if(ResourceManager::getInstance()->isRTL()) {
SetProcessDefaultLayout(LAYOUT_RTL);
}
int nRet;
{// !SMT!-fix this will ensure that GUI (wndMain) destroyed before client library shutdown (gui objects may call lib)
MainFrame wndMain;
CRect rc = wndMain.rcDefault;
if( (SETTING(MAIN_WINDOW_POS_X) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_POS_Y) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_SIZE_X) != CW_USEDEFAULT) &&
(SETTING(MAIN_WINDOW_SIZE_Y) != CW_USEDEFAULT) ) {
rc.left = SETTING(MAIN_WINDOW_POS_X);
rc.top = SETTING(MAIN_WINDOW_POS_Y);
rc.right = rc.left + SETTING(MAIN_WINDOW_SIZE_X);
rc.bottom = rc.top + SETTING(MAIN_WINDOW_SIZE_Y);
// Now, let's ensure we have sane values here...
if( (rc.left < 0 ) || (rc.top < 0) || (rc.right - rc.left < 10) || ((rc.bottom - rc.top) < 10) ) {
rc = wndMain.rcDefault;
}
}
int rtl = ResourceManager::getInstance()->isRTL() ? WS_EX_RTLREADING : 0;
if(wndMain.CreateEx(NULL, rc, 0, rtl | WS_EX_APPWINDOW | WS_EX_WINDOWEDGE) == NULL) {
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
// Backup & Archive Settings at Starup!!! Written by Drakon.
if (BOOLSETTING(STARTUP_BACKUP))
{
tstring bkcmd = Text::toT(Util::getDataPath()) + _T("BackUp/BackupProfile.bat");
ShellExecute(NULL, NULL, bkcmd.c_str(), NULL, NULL, SW_HIDE);
}
// End of BackUp...
DestroyAndDetachWindow(splash);
if(nCmdShow == SW_SHOWMINIMIZED || BOOLSETTING(MINIMIZE_ON_STARTUP)) {
wndMain.ShowWindow(SW_SHOWMINIMIZED);
} else {
wndMain.ShowWindow(((nCmdShow == SW_SHOWDEFAULT) || (nCmdShow == SW_SHOWNORMAL)) ? SETTING(MAIN_WINDOW_STATE) : nCmdShow);
}
nRet = theLoop.Run();
ChatBot::deleteInstance(); // !SMT!-CB
_Module.RemoveMessageLoop();
} // !SMT!-fix
Application::shutdown();
return nRet;
}