Link to home
Start Free TrialLog in
Avatar of tdietz
tdietz

asked on

Trying to use CreateWindowEx

I am trying to create a standard SDI window with CreateWindowEx.  I have registered a custom class and tried the following:

   CreateEx( WS_EX_CLIENTEDGE,
             NULL,
             theApp.m_NewMailWndClass,  // my own class
             "new window",
             WS_BORDER | WS_CHILD,
             rect,
             NULL,
             0);

I registered the class like this:
m_NewMailWndClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW));

The "rect" is set to 0,0,100,100 (I size it later)

CreateWindowEx fails (0)

Any suggestions?

I am calling this from an MFC-SDI window (toolbar button callback)
ASKER CERTIFIED SOLUTION
Avatar of mbhakta
mbhakta

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tdietz
tdietz

ASKER

I have two comments, one to mbhakta and to tdietz.
To mbhakta : I was under the impression that the class is automatically unregistered.Is it not?
To tdietz : I am unable to guess as to what could be the cause.Can you call "GetLastError()" and find out?Will it give you some clue?

Regards,
Amaresh