Click here to Skip to main content
15,896,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: 'c' Program Pin
David Crow9-Nov-09 4:21
David Crow9-Nov-09 4:21 
JokeRe: 'c' Program Pin
Cedric Moonen9-Nov-09 4:32
Cedric Moonen9-Nov-09 4:32 
AnswerRe: 'c' Program Pin
Michael Schubert9-Nov-09 6:03
Michael Schubert9-Nov-09 6:03 
QuestionInvalidating / Repainting / Refreshing UltraWinGrid in/from C++ Control Pin
Sebastian Schwarzenberg9-Nov-09 2:40
Sebastian Schwarzenberg9-Nov-09 2:40 
AnswerRe: Invalidating / Repainting / Refreshing UltraWinGrid in/from C++ Control Pin
LunaticFringe9-Nov-09 8:22
LunaticFringe9-Nov-09 8:22 
QuestionHow does one access a Serial port using Visual C++ 2008 Express tools. Pin
dk-info9-Nov-09 1:32
dk-info9-Nov-09 1:32 
AnswerRe: How does one access a Serial port using Visual C++ 2008 Express tools. Pin
David Crow9-Nov-09 2:58
David Crow9-Nov-09 2:58 
GeneralRe: How does one access a Serial port using Visual C++ 2008 Express tools. Pin
dk-info9-Nov-09 5:33
dk-info9-Nov-09 5:33 
Thank you for the rapid response.

I used a portion of the code you presented to illustrate how to so simple serial output from a Win32 console application. I was able to create a Handle using this code:
#include <iostream>
#include <windows.h>
#include "serialPlay.h"
using namespace std;

int main(void)
{
    HANDLE hCom;
    DWORD dwRet;

    // try to open a serial port
    hCom = ::CreateFile(
       TEXT("\\\\.\\COM1"),	      // filename
       GENERIC_READ | GENERIC_WRITE,  // desired access
       0,                             // exclusive
       NULL,                          // security irrelevant
       OPEN_EXISTING,                 // it has to be there
       FILE_FLAG_OVERLAPPED,          // open asynchronous
     NULL);                           // template file

     if(hCom == INVALID_HANDLE_VALUE) {
	cout << "Cannot open serial port COM1\n";
        return PROGRAM_FAILURE;
     } else {
	// it seems to be open, try to write to it
        WriteFile( hCom, "This is testfile", 16, &dwRet, NULL );
     } // end if no handle creation failure

     return PROGRAM_SUCCESS;
} // end main()


It compiles and runs using Visual C++ in Visual Studio 2008 Express, in a Win32 console project without error, and using another computer and Hyper Terminal set to 9600 Baud, N-8-1 it does indeed transmit the message "This is testfile".

Looking to do more, here is a followup question:
I had to replace the "_T" macro with "TEXT" to resolve a compiler error; what is the "_T" macro?

Thanks again for helping me with this question.

Cheers!
David
AnswerRe: How does one access a Serial port using Visual C++ 2008 Express tools. Pin
David Crow9-Nov-09 5:38
David Crow9-Nov-09 5:38 
GeneralRe: How does one access a Serial port using Visual C++ 2008 Express tools. Pin
dk-info11-Nov-09 8:20
dk-info11-Nov-09 8:20 
QuestionHow to prevent screen capture? Pin
semaphore19-Nov-09 1:24
semaphore19-Nov-09 1:24 
AnswerRe: How to prevent screen capture? Pin
mav@octaval9-Nov-09 2:00
mav@octaval9-Nov-09 2:00 
AnswerRe: How to prevent screen capture? [modified] Pin
hxhl959-Nov-09 10:38
hxhl959-Nov-09 10:38 
GeneralRe: How to prevent screen capture? [modified] Pin
semaphore19-Nov-09 19:48
semaphore19-Nov-09 19:48 
GeneralRe: How to prevent screen capture? Pin
Midono126-Nov-09 21:00
Midono126-Nov-09 21:00 
GeneralRe: How to prevent screen capture? Pin
semaphore126-Nov-09 23:51
semaphore126-Nov-09 23:51 
GeneralRe: How to prevent screen capture? Pin
Midono127-Nov-09 3:47
Midono127-Nov-09 3:47 
GeneralRe: How to prevent screen capture? Pin
Ramkrishna Pawar5-Jan-10 7:53
Ramkrishna Pawar5-Jan-10 7:53 
GeneralDetails of Screen Capture Prevention Pin
Gopalakrishna Palem10-Jan-10 0:34
Gopalakrishna Palem10-Jan-10 0:34 
Questioncreating directx texture from raw image data Pin
Andreoli Carlo8-Nov-09 23:58
professionalAndreoli Carlo8-Nov-09 23:58 
QuestionTYPE_E_CANTLOADLIBRARY Pin
deadlyabbas8-Nov-09 23:47
deadlyabbas8-Nov-09 23:47 
AnswerRe: TYPE_E_CANTLOADLIBRARY Pin
opedroso221-May-10 8:22
opedroso221-May-10 8:22 
QuestionAboutBox Pin
johnjitu8-Nov-09 23:36
johnjitu8-Nov-09 23:36 
AnswerRe: AboutBox Pin
josda10009-Nov-09 2:47
josda10009-Nov-09 2:47 
AnswerRe: AboutBox Pin
Stephen Hewitt9-Nov-09 3:18
Stephen Hewitt9-Nov-09 3:18 

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.