Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mixing Win32 API with MFC

Status
Not open for further replies.

mvillara

Programmer
May 18, 2002
24
ES
Hi, I am having a slight problem in one thing. The fact is that I create a Windows with API functions and I draw some objects like Ellipses and so on,.... with the WM_PAINT Event, and with the WM_CREATE Event I want to create a class (called MiButtton) inherited from CButton. The constructor of MiButton has an argument that is the Handle of the main window, so MiButton(HWND hWnd). The constructor has the following code:

cwnd = new CWnd();
cwnd->Attach( hWnd );

CButton::Create(L"Hola Sosio", WS_VISIBLE|WS_CHILD, CRect(10, 50, 80, 80), cwnd, 1);


The problem appear when I run the program and begin with an error.When I click the [X] button, the applications go on perfectly without any error and the button appear as I specify.

Can anyone expline me about this? Am I doing anything wrong?

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top