How to set active an other application?
Hi friends,
I trying to develop a tool (the same On-screen Keyboard on Windows, but it's too small key button).
But i'm having a problem. When i click on the button on my application, how to set active other application to receive key code?
Can you help me?
Thanks
[305 byte] By [
ntchinh] at [2007-11-20 11:36:09]

# 1 Re: How to set active an other application?
That's not the way to create an on-screen keyboard. The idea is that your window doesn't get focus in the first place, so you never have to worry about setting it back to some other application. Check this ( http://www.vbforums.com/showthread.php?t=459890) out.
# 2 Re: How to set active an other application?
Hi Jmcilhinney,
Thanks for your solution.
But, when i run your code, it throw an exception (InvalidCastException) at m.Result = CType(NativeConstants.MA_NOACTIVATE, IntPtr). So, i replace it by m.Result = New IntPtr(NativeConstants.MA_NOACTIVATE), it ok.
Thanks so much.
# 3 Re: How to set active an other application?
Perhaps you're using .NET 1.x because that code is currently working in my .NET 2.0 app. There's evidence that you need to specify your version when posting.
# 4 Re: How to set active an other application?
ntchinh, have a look here ( http://www.dev-archive.com/forum/showthread.php?t=403073)