1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
class CControl
{ HWND m_hwnd;
int m_nID;
// puis la position du contrôle
bool m_bVisible;
public :
CControl(HWND hwndParent,HINSTANCE hinstance);
~CControl() { DestroyWindow(m_hwnd); };
void SetVisible(bool bVisible);
};
// puis le constructeur
CControl::CControl(HWND hwndParent,HINSTANCE hinstance,int X,int Y,int nWidth,int nHeight,int nResID )
{
m_hwnd= CreateWindow ("button", "Push Button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,X,Y, nWidth, nHeight , hwndParent, (HMENU)nResID,hinstance,NULL);
m_nID=nResID ;
m_bVisible=true;
}
void CControl::SetVisible(bool bVisible)
{
bVisible==true ? ShowWindow(m_hwnd,SW_SHOW,SW_HIDE);
m_bVisible=bVisible;
void CControl::SetText(std::string strText)
{
SetWindowText(m_hwnd,strText.c_str());
}
} |
Partager