Everyone a great god, and a Shared folder, need to copy files to the local area network (LAN) recently set up this Shared folder access, so I found a similar code below:
Var
Netsorce: TNetResource;
MResult: cardinal;
The begin
Result:=False;
With netsorce do
The begin
DwType:=RESOURCETYPE_DISK;
DwDisplayType:=RESOURCEDISPLAYTYPE_SHARE;
LpLocalName:='v:';
LpRemoteName:=PAnsiChar (' \ \ 10.11.1.2 \ file1 \ ');
LpProvider:=';
end;
Case WNetAddConnection2 (netsorce @ PWD, @ user, CONNECT_UPDATE_PROFILE) of
NO_ERROR: begin the Result:=True; end;
ERROR_ACCESS_DENIED: showmessage (' Access is denied. ');
ERROR_ALREADY_ASSIGNED: ShowMessage (' The device specified in The lpLocalName parameter is already connected. ');
ERROR_BAD_DEV_TYPE: ShowMessage (' The device type and The resource type do not match. ');
ERROR_BAD_DEVICE: ShowMessage (' The value specified in lpLocalName is invalid ');
ERROR_BAD_NET_NAME: ShowMessage (' The value specified in The lpRemoteName parameter is not valid or always be located. ');
ERROR_BAD_PROFILE: ShowMessage (" The user profile is in an incorrect format. ');
ERROR_CANNOT_OPEN_PROFILE: ShowMessage (' The system is unable to open The user profile to process persistent connections. ');
ERROR_DEVICE_ALREADY_REMEMBERED: ShowMessage (' An entry for the device specified in lpLocalName is already in the user profile. ');
ERROR_EXTENDED_ERROR: ShowMessage (' A network - specific error occurred. To get A description of the error, use the WNetGetLastError function. ');
ERROR_INVALID_PASSWORD: ShowMessage (' The specified password is invalid. ');
ERROR_NO_NET_OR_BAD_PATH: ShowMessage (' The operation always be performed because either a network component is not started or The specified name always be 2. ');
ERROR_NO_NETWORK: ShowMessage (" The network is not present. ');
The else
The begin
ShowMessage (' other errors. ');
end;
But the problem is that the old connection, old prompt ERROR_NO_NET_OR_BAD_PATH, the address should be right, or is in this function, fill in the address format should not be like this? That the honour?