Last active
May 28, 2016 06:00
-
-
Save Fahrni/5a58f52c8c43eb3de2c5872fa7c696a2 to your computer and use it in GitHub Desktop.
Base Class Window Procedure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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