SAMPLE: ServerEnumDialog DLL

Last reviewed: September 15, 1997
Article ID: Q118327

The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK) for Windows NT version 3.1

SUMMARY

SERVENUM is a dynamic-link library (DLL) that implements a multithreaded dialog box, allowing a user to browse the network for servers. The dialog box is instantiated by calling the ServerEnumDialog application programming interface (API) implemented in the SERVENUM.DLL.

The following file is available for download from the Microsoft Software Library:

 ~ Srvenm.exe (size: 77485 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

MORE INFORMATION

The Win32 application programming interface (API) implements several WNet dialog boxes that allow users to connect to and browse network resources. However, an API allowing a user to browse the network for servers is currently not implemented.

Because such a dialog box is often useful in network programs, the SERVENUM sample implements such a dialog box within a DLL. The sample also includes a simple Windows program that calls the ServerEnumDialog API implemented in SERVENUM.DLL of the sample. For redistribution issues of the DLL, please see the README.TXT file included with the sample.

This sample demonstrates the following Win32 programming issues:

   DLLs
   thread local storage
   multithreading and thread synchronization
   owner-draw list boxes
   Unicode
   WNet APIs

API Interface

ServerEnumDialog(

   HWND hwnd,              // Handle of calling window
   LPWSTR lpszServer,      // Buffer to store chosen server name
   LPDWORD lpcchServer,    // Pointer to size of buffer in bytes
   FARPROC lpfnHelpProc    // User-defined help procedure
   )

Purpose:

   Display a dialog box that allows a user to select a computer on the
   network. The user may also type in a string. The result is not
   guaranteed to be a valid computer name.

Parameters:

   hwnd - Handle of calling window

   lpszServer -   Buffer to store resultant server name in. This should be
                  of length MAX_COMPUTERNAME_LENGTH+3

   lpcchServer -  Pointer to size of lpszServer, including the NULL
                  terminating character. The resultant length of the string
                  is stored here. If ERROR_MORE_DATA is return, the value
                  is the required size of the buffer.

   lpfnHelpProc - Pointer to user-defined help procedure. The procedure
                  should be prototyped as int HelpProc( VOID );

 Return Value:

   ERROR_SUCCESS - User selected or typed in a server name
   ERROR_CANCELLED - Dialog box was canceled
   ERROR_NOT_ENOUGH_MEMORY - Unable to initialize dialog box
   ERROR_MORE_DATA - lpszServer not large enough


Additional query words: WNetServerBrowseDialog softlib
Keywords : NtwkWinnet kbnetwork
Version : WINDOWS NT:3.1
Platform : NT WINDOWS
Issue type : kbfile
Solution Type : kbsample


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.