bool WindowBase::OpenWindow(int width, int height, const String& name, uint32 windowstyle, bool show) { if ( IsWindowOpen() ) CloseWindow(); if ( IsWindowBind() ) UnbindWindow(); mWindowHandle = NULL; ::Rect rectWin = {0, 0, height, width }; WindowAttributes winAttribute = (windowstyle & WINDOW_FRAME) ? kWindowStandardDocumentAttributes : 0; if ( !(windowstyle & WINDOW_SIZE) ) winAttribute &= ~kWindowResizableAttribute; if ( !(windowstyle & WINDOW_MINIMIZE) ) winAttribute &= ~kWindowFullZoomAttribute; winAttribute |= kWindowStandardHandlerAttribute|kWindowMetalAttribute; PRCORE_ASSERT_EXCEPTION( noErr != CreateNewWindow (kDocumentWindowClass,winAttribute, &rectWin,&mWindowHandle) ); mIsOpen = true; RenameWindow(name); ::SetWindowBounds ( mWindowHandle,kWindowContentRgn,&rectWin); EnableEvent(); if(show) ShowWindow(); ResizeWindow(width,height); if(show) { ::SetPortWindowPort(mWindowHandle); ::InvalWindowRect (mWindowHandle, &rectWin); MoveWindow(50,50); } return true; }
void CDlgOpentools::MyClose(int nCode) { //ZTools::WriteZToolsLog("--ShowWindow(SW_HIDE);"); //ShowWindow(SW_HIDE); //ZTools::WriteZToolsLog("ShowWindow(SW_HIDE);"); UnbindWindow(); //ZTools::WriteZToolsLog("UnbindWindow();"); //下面这句是有时DSE会跑到其它程序后面 //GetParent()->SetForegroundWindow(); //GetParent()->BringWindowToTop(); //ZTools::WriteZToolsLog("GetParent()->BringWindowToTop();"); //GetParent()->SetActiveWindow(); //ZTools::WriteZToolsLog("GetParent()->SetActiveWindow();"); m_nCode = nCode; //ZTools::WriteZToolsLog("m_nCode = nCode;"); //EndDialog(m_nCode); //ZTools::WriteZToolsLog("EndDialog(m_nCode);"); SetTimer(TIMER_CLOSE, 500, NULL); }
// release bound resources (funcdefs, etc) void BindShutdown( ASInterface *as ) { UnbindWindow(); }
// release bound resources (funcdefs, etc) void BindShutdown( ASInterface *as ) { UnbindWindow(); UnbindMatchMaker(); }