Answered by:
remote computer

Question
-
hi..
I want to access modem attached to my system and invoke it through
vb.net application which will connect to other computer connected
through telephone line. my application then will demand some data from
the remote computer the data transfer logic is working fine. infact i
can transfer data if i connect them using dialup..but i dont want user
to make all this stuff but through my application..
any help???
thanks in advance..- Moved by nobugz Tuesday, August 25, 2009 7:07 PM (From:Windows Forms General)
Tuesday, August 25, 2009 5:05 AM
Answers
-
Hi vicks1234,
http://social.msdn.microsoft.com/Forums/en-US/vblanguage/thread/5dbc3ae4-6f4d-4224-837c-107897d8f76d
Welcome to MSDN forums! You could know more informaition form Martin's answer.
1. You can use WMI to login remote computer with credential users.
Code sample: How to use Windows Management Instrumentation (WMI) to connect/login remote computer and retrieve hardware info (e.g. check available space).
Trackback:http://forums.msdn.microsoft.com/en-US/vblanguage/thread/d25ba4b3-57cd-4127-999e-525810961634/
Imports System.ManagementPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load CalculateFreeUsed("SeverName1") CalculateFreeUsed("SeverName2") End Sub Private Sub CalculateFreeUsed(ByVal srvname As String) Try 'Connection credentials to the remote computer, not needed if the logged account has access Dim oConn As ConnectionOptions = New ConnectionOptions oConn.Username = "AdminUsername" oConn.Password = "AdminPassword" Dim strNameSpace As String = "\\" If (srvname <> "") Then strNameSpace = (strNameSpace + srvname) Else strNameSpace = (strNameSpace + ".") End If strNameSpace = (strNameSpace + "\root\cimv2") Dim oMs As ManagementScope = New ManagementScope(strNameSpace, oConn) 'get Fixed disk state Dim oQuery As ObjectQuery = New ObjectQuery("select FreeSpace,Size,Name from Win32_LogicalDisk where DriveType=3") 'Execute the query Dim oSearcher As ManagementObjectSearcher = New ManagementObjectSearcher(oMs, oQuery) 'Get the results Dim oReturnCollection As ManagementObjectCollection = oSearcher.Get 'loop through found drives and write out info Dim D_Freespace As Double = 0 Dim D_Totalspace As Double = 0 For Each oReturn As ManagementObject In oReturnCollection ' Disk name ListBox1.Items.Add(("Disk: " + oReturn("Name").ToString)) ' Free Space in bytes ListBox1.Items.Add("Free Space: " + oReturn("FreeSpace").ToString) 'Total Space in bytes ListBox1.Items.Add("Total Space: " + oReturn("Size").ToString) Next Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class
2. You can connect to remote desktop via running mstsc.exe command in VB.NET like this:
Detail: http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/f316f409-2e1f-4789-be6d-dd19c7edefec/Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Execute command with arguments in Dos command line Process.Start("Cmd.exe", "/C mstsc.exe C:\RemoteServer.rdp") ' /C parameter means exiting Cmd.exe after executing command End Sub End Class
3. You can use the remote desktop control named msrdp.ocx (that is Microsoft Terminal Sevices control) to connect to remote desktop.
Right-click on Toolbox in Visual Studio 2005/2008 -> Choose Items -> COM Components tab -> Locate the "Microsoft Terminal Services Control" and add it.
Then the control named "Microsoft Terminal Services Control" will be added onto the Toolbox. If you drag&drop it onto Form, the AxMsTscAxNotSafeForScripting1 object will be generated automatically.
You can see these properties of the control in Properties pane and play with them to see if they can achieve your goal.
Code sample: Call "Microsoft Terminal Services Control" to connect remote workstation desktop in VB.NET.Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxMsTscAxNotSafeForScripting1.Server = "MartinXie" AxMsTscAxNotSafeForScripting1.Domain = "fareast" AxMsTscAxNotSafeForScripting1.UserName = "v-maxie" AxMsTscAxNotSafeForScripting1.Connect() End Sub End Class Here is the illustration:
Trackback: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/ee5e2b11-e36f-477c-8476-a88c11e79242/
Best Regards
Xinwei Hu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Marked as answer by Xingwei Hu Thursday, September 10, 2009 5:01 AM
Monday, August 31, 2009 12:03 PM