How to awoid taking focus

  • Thread starter Thread starter Mads Hansen
  • Start date Start date
M

Mads Hansen

I have now tried almost every thing to avoid a form taking the keyboard
focus but I have failed to avoid this.

How can I avoid a windows form taking focus in .Net. The problem is that I
have to create a onscreen keyboard and it would be nice if the form with the
keyboard on newer gains focus.

How can I create a form that newer takes focus ?
 
I have been through almost any possible Windows messages with out luck.
But I will give it a try. Do you now the Id number of this messages.

Another thing do you now where to find examples for VB .Net and Win API
32 because almost all examples I can find is readen for VB 5/6 and I
cant seem to make them work in VB .Net at least not all of them.
 
If you have Visual Studio .NET installed, you can look up the message
constants in C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\WinUser.h.

In case you don't have VS.NET, the numeric value for WM_MOUSEACTIVATE is
0x0021. You'll also need to know the return codes: MA_ACTIVATE is 1,
MA_ACTIVATEANDEAT is 2, MA_NOACTIVATE is 3, and MA_NOACTIVATEANDEAT is 4.

As for finding sample code, no, I haven't found any good comprehensive
sites for P/Invoke and WndProc stuff. I've had the best luck just
searching Google (both Web and newsgroups) -- so far that's always found
me what I need.
 
The only option I would know how to implement is to descend a new class
from the control and override its WndProc.

I'm sure there are other ways (using SetWindowLong to subclass the
control at runtime, for example), but I'm not sure how to implement them
in .NET.
 
Back
Top