RasMonitorDlg function

The RasMonitorDlg function displays the Dial-Up Networking Monitor property sheet that describes the status of RAS connections.

Syntax


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

Parameters

lpszDeviceName [in]

Pointer to a null-terminated string that specifies the name of the device to display initially. If this parameter is NULL, or if the specified device does not exist, the property sheet displays the first device.

lpInfo [in, out]

Pointer to the RASMONITORDLG structure that specifies additional input and output parameters.

On input, the dwSize member of this structure specifies sizeof( RASMONITORDLG).

If an error occurs, the dwError member receives, on output, an error code; otherwise, it receives zero.

Return value

If the user hangs up a connection, the return value is TRUE. Otherwise, the function returns FALSE.

If an error occurs, the dwError member of the RASMONITORDLG structure returns a value from Routing and Remote Access Error Codes or Winerror.h.

Remarks

The following sample code invokes the RAS monitor dialog box.


#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;
}


Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Rasdlg.h

Library

Rasdlg.lib

DLL

Rasdlg.dll

Unicode and ANSI names

RasMonitorDlgW (Unicode) and RasMonitorDlgA (ANSI)

See also

Remote Access Service (RAS) Overview
Remote Access Service Functions
RASMONITORDLG

 

 

Community Additions

ADD
Show: