bool ConnectNetShare(LPSTR ShareName, LPSTR UserName, LPSTR Password)
{ NETRESOURCE ns; memset(&ns, 0, sizeof(ns)); ns.lpRemoteName = ShareName; ns.dwType = RESOURCETYPE_DISK; return WNetAddConnection2(&ns,Password,UserName,0)==NO_ERROR; } void __fastcall TForm1::Button1Click(TObject *Sender) { ShowMessage((int)ConnectNetShare(SharePath->Text.c_str(), ShareUser->Text.c_str(), SharePsw->Text.c_str())); }同意。。 Friecin(雪客)