Time:11-06
CodePudding user response:
CButton class should be in the VC source code, only some of the API used mfc100u. DLL
Quote: refer to 1st floor oyljerry response: CButton class should be in the VC source code, only some of the API used mfc100u. DLL Obviously not with source code, or not in mfc100u. Constructed in the DLL,
class CButton: public CWnd {DECLARE_DYNAMIC (CButton) //Constructors Public: CButton (); Virtual BOOL Create (LPCTSTR lpszCaption dwords dwStyle, Const RECT& The rect, CWnd * pParentWnd, UINT nID); //the Attributes UINT GetState () const; Void SetState (BOOL bHighlight); Const int GetCheck (); Void SetCheck (int nCheck); UINT GetButtonStyle () const; Void SetButtonStyle (UINT nStyle, BOOL bRedraw=TRUE). HICON SetIcon (HICON HICON); HICON GetIcon () const; HBITMAP SetBitmap (HBITMAP HBITMAP); HBITMAP GetBitmap () const; HCURSOR SetCursor (HCURSOR HCURSOR); HCURSOR GetCursor (); # if (_WIN32_WINNT & gt;=0 x501) BOOL GetIdealSize (SIZE * psize); BOOL SetImageList (PBUTTON_IMAGELIST pbuttonImagelist); BOOL GetImageList (PBUTTON_IMAGELIST pbuttonImagelist); BOOL SetTextMargin (the RECT * pmargin); BOOL GetTextMargin (the RECT * pmargin); # endif//(_WIN32_WINNT & gt;=0 x501) //Overridables (for the owner the draw only) Virtual void DrawItem (LPDRAWITEMSTRUCT LPDRAWITEMSTRUCT); //Implementation Public: Virtual ~ CButton (); Protected: Virtual BOOL OnChildNotify (UINT, WPARAM, LPARAM LRESULT *); };
///////////////////////////////////////////////////////////////////////////////CButton BOOL CButton: : Create (LPCTSTR lpszCaption, dwords dwStyle, Const RECT& The rect, CWnd * pParentWnd, UINT nID) {The CWnd * pWnd=this; Return pWnd - & gt; Create (_T (" BUTTON "), lpszCaption, dwStyle, the rect, pParentWnd, nID); } CButton: : ~ CButton () {DestroyWindow (); } //Helper for radio buttons Int CWnd: : GetCheckedRadioButton (int nIDFirstButton, int nIDLastButton) {For (int nID=nIDFirstButton; NID & lt;=nIDLastButton; NID++) {If (IsDlgButtonChecked (nID)) Return the nID;//id that matched } return 0;//invalid ID } //Derived class is responsible for implementing all of these handlers //for the owner/self the draw controls, Void CButton: : DrawItem (LPDRAWITEMSTRUCT) {ASSERT (FALSE); } BOOL CButton: : OnChildNotify (UINT message, WPARAM WPARAM, LPARAM LPARAM, LRESULT * pResult) {If (the message!=WM_DRAWITEM) Return the CWnd: : OnChildNotify (lParam message, wParam, pResult); ASSERT (pResult==NULL);//no return value expected UNUSED (pResult);//unused in release builds DrawItem (lParam) (LPDRAWITEMSTRUCT); Return TRUE; }
_AFXWIN_INLINE CButton: : CButton () {} Const _AFXWIN_INLINE UINT CButton: : GetState () {ASSERT (: : IsWindow (m_hWnd)); Return (UINT) : : SendMessage (m_hWnd, BM_GETSTATE, 0, 0); } _AFXWIN_INLINE void CButton: : SetState (BOOL bHighlight) {: : SendMessage (m_hWnd, BM_SETSTATE, bHighlight, 0); } Const _AFXWIN_INLINE int CButton: : GetCheck () {ASSERT (: : IsWindow (m_hWnd)); Return (int) : : SendMessage (m_hWnd, BM_GETCHECK, 0, 0); } _AFXWIN_INLINE void CButton: : SetCheck (int nCheck) {ASSERT (: : IsWindow (m_hWnd)); : : SendMessage (m_hWnd, BM_SETCHECK, nCheck, 0); } Const _AFXWIN_INLINE UINT CButton: : GetButtonStyle () {ASSERT (: : IsWindow (m_hWnd)); Return (UINT) GetWindowLong (m_hWnd, GWL_STYLE) & amp; 0 XFF. } _AFXWIN_INLINE void CButton: : SetButtonStyle (UINT nStyle, BOOL bRedraw) {ASSERT (: : IsWindow (m_hWnd)); : : SendMessage (m_hWnd, BM_SETSTYLE nStyle, (LPARAM) bRedraw); } //Win4 _AFXWIN_INLINE HICON CButton: : SetIcon (HICON HICON) {ASSERT (: : IsWindow (m_hWnd)); Return (HICON) : : SendMessage (m_hWnd, BM_SETIMAGE IMAGE_ICON, (LPARAM) HICON); } Const _AFXWIN_INLINE HICON CButton: : GetIcon () {ASSERT (: : IsWindow (m_hWnd)); Return (HICON) : : SendMessage (m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0 l); } _AFXWIN_INLINE HBITMAP CButton: : SetBitmap (HBITMAP HBITMAP) {ASSERT (: : IsWindow (m_hWnd)); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
Page link:https//www.codepudding.com/Softwareengineering/78148.html