Solved

Trying to use CreateWindowEx

Posted on 1997-07-17
2
253 Views
Last Modified: 2013-11-20
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)
0
Comment
Question by:tdietz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
mbhakta earned 50 total points
ID: 1302653
Try using AfxRegisterClass() instead.  Also don't forget to use UnRegisterClass when window terminates.
0
 

Author Comment

by:tdietz
ID: 1302654
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
0

Featured Post

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question