DelphiFAQ Home Search:
General :: Programming :: Delphi :: Network
Network (local network and Internet) programming under Windows with Delphi.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Dialogs to connect or disconnect mapped network drives

There are two functions WNetConnectionDialog and WNetDisconnectionDialog that will display these dialogs. They are defined in unit Windows (Delphi 5).

The first parameter Handle identifies the owning window by its window handle.

These Win32 API calls only brings up the network connections dialog.

If you want to map programmatically a specific (remote or local) directory to a specific drive letter, then I recommend creating a temporary batch file with a command like this:

NET USE  N:  \\\C$\Temp

This only works if the currently logged in user has an identical account on the remote machine. Otherwise the batch file will ask for the password during execution - ugly.

To remove a mapping programmatically, create a batch file with a command like this:


   // show the connect dialog
  WNetConnectionDialog(Handle, RESOURCETYPE_DISK);
   // ...

   // show the disconnect dialog
  WNetDisconnectDialog(handle, RESOURCETYPE_DISK);
You don't like the formatting? Check out SourceCoder then!
Generated 16:01:12 on Nov 18, 2019