void CPianoCtrl::UpdateKeyLabelFont(CSize Size, DWORD dwStyle) { LOGFONT lf; ZeroMemory(&lf, sizeof(lf)); lf.lfQuality = ANTIALIASED_QUALITY; lf.lfPitchAndFamily = FF_SWISS; // sans serif lf.lfWeight = FW_BOLD; CSize MaxLabel(0, 0); CClientDC dc(this); CFont ExtFont; // font for measuring label text extents lf.lfHeight = 50; // sufficient height for reasonable precision if (!ExtFont.CreateFontIndirect(&lf)) // create text extent font AfxThrowResourceException(); HGDIOBJ hPrevFont = dc.SelectObject(ExtFont); // select font int nLabels = m_KeyLabel.GetSize(); for (int iLabel = 0; iLabel < nLabels; iLabel++) { // for each label CSize sz = dc.GetTextExtent(m_KeyLabel[iLabel]); if (sz.cx > MaxLabel.cx) // if label width exceeds maximum MaxLabel.cx = sz.cx; // update maximum if (sz.cy > MaxLabel.cy) // if label height exceeds maximum MaxLabel.cy = sz.cy; // update maximum } dc.SelectObject(hPrevFont); // restore DC's default font double FontAspect; if (MaxLabel.cx) // if at least one label has non-zero width FontAspect = double(MaxLabel.cy) / MaxLabel.cx; // get font aspect ratio else // all zero widths FontAspect = 0; // avoid divide by zero double WhiteAvail = 2.0 / 3.0; // portion of white key available for label // compute font height; truncate instead of rounding to err on side of caution int FontHeight; if (dwStyle & PS_VERTICAL) { // if vertical orientation int WhiteMaxWidth = trunc((Size.cx - m_BlackKeySize.cx) * WhiteAvail); FontHeight = trunc(min(MaxLabel.cx, WhiteMaxWidth) * FontAspect); FontHeight = min(FontHeight, m_BlackKeySize.cy); } else { // horizontal orientation if (dwStyle & PS_ROTATE_LABELS) { // if rotated labels int WhiteMaxHeight = trunc((Size.cy - m_BlackKeySize.cy) * WhiteAvail); FontHeight = trunc(min(MaxLabel.cx, WhiteMaxHeight) * FontAspect); FontHeight = min(FontHeight, m_BlackKeySize.cx); lf.lfOrientation = 900; // rotate font 90 degrees counter-clockwise lf.lfEscapement = 900; } else { // normal labels FontHeight = trunc((m_BlackKeySize.cx - OUTLINE_WIDTH * 2) * FontAspect); int WhiteMaxHeight = trunc((Size.cy - m_BlackKeySize.cy) * WhiteAvail); FontHeight = min(FontHeight, WhiteMaxHeight); } } FontHeight = CLAMP(FontHeight, MIN_FONT_HEIGHT, MAX_FONT_HEIGHT); lf.lfHeight = FontHeight; // font height, in logical pixels m_KeyLabelFont.DeleteObject(); // delete previous font if any if (!m_KeyLabelFont.CreateFontIndirect(&lf)) // create font AfxThrowResourceException(); }
int CPianoCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; // create key brushes for (int iType = 0; iType < KEY_TYPES; iType++) { // for each key type for (int iState = 0; iState < KEY_STATES; iState++) { // for each key state if (!m_KeyBrush[iType][iState].CreateSolidBrush(m_KeyColor[iType][iState])) AfxThrowResourceException(); } } if (!m_OutlineBrush.CreateSolidBrush(m_OutlineColor)) // create outline brush AfxThrowResourceException(); return 0; }
// dock bars will be created in the order specified by dwMRCDockBarMap // this also controls which gets priority during layout // this order can be changed by calling EnableDocking repetitively // with the exact order of priority //------------------------------------------------------------------------------ void CMRCFrameWndSizeDock::EnableDocking(DWORD dwDockStyle, CRuntimeClass *pFloatingClass) // This is over-ridden primarily because we need to insert our own CDockBar class // to handle the recalc layout, and this is the place they are created. //------------------------------------------------------------------------------ { // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0); m_pFloatingFrameClass = pFloatingClass; // protected member for (int i = 0; i < 4; i++) { if (dwMRCDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) // protected { CDockBar* pDock = (CDockBar*)GetControlBar(dwMRCDockBarMap[i][0]); if (pDock == NULL) { pDock = new CSizeDockBar; if (!pDock->Create(this, WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE | dwMRCDockBarMap[i][1], dwMRCDockBarMap[i][0])) { AfxThrowResourceException(); } } } } }
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 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; }
CPen::CPen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount, const DWORD* lpStyle) { if (!Attach(::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount, lpStyle))) AfxThrowResourceException(); }
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; } }
//--------------------------------------------------------------------------------------------------------------// 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; }
/****************************************************************************** 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; }
CWnd* CuDlgIpmTabCtrl::Page_RepStaticIntegerity(UINT nIDD) { CuDlgReplicationStaticPageIntegrity* pDld = new CuDlgReplicationStaticPageIntegrity (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::Page_RepServerStartupSetting(UINT nIDD) { CuDlgReplicationServerPageStartupSetting* pDld = new CuDlgReplicationServerPageStartupSetting (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::Page_Processes(UINT nIDD) { CuDlgIpmPageProcesses* pDld = new CuDlgIpmPageProcesses (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::Page_RepStaticEvent (UINT nIDD) { CuDlgReplicationStaticPageRaiseEvent* pDld = new CuDlgReplicationStaticPageRaiseEvent (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::Page_LogFile(UINT nIDD) { CuDlgIpmPageLogFile* pDld = new CuDlgIpmPageLogFile (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::IcePage_Transaction(UINT nIDD) { CuDlgIpmIcePageTransaction* pDld = new CuDlgIpmIcePageTransaction (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
CWnd* CuDlgIpmTabCtrl::IcePage_ConnectedUser(UINT nIDD) { CuDlgIpmIcePageConnectedUser* pDld = new CuDlgIpmIcePageConnectedUser (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
void RWindowsImageList::CreateMask( int nWidth, int nHeight, COLORREF crMask ) { // Create the image mask bitmap and screen compatible device HDC hdcImageMask = ::CreateCompatibleDC( m_hdcImageList ) ; HBITMAP hbmImageMask = ::CreateBitmap( nWidth, nHeight, 1, 1, NULL ) ; if (!hdcImageMask || !hdcImageMask) { if (hdcImageMask) { ::DeleteDC( hdcImageMask ) ; } if (hbmImageMask) { ::DeleteObject( hbmImageMask ) ; } AfxThrowResourceException( ) ; } m_hdcImageMask = hdcImageMask ; m_hbmImageMask = hbmImageMask ; // Select the bitmaps into the screen compatible dc m_hbmOldImageMask = (HBITMAP) ::SelectObject( m_hdcImageMask, m_hbmImageMask ) ; COLORREF crBkColor = ::SetBkColor( m_hdcImageList, crMask ) ; ::BitBlt( m_hdcImageMask, 0, 0, nWidth, nHeight, m_hdcImageList, 0, 0, SRCCOPY ) ; ::SetBkColor( m_hdcImageList, crBkColor ) ; }
CWnd* CuDlgIpmTabCtrl::Page_RepServerAssignment(UINT nIDD) { CuDlgReplicationServerPageAssignment* pDld = new CuDlgReplicationServerPageAssignment (&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
/* * 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; }
CWnd* CuDlgIpmTabCtrl::Page_StaticReplication(UINT nIDD) { CuDlgIpmPageStaticReplications* pDld = new CuDlgIpmPageStaticReplications(&m_cTab1); if (!pDld->Create (nIDD, &m_cTab1)) AfxThrowResourceException(); return (CWnd*)pDld; }
void CGuiDocBarExten::BarsDocking(CFrameWnd * pFrame, DWORD dwDockStyle) { ASSERT_VALID(pFrame); // must be CBRS_ALIGN_XXX or CBRS_FLOAT_MULTI only ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0); pFrame->EnableDocking(dwDockStyle); for (int i = 0; i < 4; i++) { if (dwDockBarMap[i][1] & dwDockStyle & CBRS_ALIGN_ANY) { CDockBar* pDock = (CDockBar*)pFrame->GetControlBar(dwDockBarMap[i][0]); if( pDock == 0 || ! pDock->IsKindOf(RUNTIME_CLASS(CGuiDocBarExten)) ) { BOOL bNeedDelete = ! pDock->m_bAutoDelete; pDock->m_pDockSite->RemoveControlBar(pDock); pDock->m_pDockSite = 0; pDock->DestroyWindow(); if( bNeedDelete ) delete pDock; pDock = 0; } if( pDock == 0 ) { pDock = new CGuiDocBarExten; ASSERT_VALID(pDock); if ((!pDock) || (!pDock->Create(pFrame, WS_CLIPSIBLINGS|WS_CLIPCHILDREN|WS_CHILD|WS_VISIBLE | dwDockBarMap[i][1], dwDockBarMap[i][0]))) { AfxThrowResourceException(); } } } } }
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; }
CWindowDC::CWindowDC(CWnd* pWnd) { ASSERT(pWnd == NULL || ::IsWindow(pWnd->m_hWnd)); if (!Attach(::GetWindowDC(m_hWnd = pWnd->GetSafeHwnd()))) AfxThrowResourceException(); }
void CErrorsDialog::SelectSource(int nSel) { if (m_listErrorInfo.IsEmpty()) { CString strError; if( strError.LoadString(IDS_NOSPECIFIED_ERROR) == FALSE) { AfxThrowResourceException(); } m_ctlDescription.SetWindowText(strError); m_ctlGUID.SetWindowText(_T("")); } else { OLECHAR szGUID[40]; POSITION pos = m_listErrorInfo.FindIndex(nSel); struct MYERRORINFO* pInfo = (MYERRORINFO*)m_listErrorInfo.GetAt(pos); m_ctlDescription.SetWindowText(COLE2T(pInfo->bstrDescription)); ::StringFromGUID2(pInfo->guid, szGUID, 40); m_ctlGUID.SetWindowText(COLE2T(szGUID)); } }
CBrush::CBrush(CBitmap* pBitmap) { ASSERT_VALID(pBitmap); if (!Attach(::CreatePatternBrush((HBITMAP)pBitmap->m_hObject))) AfxThrowResourceException(); }
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 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; }
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 = (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; }
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; }