[comp.windows.ms.programmer] Getting calls to SetFocus/KillFocus first.

jsstraub@libws2.ic.sunysb.edu (James (von)Straub) (06/29/91)

Please help...

I'm writing a program that sub-classes the active window and draws a
different caption bar.  That part works fine (except for sub-classing 
White Water ToolKit, which crashes.)  The only problem is moving to the
active window.  At the moment I'm looking for WM_ACTIVATE messages on 
the current sub-classed window.  This message *sometimes* tells you 
what window is geting activated next.  But *sometimes* is no good.

What I need to do is to capture all calls to SetFocus and KIllFocus, 
sub-class the specified window then call SetFocus or KIllFocus!

Here's what I mean:

This is what I have...
	case WM_ACTIVATE:
		if (wParm == 0)	{
			if (lParam != NULL)
				SubClassWindow((HWND) lParam);
		}			

This is what I would like...
	HWND FilterSetFocus(HWND hWnd)
	{
		SubClassWindow(hWnd);
		return(SetFocus(hWnd));
	} /* FilterSetFocus */

This is as far as I got with this idea...
	hUserModual = GetModuleHandle((LPSTR)"USER");
	fpSetFocus = GetProcAddress(hUserModual, "SetFocus");

Now that I have "fpSetFocus" what do I do?  Is what I want to do
feasible?  Any help with this would be most appreciated and
would gain notable honor in my program's about box.



Thank you very much...

James Straub

-- 
_______________________________________________________________________________
| James S. Straub       -> Life may be limited but your imagination isn't! <- |
| InterNET: jsstraub@csserv1.ic.sunysb.edu     BITNet: jsstraub@sbccvm.bitnet |
-------------------------------------------------------------------------------
[0m