本文整理汇总了C++中AfxRegisterClass函数的典型用法代码示例。如果您正苦于以下问题:C++ AfxRegisterClass函数的具体用法?C++ AfxRegisterClass怎么用?C++ AfxRegisterClass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AfxRegisterClass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AfxGetInstanceHandle
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;
}
示例2: TraceLineI
/////////////////////////////////////////////////////////////////////////////
// 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;
}
示例3: ASSERT_VALID
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;
}
示例4: AfxGetResourceHandle
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;
}
示例5: TraceLineS
/////////////////////////////////////////////////////////////////////////////
// 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;
}
示例6: AfxGetInstanceHandle
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;
}
示例7: AfxGetInstanceHandle
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;
}
示例8: AfxGetInstanceHandle
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;
}
示例9: AfxGetInstanceHandle
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;
}
示例10: AfxGetInstanceHandle
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;
}
示例11: AfxGetInstanceHandle
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;
}
示例12: Input
/******************************************************************************
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;
}
示例13: m_CurrentSelectedRow
// 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);
}
示例14: AfxGetInstanceHandle
/*
* 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;
}
示例15: lstrcpyn
//--------------------------------------------------------------------------------------------------------------//
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;
}