Sign in to follow this  
Vortez

Sending Mouse and kb messages over network... what would be best?

Recommended Posts

Hi, im working on a little program like vnc to remote control 1 computer remotely using winsock, all this in c/c++. I've been able to send the screenshot but now i have to do the mouse and keyboard input code. What do u think would be the best approach? Should i use hook to capure those(in the server), then use SendMessage() in the client to simulate those? And should i send the 2 DWORD wParam and lParam as it or just send essencial data like the mouse pos for a mouse mouve msg, the mouse pos and button pressed for a mouse click msg, ect? What do u think?

Share this post


Link to post
Share on other sites
I would simply use a fullscreen window, displaying the remote computer. Thus, you would just capture the mouse move, keypress and such messages and send it to the client. (basically the mouse position, keypresses and clicks, not the messages themselves)

The client then just PostMessage()-es all these stuff to the approtiate windows having the focus, or under the mouse position. So you DO have to reconstruct the messages client-side...

Share this post


Link to post
Share on other sites
Sending the LPARAM and WPARAM won't work in the general case, because they may contain pointers for various message kinds.

I would write a VNC client at a lower (higher?) level: implement the remote mouse/keyboard as a user-level mouse/keyboard device on the server, and the remove framebuffer as a screen scraper for the server. For a simple, one-person project, I would not attempt to hook windows messages or GDI at the application level.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this