joe_pool_is
Contributor
I'm trying to write a C++ app using a VB example. It uses the Delegate keyword, but I'm not sure exactly what it is or what the equivalent would be in C++.
Here is the code:
The Delegate is defined as follows:
While I am asking, does anyone know what Application.DoEvents() and ReDim are and what their equivalents would in C/C++? I would guess Sleep(1) and memcpy, but I would like a confirmation if someone knows this.
Here is the code:
Code:
Application.DoEvents()
While True
If retCode = 0 Then
'---either error or stop is requested
Exit While
Else
Dim updateDelegate As New _
myDelegate(AddressOf updateMessageLog)
updateDelegate.Invoke(byteArrayToString(inbuff))
ReDim inbuff(300)
retCode = ReadFile(infileHandler, _
inbuff, _
inbuff.Length, _
numReadWrite, _
0)
Application.DoEvents()
End If
End While
Code:
Public Delegate Sub myDelegate(ByVal str As String)
Public Sub updateMessageLog(ByVal str As String)
If str.Length > 0 Then
txtMessageLog.Text += str
End If
End Sub
Last edited: