Need help with Owner Drawn Button Class in ATL composite Control 
Author Message
 Need help with Owner Drawn Button Class in ATL composite Control

Ok, it goes like this.  I have a class which is derived from the
CButton class.  This class has all of the functionality of a CButton,
but it allows me to make the button any shape and allows me to draw a
bitmap on it.  The class works great in a regular MFC project.  My
problem is that I now need to use it in an ATL dll project.  I have a
composite ATL control, and I want to add my button to it.  I call my
Create() function in the InitDialog() function of my composite control
like this:

.
.
.
btn1.Create("",WS_CHILD|WS_VISIBLE,CPoint(0,0),hRegion,BtnID,bitmap1,bitmap2,bitmap3);
.
.
.
The first parameter is the button text, the second are the button
flags, the third is a CPoint of the position of the button, the fourth
is a window region, the fifth is the parent window, and the last
parameters are the bitmaps to load onto the button.(one for normal
state, one for depressed state, one for hover).
My problem is that I don't know what to send as the parent window in
an ATL composite control.  In a normal MFC application, I would just
use "this", but it does not work with ATL.  I have also tried
GetParent(), CWnd::FromHandle(GetDlgItem(IDD_MYDLG)), and
CWnd::FromHandle(this->m_hWnd). Using any of these or passing NULL
will cause a DEBUG ASSERTION FAILED message.  What can I pass to get
my button to work? please send any comments or suggestions to

                            --Mike W.



Tue, 30 Dec 2003 04:11:11 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help needed, Creating Custom Controls / Owner Draw

2. Sample owner-draw radio button with ATL

3. ATL ActiveX composite Control and drawing

4. Mouse Control in Owner Drawn Button

5. Owner Draw in ATL/WTL Window Controls

6. Owner draw buttons get extraneous draw item messages

7. MSVC 1.52 button disable with owner draw buttons

8. Help !! Prob in Owner drawn Button

9. Owner draw button in replacement of the next/back button in a CPropertySheet in Wizard mode

10. Newbie to owner drawn: Scroll Bars in Owner drawn ListCtrl

11. Owner Drawn Pushbuttons:help needed

12. CListBox -- Owner Drawn - (override OnPaint) - Need help, please!

 

 
Powered by phpBB® Forum Software