No Hook can also achieve fast skin regeneration (original)

zhaozj2021-02-16  51

Everyone knows if you want to use a good button, you usually do two: 1 mapping button variable 2 .h definition

CEXBUTTON M_BTN; then m_btn.subclassdlgitem. These two practices have no problem in small procedures, and they are working

Cheng is a big, it is very difficult to make a special feet and it is easy to make mistakes. If you want to remove these, it is undoubtedly a nightmare! Below

The principle is simple, practical and convenient.

First: Add a secondary CLXPSKIN Class CXPButton; Class Ceditex; Class ClineStatic; Class CFLATCOMBOX; Class CexCheckbox; Class CexgroupBox;

Class CLXPSKIN {public:

CLXPSKIN (HWND HDLG); // An instance of a class corresponds to a dialog

~ CLXPSKIN ();

PUBLIC:

Clist m_btnlist; // Corresponding to one window All Button Links

Clist M_EDTLIST; / / Corresponding to all Edit Links below

Clist m_linelist; // Corresponding to all static chains under one window

table

Clist m_cmblist; // Corresponding to one window

ComboBox Links

Clist M_CHKLIST; / / Corresponding to all Checkbox chains

table

Clist m_grplist; // Corresponding to all Checkbox chains

table

Private:

HWND M_HDLG;

Public: // Record all of each dialog window in the system and its corresponding LXPSKIN Static CMAP m_mapskin;

Static Bool Installskin (HWND HDLG);

Static void uninstallskin (hwnd hdlg);

The method is as follows: When you finish the above class, you have to do it on the onInitDialog of each Dialog: CLXPSKIN :: Installskin

m_hwnd) Write CLXPSKIN :: Uninstallskin (M_HWND) in OnDestroy ();

The corresponding CPP files are as follows: CMAP CLXPSKIN :: M_Mapskin; clxpskin :: clXpskin (hwnd hdlg): m_btnlist (10), m_hdlg (hdlg) {} CLXPSKIN :: ~ clxpskin () {POSITION POS = m_btnlist.getHeadPosition (); while (pOS! = Null) {delete m_btnlist.getnext (POS);} POS = m_edtlist.getHeadPosition (); while (pOS! = Null) {delete m_edtlist.getNext (POS) POS = m_LineList.getHeadPosition (); while (pOS! = Null) {delete m_LineList.getNext (POS);} POS = m_cmblick (POS! = Null) {delete m_cmblick.getNext (POS) } POS = m_chklist.getHeadPosition (); while (pOS! = Null) {delete m_chklist.getnext (POS);} POS = m_grplist.getheadPosition (); while (pos! = Null) {delete m_grplist.getnext (POS) }} BOOL CLXPSKIN :: Installskin (hwnd hdlg) {assert (:: iswindow (hdlg)); Tchar Szbuf [256]; hwnd hwnd; int Nidfirst; DWORD DWSTYLE; CLXPSKIN * PSKIN = New CLXPSKIN (HDLG);

// map the handle of each dialog and each class instance IF (pskin! = Null) m_mapskin.setat (hdlg, pskin);

HWnd = getWindow; if (hwnd == null ||! :: iswindow (hwnd)) Return False; Nidfirst = getdlgctrlid (hwnd);

Do {getClassName (hwnd, szbuf, 256);

// edit subclass

IF (_TCSICMP ("Edit") == 0) {// Verify that whether it has been permanently mapped if (CWnd :: fromHandlePermanent (hwnd) == null) {CEDITEX * PEDIT = New Ceditex (); if (PEDIT == NULL) RETURN FALSE; PSKIN-> m_edtlist.addtail (PEDIT); // Subclass this window PEDIT-> SubclassWindow (hwnd);}

}

// button subclass

if (_tcsicmp (szBuf, _T ( "Button")) == 0) {dwStyle = GetWindowLong (hWnd, GWL_STYLE); if ((dwStyle & SS_TYPEMASK) == BS_DEFPUSHBUTTON) dwStyle = BS_PUSHBUTTON; if ((dwStyle & SS_TYPEMASK) = = BS_AUTOCHECKBOX) DWSTYLE = BS_CHECKBOX; TCHAR SZBUF [256]; GetWindowText (hwnd, szbuf, 256);

// pushbutton subclass

IF ((DWStyle & SS_TYPEMASK) == BS_PUSHBUTTON) {if (cwnd :: fromHandlePermanent (hwnd) == null) {cxpbutton * PBTN = new cxpbutton (); if (PBTN == Null) Return False; pskin-> m_btnlist. Addtail (PBTN); PBTN-> SubclassWindow (hwnd);}}

// Checkbox subclass

else if ((dwStyle & SS_TYPEMASK) == BS_CHECKBOX) {if (CWnd :: FromHandlePermanent (hWnd) == NULL) {CExCheckBox * pChk = new CExCheckBox (); if (pChk == NULL) return FALSE; pSkin-> m_chkList .AddTail (pChk); pChk-> SubclassWindow (hWnd);}} else if ((dwStyle & SS_TYPEMASK) == BS_GROUPBOX) {if (CWnd :: FromHandlePermanent (hWnd) == NULL) {CExGroupBox * pGrp = new CExGroupBox ( ); If (pgrp == null) Return False; pskin-> m_grplist.addtail (pgrp); pgrp-> subclasswindow (hwnd);}}}

// static subclass

IF ((_TCSICMP (SZBUF, _T ("static")) == 0) && (getWindowlong (hwnd, gwl_style) & ss_etchedhorz) ==

SS_ETCHEDHORZ) {if (CWnd :: FromHandlePermanent (hWnd) == NULL) {CLineStatic * pLine = new CLineStatic (); if (pLine == NULL) return FALSE; pSkin-> m_lineList.AddTail (pLine); pLine-> SubclassWindow (hwnd);}}

// ComboBox subclass

IF (_TCSICMP ("ComboBox")) == 0) {if (cwnd :: fromHandlePermanent (hwnd) == null) {cflatcomboBox * pcmb = new cflatcomboBOX (); if (pcmb == null) Return False Pskin-> m_cmblist.addtail (PCMB); PCMB-> SubclassWindow (hwnd);}}

// ETC

HWnd = getWindow (hwnd, gw_hwndnext); if (! :: iswindow (hwnd) || hWnd == null) Break;

WHILE (Nidfirst! = getdlgctrlid (hwnd));

Return True;

} Void CLXPSKIN :: Uninstallskin (hwnd hdlg) {clxpskin * pskin = null; if (m_mapskin.look (hdlg, pskin)) {delete pskin; pskin = null;} return;}

Advantages: This class can not only change the function of some of the controls in the project, but also to make changes and restore.

Precision conductive slip ring is a small space, fairly intensive components, and various signals are concentrated in the slip ring, and the mutual capacity of each signal is large, because the slip and the loop contact cannot be shielded. And the coupling of the stagnation is particularly serious. Now technology, comprehensive consideration from the inner wiring design of the slip ring structure and the inner wiring of the slip ring, fully avoiding the problem of interference between power and signal, signal and signal, and prevents electromagnetic interference inside the slip ring in the outside.

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

New Post(0)