Sending input events to background applications in Win32

Discussion in 'Windows' started by bhua8122, Mar 14, 2009.

  1. bhua8122

    bhua8122 New Member

    Joined:
    Mar 14, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Our goal is the create a application sharing system that allows users to drag the applications off-screen into other people's desktops for them to use while maintaining control of the local desktop. Currently we plan to implement it by creating a virtual screen and placing the shared application there. VNC will then be used to stream windows to peers and input will be routed over.

    The problem I am facing is that Win32 only has one input queue and allows input only to the active window. This is a deal breaker as we wanted to send input coming in from the network to a specific, background application on the virtual screen. We have to do this as the active window from the local user's perspective will some other program they are actually controlling on their real, physical desktop.

    I want to write a wrapper for the Win32 DLL(s) and reimplement the window management with multiple input queues/multiple activate windows. I don't need multiple mouse pointers (altough that has been done by CPN Mouse) to achieve this as I just need to route calls like SendInput to the desired background application (clicks, drags, over, up/down and keystrokes). The sharing platform will handle mouse cursors and resizing on the client side.

    I was hoping developers here will have some insight on where I should start looking and whether the entire modification is in just one DLL, a collection of them and whether it is even feasible to do such a thing at.
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    Maybe the Windows Hook functions will do what you want:
    http://msdn.microsoft.com/en-us/library/ms644959.aspx

    However, I would have thought that the main problem you face is not in getting input from one machine and sending it to another but in providing a completely seamless transfer of the window from one machine to another, because it's not just the window you need to move but you need to start the application on the other machine and get it into the correct state so that it continues to work.

    Thinking about the window I'm using right now, if I were to transfer the window to another machine I would have to start Firefox on the other machine, open the appropriate number of tabs, get each tab to load the correct page, scroll to the appropriate place on each tab, if there are any text boxes and history then that lot will need transferring as well....basically I don't think this would be possible without a LOT of work, and a lot of application-specific work as well. Also what happens to Firefox on this PC, would it be terminated?

    Maybe the X-Window system might have features you need. Xclients and Xservers work the opposite way round from what you might expect; the display is connected to an Xserver and the application runs in the Xclient. If you can persuade an Xclient to start using a different Xserver without having to be restarted then in effect the window should appear simply to jump from one computer (Xserver) to another. However you would then need to trap input on the original Xserver and send it to the new Xserver, which should in theory be less difficult on an open source OS such as Linux than on a closed source beast like Windows. And you can get Xservers for Windows (Exceed is one, although iirc it is closed source; there may be OSS ones).
     
  3. bhua8122

    bhua8122 New Member

    Joined:
    Mar 14, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    We are going to use VNC base techniques to transfer screen updates or individual windows. The applications themselves will want on the original host.

    I have found PostMessage to work well for clicks and text input so far. However, dragging and controls keys may prove more difficult.

    An annoying problem is that PostMessage() works fine in C++/MFC, but when I try it in C#/.NET, it works for keys but not clicks.

    I prefer to go with C# easier debugging. If you know anyone who has gotten clicks to work from C# using PostMessage() please post a code snippit.

    Thansk for your reply.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice