ID_BTN_OK_X:
begin
Computer := GetItemTextW(hDlg, ID_EDT_COMP_X);
User := GetItemTextW(hDlg, ID_EDT_ACCOUNT_X);
PW := GetItemTextW(hDlg, ID_EDT_PW_X);
DisconnectNetworkDrivew(CurComputer);
ret := ConnectToNetworkDriveW('
', Computer + '
\IPC$', User, PW, False);
if ret = 0
then
begin
SelCmpData := GetMemory(sizeof(TSelCmpData));
SelCmpData.Computer := Computer;
SelCmpData.Success := True;
EndDialog(hDlg, Integer(SelCmpData));
end
else
begin
DisplayErrorMsg(hDlg, ret, SysErrorMessage(ret), rsErrorConnectNetWork);
case ret
of
53:
begin
SetItemTextW(hDlg, ID_EDT_COMP_X, '
');
SetFocus(GetDlgItem(hDlg, ID_EDT_COMP_X));
end;
1385:
begin
SetItemTextW(hDlg, ID_EDT_ACCOUNT_X, '
');
SetItemTextW(hDlg, ID_EDT_PW_X, '
');
SetFocus(GetDlgItem(hDlg, ID_EDT_ACCOUNT_X));
end;
end;
end;
end;