RasMonitorDlg

BOOL RasMonitorDlg(
  _In_    LPTSTR          lpszDeviceName,
  _Inout_ LPRASMONITORDLG lpInfo
);

说明

该函数显示用于描述RAS连接状态的拨号网络监视属性页。

参数

lpszDeviceName [in]

指向一个最初显示的设备名称字符串。如果该参数为NULL,或者指定的设备不存在,则显示第一个设备。

lpInfo [in, out]

指向一个RASMONITORDLG结构,用于指定额外的输入输出参数。

调用前将lpInfo->dwSize设置为sizeof(RASMONITORDLG)。

当有错误发生时,可从lpInfo->dwError获取错误代码。

返回值

当用户挂起该连接时,函数返回TRUE,否则返回FALSE。

失败时lpInfo->dwError返回来自Routing and Remote Access Error Codes或Winerror.h中定义的错误码。

注意事项

#include <windows.h>
#include <stdio.h>
#include "ras.h"
#include "rasdlg.h"

DWORD __cdecl wmain()
{

    DWORD dwError = ERROR_SUCCESS;
    BOOL nRet = TRUE;

    // Allocate heap memory and initialize RASMONITORDLG structure

    LPRASMONITORDLG lpInfo = (LPRASMONITORDLG) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASMONITORDLG));

    if (lpInfo == NULL)
    {
           printf("HeapAlloc failed");
           return 0;
    }

    // The RASMONITORDLG dwSize member has to be initialized or the RRAS API will fail below.
    lpInfo->dwSize = sizeof(RASMONITORDLG);

    nRet = RasMonitorDlg(NULL,lpInfo);
    dwError = lpInfo->dwError;

    if (nRet == FALSE)
    {
        printf("User hung up the connection.\n");
    }
    else
    {
        if (dwError != ERROR_SUCCESS){
            printf("RasMonitorDlg failed: Error = %d\n", dwError);
        }
        else
        {
            printf("User pressed Close.\n");
        }
    }

    HeapFree(GetProcessHeap(), 0, lpInfo);
    return 0;
}

系统支持

客户端最小支持Windows 2000 专业版
服务端最小支持Windows 2000 Server
HeaderRasdlg.h
LibraryRasdlg.lib
DLLRasdlg.dll
Unicode和ANSI名称RasMonitorDlgW(Unicode)和RasMonitorDlgA(ANSI)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值