CPictureCtrl::CPictureCtrl(void) { WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if (!(::GetClassInfo(hInst, WND_CLASSNAME, &wndcls))) { wndcls.style = CS_DBLCLKS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = 0; wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = (HBRUSH)COLOR_WINDOW; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = WND_CLASSNAME; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } m_pImage = NULL; m_clrBkgnd = ::GetSysColor(COLOR_WINDOW); m_nTimerId = 0; m_nDrawFlag = 0; }
CTitleTip::CTitleTip() { // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK +1); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = TITLETIP_CLASSNAME; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } m_dwLastLButtonDown = ULONG_MAX; m_dwDblClickMsecs = GetDoubleClickTime(); m_bCreated = FALSE; m_pParentWnd = NULL; }
///////////////////////////////////////////////////////////////////////////// // ZTitleTip // ZTitleTip::ZTitleTip( zLONG lHoverDelay ) { #ifdef DEBUG_ALL TraceLineI( "ZTitleTip::ctor Delay: ", lHoverDelay ); #endif // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle( ); if ( ::GetClassInfo( hInst, ZTITLETIP_CLASSNAME, &wndcls ) == 0 ) { // Otherwise we need to register a new class. wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = 0; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = 0; wndcls.lpszClassName = ZTITLETIP_CLASSNAME; if ( AfxRegisterClass( &wndcls ) == 0 ) AfxThrowResourceException( ); } m_dwLastLButtonDown = ULONG_MAX; m_ulDblClickInterval = GetDoubleClickTime( ); m_bCreated = FALSE; m_pParentWnd = 0; m_lHoverDelay = lHoverDelay; }
BOOL CToolTipWnd::Create(CWnd *pParentWnd) { ASSERT_VALID(pParentWnd); WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, m_szClassName, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = ::LoadCursor(NULL, IDC_ARROW); wndcls.hbrBackground = NULL; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = m_szClassName; if(!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); } } DWORD dwStyle = WS_POPUP; DWORD dwExStyle = WS_EX_TOOLWINDOW;// | WS_EX_TOPMOST; if (!CreateEx(dwExStyle, m_szClassName, NULL, dwStyle, 0, 0, 0, 0, pParentWnd->GetSafeHwnd(), NULL, NULL)) { return FALSE; } return TRUE; }
BOOL CFilePreviewDlgArea::RegisterWindowClass() { WNDCLASS wndcls; //HINSTANCE hInst = AfxGetInstanceHandle(); HINSTANCE hInst = AfxGetResourceHandle(); if (!(::GetClassInfo(hInst, _T("FilePreviewDlgArea"), &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_OWNDC | CS_SAVEBITS | CS_HREDRAW | CS_VREDRAW ; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadCursor(IDC_ARROW); wndcls.hbrBackground = NULL; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = _T("FilePreviewDlgArea"); if (!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
///////////////////////////////////////////////////////////////////////////// // ZListTip // ZListTip::ZListTip( zLONG lHoverDelay ) { #ifdef DEBUG_ALL TraceLineS( "ZListTip::ctor", "====================>>>>" ); #endif // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle( ); if ( ::GetClassInfo( hInst, "ZeidonListTip", &wndcls ) == 0 ) { // Otherwise we need to register a new class. wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = 0; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = 0; wndcls.lpszClassName = "ZeidonListTip"; if ( AfxRegisterClass( &wndcls ) == 0 ) AfxThrowResourceException( ); } m_ulDblClickInterval = 0; m_ptStart.x = m_ptStart.y = 0; m_lHoverDelay = lHoverDelay; }
BOOL CLabKnob::RegisterWindowClass() { WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); HBRUSH background; background = ::GetSysColorBrush(COLOR_BTNFACE); if (!(::GetClassInfo(hInst, "MFCLabKnob", &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = background; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = "MFCLabKnob"; if (!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
BOOL CTimeViewer::RegisterWindowClass() { WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if (!(::GetClassInfo(hInst, TIMEVIEWER_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = TIMEVIEWER_CLASSNAME; if (!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
BOOL CAdvComboBox::RegisterWindowClass() { WNDCLASS wndcls; HINSTANCE hInst; hInst = AfxGetInstanceHandle(); ASSERT( hInst != 0 ); if( !(::GetClassInfo(hInst, ADVCOMBOBOXCTRL_CLASSNAME, &wndcls)) ) { wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = 0; wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = (HBRUSH) (COLOR_WINDOW); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = ADVCOMBOBOXCTRL_CLASSNAME; if( !AfxRegisterClass(&wndcls) ) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
CTitleTip::CTitleTip() { // Register the window class if it has not already been registered. WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, TITLETIP_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_SAVEBITS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = LoadCursor( hInst, IDC_ARROW ); wndcls.hbrBackground = NULL;//(HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = TITLETIP_CLASSNAME; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } m_bHasBorder = true; m_bIsTransparent = false; }
BOOL CCamWnd::PreCreateWindow(CREATESTRUCT& cs) { WNDCLASS wc; HINSTANCE hInstance = AfxGetInstanceHandle(); if (::GetClassInfo(hInstance, CAMERA_WINDOW_CLASS, &wc) == FALSE) { // Register a new class memset (&wc, 0, sizeof(wc)); wc.style = CS_NOCLOSE | CS_OWNDC; wc.lpszClassName = CAMERA_WINDOW_CLASS; wc.hCursor = LoadCursor (NULL,IDC_ARROW); wc.lpfnWndProc = CamWndProc; if (AfxRegisterClass(&wc) == FALSE) Error ("CCamWnd RegisterClass: failed"); } cs.lpszClass = CAMERA_WINDOW_CLASS; cs.lpszName = "CAM"; if (cs.style != QE3_CHILDSTYLE) cs.style = QE3_SPLITTER_STYLE; BOOL bResult = CWnd::PreCreateWindow(cs); // See if the class already exists and if not then we need // to register our new window class. return bResult; }
BOOL CZegoAVView::RegisterWndClass(void) { WNDCLASS windowclass; HINSTANCE hInst = AfxGetInstanceHandle(); if (!(::GetClassInfo(hInst, L"ZegoAVView", &windowclass))) { windowclass.style = CS_DBLCLKS; windowclass.lpfnWndProc = ::DefWindowProc; windowclass.cbClsExtra = windowclass.cbWndExtra = 0; windowclass.hInstance = hInst; windowclass.hIcon = NULL; windowclass.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); windowclass.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); windowclass.lpszMenuName = NULL; windowclass.lpszClassName = L"ZegoAVView"; if (!AfxRegisterClass(&windowclass)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
/****************************************************************************** Function Name : RegisterWindowClass Input(s) : - Output : BOOL Functionality : Register the Indicator window as a custom Window control. Member of : CWaitIndicator Friend of : - Author(s) : Venkatanarayana Makam Date Created : Modifications : ******************************************************************************/ BOOL CWaitIndicator::RegisterWindowClass(void) { WNDCLASS wndcls; HINSTANCE hInst = AfxGetInstanceHandle(); if (!(::GetClassInfo(hInst, INDICATOR_CLASSNAME, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW ; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = nullptr; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = (HBRUSH) (COLOR_ACTIVEBORDER + 1); wndcls.lpszMenuName = nullptr; wndcls.lpszClassName = INDICATOR_CLASSNAME; if (!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
// CCustomListScrollableArea constructor CCustomListScrollableArea::CCustomListScrollableArea(CCustomList* parent) : m_CurrentSelectedRow(-1), m_RowCount(0), m_Parent(parent), m_ListRowsArray(NULL), m_ScrollPos(0) { // create font for text items LOGFONT lf; // Used to create the CFont. memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure. lf.lfHeight = CCustomList::FONTHEIGHT; strcpy(lf.lfFaceName, "Microsoft Sans Serif"); // with face name "Arial". m_Font.CreateFontIndirect(&lf); // Create the font. // create the row objects m_ListRowsArray = new CCustomListRowWnd*[CCustomList::MAXROWS]; for(INT32 i=0; i<CCustomList::MAXROWS; i++) { m_ListRowsArray[i] = NULL; } // set up window class for the rows WNDCLASS NewWindowClass; memset(&NewWindowClass, 0, sizeof(WNDCLASS)); NewWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS ; NewWindowClass.lpfnWndProc = ::DefWindowProc; NewWindowClass.hInstance = AfxGetInstanceHandle(); NewWindowClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); ;//(HBRUSH) ((COLOR_BTNFACE)); NewWindowClass.lpszMenuName = NULL; NewWindowClass.lpszClassName = _T("RowClass"); AfxRegisterClass(&NewWindowClass); }
/* * Method preamble ************************************************************ * * CLASS: TFXDataTip * NAME: RegisterWnd * * DESCRIPTION: This method registers the window class used by the DataTip * windows. This must be called after the class background * brush has been constructed. * * PARAMETERS: none * * RETURN TYPE: void * ****************************************************************************** * REVISION HISTORY * ****************************************************************************** */ void TFXDataTip::RegisterWnd( ) { // check for prior registration if (_registered) return; // initialise the basic information before registration HINSTANCE hInst = AfxGetInstanceHandle( ); // initialise the window class information WNDCLASS wndcls; wndcls.style = CS_SAVEBITS | CS_DBLCLKS; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = 0; wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wndcls.hbrBackground = *_brush; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = _T("TFXDataTip"); // register the window class if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); _registered = TRUE; }
//--------------------------------------------------------------------------------------------------------------// BOOL CFrmMain::PreCreateWindow(CREATESTRUCT& cs) { if (FALSE == CFrameWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle &= ~WS_EX_CLIENTEDGE; lstrcpyn(AfxGetThreadState()->m_szTempClassName, c_szSingleInstanceId, sizeof(AfxGetThreadState()->m_szTempClassName) / sizeof(TCHAR)); cs.lpszClass = AfxGetThreadState()->m_szTempClassName; WNDCLASS wndcls = {0}; HINSTANCE hInst = NULL; hInst = AfxGetInstanceHandle(); if (FALSE == ::GetClassInfo(hInst, cs.lpszClass, &wndcls)) { wndcls.style = 0; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInst; wndcls.hIcon = NULL; wndcls.hCursor = NULL; wndcls.hbrBackground = NULL; wndcls.lpszMenuName = NULL; wndcls.lpszClassName = cs.lpszClass; if (!AfxRegisterClass(&wndcls)) AfxThrowResourceException(); } else { ASSERT(wndcls.style == 0); return TRUE; } return TRUE; }
CFHDragWnd::CFHDragWnd() { // Register the window class if it has not already been registered. WNDCLASS wndclass; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, FHDRAGWND_CLASSNAME, &wndclass))) { // otherwise we need to register a new class wndclass.style = CS_SAVEBITS ; wndclass.lpfnWndProc = ::DefWindowProc; wndclass.cbClsExtra = wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor( hInst, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = FHDRAGWND_CLASSNAME; if (!AfxRegisterClass(&wndclass)) AfxThrowResourceException(); } m_pFlatHeaderCtrl = NULL; m_iItem = -1; m_lphdiItem = NULL; }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) { if(cs.hMenu != NULL) { ::DestroyMenu(cs.hMenu); // delete menu if loaded cs.hMenu = NULL; // no menu for this window } if(!CFrameWnd::PreCreateWindow(cs)) { return FALSE; } WNDCLASS wc; wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = AfxWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = AfxGetInstanceHandle(); wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = _T("Ditto"); // Create the QPaste window class if(!AfxRegisterClass(&wc)) { return FALSE; } cs.lpszClass = wc.lpszClassName; return TRUE; }
// コントロールのウィンドウクラス登録 bool CCellListCtrl::RegisterWindowClass() { HINSTANCE hInstance = AfxGetInstanceHandle(); WNDCLASS wndclass = {}; if (::GetClassInfo(hInstance, CELLLISTCTRL_CLASSNAME, &wndclass)) { // 既に登録済みなら何もしない return true; } wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = ::DefWindowProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = NULL; wndclass.hCursor = ::LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_3DFACE + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = CELLLISTCTRL_CLASSNAME; if (!AfxRegisterClass(&wndclass)) { return false; } return true; }
BOOL CXTPSyntaxEditTipWnd::RegisterWindowClass(HINSTANCE hInstance /*= NULL*/) { WNDCLASS wndcls; if (hInstance == NULL) hInstance = AfxGetInstanceHandle(); if (!(::GetClassInfo(hInstance, XTP_EDIT_CLASSNAME_LBOXTIP, &wndcls))) { // otherwise we need to register a new class wndcls.style = CS_SAVEBITS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = ::DefWindowProc; wndcls.cbClsExtra = wndcls.cbWndExtra = 0; wndcls.hInstance = hInstance; wndcls.hIcon = NULL; wndcls.hCursor = ::LoadCursor(0, IDC_ARROW); wndcls.hbrBackground = (HBRUSH)(COLOR_INFOBK + 1); wndcls.lpszMenuName = NULL; wndcls.lpszClassName = XTP_EDIT_CLASSNAME_LBOXTIP; if (!AfxRegisterClass(&wndcls)) { AfxThrowResourceException(); return FALSE; } } return TRUE; }
CTreeListColumnDropWnd::CTreeListColumnDropWnd() : m_pTreeListCtrl( NULL ) { // register the window class WNDCLASS wndclass; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, TLCDROPWND_CLASSNAME, &wndclass))) { wndclass.style = CS_HREDRAW | CS_VREDRAW ; //CS_SAVEBITS ; wndclass.lpfnWndProc = ::DefWindowProc; wndclass.cbClsExtra = wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor( hInst, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = TLCDROPWND_CLASSNAME; if (!AfxRegisterClass(&wndclass)) AfxThrowResourceException(); } if( g_lpfnUpdateLayeredWindow == NULL || g_lpfnSetLayeredWindowAttributes == NULL ) { HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL")); g_lpfnUpdateLayeredWindow = (lpfnUpdateLayeredWindow)GetProcAddress( hUser32, _T("UpdateLayeredWindow") ); g_lpfnSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress( hUser32, _T("SetLayeredWindowAttributes") ); if( g_lpfnUpdateLayeredWindow == NULL || g_lpfnSetLayeredWindowAttributes == NULL ) m_bLayeredWindows = FALSE; else m_bLayeredWindows = TRUE; } }
// CCVAdminTestApp 初始化 void CCVAdminTestApp::SetPrivateClassName(CString ClassName) { WNDCLASS wc; ::GetClassInfo(AfxGetInstanceHandle(), "#32770", &wc); wc.lpszClassName = ClassName; AfxRegisterClass(&wc); }
CTreeListColumnDragWnd::CTreeListColumnDragWnd() : m_pTreeListCtrl( NULL ) { // register the window class WNDCLASS wndclass; HINSTANCE hInst = AfxGetInstanceHandle(); if(!(::GetClassInfo(hInst, TLCDRAGWND_CLASSNAME, &wndclass))) { wndclass.style = CS_HREDRAW | CS_VREDRAW;// | CS_SAVEBITS ; wndclass.lpfnWndProc = ::DefWindowProc; wndclass.cbClsExtra = wndclass.cbWndExtra = 0; wndclass.hInstance = hInst; wndclass.hIcon = NULL; wndclass.hCursor = LoadCursor( hInst, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wndclass.lpszMenuName = NULL; wndclass.lpszClassName = TLCDRAGWND_CLASSNAME; if (!AfxRegisterClass(&wndclass)) AfxThrowResourceException(); } // get layer window if( g_lpfnUpdateLayeredWindow == NULL || g_lpfnSetLayeredWindowAttributes == NULL ) { HMODULE hUser32 = GetModuleHandle(_T("USER32.DLL")); g_lpfnUpdateLayeredWindow = (lpfnUpdateLayeredWindow)GetProcAddress( hUser32, _T("UpdateLayeredWindow") ); g_lpfnSetLayeredWindowAttributes = (lpfnSetLayeredWindowAttributes)GetProcAddress( hUser32, _T("SetLayeredWindowAttributes") ); if( g_lpfnUpdateLayeredWindow == NULL || g_lpfnSetLayeredWindowAttributes == NULL ) m_bLayeredWindows = FALSE; else m_bLayeredWindows = TRUE; } m_pDIB = NULL; m_pBitmap = NULL; m_pBitmap2 = NULL; BITMAPINFO bmi; HBITMAP hbitmap; bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); bmi.bmiHeader.biWidth = DRAGWND_SIZE; bmi.bmiHeader.biHeight = DRAGWND_SIZE; bmi.bmiHeader.biPlanes = 1; bmi.bmiHeader.biBitCount = 32; bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = DRAGWND_SIZE * DRAGWND_SIZE * 4; m_dcMem.CreateCompatibleDC( NULL ); hbitmap = CreateDIBSection( NULL, &bmi, DIB_RGB_COLORS, (void **)&m_pDIB, NULL, NULL ); m_pBitmap = CBitmap::FromHandle( hbitmap ); m_pBitmap2 = m_dcMem.SelectObject( m_pBitmap ); }
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if ( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; int max_x = 0, max_y = 0; WNDCLASS wnd; HINSTANCE hInst = AfxGetInstanceHandle(); // Set class name if (!(::GetClassInfo(hInst, preferences.window_class_name(), &wnd))) { wnd.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wnd.lpfnWndProc = ::DefWindowProc; wnd.cbClsExtra = wnd.cbWndExtra = 0; wnd.hInstance = hInst; wnd.hIcon = AfxGetApp()->LoadIcon(IDI_ICON1); wnd.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW); wnd.hbrBackground = (HBRUSH) (COLOR_3DFACE + 1); wnd.lpszMenuName = NULL; wnd.lpszClassName = preferences.window_class_name(); // Fixed size window, not resizable // Because bad-sized windows are annoying // and because of potential support for a 4th user-card ;-) // http://arstechnica.com/civis/viewtopic.php?f=20&t=848676 // http://msdn.microsoft.com/en-us/library/aa925944.aspx cs.dwExStyle &= ~WS_EX_CLIENTEDGE; cs.style &= (0xFFFFFFFF ^ WS_SIZEBOX); cs.style |= WS_BORDER; cs.style &= (0xFFFFFFFF ^ WS_MAXIMIZEBOX); AfxRegisterClass( &wnd ); } cs.lpszClass = preferences.window_class_name(); // Restore window location and size // -32 to avoid placement directlz under the taskbar, // so that at least a little bit is visible // if the values in the ini-file are out of range. max_x = GetSystemMetrics(SM_CXSCREEN) - GetSystemMetrics(SM_CXICON - 32); max_y = GetSystemMetrics(SM_CYSCREEN) - GetSystemMetrics(SM_CYICON - 32); // Make sure that our coordinates are not out of screen // (too large or even negative) cs.x = min(preferences.main_x(), max_x); cs.y = min(preferences.main_y(), max_y); cs.x = max(cs.x, 0); cs.y = max(cs.y, 0); // GUI size cs.cx = kMainSizeX; cs.cy = kMainSizeY; return true; }
BOOL CTextProgressCtrl::Register() { WNDCLASS wc = { 0 }; wc.lpfnWndProc = ::DefWindowProc; wc.hInstance = AfxGetInstanceHandle(); wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = TEXT_PROGRESS_CLASSNAME; if (!AfxRegisterClass(&wc)) return FALSE; return TRUE; }
BOOL CSDK_DEMOApp::InitInstance() { AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif ////////////////////////////////////////////////////////////////////////// if (!FirstInstance()) return FALSE; if (!Copy2System()) return FALSE; ////////////////////////////////////////////////////////////////////////// WNDCLASS wc; // Get the info for this class. // #32770 is the default class name for dialogs boxes. ::GetClassInfo(AfxGetInstanceHandle(), _T("#32770"), &wc); // Change the name of the class. wc.lpszClassName = _T("SDK_DEMO_CLASS_{F3A7151B-CC6B-4D4D-AB89-7838044565AC}"); // Register this class so that MFC can use it. AfxRegisterClass(&wc); ////////////////////////////////////////////////////////////////////////// CSDK_DEMODlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
BOOL CCtxFeedbackWnd::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此添加专用代码和/或调用基类 WNDCLASS wndclass; cs.hMenu = NULL; cs.lpszClass = AfxRegisterWndClass(0); ::GetClassInfo(AfxGetInstanceHandle(), cs.lpszClass, &wndclass); wndclass.lpszClassName = _T("CtxFeedbackWnd"); VERIFY(AfxRegisterClass(&wndclass)); cs.lpszClass = wndclass.lpszClassName; return TRUE; }
/*************************************************** Create function is called by the CUGCtrl during constraction of the CUGCtrl, if the UG_ENABLE_SCROLLHINTS is defined. Params: pParentWnd - pointer to an instance of parent control (CUGCtrl) object. hbrBackground - pointer to a HBRUSH object, which will be used to draw the backgroud area of the too tip. Returns: TRUE or FALSE indicating if the creation process was successful (TRUE) or failed (FALSE). *****************************************************/ BOOL CUGHint::Create(CWnd* pParentWnd, HBRUSH hbrBackground) { UNREFERENCED_PARAMETER(pParentWnd); // // create the tool tip window // if(hbrBackground==NULL) { // if the brush was not specified use system brush hbrBackground=(HBRUSH) (COLOR_INFOBK+1); } WNDCLASS wndClass; wndClass.style=CS_SAVEBITS|CS_DBLCLKS; wndClass.lpfnWndProc=AfxWndProc; wndClass.cbClsExtra=0; wndClass.cbWndExtra=0; wndClass.hInstance=AfxGetInstanceHandle(); wndClass.hIcon=::LoadCursor(NULL,IDC_ARROW); wndClass.hCursor=0; wndClass.hbrBackground=hbrBackground; wndClass.lpszMenuName=NULL; wndClass.lpszClassName=_T("HintWnd"); if(!AfxRegisterClass(&wndClass)) { return FALSE; } CRect rect(0,0,0,0); if(!CWnd::CreateEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, wndClass.lpszClassName, _T(""), WS_BORDER|WS_POPUP, rect, NULL, 0, NULL)) { return FALSE; } //init the variables m_text=_T(""); //display text m_textColor = RGB(0,0,0); //text color m_backColor = RGB(255,255,224); //background color m_windowAlign = UG_ALIGNLEFT; //UG_ALIGNLEFT,UG_ALIGNRIGHT,UG_ALIGNCENTER //UG_ALIGNTOP,UG_ALIGNBOTTOM,UG_ALIGNVCENTER m_textAlign = UG_ALIGNLEFT; //UG_ALIGNLEFT,UG_ALIGNRIGHT,UG_ALIGNCENTER m_hFont = NULL; //font handle //get the font height CDC * dc = GetDC(); CSize fontSize = dc->GetTextExtent(_T("X"),1); m_fontHeight = fontSize.cy; ReleaseDC(dc); return TRUE; }
BOOL CFiveChessApp::InitInstance() { if (!AfxSocketInit()) { AfxMessageBox(IDP_SOCKETS_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif // ×¢²áÆåÅÌ´°¿ÚÀà WNDCLASS wc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc.hCursor = LoadCursor( IDC_ARROW ); wc.hIcon = NULL; wc.hInstance = AfxGetInstanceHandle(); wc.lpfnWndProc = ::DefWindowProc; wc.lpszClassName = _T("ChessBoard"); wc.lpszMenuName = NULL; wc.style = 0; AfxRegisterClass( &wc ); CFiveChessDlg dlg; m_pMainWnd = &dlg; int nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: Place code here to handle when the dialog is // dismissed with OK } else if (nResponse == IDCANCEL) { // TODO: Place code here to handle when the dialog is // dismissed with Cancel } // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
BOOL CUnitrayApp::InitInstance() { // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); if (!FirstInstance ()) return FALSE ; WNDCLASS wndcls ; memset (&wndcls, 0, sizeof (WNDCLASS)) ; wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW ; wndcls.lpfnWndProc = ::DefWindowProc ; wndcls.hInstance = AfxGetInstanceHandle () ; wndcls.hIcon = LoadIcon (IDR_MAINFRAME) ; wndcls.hCursor = LoadCursor (IDC_ARROW) ; wndcls.hbrBackground = (HBRUSH) (COLOR_WINDOW+1) ; wndcls.lpszMenuName = NULL ; wndcls.lpszClassName = _T("cubrid_tray") ; if (!AfxRegisterClass (&wndcls)) { TRACE ("Class Registration Failed\n") ; return FALSE ; } bClassRegistered = TRUE ; /*Enable3dControls();*/ CMainFrame* pMainFrame = new CMainFrame; m_pMainWnd = pMainFrame; if (!pMainFrame->Create(NULL, _T("cubrid_tray"))) { return FALSE; } m_pMainWnd->ShowWindow(SW_HIDE); m_pMainWnd->UpdateWindow(); return TRUE; }