GetCommTimeouts

 

Description

The GetCommTimeouts function retrieves the time-out parameters for all read and write operations on a specified communications device.

Syntax

BOOL GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts )

Parameters

hFile
Handle to the communications device.
lpCommTimeouts
Pointer to a COMMTIMEOUTS structure in which the time-out information is returned.

Return

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Examples

EX1

#include <Origin.h>
#include <mscomm.h>

BOOL Get_Comm_Timeouts()
{

        file ff;

        //Open comm port
        if (!ff.Open("COM1:",  file::modeReadWrite ))
        {
                ASSERT(FALSE);
                return FALSE;
        }

        UINT hCom = ff.GetHandle();

        if ( hCom == file::hFileNull ) 
        {
                ASSERT(FALSE);
                return FALSE;
        }

        COMMTIMEOUTS tTimeout; 
        // get the timeout 
        if( !GetCommTimeouts((HANDLE)hCom,&tTimeout) )
        {
                ASSERT(FALSE);  
                return FALSE;
        }

        //...

        if( !ff.Close() ) // Close() function will happen automatically by the file class destructor.
        {
                ASSERT(FALSE);
                return FALSE;
        }
}

Remark

See Also

file::Open, file::GetHandle, SetCommTimeouts

header to Include

mscomm.h

Reference