|
-
Jul 21st, 2003, 11:08 AM
#1
Thread Starter
Frenzied Member
Is OnPaint just a MFC function?
I have my window subclassed and was hoping that instead of completely overriding every message that I handle, it would carry out whatever is in the subclassed window as well, like C# does in the OnPaint event.
In C# I have a choice whether to completely override it or not and when it is carried out using
base.OnPaint(e);
I hope you know what I mean. How would I do this?
-
Jul 22nd, 2003, 03:17 AM
#2
<base class name>::OnPaint(bla);
And yeah, OnPaint is not there in WinAPI, although no one prevents you from declaring one
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 22nd, 2003, 03:18 AM
#3
In the WinAPI, when you're subclassing, you receive the old WNDPROC pointer. You need to store it and in the subclassing WndProc, instead of calling DefWindowProc, call
return CallWindowProc(pOldWndProc, hwnd, msg, wparam, lparam);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 22nd, 2003, 05:01 AM
#4
Thread Starter
Frenzied Member
Yes I have done that in my sub classed window. The problem is that it does not call the messages that I handled, only the ones I didn't. In C# I can call the base class to do it's work and then paint over it. But that can slow. I guess that is not a good concept for C++.
-
Jul 22nd, 2003, 09:38 AM
#5
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jul 22nd, 2003, 10:13 AM
#6
Thread Starter
Frenzied Member
You're right, I guess it depends upon how I implement everything. What I could do is make my own OnPaint function and pass the window message to it including a rectangle of the area I want erased or refreshed, draw that to a memory HDC, pass the memory HDC back and draw to that.
Good thinking CornedBee.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|