I've only done serial port stuff using C# and VB, but I expect it should be almost the same for visual C++. In C# (and maybe in C++), you would do the following:
System.IO.Ports.SerialPort port = new System.IO.Ports.SerialPort("COM1", 19200);
port.Open();
port.Write(new Byte[] { 128, 2, 45, 254 }, 0, 4); // array of bytes, array index of first byte to send, number of bytes to send
port.Close();
To read from the serial port you can either do
Byte[] buffer = new Byte[255];
int bytesToRead = 5;
port.Read(buffer, 0, bytesToRead);
or
int byte;
while (port.BytesToRead > 0)
{
byte = port.ReadByte();
...
}