📄 0503006.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<link rel="stylesheet" type="text/css" href="../../vckbase.css">
</head>
<body>
<div align="justify">
<table border="0" width="100%" class="font" height="57">
<tr>
<td width="27%" height="6" class="bigfont" bgcolor="#B8CFE7" align="center" bordercolor="#800080">
<font color="#800080">VC知识库(五)</font>
</td>
<td width="73%" height="6" class="bigfont" bgcolor="#B8CFE7" align="center" bordercolor="#800080">
<font color="#800080">www.vckbase.com</font>
</td>
</tr>
<tr>
<td width="100%" height="4" class="header" valign="top" align="center" colspan="2">
<hr>
</td>
</tr>
<tr>
<td width="100%" height="17" class="header" valign="top" align="center" colspan="2">
<big><strong>在使用Internet后挂断线路</strong></big></NOSCRIPT>
</td>
</tr>
<tr>
<td width="100%" height="17" class="info" align="center" colspan="2">
</td>
</tr>
<tr>
<td width="100%" height="22" class="font" colspan="2">
<hr>
</td>
</tr>
<tr>
<td width="100%" height="5" class="font" colspan="2">
<p>WinInet API提供的功能很强大,但是当关闭掉Internet事务却不能关闭掉dial
up连接。在WinInet API中没有提供相应的函数完成该功能。</p>
<h3>解决方法:</h3>
<p>RAS API可以通过调用RasHangUp(...)关闭连接,但是需要RAS句柄。有两种方法可以得当RAS句柄:1、自己建立RAS连接是保存该句柄,但这样做对与解决当前提出的问题是没必要的,2、通过RasEnumConnections(...)列举所有句柄。</p>
<h3>所需环境:</h3>
<ol>
<li>RASAPI32.DLL,该连接库在安装播号网络时会自动安装。</li>
<li>RAS.H </li>
<li>RASAPI32.LIB </li>
</ol>
<h3>示范代码:<!-- start a block of source code --></h3>
<!-- start a block of source code -->
<p><tt><font color="#990000">// Quit a dial up connection - rasapi32.lib und
#include "ras.h" needed<br>
bool DisconnectRas()<br>
{<br>
bool bOk = false;<br>
RASCONN ras[20];<br>
DWORD dSize,dNumber,dCount;<br>
<br>
ras[0].dwSize = sizeof(RASCONN);<br>
dSize = sizeof( ras );<br>
<br>
// Get active RAS - Connection<br>
if( RasEnumConnections( ras, &dSize, &dNumber ) == 0 )<br>
{<br>
bOk = true;<br>
<br>
for( dCount = 0; dCount < dNumber; dCount++ )<br>
{<br>
// Hang up that connection<br>
if( RasHangUp(ras[dCount].hrasconn) != 0
)<br>
{<br>
bOk = false;<br>
break;<br>
}<br>
}<br>
}<br>
return bOk;<br>
}</font></tt></p>
</td>
</tr>
<tr>
<td width="100%" height="12" class="font" colspan="2">
</td>
</tr>
<tr>
<td width="100%" height="6" class="font" colspan="2">
</td>
</tr>
<tr>
<td width="100%" height="8" class="font" colspan="2">
</td>
</tr>
<tr>
<td width="100%" height="17" class="font" colspan="2"></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -