÷è÷ë²Ù×÷ϵͳÖеÄÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼ûÔõÑùʵÏÖ£¿
÷è÷ë²Ù×÷ϵͳÖеÄÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼ûÔõÑùʵÏÖ£¿
Ëæ×Å»¥ÁªÍøÊÖÒÕµÄѸÃÍÉú³¤£¬Ô¶³Ì×ÀÃæºÍÔ¶³Ì»á¼û³ÉΪÁËÖ÷ÒªµÄ¹¤¾ß¡£ËüÃÇʹµÃÓû§¿ÉÒÔͨ¹ýÍøÂçÔ¶³Ì»á¼û²¢¿ØÖÆÔ¶³ÌÅÌËã»ú£¬²»ÊÜʱ¿ÕÏÞÖÆ£¬¼«´óµØÌá¸ßÁËÊÂÇéºÍÉúÑĵıã½ÝÐÔ¡£ÔÚ÷è÷ë²Ù×÷ϵͳÖУ¬Ò²ÌṩÁËÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼ûµÄ¹¦Ð§£¬¿ÉÒÔ×ÊÖúÓû§ÊµÏÖ¿çƽ̨¡¢¿ç×°±¸µÄ²Ù×÷ºÍ»á¼û¡£
÷è÷ë²Ù×÷ϵͳÌṩÁËÒ»¸öÃûΪ”Remote Desktop”£¨Ô¶³Ì×ÀÃ棩µÄ¹¦Ð§Ä£¿é£¬Í¨¹ý¸ÃÄ£¿é£¬Óû§¿ÉÒÔÔÚÍâµØÅÌËã»úÉÏ»á¼ûºÍ²Ù×÷Ô¶³ÌÅÌËã»ú¡£ÏÂÃæÎÒÃǽ«ÒÔʵÀý´úÂëµÄ·½·¨ÏÈÈÝ÷è÷ë²Ù×÷ϵͳÖÐÔ¶³Ì×ÀÃæµÄʵÏÖ¡£
Ê×ÏÈ£¬ÔÚÔ´´úÂëÖÐÐèÒªÒýÈëÏìÓ¦µÄÍ·ÎļþºÍ¿âÎļþ£º
#include <winsock2.h> #include <windows.h>
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬½¨ÉèÒ»¸öº¯ÊýÀ´³õʼ»¯Ô¶³Ì×ÀÃ棺
// ³õʼ»¯Ô¶³Ì×ÀÃæ void InitRemoteDesktop() { WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { MessageBox(NULL, "WSAStartup failed!", "Error", MB_OK); return; } }
µÇ¼ºó¸´ÖÆ
È»ºó£¬ÔÚÖ÷º¯ÊýÖÐŲÓÃÉÏÊöº¯Êý¾ÙÐгõʼ»¯£¬²¢½¨ÉèÒ»¸ö´°¿ÚÀ´ÏÔʾԶ³Ì×ÀÃ棺
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { InitRemoteDesktop(); HWND hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, "RemoteDesktop", "Remote Desktop", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL); if (hWnd == NULL) { MessageBox(NULL, "Window creation failed!", "Error", MB_OK); return 1; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); MSG msg; while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } WSACleanup(); return msg.wParam; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂë»á½¨ÉèÒ»¸ö´°¿ÚÀ´ÏÔʾԶ³Ì×ÀÃ棬Óû§¿ÉÒÔÔڸô°¿ÚÖÐÉó²éºÍ²Ù×÷Ô¶³ÌÅÌËã»ú¡£
³ýÁËÔ¶³Ì×ÀÃ湦Ч£¬÷è÷ë²Ù×÷ϵͳ»¹ÌṩÁËÔ¶³Ì»á¼ûµÄ¹¦Ð§£¬Óû§¿ÉÒÔͨ¹ýÔ¶³Ì»á¼ûÐÒé»á¼ûºÍ¿ØÖÆÔ¶³ÌÅÌËã»úµÄÎļþ¡¢Ó¦ÓóÌÐòºÍϵͳÉèÖá£ÏÂÃæÎÒÃǽ«ÒÔʵÀý´úÂëµÄ·½·¨ÏÈÈÝ÷è÷ë²Ù×÷ϵͳÖÐÔ¶³Ì»á¼ûµÄʵÏÖ¡£
Ê×ÏÈ£¬ÔÚÔ´´úÂëÖÐÐèÒªÒýÈëÏìÓ¦µÄÍ·ÎļþºÍ¿âÎļþ£º
#include <winsock2.h> #include <windows.h>
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
½ÓÏÂÀ´£¬½¨ÉèÒ»¸öº¯ÊýÀ´³õʼ»¯Ô¶³Ì»á¼û£º
// ³õʼ»¯Ô¶³Ì»á¼û void InitRemoteAccess() { WSADATA wsaData; if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) { MessageBox(NULL, "WSAStartup failed!", "Error", MB_OK); return; } }
µÇ¼ºó¸´ÖÆ
È»ºó£¬ÔÚÖ÷º¯ÊýÖÐŲÓÃÉÏÊöº¯Êý¾ÙÐгõʼ»¯£¬²¢½¨ÉèÒ»¸ö´°¿ÚÀ´ÏÔʾԶ³Ì»á¼ûµÄÄÚÈÝ£º
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { InitRemoteAccess(); HWND hWnd = CreateWindowEx( WS_EX_CLIENTEDGE, "RemoteAccess", "Remote Access", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, hInstance, NULL); if (hWnd == NULL) { MessageBox(NULL, "Window creation failed!", "Error", MB_OK); return 1; } ShowWindow(hWnd, nCmdShow); UpdateWindow(hWnd); MSG msg; while (GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } WSACleanup(); return msg.wParam; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂë»á½¨ÉèÒ»¸ö´°¿ÚÀ´ÏÔʾԶ³Ì»á¼ûµÄÄÚÈÝ£¬Óû§¿ÉÒÔÔڸô°¿ÚÖлá¼ûºÍ¿ØÖÆÔ¶³ÌÅÌËã»úµÄÎļþ¡¢Ó¦ÓóÌÐòºÍϵͳÉèÖá£
×ܽáÆðÀ´£¬÷è÷ë²Ù×÷ϵͳÖеÄÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼û¹¦Ð§¿ÉÒÔͨ¹ýÏìÓ¦µÄº¯ÊýºÍ´°¿ÚÀ´ÊµÏÖ¡£Óû§¿ÉÒÔÀû±ãµØÔÚÍâµØÅÌËã»úÉÏÔ¶³Ì»á¼ûºÍ¿ØÖÆÔ¶³ÌÅÌËã»ú£¬¼«´óµØÌá¸ßÁËÊÂÇéºÍÉúÑĵıã½ÝÐÔ¡£ÒÔÉÏÊǹØÓÚÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼ûÔÚ÷è÷ë²Ù×÷ϵͳÖеÄʵÏÖµÄһЩ¼ò½éºÍ´úÂëʾÀý£¬Ï£Íû¶ÔÄúÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇ÷è÷ë²Ù×÷ϵͳÖеÄÔ¶³Ì×ÀÃæºÍÔ¶³Ì»á¼ûÔõÑùʵÏÖ£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡