Skip to content

Instantly share code, notes, and snippets.

@Fahrni
Last active May 28, 2016 06:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Base Class Window Procedure
EXTERNC ACLWINCB(LRESULT) ACLWindowDispatchProc
(
IN HWND hWnd,
IN UINT uMsg,
IN WPARAM wParam,
IN LPARAM lParam
)
{
UNALIGNED ACLWinBase* pWindow = NULL;
PWINMSGHNDLR pHandler = NULL;
LRESULT lResult = 1;
switch (uMsg)
{
case WM_CREATE:
{
// lparam is passed with a pointer to the "this" of our
// object. Grab it here and "attach" it to the window
// proc.
//
pWindow = (ACLWinBase*)(((LPCREATESTRUCT)lParam)->lpCreateParams);
pWindow->SetBoundWindow(hWnd);
break;
}
default:
{
// By default we're going to grab a pointer to the "this" we
// saved at Init time.
//
pWindow = ACLPrivateGetBoundWindow(hWnd);
break;
}
} // switch
if (pWindow)
{
lResult = pWindow->DispatchMessage(uMsg, wParam, lParam);
}
// If we couldn't get a window to dispatch to or the message returned 1
// then go ahead and call DefWindowProc.
//
if (pWindow == NULL || lResult == 1)
{
lResult = ::DefWindowProc(hWnd, uMsg, wParam, lParam);
}
return lResult;
} // ACLWindowDispatchProc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment