Solved

CWindowImpl problem - URGENT

Posted on 2001-06-13
6
388 Views
Last Modified: 2010-08-05
Hi, I'm trying to implement CWindowImpl on my class CMenus, here is a simplified declaration:

CMenus: ..., public CWindowImpl<CMenus> {
BEGIN_MSG_MAP(CMenus)
  MESSAGE_HANDLER(WM_MEASUREITEM, OnMeasureItem)
END_MSG_MAP

LRESULT OnMeasureItem(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
  // TODO : Add Code for message handler. Call    
     DefWindowProc if necessary.
  return 0;
}

This code gives me the error "fatal error C1075: end of file found before the left brace '{' at 'c:\dev\menus\menus.h(28)' was matched"

menus.h(28) is the line
BEGIN_MSG_MAP(CMenus)

What am I doing wrong here? If I don't get this right ASAP, I'm going to have to implement subclassing myself, and I'd rather use the ATL implementation.
0
Comment
Question by:shederman
6 Comments
 

Expert Comment

by:NickAtBOM
ID: 6184972
The code you have posted here needs an additional right brace on the last line - you open braces for the class definition on line 1 but never close again.  

If this is not the correct answer, can you post the full code?
0
 

Expert Comment

by:SusanneJost
ID: 6188677
Nick is absolutely right
0
 
LVL 22

Expert Comment

by:ambience
ID: 6189479
menus.h(28) is the line
BEGIN_MSG_MAP(CMenus)

>>> Something has gone wrong before that line , it can't be the right brace that you are missing on the last line in the post.

C1075: The compiler expected to find a matching brace before it reached the end of your source file but was unable to. Check whether your open brackets (and other paired characters such as curly braces) match with close brackets.

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:shederman
ID: 6189653
I don't think the problem is actually unmatched braces. If I take out the CWindomImpl<CMenus> inheritance, and remove the MSG_MAP the program compiles perfectly.
0
 

Accepted Solution

by:
NickAtBOM earned 200 total points
ID: 6189846
Just spotted another typo.  Try putting

END_MSG_MAP()  // i.e. with brackets

If it is not the brace at the end of the class, then it suggests that one of the two braces opened by the BEGIN_MSG_MAP(class) macro have not been closed.
0
 

Author Comment

by:shederman
ID: 6189889
Bloody hell, I feel like an idiot. Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

772 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