Click here to Skip to main content
15,883,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIncrease Height of the Status Bar Pin
RockyJames4-Apr-06 3:23
RockyJames4-Apr-06 3:23 
AnswerRe: Increase Height of the Status Bar Pin
toxcct4-Apr-06 4:19
toxcct4-Apr-06 4:19 
AnswerRe: Increase Height of the Status Bar Pin
ThatsAlok4-Apr-06 6:59
ThatsAlok4-Apr-06 6:59 
QuestionMenus Pin
Aravind Badrinath Krishnan4-Apr-06 3:20
Aravind Badrinath Krishnan4-Apr-06 3:20 
QuestionWaitCommEvent Pin
LCI4-Apr-06 3:08
LCI4-Apr-06 3:08 
AnswerRe: WaitCommEvent Pin
Ștefan-Mihai MOGA4-Apr-06 3:17
professionalȘtefan-Mihai MOGA4-Apr-06 3:17 
GeneralRe: WaitCommEvent Pin
LCI4-Apr-06 6:06
LCI4-Apr-06 6:06 
AnswerRe: WaitCommEvent Pin
YaronNir4-Apr-06 4:06
YaronNir4-Apr-06 4:06 
Taken from the MSDN :


#include <windows.h>
#include <assert.h>
#include <stdio.h>

void main( )
{
    HANDLE hCom;
    OVERLAPPED o;
    BOOL fSuccess;
    DWORD dwEvtMask;

    hCom = CreateFile( "COM1",
        GENERIC_READ | GENERIC_WRITE,
        0,    // exclusive access 
        NULL, // default security attributes 
        OPEN_EXISTING,
        FILE_FLAG_OVERLAPPED,
        NULL 
        );

    if (hCom == INVALID_HANDLE_VALUE) 
    {
        // Handle the error. 
        printf("CreateFile failed with error %d.\n", GetLastError());
        return;
    }

    // Set the event mask. 

    fSuccess = SetCommMask(hCom, EV_CTS | EV_DSR);

    if (!fSuccess) 
    {
        // Handle the error. 
        printf("SetCommMask failed with error %d.\n", GetLastError());
        return;
    }

    // Create an event object for use by WaitCommEvent. 

    o.hEvent = CreateEvent(
        NULL,   // default security attributes 
        FALSE,  // auto reset event 
        FALSE,  // not signaled 
        NULL    // no name
		);
    

    // Intialize the rest of the OVERLAPPED structure to zero.
    o.Internal = 0;
    o.InternalHigh = 0;
    o.Offset = 0;
    o.OffsetHigh = 0;

    assert(o.hEvent);

    if (WaitCommEvent(hCom, &dwEvtMask, &o)) 
    {
        if (dwEvtMask & EV_DSR) 
        {
             // To do.
        }

        if (dwEvtMask & EV_CTS) 
        {
            // To do. 
        }
    }
    else
    {
        DWORD dwRet = GetLastError();
        if( ERROR_IO_PENDING == dwRet)
        {
            printf("I/O is pending...\n");

            // To do.
        }
        else 
            printf("Wait failed with error %d.\n", GetLastError());
    }
}


Ask not what your application can do for you,
Ask what you can do for your application
Questionperformance of C,C++ programs Pin
vikramlinux4-Apr-06 2:54
vikramlinux4-Apr-06 2:54 
AnswerRe: performance of C,C++ programs Pin
toxcct4-Apr-06 3:05
toxcct4-Apr-06 3:05 
GeneralRe: performance of C,C++ programs Pin
vikramlinux4-Apr-06 3:08
vikramlinux4-Apr-06 3:08 
GeneralRe: performance of C,C++ programs Pin
bob169724-Apr-06 3:11
bob169724-Apr-06 3:11 
GeneralRe: performance of C,C++ programs Pin
toxcct4-Apr-06 3:12
toxcct4-Apr-06 3:12 
GeneralRe: performance of C,C++ programs Pin
vikramlinux4-Apr-06 3:43
vikramlinux4-Apr-06 3:43 
GeneralRe: performance of C,C++ programs Pin
toxcct4-Apr-06 3:46
toxcct4-Apr-06 3:46 
GeneralRe: performance of C,C++ programs Pin
Maximilien4-Apr-06 3:14
Maximilien4-Apr-06 3:14 
GeneralRe: performance of C,C++ programs Pin
vikramlinux4-Apr-06 20:16
vikramlinux4-Apr-06 20:16 
AnswerRe: performance of C,C++ programs Pin
Maximilien4-Apr-06 3:10
Maximilien4-Apr-06 3:10 
AnswerRe: performance of C,C++ programs Pin
Ștefan-Mihai MOGA4-Apr-06 3:11
professionalȘtefan-Mihai MOGA4-Apr-06 3:11 
AnswerRe: performance of C,C++ programs Pin
toxcct4-Apr-06 3:42
toxcct4-Apr-06 3:42 
QuestionMarshalling Pin
viperlogic4-Apr-06 2:36
viperlogic4-Apr-06 2:36 
AnswerRe: Marshalling Pin
Roger Stoltz4-Apr-06 3:03
Roger Stoltz4-Apr-06 3:03 
GeneralRe: Marshalling Pin
viperlogic4-Apr-06 3:22
viperlogic4-Apr-06 3:22 
GeneralRe: Marshalling Pin
YaronNir4-Apr-06 4:00
YaronNir4-Apr-06 4:00 
AnswerRe: Marshalling Pin
Roger Stoltz4-Apr-06 4:01
Roger Stoltz4-Apr-06 4:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.