HOWTO: Hiding the "Connected to" Dialog Box When Using RasDial

Last reviewed: August 13, 1997
Article ID: Q166292
The information in this article applies to:
  • Microsoft Windows 95

SUMMARY

When you establish a successful RAS connection using the RasDial API, the "Connected to..." dialog box is displayed when you run it on Windows 95. This behavior is by design and there is no programmatic way to prevent Windows 95 from generating this dialog box. Neither Windows NT 4.0 nor Windows 95 OSR 2 is subject to this issue and this behavior is also by design. However, you can write code to hide this dialog box after it momentarily appears.

MORE INFORMATION

On Windows 95, you can hide this dialog box, after it momentarily appears, by using the FindWindow and ShowWindow APIs in a worker thread.

  1. Create a worker thread immediately before you call the RasDial API.

  2. Have the worker thread periodically call the FindWindow API (perhaps every few seconds), passing into it the name of the "Connected to ..." dialog box. This name is the concatentation of the string "Connected to " and "MyConnection", where "MyConnection" is the RAS phonebook entry name for the phone number being dialed via RasDial. Assuming a RAS phonebook entry named XXX, the call to FindWindow would look like the following:

          hRasWnd = FindWindow(NULL, "Connected to XXX");
    

  3. When FindWindow successfully returns a window handle, pass that window handle into ShowWindow and specify the SW_HIDE parameter to hide the dialog box. For example, assuming hRasWnd is a valid window handle returned from a successful call to the FindWindow API, the call to the ShowWindow API would look like the following:

          fStatus = ShowWindow(hRasWnd, SW_HIDE);
    

  4. Exit the worker thread.

Note that appropriate precautions must be made to exit the worker thread for the case when the connection is never established.

Also, if the name of the phonebook entry is too long, the dialog box will truncate it. In this case you can either rename the entry to a shorter name or use a completely different technique of enumerating all windows and searching for the window that matches the beginning of the title.

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Leon Braginski, Microsoft Corporation


Additional query words: 95
Keywords : kbnetwork
Version : 95
Platform : WINDOWS
Issue type : kbhowto


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: August 13, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.