HOWTO: Hide the "Connected to..." Dialog When Using RasDial

Article ID: Q167308
Creation Date: 22-APR-1997
Revision Date: 23-APR-1997

The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API) included with: - Windows 95

SUMMARY

When a successful RAS connection is established using the RasDial API, the "Connected to..." dialog box is displayed when you are running on Windows 95. This behavior is by design and there is no programmatic way to prevent Windows 95 from generating this dialog box. However, you can write code to hide this dialog box after it momentarily appears.

NOTE: This does not occur when you are running on Windows NT 4.0 or Windows 95 OSR 2.

MORE INFORMATION

Use the FindWindow and ShowWindow APIs in a worker thread to hide the dialog box after it momentarily appears.

  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 will be 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: If the connection is never established, appropriate precautions must be made to exit the worker thread.

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


Keywords : kbnetwork NtwkRAS
Version : 95
Platform : Win95
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.

©1997 Microsoft Corporation. All rights reserved. Legal Notices.