WINDOWS远程登录组件mstscax.dll的使用.doc
文本预览下载声明
WINDOWS遠程登錄組件mstscax.dll的使用
專案中要求能有遠程控制功能,這兩天一直在找資料,想到兩個思路: 一是自己寫,思想基本上就是,在被控PC端抓圖,傳到控制程式,然後將控制程式中的指令傳到被控端,如果這樣涉及的知識比較多,有網路傳輸、WIN32API(查下來發現,滑鼠鍵盤的操作,win32API是比較可行的)、WINFORM中的一系列的東西,估計用時會很長,但能學到不少東西; 二就是利用現有的東西,特別是WINDOWS裏的終端功能的介面,基於Remote Desktop Protocol的東西,轉來轉去,發現最方便的是 ActiveX component mstscax.dll的使用,這個直接就可以在winform中生成一個對象。 考慮到工作量和時間,選第二個思路比較方便。 在網上找了很多資料,發現國內用這個的不多,可能是不值得一提吧。 最後終於找到了。現在就講講方法: 這裏主要用到的就是Activex component mstscax.dll,網上看到好多說在visual 2003中的工具箱中可以直接將它添加,我試了Win2k advance server和xp下都不能成功,報“不是com伺服器”,好像這條路行不通,幸好找到一個一個方法,繞過了這個,用的是Windows Forms ActiveX Control Importer (Aximp.exe),具體操作就把找到的帖子粘帖出來。具體的使用,還在摸索。
md c:\temp 2. cd c:\temp 3. %SDK bin directory%\aximp.exe %windir%\system32\mstscax.dll This will generate MSTSCLib.dll and AxMSTSCLib.dll. Make sure Interop.MSTSCLib.dll and AxInterop.MSTSCLib.dll have been deleted in the obj and bin\Debug directories. 4. Copy the generated files (without renaming) - MSTSCLib.dll and AxMSTSCLib.dll into the projects obj directory. 5. In the projects references, add MSTSCLib.dll and AxMSTSCLib.dll from the obj directories. 6. Now, instead of drag-droping the control from the toolbox, write code to add the control: Goto Form.cs code view Declare: private AxMSTSCLib.AxMsTscAx axMsTscAx1; In InitializeComponent: this.axMsTscAx1 = new AxMSTSCLib.AxMsTscAx(); ((System.ComponentModel.ISuppo rtInitialize)(this.axMsTscAx1) ).BeginInit(); this.axMsTscAx1.Enabled = true; this.axMsTscAx1.Location = new System.Drawing.Point(58, 17); this.axMsTscAx1.Name = axMsTscAx1 this.axMsTscAx1.OcxState = ((System.Windows.Forms.AxHost. State)(resources.GetObject(ax MsTscAx1.OcxState))); this.axMsTscAx1.Size = new System.Drawing.Size(192, 192); this.axMsTscAx1.TabIndex = 1; this.Controls.Add(this.axMsTsc Ax1); ((System.ComponentModel.ISuppo rtInitialize)(this.axMsTscAx1) ).EndInit();
===========================================================
1. 首先確保你的機器上存在mstscax.dll,假如沒有這個檔,可以從/downl
显示全部