?
Solved

For NigelTodd - NetAddConnection question

Posted on 2000-01-06
3
Medium Priority
?
212 Views
Last Modified: 2010-04-06
This is an attempt to get both you and Madshi points for helping answer my question.

How can I dynamically map a drive to a Network Server in Delphi 3 without requiring multiple calls to a Batch file containing the Net Use M: command?

I am writing a program that has to retrieve data from a database that resides locally on 46 Network Servers.  The database is located in the same folder and has an identical name on each of the 46 Network Servers.  I kind of know how to solve this problem with the Batch file approach but would rather avoid pulling a DOS/Command window up 46 times each time the program is run.


Thanks again for your help.
0
Comment
Question by:blakec
3 Comments
 
LVL 6

Expert Comment

by:Jaymol
ID: 2331679
Have this....

function MapNetworkDrive(RemoteName, LocalName: String): Integer;
var
  NewMap : NetResource;
begin
  NewMap.lpRemoteName:=PAnsiChar(RemoteName); // Path to dir to map.
  NewMap.lpLocalName:=PAnsiChar(LocalName);  // Drive letter to use.
  NewMap.lpProvider:=nil;
  NewMap.dwType:=RESOURCETYPE_DISK;
  Result:=WNetAddConnection(PChar(RemoteName), nil, PChar(LocalName));
end;

Maps a network drive.

Have fun,

John.
0
 

Accepted Solution

by:
nigeltodd earned 200 total points
ID: 2335335
Use the netconn component available from Delphi Super Page or give me you r eamil address & I'll send it to you. While Madshi (& others) have suggested using WNetConnection calls, this component is as easy as just setting the properties, and making the connection.

Good luck,

Nigel
0
 

Author Comment

by:blakec
ID: 2339151
Hey Nigel,

I tried using the NetConn component but couldn't get it to install.  I'm using D3 for this project and am not sure I have all the patches for it.

Email me @ blake.cook@staff-leasing.com or blakec@iname.com

Thanks for your help Nigel!!!

Blake
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question