Wednesday, March 2, 2011

How to bring up the network connections dialog using Win32 API

If you want to give your users the opportunity to connect to network resources from within your program, all you have to do is call the "WNetConnectionDialog()" Win32 API function:

 
WNetConnectionDialog(
  0,
  RESOURCETYPE_DISK );
Listing #1 : Delphi code. Download netdrv (0.18 KB).
 
First parameter is the handle of the parent Window, so if you're calling "WNetConnectionDialog()" from a "form" window, you can pass "Handle" to make the network drives dialog a child window of the form.
 
WNetConnectionDialog(
  Handle,
  RESOURCETYPE_DISK );
Listing #2 : Delphi code. Download netdrv2 (0.19 KB).

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum