Solved

DUN RasEnumConnections problem (please help!)

Posted on 2004-03-24
4
539 Views
Last Modified: 2007-12-19
Hi experts,

I'm closing down on a long problem I've been having, I posted a few Q's in the Delphi area and now I'm posting here a second one cause its urgent, the matter is separated, the guys in the Delphi area  must be sick of me and also Dan pointed out something about posting two Qs in one so I guess it's ok to post many Qs if the subject is a bit different ;)

Anyway, my problem is as follows:
I have a small application to stablish a Dialup connection to a local ISP. It works fine, my problem is that in Win2000 & WinXP I can't disconect the dialing when the user clicks on my "cancel" button.

I'm using RasApi. I realized that my RasEnumConnections isn't returning connections so I can't call RasHangUp on it, I'm guessing...

All I wan't is to be able to cancel the connection I'm stablishing, at this point I'm really not concerned how.

What eventually happens is, since my code for disconnecting doesn't work, the connection ends up getting stablished succesfully eventhough the user had click the "cancel" button.

This is a link to another Q I posted in the Delphi area:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20922613.html

Please help!

Thanks,

Esopo.
0
Comment
Question by:Esopo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
Kavar earned 300 total points
ID: 10673083
do you have a valid hrasconn handle?  (I mean can you RasGetConnectStatus without error?)

excerpt from msdn
*********************
When a RAS client application starts a connection operation, the RasDial call receives an HRASCONN connection handle to identify the connection. If the returned handle is not NULL, the client must eventually call the RasHangUp function to end the connection. If an error occurs during the connection operation, the client must call RasHangUp even though the connection was never established.

The application that calls RasHangUp should not exit immediately because the Remote Access Connection Manager needs time to properly terminate the connection. Instead, the application should wait until the RasGetConnectStatus function returns ERROR_INVALID_HANDLE, indicating that the connection has been deleted.
**********************
'end msdn


0
 
LVL 14

Author Comment

by:Esopo
ID: 10673427
Do you mean that, with the HRASCONN connection handle returned by RasDial, I can call RasHangUp even without getting valid connections from  RasEnumConnections?

I'm sure checking this up, thank you for your comment, if you have any other idea please let me know.

Best regards,

Esopo.
0
 
LVL 10

Expert Comment

by:Kavar
ID: 10673438
yes that is what I mean, if you can RasGetConnectStatus with your handle, then regardless of what enumconnections returns, you can RasHangUp the HRASCONN
0
 
LVL 14

Author Comment

by:Esopo
ID: 10682635
It seems to work like a charm. Of Course! the RasDial returns a Handle!! how could I have been so blind!

I stored the handle the RasDial returned and called RasHangUp with it. Seems to work properly. Thank you. This Q is over. (Finally, now I just have to close the other Qs related to this subject ;)
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Simple Linear Regression

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question