Using the WinInet class there4s a slight problem when disconnecting from the Internet because shutting down der Internet session doesn4t close the dial up connection. Unfortunaltely CInternetSession::Close() wont give any possibility of getting the phone line free.
Solution:
The RAS Api has got a method called RasHangUp() which does that job but it needs an RAS handle to do so. There a two ways to get hold of this handle; one is to establish the whole RAS session which is rather complicated and quite unnecessary. The easier one is shown in the code sample below. It uses RasEnumConnections() to get the desired handle; which also works if the connection wasn4t made using RAS directly.
Needed:
In order to get the code below going it is necessary to
have RAS installed on the system ( RASAPI32.DLL ). This is automatically the case when you`ve got a dial up network installed
inlude RAS.H
link RASAPI32.LIB
کد:
برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید
منبع :
کد:
برای مشاهده محتوا ، لطفا وارد شوید یا ثبت نام کنید