Solved

Trying to use CreateWindowEx

Posted on 1997-07-17
2
252 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Show shut-down message as Windows 8 shuts down. 9 109
How to know only "File created" with EventLog 3 35
NotAlone Challenge 20 93
mapAB Challlenge 35 185
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.

734 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