CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2007
    Posts
    7

    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

  2. #2
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    1,080

    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 out.
    Tutorials: Home & Learn | Start VB.NET | Learn VB.NET | C# Station | GotDotNet | Games in VB.NET 101 Samples: 2002 | 2003 | 2005 | More .NET 2.0 (VB.NET, C#) Articles: VB.NET | C# | ASP.NET | MoreFree Components: WFC | XPCC | ElementsEx | VBPP | Mentalis | ADO.NET/MySQL | VisualStyles | Charting (NPlot, ZedGraph) | iTextSharp (PDF) | SDF (CF) ● Free Literature: VB 2005 (eBook) | VB6 to VB.NET (eBook) | MSDN Magazine (CHM format) ● Bookmarks: MSDN | WinForms .NET | ASP.NET | WinForms FAQ | WebForms FAQ | GotDotNet | Code Project | DevBuzz (CF) ● Code Converter: C#/VB.NET | VB.NET/C# | VS 2005 add-in

  3. #3
    Join Date
    Oct 2007
    Posts
    7

    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.
    Last edited by ntchinh; October 25th, 2007 at 08:56 PM.

  4. #4
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    1,080

    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.
    Tutorials: Home & Learn | Start VB.NET | Learn VB.NET | C# Station | GotDotNet | Games in VB.NET 101 Samples: 2002 | 2003 | 2005 | More .NET 2.0 (VB.NET, C#) Articles: VB.NET | C# | ASP.NET | MoreFree Components: WFC | XPCC | ElementsEx | VBPP | Mentalis | ADO.NET/MySQL | VisualStyles | Charting (NPlot, ZedGraph) | iTextSharp (PDF) | SDF (CF) ● Free Literature: VB 2005 (eBook) | VB6 to VB.NET (eBook) | MSDN Magazine (CHM format) ● Bookmarks: MSDN | WinForms .NET | ASP.NET | WinForms FAQ | WebForms FAQ | GotDotNet | Code Project | DevBuzz (CF) ● Code Converter: C#/VB.NET | VB.NET/C# | VS 2005 add-in

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: How to set active an other application?

    ntchinh, have a look here

  6. #6
    Join Date
    Oct 2007
    Posts
    7

    Re: How to set active an other application?

    Yes, I think so.

    Thanks about warned from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured