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.
jmcilhinney at 2007-11-10 3:08:19 >
# 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.
ntchinh at 2007-11-10 3:09:19 >
# 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.
jmcilhinney at 2007-11-10 3:10:12 >
# 4 Re: How to set active an other application?
ntchinh, have a look here ( http://www.dev-archive.com/forum/showthread.php?t=403073)
HanneSThEGreaT at 2007-11-10 3:11:18 >
# 5 Re: How to set active an other application?
Yes, I think so.

Thanks about warned from you.
ntchinh at 2007-11-10 3:12:17 >