Hi all.. I have placed button ctrl having ID = IDC_BUTTON1 over dialog and Added Bitmap having ID="BUTTON_IMPORT". I have written following code snippet in OnInitDialog():- { . . CBitmapButton MyBmpBtn; MyBmpBtn.LoadBitmaps(_T("BUTTON_IMPORT")); CButton *btn; btn = reinterpret_cast<CButton *>(GetDlgItem(IDC_BUTTON1)); LONG GWLIMP = GetWindowLong(btn->m_hWnd, GWL_STYLE); SetWindowLong(btn->m_hWnd, GWL_STYLE, GWLIMP | BS_OWNERDRAW); MyBmpBtn.SubclassDlgItem(IDC_BUTTON1,this); . . } But Button is not visible on dialog when i execute program...... pls help me out know why button have been not displayed on screen.... thanks all
You should define your MyBmpBtn variable in the scope of the dialog class and not in InitDialog function as that would mean when the function ends the variable is out of scope. This is the most common mistake even I faced writing my first button though and had to learn the hard way out of assembly debugging.
Hi all, Here i got another problem. Following is the hierarchy of class inheritance:- class CXPropertyPage : Public CPropertyPage class CPPage : Public CXPropertyPage class CChild : Public CPPage As Shabbir suggested to add CBitmapButton object in class, i tried to add it in CChild class and i found an assertion in OnInitDialog of CXPropertyPage. It occurs in CXPropertyPage::OnInitDialog() when it calls CPropertyPage::OnInitDialog() :- BOOL CXPropertyPage::OnInitDialog() { CPropertyPage::OnInitDialog(); return TRUE; } I have no Idea why I am getting assertion/Exception !! Pls help me to find out solution... Thanks All
Hi All. I dont know, but, if i try to add/delete any member in CChild( pls take a look at class hierarchy in previous quote) class program gives assertion otherwise things are going well.
Hi, everything was fine after ur solution.. the problem was with file attributes and access rights.... Now there is no problem with CBitmapButton... Thanks a Lot