int GameLoop::InitInstance() { int code = App::InitInstance(); InitCommonControls(); //img_pacman = ImageList_LoadBitmap(App::GetInstance(), MAKEINTRESOURCE(IDB_BITMAP1),32, 0, RGB(255, 0, 255)); XString title; title.LoadFromResource(IDS_APP_TITLE); XString wclass; wclass.LoadFromResource(IDC_OOPACMAN); RECT rect = game->get_map()->get_rect(); DWORD style = WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME; AdjustWindowRect(&rect, style, FALSE); if (!window.CreateWnd(title, style, CW_USEDEFAULT, 0, rect.right-rect.left, rect.bottom-rect.top, NULL, LPCTSTR(NULL)) ) return 1; SetMainWindow(&window); window.ShowWindow(_cmdShow); window.UpdateWindow(); return code; }
void InitMainWindow() { TFrameWindow * p_tfr_win; p_tfr_win = new TFrameWindow(0, "Mi propia ventana", new Dibuja); SetMainWindow( p_tfr_win ); }
////////////////////////////////////////////////////////// // mtlrchApp // ===== // Application intialization. // void mtlrchApp::InitMainWindow () { mdiClient = new mtlrchMDIClient; TDecoratedMDIFrame* frame = new TDecoratedMDIFrame(Name, MDI_MENU, *mdiClient, TRUE); nCmdShow = (nCmdShow != SW_SHOWMINNOACTIVE) ? SW_SHOWNORMAL : nCmdShow; // // Assign ICON w/ this application. // frame->SetIcon(this, IDI_MDIAPPLICATION); // // Menu associated with window and accelerator table associated with table. // frame->AssignMenu(MDI_MENU); // // Associate with the accelerator table. // frame->Attr.AccelTable = MDI_MENU; SetupSpeedBar(frame); TStatusBar *sb = new TStatusBar(frame, TGadget::Recessed, TStatusBar::CapsLock | TStatusBar::NumLock | TStatusBar::ScrollLock | TStatusBar::Overtype); frame->Insert(*sb, TDecoratedFrame::Bottom); SetMainWindow(frame); }
void TMyApp::InitMainWindow() { int ResIdNum = ID_DLGMSG1000; // Hi Res Dialog int h,w; GetDefaultWH(w,h); if(h <= 480) { ResIdNum = ID_DLGMSG640x480; } /// DlgMsg *Dw = new DlgMsg((TWindow*)0, ResIdNum); MainFramePtr = new TDecoratedFrame(0, ".", Dw ); const int small = 6; const big = 20; TControlBar *Cbar = new TControlBar(MainFramePtr); Cbar->Insert(*new TSeparatorGadget(big) ); // left margin on tool bar Cbar->Insert(*new TButtonGadget(CM_BM_RESCAN,ID_RESCAN,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(big) ); Cbar->Insert(*new TButtonGadget(CM_BM_SETUP,ID_SETUP,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(small) ); Cbar->Insert(*new TButtonGadget(CM_BM_PROJECTWIN,CM_OPENPROJECTWIN,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(small) ); Cbar->Insert(*new TButtonGadget(CM_BM_PRJPATH,ID_PATH,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(big) ); Cbar->Insert(*new TButtonGadget(CM_BM_NEWCLASS,ID_ADD_CLASS,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(big) ); Cbar->Insert(*new TButtonGadget(CM_BM_VARIABLE,ID_VARIABLE,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(big) ); Cbar->Insert(*new TButtonGadget(CM_BM_ADDFUNCTION,ID_ADD_EVENT,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(small) ); Cbar->Insert(*new TButtonGadget(CM_BM_DELFUNCTION,ID_DEL_MEMBER,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(big) ); Cbar->Insert(*new TButtonGadget(CM_BM_TOOLS,ID_TOOLS,TButtonGadget::Command) ); Cbar->Insert(*new TSeparatorGadget(small) ); Cbar->Insert(*new TButtonGadget(CM_BM_ABOUT,CM_ABOUT,TButtonGadget::Command) ); MainFramePtr->Insert(*Cbar, TDecoratedFrame::Top); Sbar = new TStatusBar(MainFramePtr,TGadget::Embossed, TStatusBar::CapsLock | TStatusBar::NumLock | TStatusBar::Overtype); MainFramePtr->Insert(*Sbar, TDecoratedFrame::Bottom); SetMainWindow( MainFramePtr ); MainWindow->AssignMenu(ID_MAINMENU); MainWindow->SetIcon(this,ICON2); MainWindow->Attr.Style &= ~WS_MAXIMIZEBOX; RecallWindowSizePos(); RecallProjectPath(NULL,TRUE); }
/*! @brief コントロールプロセスを初期化する MutexCPを作成・ロックする。 CControlTrayを作成する。 @author aroka @date 2002/01/07 @date 2002/02/17 YAZAKI 共有メモリを初期化するのはCProcessに移動。 @date 2006/04/10 ryoji 初期化完了イベントの処理を追加、異常時の後始末はデストラクタに任せる @date 2013.03.20 novice コントロールプロセスのカレントディレクトリをシステムディレクトリに変更 */ bool CControlProcess::InitializeProcess() { MY_RUNNINGTIMER( cRunningTimer, "CControlProcess::InitializeProcess" ); // アプリケーション実行検出用(インストーラで使用) m_hMutex = ::CreateMutex( NULL, FALSE, GSTR_MUTEX_SAKURA ); if( NULL == m_hMutex ){ ErrorBeep(); TopErrorMessage( NULL, _T("CreateMutex()失敗。\n終了します。") ); return false; } std::tstring strProfileName = to_tchar(CCommandLine::getInstance()->GetProfileName()); // 初期化完了イベントを作成する std::tstring strInitEvent = GSTR_EVENT_SAKURA_CP_INITIALIZED; strInitEvent += strProfileName; m_hEventCPInitialized = ::CreateEvent( NULL, TRUE, FALSE, strInitEvent.c_str() ); if( NULL == m_hEventCPInitialized ) { ErrorBeep(); TopErrorMessage( NULL, _T("CreateEvent()失敗。\n終了します。") ); return false; } /* コントロールプロセスの目印 */ std::tstring strCtrlProcEvent = GSTR_MUTEX_SAKURA_CP; strCtrlProcEvent += strProfileName; m_hMutexCP = ::CreateMutex( NULL, TRUE, strCtrlProcEvent.c_str() ); if( NULL == m_hMutexCP ){ ErrorBeep(); TopErrorMessage( NULL, _T("CreateMutex()失敗。\n終了します。") ); return false; } if( ERROR_ALREADY_EXISTS == ::GetLastError() ){ return false; } /* 共有メモリを初期化 */ if( !CProcess::InitializeProcess() ){ return false; } // コントロールプロセスのカレントディレクトリをシステムディレクトリに変更 TCHAR szDir[_MAX_PATH]; ::GetSystemDirectory( szDir, _countof(szDir) ); ::SetCurrentDirectory( szDir ); /* 共有データのロード */ // 2007.05.19 ryoji 「設定を保存して終了する」オプション処理(sakuext連携用)を追加 if( !CShareData_IO::LoadShareData() || CCommandLine::getInstance()->IsWriteQuit() ){ /* レジストリ項目 作成 */ CShareData_IO::SaveShareData(); if( CCommandLine::getInstance()->IsWriteQuit() ){ return false; } } /* 言語を選択する */ CSelectLang::ChangeLang( GetDllShareData().m_Common.m_sWindow.m_szLanguageDll ); RefreshString(); MY_TRACETIME( cRunningTimer, "Before new CControlTray" ); /* タスクトレイにアイコン作成 */ m_pcTray = new CControlTray; MY_TRACETIME( cRunningTimer, "After new CControlTray" ); HWND hwnd = m_pcTray->Create( GetProcessInstance() ); if( !hwnd ){ ErrorBeep(); TopErrorMessage( NULL, LS(STR_ERR_CTRLMTX3) ); return false; } SetMainWindow(hwnd); GetDllShareData().m_sHandles.m_hwndTray = hwnd; // 初期化完了イベントをシグナル状態にする if( !::SetEvent( m_hEventCPInitialized ) ){ ErrorBeep(); TopErrorMessage( NULL, LS(STR_ERR_CTRLMTX4) ); return false; } return true; }