OSDN Git Service

別のウェブ記事を参考
authoryamat0jp <terukohietori@gmail.com>
Sun, 26 Apr 2020 04:44:56 +0000 (13:44 +0900)
committeryamat0jp <terukohietori@gmail.com>
Sun, 26 Apr 2020 04:44:56 +0000 (13:44 +0900)
Unit1.pas

index 9c0bad7..10aac26 100644 (file)
--- a/Unit1.pas
+++ b/Unit1.pas
@@ -67,12 +67,12 @@ begin
   begin
     dwType := RESOURCETYPE_DISK;
     lpLocalName := nil;
-    lpRemoteName := PChar(ListBox1.Items[ListBox1.ItemIndex]);
+    lpRemoteName := PChar(ListBox1.Items[ListBox1.ItemIndex]+'\IPC$');
     lpProvider := nil;
   end;
   password := PChar('');
   user := PChar('');
-  lResult := WNetAddConnection2(NR, password, user, 0);
+  lResult := WNetAddConnection2(NR, password, user, CONNECT_UPDATE_PROFILE);
   if lResult in [NO_ERROR, ERROR_ALREADY_ASSIGNED] then
   begin
     path := ExcludeTrailingPathDelimiter(NR.lpRemoteName);