Click here to Skip to main content
15,905,414 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do I get contents of long strings in VS 2008 debugger? Pin
Interrobang9-Nov-09 4:28
Interrobang9-Nov-09 4:28 
AnswerRe: How do I get contents of long strings in VS 2008 debugger? Pin
loyal ginger9-Nov-09 4:48
loyal ginger9-Nov-09 4:48 
AnswerRe: How do I get contents of long strings in VS 2008 debugger? Pin
Chris Losinger9-Nov-09 4:50
professionalChris Losinger9-Nov-09 4:50 
QuestionSimple CToolTipCtrl trouble. Pin
Nikz29-Nov-09 4:20
Nikz29-Nov-09 4:20 
AnswerRe: Simple CToolTipCtrl trouble. Pin
Code-o-mat9-Nov-09 5:24
Code-o-mat9-Nov-09 5:24 
GeneralRe: Simple CToolTipCtrl trouble. Pin
Nikz29-Nov-09 5:52
Nikz29-Nov-09 5:52 
GeneralRe: Simple CToolTipCtrl trouble. Pin
Code-o-mat9-Nov-09 5:59
Code-o-mat9-Nov-09 5:59 
GeneralRe: Simple CToolTipCtrl trouble. Pin
Nikz29-Nov-09 6:13
Nikz29-Nov-09 6:13 
GeneralRe: Simple CToolTipCtrl trouble. Pin
Code-o-mat9-Nov-09 7:30
Code-o-mat9-Nov-09 7:30 
GeneralRe: Simple CToolTipCtrl trouble. Pin
Nikz29-Nov-09 10:48
Nikz29-Nov-09 10:48 
Question'c' Program [modified] Pin
singh.niraj40@yahoo.com9-Nov-09 4:01
singh.niraj40@yahoo.com9-Nov-09 4:01 
AnswerRe: 'c' Program Pin
Chris Losinger9-Nov-09 4:03
professionalChris Losinger9-Nov-09 4:03 
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 

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.