VC++ Serial Communication

Hello Everyone,
Im new to VC++ express 2008 though I've been using VB6 for a while. Im trying to write code that communicates to serial port using VC++ express 2008.

This is my VB6 equivalent code:
' Port Initialization is done on different Sub.
' and .RThreshold = 1

' Send data to Port
Private Sub sendBttn_Click()
MSComm1.Output = "*idn?" & vbCrLf
End Sub

[b]' Detect Incoming Serial Data
Private Sub MSComm1_OnComm() ' need an VC++ code for this Sub.
Call InputHandler(MSComm1)
End Sub
' Input Handler
Sub InputHanlder(SelectedPort As MSComm)
Dim Incommbuff As String
Incommbuff = SelectedPort.Input
RcvdBuffer = RcvdBuffer + Incommbuff ' Public RcvdBuffer as string
If InStr(RcvdBuffer, "vbCr") Then
Text1.Text = RcvdBuffer;
RcvdBuffer = ""
End If
End Sub

My Problem... How do i write an equivalent code (VB6 = "MSComm1_OnComm") for the Serial Event for VC++.

Heres the VC++ partial code..

#pragma endregion
private: System::Void sendBttn_Click(System::Object^ sender, System::EventArgs^ e) {

[b]/* how do i detect the response from the equipments???
/* Can someone post a sample code...[/b]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!