Solved

Mapping Network Drives

Posted on 2000-02-21
14
220 Views
Last Modified: 2010-04-04
Hi ho.

I'm using Wise InstallMaster v8.01 to deploy an application writting in Delphi 5.  I need to make it display a Map Network Drive dialog box.  Does anyone know what DLL (ie, SHELL32.DLL, KERNEL386.EXE etc) the fuction is stored in, and what parameters I need to pass to get this dialog box to display?  I know this isn't a Delphi related questions, but you guys are all just so smart ;)

Thanks for any help,

Stu.
0
Comment
Question by:Stuart_Johnson
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2544211
Hi ,
couple of ways:

easy way:

procedure TForm1.Button2Click(Sender: TObject);
begin
  WNetConnectionDialog(Handle,RESOURCETYPE_DISK);
   {RESOURCETYPE_PRINT for printer}
end;


second way ( slightly longer ;-)

procedure TForm1.Button3Click(Sender: TObject);
var
 NetResource: TNetResource;
  begin
  { fill our TNetResource record structure }
 NetResource.dwType       := RESOURCETYPE_DISK;
 NetResource.lpLocalName  := 'S:';
 NetResource.lpRemoteName := '\\server\public';
 NetResource.lpProvider   := '';
{ map our network drive using our TNetResource
 record structure }
 WNetAddConnection2(NetResource,
      '', {Clave o vacio /Password or empty}
      '', {Nombre del usurio o vacio/User name o vacio}
 CONNECT_UPDATE_PROFILE);
   end;
{In that example, we will connect '\\server\public' to S:,
 without username neither password }

Regards Barry
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2544223
Argh, Inthe, you're quick :-)

WNetConnectionDialog(Handle, RESOURCETYPE_DISK);

Be sure to check the result of the WNetConnectionDialog, since according to
the docs it will return ERROR_NO_NETWORK on non-networked computers

Zif

0
 
LVL 17

Expert Comment

by:inthe
ID: 2544232
mmm..i just re-red the question and wondering if that was correct for what you needed?

WNetConnectionDialog comes from mpr.dll
it is declared in windows.pas
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 17

Expert Comment

by:inthe
ID: 2544237
hi zif ,gotta be quick with you and raymond around ;-)
0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 2544278
Hi all,

Thanks for the mega fast replies.  Barry, what you originally specified would have been useful if I was calling it out of Delphi, but as mentioned, I am actually calling it directly out of Wise.  Your second comment was the answer I was looking for.

To call this function, I need to RUNDLL32.EXE.  However, if I type in (at the DOS prompt):

RUNDLL32 C:\WINDOWS\SYSTEM\MPR.DLL WNetConnectionDialog

I get no dialog displayed.  Does anyone have any idea how I can display this dialog at all using RUNDLL32?

Thanks for you help!

Stu.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2544866
hello
typing this below works:

RUNDLL32 user,wnetconnectdialog

doesnt seem to need mpr.dll ?
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2546016
Hi.... The Network Dialog.... hmmm i have seen that before i think... but this is your best bet...

COMDLG32.DLL, i think this is where you get it from, and there are more in here like the dialog box to shutdown windows and more stuff like that....

Barry, You may know what to do with this link.... i gave up trying to call a dll a long time ago :)  but Stuart, i think your answer is here...


http://www.geocities.com/SiliconValley/4942/common.html
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2546032
ok forget the answer being in there... you may find the other dialogs usefull :)  i am going to have to read all the questions first not just parts of them...
0
 
LVL 17

Expert Comment

by:inthe
ID: 2547371
hi craig ,i guessed you misinterpret my comment..i was assuming ineeded to put the path to mpr.dll but seems not.

typing this below at dos prompt etc works fine to show the dialog:

RUNDLL32 user,wnetconnectdialog

0
 
LVL 6

Author Comment

by:Stuart_Johnson
ID: 2548207
Thanks Barry!  Much appreciated.  Works like a dream.

Cheers!!

Stu.
0
 
LVL 17

Expert Comment

by:inthe
ID: 2548224
great to hear ;-)
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2550390
inthe.... Did you check out these dialogs?.... You may find them intrsting if nothing else....

http://www.geocities.com/SiliconValley/4942/common.html
0
 
LVL 17

Expert Comment

by:inthe
ID: 2552925
hi craig ,
thanks for link but i already have components for all these shell dialogs .. ;-)
0
 
LVL 2

Expert Comment

by:craig_capel
ID: 2553952
If i only had the yahoo symbols...... :P

Craig C.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

810 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