|
-
Oct 31st, 2004, 01:47 PM
#1
Thread Starter
PowerPoster
DefWindow, CallWindow..wut Proc??
Alright, I know I asked this before, but I never really got a straightforward understandable answer and seeing I am beginning to run into problems.....
All my controls are subclassed.
There is a static message router which derives the right control class from the window long and calls a private wnd proc.
All I want to know is when to call: CallWindowProc and DefWindowProc.
does it matter?
is there a case where I only call one?
is there a case where I call neither?
do I always call CallWindowProc()?
What does CallWindowProc return usually?
Can I deal with CallWindowProc returning 0 to call DefWindow?
whenever I send messages to my subclassed controls, it never worked out right because I was always returning 1 or 0 depending on if a command was found. Instead I have to return CallWindowProc from the private WndProc to get the data from the sendmessage.
So, if I call CallWindowProc should I still call DefWindowProc?
If I deal with a message, any message...should I
return 0;
return DefWindowProc first or CallWindowProc first...neither...
This is beginning to confuse me, and I am way to far into this project to get confused on this subject now.
This is what the basics look like
PHP Code:
//------------------
//Msg Router
//------------------
LRESULT CALLBACK ControlSet::MsgRouter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static long iRet = 0;
ControlSet* cset=0;
cset = reinterpret_cast<ControlSet *>(GetWindowLong(hwnd, GWL_USERDATA));
if (cset) iRet = cset->WndProc(hwnd, msg, wParam, lParam);
else iRet=0;
cset = 0;
if (iRet == 0)
return DefWindowProc(hwnd, msg, wParam, lParam);
else
return iRet;
}
//----------------------
//Private Subclassed WndProc
//----------------------
long ListBox::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
//check through user-defined events
for (iterEvent = m_Events.begin(); iterEvent != m_Events.end(); iterEvent++)
if ( msg == (*iterEvent).CallWord ) return (*iterEvent).p();
//switch through pre-defined events
switch (msg)
{
case WM_LBUTTONDOWN:
{
typedef void (*VoidType)();
VoidType lpFunc = (VoidType)EventClick;
if (EventClick != 0) lpFunc();
}
break;
}
return CallWindowProc(m_OldWndProc, hwnd, msg,wParam, lParam);
}
HELP!!!!!!!!
Last edited by Halsafar; Oct 31st, 2004 at 01:53 PM.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
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
|