Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating a RAS disconnection
Message
From
18/09/1997 08:51:36
 
 
To
18/09/1997 06:20:23
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00050523
Message ID:
00050538
Views:
29
>Thanks for the reply. I am e-mailing you because I have never used the API function on Visual Foxpro5. When you told me to refer to the RASHangUp() Win32 API function, I did not really understand what you were trying to say. So I looked in the WindowsNT ver.4.00 help fileto see if I could find anything on this feature, but unforunately I did not find anything. So then I looked in the Foxpro5 help file and found some information on API files but because I have never used API files before I could not figure out how to associate a api file with WindowsNT RAS. I would be very gratefull if you could shed some light on this topic.

It is not an API file, but an API function (Win32 API). (API = Application Programming Interface).

If you're not using API functions, how did you established the RAS connection? (Maybe you already said it in a thread I didn't read?)

Basically, to use an API function, you must declare it using DECLARE and after that you can use it as a VFP function (or almost).

Here's the help for RASHangUp():

The RasHangUp function terminates a remote access connection. The connection is specified with a Remote Access Service (RAS) connection handle. The function releases all RASAPI32.DLL resources associated with the handle.

DWORD RasHangUp(

HRASCONN hrasconn // handle to the RAS connection to hang up
);
Parameters

hrasconn

Identifies the remote access connection to terminate. This is a handle returned from a previous call to RasDial or RasEnumConnections.

Return Value

If the function succeeds, the return value is zero.
If the function fails, the return value is a nonzero error value listed in the RAS header file, or ERROR_INVALID_HANDLE.

Remarks

The connection is terminated even if the RasDial call has not yet been completed.
After this call, the hrasconn handle can no longer be used.
An application should not call RasHangUp and then immediately exit. The connection state machine needs time to properly terminate. If the system prematurely terminates the state machine, the state machine may fail to properly close a port, leaving the port in an inconsistent state. A simple way to avoid this problem is to call Sleep(3000) after returning from RasHangUp; after that pause, the application can exit. A more responsive way to avoid the problem is, after returning from RasHangUp, to call RasGetConnectStatus(hrasconn) and Sleep(0) in a loop until RasGetConnectStatus returns ERROR_INVALID_HANDLE.

See Also

RASCONN, RasDial, RasEnumConnections, RasGetConnectStatus, Sleep
Previous
Reply
Map
View

Click here to load this message in the networking platform