BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.cx = 472; cs.cy = 460; if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE; }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs //需要调整此值,使得client大小恰好为1280*720 cs.cx = 1296; cs.cy = 778; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE; }
BOOL CSplashScreen::Create(CWnd* pParentWnd /*= nullptr*/) { BOOL bResult = FALSE; if (m_ouBitMapImage.LoadBitmap(IDR_BMP_SPLASH_SCREEN) == TRUE) { BITMAP BitMap; m_ouBitMapImage.GetBitmap(&BitMap); bResult = CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), nullptr, WS_POPUP | WS_VISIBLE, 0, 0, BitMap.bmWidth, BitMap.bmHeight, pParentWnd->GetSafeHwnd(), nullptr); } return bResult; }
BOOL CProjectWindow::Create() { #ifndef FLOATING_PROJECT_WINDOW char szProjectName[512]; sprintf(szProjectName, "Project [%s]", m_Project->GetGameSubDirectory()); // create the window CMDIChildWnd::Create( AfxRegisterWndClass(CS_NOCLOSE, NULL, NULL, AfxGetApp()->LoadIcon(IDI_PROJECT)), szProjectName, WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW); #endif // create widgets m_TreeControl.Create( WS_VISIBLE | WS_CHILD | TVS_SHOWSELALWAYS | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS | TVS_DISABLEDRAGDROP, CRect(0, 0, 0, 0), this, TreeID); //m_TreeControl.SetFocus(); HIMAGELIST image_list = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 3, 1); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_PV_GAME_SETTINGS)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_PV_CLOSED_FOLDER)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_PV_OPEN_FOLDER)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_UNKNOWN)); // add filetype icons ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_MAP)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_SPRITESET)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_SCRIPT)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_SOUND)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_FONT)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_WINDOWSTYLE)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_IMAGE)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_ANIMATION)); ImageList_AddIcon(image_list, AfxGetApp()->LoadIcon(IDI_TILESET)); m_TreeControl.SetImageList(CImageList::FromHandle(image_list), TVSIL_NORMAL); // make sure they are in the right place RECT rect; GetClientRect(&rect); OnSize(0, rect.right, rect.bottom); Update(); DragAcceptFiles(); return TRUE; }
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; m_hCursor = LoadCursor(NULL, IDC_ARROW); cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, m_hCursor, HBRUSH(COLOR_WINDOW+1), NULL); m_hCursor = LoadCursor(NULL, IDC_ARROW); return TRUE; }
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.cx = 256; cs.cy = 240; cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW), reinterpret_cast<HBRUSH>(COLOR_WINDOW+1), NULL); return TRUE; }
///////////////////////////////////////////////////////////////////////////// // COpenScreenWnd message handlers void COpenScreenWnd::CreatScreenWnd() { //建立大小与位图大小相同的窗口 CreateEx(0,AfxRegisterWndClass(0,AfxGetApp()->LoadStandardCursor(IDC_ARROW)), "ImageScreen", WS_POPUP, 0, 0, m_bm.bmWidth, m_bm.bmHeight, NULL, NULL, NULL ); }
CPlVodWnd::CPlVodWnd(HWND hParent, UINT nID) //: CPlWnd(hParent, nID) { m_hParent = hParent; LPCTSTR lpWndClass = AfxRegisterWndClass(CS_DBLCLKS, NULL, (HBRUSH)GetStockObject(BLACK_BRUSH), 0); CString wndName; wndName.Format("Vod Player Window:%d",nID); CreateEx(NULL,lpWndClass,wndName, WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 0,0,0,0, hParent ,(HMENU)nID); }
BOOL CDownloads_Progress::Create(CWnd *pParent) { CRect rc (0, 0, 50, 50); if (FALSE == CWnd::Create (AfxRegisterWndClass (0, LoadCursor (NULL, IDC_ARROW), (HBRUSH) (COLOR_WINDOW+1), NULL) , NULL, WS_CHILD, rc, pParent, 0x121)) return FALSE; m_brProgress.CreateSolidBrush (RGB (255, 255, 255)); m_brDone.CreateSolidBrush (RGB (158, 208, 235)); m_penQ.CreatePen (PS_SOLID, 1, RGB (0, 115, 170)); return TRUE; }
// PreCreateWindow 先于 CWinApp::Run 执行 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if (!CFrameWnd::PreCreateWindow(cs)) return FALSE; // NOTE: 不要在这里设置窗口大小 (cs.cx, cs,cy), 因为将根据视频模式重新设置窗口大小 cs.style &= ~(WS_THICKFRAME | WS_MAXIMIZEBOX); cs.lpszClass = AfxRegisterWndClass(0, ::LoadCursor(NULL, IDC_ARROW), NULL, AfxGetApp()->LoadIcon(IDR_MAINFRAME)); m_Style = cs.style; m_Menu = cs.hMenu; return TRUE; }
BOOL COptionTreeColorPopUp::Create(CPoint pPoint, COLORREF crColor, CWnd* pParentWnd, LPCTSTR szDefaultText, LPCTSTR szCustomText) { // Declare variables CString strClassName; // Verify window ASSERT(pParentWnd && ::IsWindow(pParentWnd->GetSafeHwnd())); // Se variables m_wndParent = pParentWnd; m_crColor = m_crInitialColor = crColor; // Get the class name and create the window strClassName = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, 0, (HBRUSH) (COLOR_BTNFACE+1), 0); // Create window if (!CWnd::CreateEx(0, strClassName, _T(""), WS_POPUP | WS_VISIBLE, pPoint.x, pPoint.y, 100, 100, pParentWnd->GetSafeHwnd(), 0, NULL)) { return FALSE; } // Show window ShowWindow(SW_SHOWNA); // Store the Custom text if (szCustomText != NULL) { m_strCustomText = szCustomText; } // Store the Default Area text if (szDefaultText != NULL) { m_strDefaultText = szDefaultText; } // Set the window size SetWindowSize(); // Create the tooltips CreateToolTips(); // Find which cell (if any) corresponds to the initial color FindCellFromColor(crColor); // Capture all mouse events for the life of this window SetCapture(); return TRUE; }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE | WS_MINIMIZEBOX | WS_MAXIMIZEBOX; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE; }
BOOL CLayerView::Create(ILayerViewHandler* handler, CWnd* parent, sMap* map) { m_Handler = handler; m_Map = map; return CWnd::Create( AfxRegisterWndClass(0, LoadCursor(NULL, IDC_ARROW), NULL, LoadIcon(NULL, IDI_APPLICATION)), "LayerView", WS_CHILD | WS_VISIBLE | WS_VSCROLL, CRect(0, 0, 0, 0), parent, 0 ); }
BOOL CMeterCtrl::Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, HMENU nID) { // TODO: 在此添加专用代码和/或调用基类 static CString className = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW); return CWnd::CreateEx(WS_EX_STATICEDGE, //WS_EX_CLIENTEDGE | WS_EX_STATICEDGE, className, lpszWindowName, dwStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, pParentWnd->GetSafeHwnd(), (HMENU) nID); // return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, // rect, pParentWnd, nID, pContext); }
int CDlgResLib::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialogEx::OnCreate(lpCreateStruct) == -1) return -1; // Initialize a context for the view. CMyTreeView is my view and // is defined as : class CMyTreeView : public CTreeView. CCreateContext ccc; ccc.m_pNewViewClass = RUNTIME_CLASS(CMineSplitterView); ccc.m_pCurrentDoc = NULL; ccc.m_pNewDocTemplate = NULL; ccc.m_pLastView = NULL; ccc.m_pCurrentFrame = NULL; // Because the CFrameWnd needs a window class, we will create // a new one. I just copied the sample from MSDN Help. // When using it in your project, you may keep CS_VREDRAW and // CS_HREDRAW and then throw the other three parameters. CString strMyClass = AfxRegisterWndClass(CS_VREDRAW | CS_HREDRAW, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH) ::GetStockObject(WHITE_BRUSH), ::LoadIcon(NULL, IDI_APPLICATION)); // Create the frame window with "this" as the parent m_pFrameWnd = new CFrameWnd(); m_pFrameWnd->Create(strMyClass,"", WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CRect(0,0,1,1), this); m_pFrameWnd->ShowWindow(SW_SHOW); m_pFrameWnd->MoveWindow(0,0,300,300); m_wndSplitter.CreateStatic (m_pFrameWnd, 1, 2 , WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN , ID_JIANMO_COMPONENT_SPLITTER); theApp.m_nSpliterViewFlag = theApp.SPLVF_COMPONENT_TREE; m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS (CMineSplitterView) , CSize (100, 100), &ccc); theApp.m_nSpliterViewFlag = theApp.SPLVF_COMPONENT_LIST; m_wndSplitter.CreateView (0, 1, RUNTIME_CLASS (CMineSplitterView), CSize (200, 100), &ccc); m_wndSplitter.GetPane(0, 0)->ModifyStyle(NULL, WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_wndSplitter.GetPane(0, 1)->ModifyStyle(NULL, WS_CLIPSIBLINGS | WS_CLIPCHILDREN); theApp.m_nSpliterViewFlag = -1; return 0; }
int CKSFileDialog::DoModal() { ASSERT_VALID(this); DWORD nOffset = lstrlen(m_ofn.lpstrFile)+1; memset(m_ofn.lpstrFile+nOffset, 0, (m_ofn.nMaxFile-nOffset)*sizeof(TCHAR)); HWND hWndFocus = ::GetFocus(); BOOL bEnableParent = FALSE; //m_ofn.hwndOwner = PreModal(); CWnd dummy; dummy.CreateEx(NULL,AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)),NULL,NULL,CRect(0,0,0,0),NULL,NULL); dummy.CenterWindow(); CRect rect; dummy.GetWindowRect(rect); dummy.SetWindowPos(NULL, rect.left-230, rect.top-180, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); dummy.ShowWindow(SW_HIDE); m_ofn.hwndOwner=dummy.GetSafeHwnd(); if (m_ofn.hwndOwner==NULL) m_ofn.hwndOwner=PreModal(); if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { bEnableParent = TRUE; ::EnableWindow(m_ofn.hwndOwner, FALSE); } _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); ASSERT(pThreadState->m_pAlternateWndInit == NULL); m_ofn.lpfnHook = NULL; m_ofn.lpTemplateName = NULL; int nResult; if (m_bOpenFileDialog) nResult = ::GetOpenFileName(&m_ofn); else nResult = ::GetSaveFileName(&m_ofn); if (nResult) ASSERT(pThreadState->m_pAlternateWndInit == NULL); pThreadState->m_pAlternateWndInit = NULL; // WINBUG: Second part of special case for file open/save dialog. if (bEnableParent) ::EnableWindow(m_ofn.hwndOwner, TRUE); if (::IsWindow(hWndFocus)) ::SetFocus(hWndFocus); PostModal(); return nResult ? nResult : IDCANCEL; }
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs) { //Trace("CChildView::PreCreate - Initializing"); if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.style |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;//for OpenGL cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL); //Trace("CChildView::PreCreate - Done"); return TRUE; }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWndEx::PreCreateWindow(cs) ) return FALSE; // TODO: 在此处通过修改 // CREATESTRUCT cs 来修改窗口类或样式 cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX /*| WS_MAXIMIZEBOX | WS_MAXIMIZE*/ | WS_SYSMENU; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE; }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.cx = MainWindowWidth; cs.cy = MainWindowHeight; cs.style &= ~WS_MAXIMIZEBOX; cs.style &= ~WS_SIZEBOX; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.lpszClass = AfxRegisterWndClass(0); return TRUE; }
BOOL CKaiView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs HCURSOR h_cursor; h_cursor = LoadCursor (NULL, IDC_IBEAM); cs.lpszClass = AfxRegisterWndClass (CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNWINDOW | CS_DBLCLKS, h_cursor, NULL, // no brush NULL); return CView::PreCreateWindow (cs); }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style = WS_OVERLAPPED | WS_CAPTION | WS_THICKFRAME | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; HCURSOR hCus=AfxGetApp()->LoadStandardCursor(IDC_ARROW); HICON hIcn=AfxGetApp()->LoadIcon(IDR_MAINFRAME); cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS,hCus,NULL,hIcn); return TRUE; }
CPlFullWnd::CPlFullWnd(HWND hParent, UINT nID) { LPCTSTR wndClass = AfxRegisterWndClass(CS_DBLCLKS, AfxGetApp()->LoadStandardCursor(IDC_ARROW), (HBRUSH)GetStockObject(WHITE_BRUSH), 0); CreateEx(NULL,wndClass,_T("FullScreenWindow"), WS_POPUP | WS_CLIPCHILDREN, 0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN), NULL ,0,0); m_bFullScreen = FALSE; m_hNeedFullWnd = NULL; m_oldParent = NULL; memset(&m_OldWndPlacement,0,sizeof(m_OldWndPlacement)); }
BOOL CNSChartBarCtrl::Create(CWnd * pParentWnd, const CString& sTitle /* = _T("ListOptionCtrl")*/, const UINT nID /* = IDC_LISTOPTIONCTRL */) { //Register a windows class for the control bar static CString strWndClass; if ( strWndClass.IsEmpty()) { strWndClass = AfxRegisterWndClass(CS_DBLCLKS); } return COXSizeControlBar::Create(strWndClass, sTitle, WS_VISIBLE |WS_CHILD | CBRS_RIGHT|WS_CLIPCHILDREN, CFrameWnd::rectDefault, pParentWnd, nID); }
//----------------------------------------------------------------------------- BOOL CLayerManager::Create (CWnd *pParent, LPCTSTR lpszTitle) { CString strWndClass ; strWndClass =AfxRegisterWndClass (CS_DBLCLKS, LoadCursor (NULL, IDC_ARROW)) ; CRect rect (0, 0, 200, 150) ; if (!CAcUiDockControlBar::Create (strWndClass, lpszTitle, WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN,rect, pParent, 0)) return (FALSE) ; SetToolID (&clsCLayerManager) ; CLayerManager::EnableDocking(CBRS_ALIGN_LEFT | CBRS_ALIGN_RIGHT);// | CBRS_ALIGN_TOP CLayerManager::DockControlBar(CBRS_ALIGN_LEFT,CRect(0, 0, 200, 150)); CLayerManager::RestoreControlBar(); return (TRUE) ; }
BOOL COutputTabView::Create(CWnd * pParentWnd, const CString& sTitle /*_T("Output")*/, const UINT nID /*=ID_OUTPUTTABVIEW*/) { // register a window class for the control bar static CString strWndClass; if (strWndClass.IsEmpty()) { strWndClass = AfxRegisterWndClass(CS_DBLCLKS); } return COXSizeControlBar::Create(strWndClass, sTitle, WS_VISIBLE|WS_CHILD|CBRS_BOTTOM|WS_CLIPCHILDREN, CFrameWnd::rectDefault, pParentWnd, nID); }
BOOL CWndPopup::Create(CWnd *pParent, CRect rc, UINT uMessageID) { CString sWindowClassName = AfxRegisterWndClass(CS_DBLCLKS,::LoadCursor(NULL, IDC_ARROW)); m_uMessageID = uMessageID; m_point.x = rc.left; m_point.y = rc.top; if(CWnd::CreateEx(WS_EX_TOPMOST | WS_EX_TOOLWINDOW,sWindowClassName ,NULL,WS_POPUP, rc, pParent, 0, NULL)) { return FALSE; } return TRUE; }
FW_DropDownWnd::FW_DropDownWnd(CWnd* pParent) : m_nDropDownState(0), m_bMouseTracking(false), m_buttonRect(0,0,0,0) { CString str = AfxRegisterWndClass(CS_DBLCLKS); CreateEx(0,str, _T(""), WS_VISIBLE | WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, pParent->m_hWnd, NULL); CRect rect(0,0,250,100); CalcWindowRect(&rect); SetWindowPos(NULL,200,400,rect.Width(),rect.Height(), SWP_NOZORDER); }
bool CXTPTrayIcon::CreateMinimizeWnd(CWnd* pWndApp) { // Create the minimize window if (!::IsWindow(m_wndMinimize.m_hWnd)) { if (!m_wndMinimize.CreateEx(0, AfxRegisterWndClass(0), _T(""), WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, 0)) { return false; } } pWndApp->SetParent(&m_wndMinimize); return true; }
void CWaveformWnd::Create(CWnd *p_parent, CRect &p_rect, CWaveformBuffer *p_buffer) { CString winclass = AfxRegisterWndClass(0, 0, 0, 0); CWnd::CreateEx(0, winclass, TEXT("Waveform"), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS , p_rect, p_parent, 0); m_buffer = p_buffer; // Tell the buffer we are installed m_buffer->AddView(this); }
void CColorButton::OnPaint() { if (m_preview.m_hWnd == NULL) { CRect rc; GetClientRect(rc); rc.right= rc.left + rc.Width() / 3; rc.DeflateRect(4, 4); VERIFY(m_preview.Create(AfxRegisterWndClass(0, 0, 0, 0), _T(""), WS_CHILD|WS_VISIBLE, rc, this, 4711)); ModifyStyle(0, WS_CLIPCHILDREN); } CButton::OnPaint(); }