请问,在C#中能不能操作另一台电脑上的非共享文件夹下的文件
解决方案 »
- excel 怎么导入access呢?
- 奇怪的问题,高手指点
- 求一个正则表达式
- 一个“类”中,不能多次调用“WCF 代理类”中同一方法???
- WINFORM TREEVIEW如何更新某一子节点?
- 请高手帮忙!!!如何控制事务???
- 有没有高手帮帮我,关于类的问题
- 痛苦的问题!!!
- [WinForm]有没有直接的方法画出Button的样子?
- 那里有《ASP.NET高级编程-C# 编程》下载啊
- 從局域网中的電腦連接到internet(固定ip)上的電腦,怎樣做100分請教
- 新建asp.net web应用程序时报“http:/1.1 403 Access Forbidden”错误,直接的帮助里说得不甚清楚,有解决过这个问题的,说具体点么?
共享时共享名后加上“$”,这些共享时别人无法看见,是隐藏的共享,访问时用共享名后加“$”
有源代码吗
//*****************************************************************************
應該可以,但是沒試過,你可以做一個網絡磁碟映射,(這個需要知道对方帐号和密码) 如H
然後直接直接對H路徑操作,和訪問本機是一樣的
有源码吗?
谢谢
{
//Set up a handler for the asynchronous callback
ManagementOperationObserver observer = new ManagementOperationObserver();
completionHandler.MyHandler completionHandlerObj = new completionHandler.MyHandler();
observer.ObjectReady += new ObjectReadyEventHandler(completionHandlerObj.Done); string stringMachineName = ""; //Connect to the remote computer
ConnectionOptions co = new ConnectionOptions(); if (radioMachine.Checked == true)
{
stringMachineName = "localhost";
}
else
{
stringMachineName = textIP.Text;
} if (stringMachineName.Trim().Length == 0)
{
MessageBox.Show("Must enter machine IP address or name.");
return;
} //get user and password
if (textUserID.Text.Trim().Length > 0)
{
co.Username = textUserID.Text;
co.Password = textPassword.Text;
} //Point to machine
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\" + stringMachineName + "\\root\\cimv2", co);
//get process path
ManagementPath path = new ManagementPath( "Win32_Process"); //Get the object on which the method will be invoked
ManagementClass processClass = new ManagementClass(ms,path,null); //Status
updateStatus("Create process " + stringCommandLine + ".");
//Create an array containing all arguments for the method
object[] methodArgs = {stringCommandLine, null, null, 0}; //Execute the method
processClass.InvokeMethod (observer, "Create", methodArgs); //wait until invoke method is complete or 5 sec timeout
int intCount = 0;
while (!completionHandlerObj.IsComplete)
{
if (intCount > 10)
{
MessageBox.Show("Create process timed out.", "Terminate Process Status");
break;
}
//wait 1/2 sec.
System.Threading.Thread.Sleep(500);
//increment counter
intCount++;
} if (intCount != 10)
{
//InvokeMethod did not time out
//check for error
if (completionHandlerObj.ReturnObject.Properties["returnValue"].Value.ToString() == "0")
{
//refresh process list
this.Refresh();
}
else
{
MessageBox.Show("Error creating new process.", "Create New Process");
}
} //Status
updateStatus("Ready");
this.Update();
}