Complete implementation of remote control (desktop) under VC

Source: Internet
Author: User

Source code location: http://download.csdn.net/detail/dijkstar/5564789,http://www.pudn.com/downloads552/sourcecode/windows/network/detail2276709.html

I. functions:

There are two types of software: Host and remote terminal ]. Remote Terminal: You can use the mouse and keyboard to control the Host Program. Host transfers the interface to remote terminal for display.

Ii. Design Introduction:

① The interface bitmap transmission function on the host side uses the blocksock of ex34a in the fifth edition of Visual C ++ c6.0 technology insider. This TCP socket class is very useful, we recommend that you use more classes in the project because of the "time-out cancellation" function;

② Desktop bitmap capture on the host side. For details, see copybitmap and tomemory. They are divided into two functions: obtaining the desktop hbitmap and saving the hbitmap to the memory in full bitmap format. The third parameter of tomemory is the pixel color. You can select 32, 24, 16, and 8. Try it yourself and it will occupy different memory capacity. We recommend that you use 8, such a 800x600 bitmap occupies more than kb when it is not compressed;

③ [Host] uses the open source project minilzo for bitmap compression, which is very useful. It has been verified that the bitmap on the interface can be compressed with a compression ratio of 90% and the speed is extremely high. These proportions are displayed in the program;

④ The mouse and keyboard control information is obtained using the low-level Hook method. Note that low-level hooks do not need to be written into the DLL separately. See some of the summary (MFC message, driectinput, Hook) of the http://blog.csdn.net/dijkstar/article/details/9007167 (vc6 capture mouse events (move, click, etc.), explains why low-level hooks are used in exchange;

⑤ UDP is used for controlling information transmission on the mouse and keyboard, which is implemented in Lan. cpp;

⑥ To improve the robustness of the program, the millisecond-level multimedia timing function is used to measure the time spent on sending and receiving;

7. Remote Terminal: Decompress the received compressed bitmap, use the gethbmp function to obtain the hbimap, and use a bitmap Control for display.


During use, set the IP address of each program (each program has two IP addresses to be set, and the IP address refers to the IP address of the other party), and run the remote terminal first ], then run the Host Program.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.