There are things you need to understand about MFC before you start, and nearly every book
about MFC explains these things. One of them is that most methods of wrapper classes have
the same names as the API calls. I knew this the first day I wrote an MFC program, and I
didn't have a book, just the Microsoft documentation and the Scribble tutorial. You can't
just sit down and start randomly writing code without doing SOME study, and one of the
very first things you have to study is the CWnd class because it is so important. The
next one to study is the CDC class. You spend the first few days just reading the methods
in these classes. Then it is obvious.
The answer is indeed obvious. If you know how to use the API, you know how to use the MFC
method. The only thing you glean from the documentation is that instead of using the HWND
value HWND_TOPMOST, for example, you use the CWnd* value &hwndTopMost.
There are disciplines of learning technology that you need to apply, and that's what I was
really yelling at you for. You did not apply good study methods to learning a new system.
When I learned windows, I spent a couple weeks just reading manuals, so by the time I sat
down to write my first program, I had absorbed a massive amount of the culture of Windows.
After that, it was just looking things up. I read the Windows manuals at night,
alphabetically by API name, to see what each API did.
When I learned MFC, it took me considerably less than a day to learn about the naming
conventions for the methods. It was in the introductory documentation, somewhere near the
front! I just started doing the Scribble tutorial and learned enough MFC in three days to
deliver a prototype to my customer in two weeks.
You DON'T sit down and start typing code. It is a bad way to develop software, and it is
a bad way to learn.
Today, I STILL sit down with something in the manual and read all about it before I start
coding. I read the entire debug interface two weeks ago. Spent a whole day just reading
it. When I sat down to write my code, it came up almost immediately, except for one
glitch that seems to be due to inadequate documentation. But you sound like you just sat
down and started typing, without taking time to understand even the superficial aspects of
what is going on in MFC, such as the methods of CWnd and CDC. Otherwise, the error you
reported would have not been made.
There are deep issues about MFC, and these take a lot of explanation, but you are expected
to know how to use the documentation.
Also note that an earlier answer to your problem suggested that this would be an issue
only if you had overlapping controls; if you don't have overlapping controls, it is not
the problem. The problem is elsewhere.
Right now, you are flailing about, sprinkling pixie dust around in the hopes of solving
the problem.
Is it an owner-draw box? What are its styles? Are you doing any graphics on your own,
using CDC, CClientDC, CPaintDC, memory DCs, etc.? It still sounds like a resource leak.
joe
On Tue, 22 May 2007 22:12:43 +0100, "GT" <
ContactGT_remove_@hotmail.com>wrote:
Quote
Joe, you clearly have a fantastic and deep understanding of the MFC and
MSDN. I have a lot of respect for this as I have no formal training in MFC.
The majority of your posts are very helpful and constructive. However, I
find a large minority of your posts very annoying as you seem to take
pleasure in berating anyone who doesn't know how to do something which to
you is simple. I felt like a naughty schoolboy after your last post which
shot me down in flames!
OK, so I have my dunces hat on, but you have taken pages of text to tell me
off for referring to the wrong version of the SetWindowPos method, but you
haven't actually offered me any help, other than saying "read the
documentation"!! Why didn't you just say that in 1 line!
Now that I have found the right page in the MSDN for SetWindowPos, I find
that it doesn't actually solve the problem anyway, so all this telling off
was for nothing!!
I did say in my original post that I "assume" that z-order is the problem,
however "m_cmbResource.SetWindowPos(&wndTop, etc" still leaves me with a
white / invisible combo box, for most of the time. So something else must be
the problem. As well as SetWindowPos, I've tried a ShowWindow with SW_HIDE,
followed by a SW_SHOW. I've tried ActivateWindow(). Any other ideas anyone?
Joseph M. Newcomer [MVP]
email:
newcomer@flounder.com
Web:
www.flounder.com">
www.flounder.com
MVP Tips:
www.flounder.com/mvp_tips.htm">
www.flounder.com/mvp_tips.htm
-