Menu

SPCOMM for MFC(Serial Port Class) / Blog: Recent posts

SPCOMM for MFC v3(vc++) serial port class

1.Use nullptr instead of NULL
If you do not support nullptr pointer, use the macro definition

#define nullptr NULL

2.Updated InputLen (v2 version InBufferSize), support openning port to change the accepted length. Changes will automatically open the serial port to perform ClearInBuffer () method

3.Add InBufferSize attributes used to set the receive buffer size, is valid only when the serial port is opened... read more

Posted by b1ackn3k0 2013-01-20 Labels: spcomm mfc serial port vc++

SPCOMM for MFC v2(vc++) serial port class

Ported from Delphi version supports the MFC class,file only two
Spcomm.h
Spcomm.cpp

SPCOMM is Delphi famous serial software, the use of multi-threaded message method to write. Online examples of many.

This version's SPCOMM based on the following features
1. Add support COM10 serial
2. Add IsOpen () function returns true is already open
3. Append additional properties tab int Tag; and void * pTag,; facilitate the dynamic establishment of multi-serial
4. Additional InBufferSize attributes, you can set the input buffer size, maximum 2048 (it can be changed to achieve greater).

#include "Spcomm.h"
char rev[100];
TComm Serial;
char rev[100];
void CALLBACK ReceiveData(void obj,void *Buffer, WORD BufferLength)
{
memcpy_s(rev,100,Buffer,BufferLength)
}

void SPCommDlg::OnBnClickedButton1()
{
Serial = new TComm(this);
Serial->CommName = L"COM3";
Serial->BaudRate = 9600;
Serial->ByteSize = TComm::_8;
Serial->Parity = TComm::None;
Serial->StopBits = TComm::_1;
Serial->OnReceiveData = ReceiveData;
Serial->ReadIntervalTimeout = 50;
Serial->StartComm();
}

void SPCommDlg::OnBnClickedButton2()
{
char bb[8];
bb[0]= 0x02;
bb[1]= 'E';
bb[2]= '0';
bb[3]= '0';
bb[4]= '4';
bb[5]= '0';
bb[6]= '0';
bb[7]= '0';
Serial->WriteCommData(bb,8);
}

Posted by b1ackn3k0 2013-01-01
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.