Define window classes

zhaozj2021-02-16  88

Write a window class, derive from CWND.

It is best to write a CREATE method, replacing the CWnd method.

BOOL RegisterWndClass (LPCTSTR name) {WNDCLASSEX wndcls; HINSTANCE hInst = AfxGetInstanceHandle (); if (! (:: GetClassInfo (hInst, name, & wndcls))) {wndcls.cbSize = sizeof (wndcls); wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndcls.lpfnWndProc = AfxWndProc; wndcls.hCursor = LoadCursor (NULL, IDC_ARROW); wndcls.hInstance = hInst; wndcls.hIconSm = NULL; wndcls.hIcon = NULL; wndcls.hbrBackground = NULL; wndcls.lpszMenuName = NULL; Wndcls.lpszclassname = name;

Wndcls.cbwndextra = 0; wndcls.cbclsextra = 0; if (RegisterClassex (& WNDCLS) == 0) {Return False;}} Return True;

Bool Create (DWORD DWSTYLE, Const Rect, CWnd * Parent, uint NID) {

LPCTSTSTR Class_name = _t ("wfc_statlist");

IF (! registerWndclass) Return False;

Return CWnd :: Create (Class_name, Null, DWStyle, Rect, Parent, NID);

转载请注明原文地址:https://www.9cbs.com/read-12219.html

New Post(0)