PureUser wrote:so can anyone help me????
@PureUser
I am not sure I am qualified to help. But since I am very interested in
a RAS dialer I took a look at the code posted and tested with it a bit.
Jurgen is correct in that your program is in a loop because res = 0.
However, the reason it is 0 is not because the API call is being
completed successfully.
At least here on my machine (Win98SE), the first attempt to run the
program dials and then ends, but doesn't clear the screen. Subsequent
attempts to run the program bypass the dialing and the results of the
Code: Select all
res = RasGetConnectStatus_(hRasConn, @RCS)
always returns as 0. This continues until a hard boot is done.
The reason for this is that you issue a RasHangUp_(@hRasConn)
and immediately end the program. The API documentation advises
against that as it leaves the port in limbo. This is what causes the
failure to dial and the incorrect resuls from the ConnectStatus on
subsequent runs.
You can Delay(3000) after the RasHangUp_(@hRasConn) and perhaps
solve that, although I have found that it isn't always enough. The best
way is to query the results of the
RasGetConnectStatus_(hRasConn, @RCS)
until it returns an Invalid Connection result indicating that the opened
connection has been disconnected and removed before exiting.
Unfortunately, I wasn't successful in doing that. My guess is that the
Structure RASCONNSTATUS is not defined correctly. What little
documentation I have access to indicates it should be 160 bytes total.
Therein lies much of my problems with RAS. I don't have complete
documentation of the RASHEADERS, etc. to work with. Perhaps you
do.
Hopefully this will help. If you get it working, please post your code. I
will do the same.
Regards,
Terry