//Create Tool Tip BOOL CToolTip2::Create(CWnd* pParentWnd) { ASSERT(this != NULL ); ASSERT(pParentWnd != NULL); m_pParentWnd = pParentWnd; //Create font m_font.CreateFont(15, 0, 0, 0, FW_REGULAR, 0, 0, 0, 0, 0, 0, 0, 0, "MS Sans Serif"); CRect rectInitialSize(0,0,0,0);//Initial Window size. Will be dynamically changed later. return CreateEx(WS_EX_TOOLWINDOW , NULL, NULL,WS_POPUP | WS_CHILD | WS_CLIPSIBLINGS, rectInitialSize,pParentWnd, NULL, NULL); }
BOOL CTitleTip::Create(CWnd * pParentWnd) { ASSERT_VALID(pParentWnd); DWORD dwStyle = WS_POPUP; DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST; m_pParentWnd = pParentWnd; return CreateEx(dwExStyle, TITLETIP_CLASSNAME, NULL, dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL ); }
BOOL CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/) { if (!m_bitmap.LoadBitmap(IDB_SPLASH)) return FALSE; BITMAP bm; m_bitmap.GetBitmap(&bm); return CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL); }
BOOL CSplashScreenEx::Create(CWnd *pWndParent,LPCTSTR szText,DWORD dwTimeout,DWORD dwStyle) { ASSERT(pWndParent!=NULL); m_pWndParent = pWndParent; if (szText!=NULL) m_strText = szText; else m_strText=""; m_dwTimeout = dwTimeout; m_dwStyle = dwStyle; WNDCLASSEX wcx; wcx.cbSize = sizeof(wcx); wcx.lpfnWndProc = AfxWndProc; wcx.style = CS_DBLCLKS|CS_SAVEBITS; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = AfxGetInstanceHandle(); wcx.hIcon = NULL; wcx.hCursor = LoadCursor(NULL,IDC_ARROW); wcx.hbrBackground=::GetSysColorBrush(COLOR_BACKGROUND); wcx.lpszMenuName = NULL; wcx.lpszClassName = "SplashScreenExClass"; wcx.hIconSm = NULL; if (m_dwStyle & CSS_SHADOW) wcx.style|=CS_DROPSHADOW; ATOM classAtom = RegisterClassEx(&wcx); // didn't work? try not using dropshadow (may not be supported) if (classAtom==NULL) { if (m_dwStyle & CSS_SHADOW) { wcx.style &= ~CS_DROPSHADOW; classAtom = RegisterClassEx(&wcx); } else return FALSE; } //if (!CreateEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,"SplashScreenExClass",NULL,WS_POPUP,0,0,0,0,pWndParent->m_hWnd,NULL)) if (!CreateEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST,"SplashScreenExClass",NULL,WS_POPUP,0,0,0,0,NULL,NULL)) return FALSE; return TRUE; }
BOOL CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/) { // check whether device supports palettes CClientDC dc(AfxGetMainWnd()); if ((dc.GetDeviceCaps(RASTERCAPS) & RC_PALETTE) != 0) m_bSupportPalette = TRUE; else m_bSupportPalette = FALSE; // load from resources according to palette support presence if (m_bSupportPalette) { HBITMAP hBitmap; HPALETTE hPalette; hBitmap = LoadResourceBitmap(NULL, (LPCTSTR)MAKELONG((WORD)VDBA_GetSplashScreen_Bitmap_id(), 0), hPalette); if (hBitmap == NULL) return FALSE; if (hPalette == NULL) { // No palette: try to load as a DDB if (!m_bitmap.LoadBitmap(VDBA_GetSplashScreen_Bitmap_id())) return FALSE; } else { m_bHasPalette = TRUE; m_bitmap.Attach(hBitmap); m_palette.Attach(hPalette); } } else { // load as a DDB if (!m_bitmap.LoadBitmap(VDBA_GetSplashScreen_Bitmap_id())) return FALSE; } // Get bitmap width/height, for window create BITMAP bm; m_bitmap.GetBitmap(&bm); // Create "Verdana 8" font for the copyright information. LOGFONT lf; // Used to create the CFont. memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure. lf.lfHeight = -9; // Request a 8-pixel-high font strcpy(lf.lfFaceName, "Verdana"); // with face name "Verdana". m_font.CreateFontIndirect(&lf); // Create the font. BOOL bSuccess; bSuccess = CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL); return bSuccess; }
BOOL CXTPDockingPaneSidePanel::Create(CRect rc) { if (m_hWnd) return TRUE; if (!CreateEx(0, _T("XTPDockingPaneSidePanel"), _T(""), WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD, rc, GetDockingPaneManager()->GetSite(), 0)) { return FALSE; } m_pCaptionButtons->CheckForMouseOver(CPoint(-1, -1)); return TRUE; }
// The Create for simple top level windows. HWND JWnd :: Create ( LPCTSTR szName , DWORD dwStyle ) { return ( CreateEx ( 0 , JWNDDEFCLASS , szName , dwStyle , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , NULL , NULL ) ) ; }
//创建窗口 VOID CLayeredWindow::CreateLayered(CWnd * pWndControl, CRect & rcWindow) { //效验参数 ASSERT((pWndControl!=NULL)&&(pWndControl->m_hWnd!=NULL)); if ((pWndControl==NULL)||(pWndControl->m_hWnd==NULL)) return; //设置变量 m_pWndControl=pWndControl; //创建窗口 CreateEx(WS_EX_LAYERED,TEXT("STATIC"),TEXT(""),0,rcWindow,pWndControl,0L); return; }
BOOL CToolBarEx::Create( CWnd* pParentWnd, DWORD dwStyle, UINT nID /*=AFX_IDW_TOOLBAR*/ ) { if ( !CreateEx( pParentWnd, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_TOOLTIPS, dwStyle & ~CBRS_TOOLTIPS, CRect( 0, 0, 0, 0 ), nID ) ) { return FALSE; } GetToolBarCtrl().SetExtendedStyle( TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS ); 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 CMainFrame::Create(DWORD dwExStyle, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { LPCTSTR m_lpszClassName; m_lpszClassName = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW, LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_WINDOW+1), NULL); // TODO: Add your specialized code here and/or call the base class return CreateEx(dwExStyle, m_lpszClassName, _T(""), dwStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, pParentWnd->GetSafeHwnd(), NULL, NULL ); }
CTipWnd::CTipWnd(signed char opt /*=-1*/, UINT fmt /*=DT_NOCLIP|DT_NOPREFIX|DT_EXPANDTABS*/) { static CString strClass; if (strClass.IsEmpty()) { // Register window class strClass = AfxRegisterWndClass(0); ASSERT(!strClass.IsEmpty()); } m_opt_page = opt; m_hovering = m_visible = m_down = false; m_fmt = fmt; m_margins = CSize(2, 2); m_bg_colour = ::GetSysColor(COLOR_INFOBK); m_text_colour = ::GetSysColor(COLOR_INFOTEXT); m_stock_font = ANSI_VAR_FONT; m_alpha = 255; m_in = m_out = false; // Check if we can do transparent window if (m_2k == -1) { OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); // Work out if this is Windows 200 or better m_2k = (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5); // If W2K then get pointer to SetLayeredWindowAttributes HINSTANCE hh; if (m_2k && (hh = ::LoadLibrary("USER32.DLL")) != HINSTANCE(0)) m_pSLWAfunc = (PFSetLayeredWindowAttributes)::GetProcAddress(hh, "SetLayeredWindowAttributes"); } DWORD exStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST; if (m_2k) exStyle |= WS_EX_LAYERED; // This allows a transparent window VERIFY(CreateEx(exStyle, strClass, NULL, WS_POPUP | WS_BORDER, 0, 0, 0, 0, NULL, (HMENU)0)); ASSERT(m_hWnd != (HWND)0); }
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 CFrameWnd::Create( LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT &rect, CWnd *pParentWnd, LPCTSTR lpszMenuName, DWORD dwExStyle, CCreateContext *pContext ) /*****************************************************************/ { if( lpszMenuName != NULL ) { HINSTANCE hInstance = AfxFindResourceHandle( lpszMenuName, RT_MENU ); m_hMenuDefault = ::LoadMenu( hInstance, lpszMenuName ); } else { m_hMenuDefault = NULL; } return( CreateEx( dwExStyle, lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, (UINT)m_hMenuDefault, pContext ) ); }
///////////////////////////////////////////////////////////////////////////// // 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 ); }
///////////////////////////////////////////////////////////////////// // // CXInfoTip::Create() // // DESCRIPTION // // Creates the tip window // // RETURNS // // [BOOL] - TRUE on success, FALSE on failure // // PARAMETERS // // [pParentWnd] - Pointer to parent window // ///////////////////////////////////////////////////////////////////// BOOL CXInfoTip::Create(CWnd* pParentWnd) { BOOL bSuccess; // Must have a parent ASSERT(pParentWnd != NULL); bSuccess = CreateEx(NULL, m_szClass, NULL, WS_POPUP, 0, 0, 0, 0, pParentWnd->GetSafeHwnd(), NULL, NULL); // Use default GUI font for default font m_pFont = CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)); return bSuccess; }
BOOL COXTabViewContainer::Create(CWnd* pParentWnd, CRect rect/*=CRect(0,0,0,0)*/, DWORD dwStyle/*=WS_CHILD|WS_VISIBLE*/, UINT nID/*=AFX_IDW_PANE_FIRST*/) { ASSERT(pParentWnd != NULL); ASSERT(dwStyle & WS_CHILD); ASSERT(nID != 0); // the Windows scroll bar styles bits turn on the smart scrollbars DWORD dwCreateStyle=dwStyle&~(WS_HSCROLL|WS_VSCROLL); dwCreateStyle&=~WS_BORDER; dwCreateStyle|=WS_CHILD; // define our own window class WNDCLASS wndClass; wndClass.style=CS_DBLCLKS; wndClass.lpfnWndProc=AfxWndProc; wndClass.cbClsExtra=0; wndClass.cbWndExtra=0; wndClass.hInstance=AfxGetInstanceHandle(); wndClass.hIcon=0; wndClass.hCursor=::LoadCursor(NULL,IDC_ARROW); wndClass.hbrBackground=(HBRUSH)(COLOR_BTNFACE+1); wndClass.lpszMenuName=NULL; wndClass.lpszClassName=_T("TabViewContainer"); if(!AfxRegisterClass(&wndClass)) return FALSE; if (!CreateEx(WS_EX_CLIENTEDGE,wndClass.lpszClassName,NULL, dwCreateStyle,rect.left,rect.top,rect.Width(),rect.Height(), pParentWnd->m_hWnd,(HMENU)(INT_PTR)nID,NULL)) { return FALSE; // create invisible } // remove WS_EX_CLIENTEDGE style from parent window pParentWnd->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_DRAWFRAME); // sign ::SetWindowLongPtr(GetSafeHwnd(),GWL_USERDATA,ID_TABVIEWCONTAINER_SIGN); SetScrollStyle(0,TRUE); CalcLayout(); 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)); }
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 CSplashWnd::Create(CWnd* pParentWnd /*= NULL*/) { UINT image = IDB_SPLASH; if (!m_bitmap.LoadBitmap(image)) return FALSE; BITMAP bm; m_bitmap.GetBitmap(&bm); BOOL rc=CreateEx(0, AfxRegisterWndClass(0, AfxGetApp()->LoadStandardCursor(IDC_ARROW)), NULL, WS_POPUP | WS_VISIBLE, 0, 0, bm.bmWidth, bm.bmHeight, pParentWnd->GetSafeHwnd(), NULL); m_hBitmap = LoadResourceBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(image)); m_pBitmap = CBitmap::FromHandle(m_hBitmap); return rc; }
BOOL CFHDragWnd::Create(CRect rect, CFlatHeaderCtrl* pFlatHeaderCtrl, INT iItem, LPHDITEM lphdiItem) { ASSERT_VALID(pFlatHeaderCtrl); ASSERT(pFlatHeaderCtrl->IsKindOf(RUNTIME_CLASS(CFlatHeaderCtrl))); m_pFlatHeaderCtrl = pFlatHeaderCtrl; m_iItem = iItem; m_lphdiItem = lphdiItem; DWORD dwStyle = WS_POPUP|WS_DISABLED; DWORD dwExStyle = WS_EX_TOOLWINDOW|WS_EX_TOPMOST; return CreateEx(dwExStyle, FHDRAGWND_CLASSNAME, NULL, dwStyle, rect.left, rect.top, rect.Width(), rect.Height(), NULL, NULL, NULL ); }
BOOL CRulerWnd::CreateWnd() { if(!CreateEx(0, ::AfxRegisterWndClass(0,::LoadCursor(NULL,MAKEINTRESOURCE(IDC_ARROW)),GetSysColorBrush(COLOR_ACTIVEBORDER)), NULL, WS_POPUP, 0,0,MINWIDTH,MINHEIGHT, NULL, NULL)) { return FALSE; } SetWindowLong(m_hWnd, GWL_EXSTYLE, GetWindowLong(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED/*|WS_EX_TOOLWINDOW*/); ::SetLayeredWindowAttributes(m_hWnd, RGB(0, 0, 0), 255, LWA_ALPHA); return TRUE; }
BOOL wcSliderButton::Create(BOOL LeftBut, DWORD dwExStyle, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID) { // Create this control in any window BOOL bResult = CreateEx(dwExStyle, "EDIT", lpszWindowName, dwStyle, rect, pParentWnd, nID); if (bResult) { // call wcSliderButton::FindFolder() to initialize the internal data structures SetLeftButton(LeftBut); // Force a call to wcSliderButton::OnNcCalcSize() to calculate button size SetWindowPos(NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); // set the font to the font used by the parent window if (pParentWnd) SetFont (pParentWnd->GetFont()); } return bResult; }
void TZNotePage::CreateZ( ) { #ifdef DEBUG_ALL TraceLineS( "TZNotePage::CreateZ ", m_csTag ); #endif CRect rect; m_pWndParent->GetClientRect( rect ); m_pZNoteBook->AdjustRect( FALSE, &rect ); CreateEx( 0, "ZeidonCustomCtrl", m_csText, WS_CHILD, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, m_pWndParent->m_hWnd, (HMENU) -1 ); }
BOOL CControlFrameWnd::Create(LPCTSTR pszFrameTitle) { if (!CreateEx( 0, NULL, pszFrameTitle, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL)) { TRACE0("Warning: failed to create CControlFrameWnd\n"); return FALSE; } return TRUE; }
BOOL CMyToolTipWnd::Create(CWnd* pParentWnd) { CString strTooltipClassName = AfxRegisterWndClass(CS_SAVEBITS); // m_hFont = (HFONT) ::GetStockObject(ANSI_VAR_FONT); m_pParentWnd = pParentWnd; // CRect rect(0,0,0,0); return CreateEx(WS_EX_TOOLWINDOW | WS_EX_NOPARENTNOTIFY, strTooltipClassName, "", WS_BORDER | WS_POPUP | WS_DISABLED, 0, 0, 0, 0, pParentWnd->m_hWnd, NULL); }
/* CAudioVolume() */ CAudioVolume::CAudioVolume() { m_nMixersCount = 0L; m_hMixer = NULL; memset(&m_stMixerCaps,'\0',sizeof(MIXERCAPS)); m_lLevel = m_lMinLevel = m_lMaxLevel = m_lStepValue = 0L; m_dwVolumeControlID = 0L; // crea la finestra per la ricezione dei messaggi di notifica inviati da MCI CString strClassName = AfxRegisterWndClass(CS_BYTEALIGNCLIENT|CS_BYTEALIGNWINDOW,0,0,0); CreateEx(0,strClassName,"AudioVolumeClass",0,1,1,1,1,NULL,NULL,NULL); if(mixerInitialize()) if(mixerGetMasterVolumeControl()) mixerGetMasterVolumeValue(m_lLevel); }
BOOL CFileEditCtrl::Create(BOOL bFindFolder, DWORD dwExStyle, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID) { // Create this control in any window BOOL bResult = CreateEx(dwExStyle, _T("EDIT"), NULL, dwStyle, rect, pParentWnd, nID); if (bResult) { // Force a call to CFileEditCtrl::OnNcCalcSize() to calculate button size SetWindowPos(NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); // call CFileEditCtrl::FindFolder() to initialize the internal data structures bResult = SetFindFolder(bFindFolder); // set the font to the font used by the parent window if (pParentWnd) SetFont (pParentWnd->GetFont()); } return bResult; }
BOOL CLuaEditor::Create(CWnd *pParentWnd, UINT nCtrlId) { BOOL bCreated = CreateEx(0, "Scintilla","", WS_CHILD|WS_VISIBLE|WS_TABSTOP, CRect(0,0,0,0),pParentWnd,nCtrlId); if ( !bCreated ) return FALSE; m_fnScintilla = (int (__cdecl *)(void *,int,int,int)) SendMessage(SCI_GETDIRECTFUNCTION,0,0); m_ptrScintilla = (void *)SendMessage(SCI_GETDIRECTPOINTER,0,0); Sci(SCI_SETMARGINWIDTHN, 1, 0); return TRUE; }
BOOL ZListTip::Create( CWnd *pParentWnd ) { #ifdef DEBUG_ALL TraceLineS( "ZListTip::Create", "" ); #endif ASSERT_VALID( pParentWnd ); DWORD dwStyle = WS_BORDER | WS_POPUP; DWORD dwExStyle = WS_EX_TOOLWINDOW | WS_EX_TOPMOST; m_pParentWnd = pParentWnd; m_uToolTipTimerId = 0; m_nOffsetX = 0; return( CreateEx( dwExStyle, "ZeidonListTip", 0, dwStyle, 0, 0, 0, 0, pParentWnd->m_hWnd, 0, 0 ) ); }