Solved

Mapping Network Drives

Posted on 2000-02-21
14
219 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi cmd execution 6 55
tvirtualstringtree freeze when load too manny images 10 52
I want to use librsync in my Delphi backup application. 3 29
update joined tables 2 31
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now