Solved

Mapping Network Drives

Posted on 2000-02-21
14
224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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