-
April 27th, 2010, 05:45 PM
#1
VC++ Serial Comm
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
' 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) {
this->serialPort1->Write("*idn?\r\n");
}
};
}
/* how do i detect the response from the equipments???
/* Can someone post a sample code...
-
April 28th, 2010, 02:41 AM
#2
Re: VC++ Serial Comm
Originally Posted by myrodeo29
... Heres the VC++ partial code..
#pragma endregion
private: System::Void sendBttn_Click(System::Object^ sender, System::EventArgs^ e) {
this->serialPort1->Write("*idn?\r\n");
}
};
}
It is *not* a VC++ code. It looks like Managed C++ and/or C++/CLI code. So try to ask in Managed C++ forum
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|