Microsoft KB Archive/166292

{|
 * width="100%"|

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

 * }

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.

 Create a worker thread immediately before you call the RasDial API.  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');"  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);" 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.

© Microsoft Corporation 1997, All Rights Reserved.

Contributions by Leon Braginski, Microsoft Corporation

Additional query words:

Keywords : kbnetwork kbAPI kbRAS kbSDKPlatform kbOSWin95 kbGrpDSNet

Issue type : kbhowto

Technology : kbWin95search kbWin95