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

Started by
1 comment, last by hplus0603 15 years, 8 months ago
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?
Advertisement
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...
-----------------------------------"After you finish the first 90% of a project, you have to finish the other 90%." - Michael Abrashstickman.hu <=my game (please tell me your opinion about it)
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.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement