1 |
用C# 實做 遠端桌面連線 , 因為公司ERP 使用遠端方式連接 , 做個小程式方便公司使用, |
1 |
順便學習一下C# 的開發環璄 |
1 |
1 2 3 4 5 6 |
AxMSTSCLib.AxMsRdpClient6 rdpc = <span class="kwrd">new</span> AxMSTSCLib.AxMsRdpClient6 rdpc.Server = <span class="str">"IP ADDR"</span> <span class="rem">//遠端ip</span> rdpc.UserName = <span class="str">"LOGIN ID"</span> <span class="rem">//登入帳號</span> IMsTscNonScriptable secured = (IMsTscNonScriptable)rdpc.GetOcx(); secured.ClearTextPassword = <span class="str">"LOGIN PASSWORD"</span>; <span class="rem">//登入密碼</span> rdpc.DesktopHeight = Screen.PrimaryScreen.Bounds.Height; <span class="rem">//</span><span class="rem">取得本機解析度</span> |
1 2 3 4 5 6 7 8 |
<span class="rem"></span> rdpc.DesktopWidth = Screen.PrimaryScreen.Bounds.Width; <span class="rem">//<span class="rem">並設定遠端主機解析度</span> </span> rdpc.AdvancedSettings6.RedirectPrinters = <span class="kwrd">true</span>; <span class="rem">//使用本機印表機 </span> rdpc.AdvancedSettings6.RedirectClipboard = <span class="kwrd">true</span>; <span class="rem">//使用本機剪貼簿</span> rdpc.FullScreen = <span class="kwrd">true</span>; <span class="rem">//全螢幕</span> rdpc.ColorDepth = 16; <span class="rem">//彩度</span> <span class="kwrd">this</span>.Controls.Add(rdpc); rdpc.Connect(); rdpc.FullScreenTitle = <span class="str">"TITLE"</span>; //顯示抬頭 |