Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help mscomm32.ocx for VC++6

Status
Not open for further replies.

youssef

Programmer
Mar 13, 2001
96
BE
Hi, I find in the msdn sample a little program for use the mscomm32.ocx with VC++6.

My question is : I would like to send binary data on the serialport. How I can do it with this sample ?
example : send byte 0x60, 0x3f, ...

Thanks for Your help ?

Best regards


=========================================


VARIANT var;

// Read/Transmit the file in blocks the size of the transmit buffer.
for (int nRxTx = 0; nRxTx<(nFileSize/nBlockSize) && !m_bCancel; nRxTx++)
{
file.Read(pchBuffer,nBlockSize);
// Convert the ASCII text string to a UNICODE string.
MultiByteToWideChar(CP_ACP,0,pchBuffer,nBlockSize,pchData,nBlockSize);
var.vt = VT_BSTR;
var.bstrVal = ::SysAllocStringLen(pchData,nBlockSize);

// Send data to comm port.
m_commctrl.SetOutput(var);
SysFreeString(var.bstrVal);

// Wait for the transmit buffer to empty.
while ((m_commctrl.GetOutBufferCount() > 0) && !m_bCancel)
DoEvents();
}
 
what is the trouble? John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top