利用微软com组件mstscax.dll实现window7远程桌面功能

Lida ·
更新时间:2024-09-21
· 707 次阅读

代码如下:
namespace Client
{
    public partial class Login : Form
    {
        private string ip = null;

        public Login()
        {
            InitializeComponent();
        }

        public Login(string IP)
        {
            InitializeComponent();
            ip = IP;
        }

        private void Login_Load(object sender, EventArgs e)
        {
            this.FormClosing += Login_Closing;

            this.Text = string.Format("登录到:{0}", ip);
            // 获取主机显示器屏幕分辨率
            Rectangle rect = Screen.PrimaryScreen.Bounds;
            try
            {
                rdp.Server = ip;
                rdp.AdvancedSettings2.RDPPort = 3389;
                rdp.Height = rect.Height;
                rdp.Width = rect.Width;
                //rdp.UserName = "client";
                //rdp.AdvancedSettings2.ClearTextPassword = "client";
                rdp.Connect();
                rdp.FullScreen = true;
                //this.FormBorderStyle = FormBorderStyle.None;
                rdp.FullScreenTitle = this.Text;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Login_Closing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("确认退出么?", "提示", MessageBoxButtons.YesNo,
                MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                e.Cancel = true;
        }
    }
}

您可能感兴趣的文章:无法进入远程桌面远程重启WIN2003服务器的方法正确开启Win2008远程桌面的方法windows服务器记录3389远程桌面IP策略用VBS修改远程桌面3389端口并添加到Windows防火墙的代码巧妙启用Windows 2003的远程桌面巧妙启用Windows 2003的远程桌面功能Win 2003的“远程桌面”登录远程桌面时遇到“由于客户端检测到一个协议错误(代码0x1104)”



com dll 远程桌面

需要 登录 后方可回复, 如果你还没有账号请 注册新账号