Solved

Mapping Network Drives

Posted on 2000-02-21
14
218 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

12 Experts available now in Live!

Get 1:1 Help Now