
VB calling C++ Dll function twice?
Hi All,
I have created a C++ Dll and an application in VB that uses it. So far
so good... This Dll contains a function FindYourMove() that returns a
BSTR. The following is the VB code:
Private Declare Function FindYourMove Lib "DraughtsDll.dll" () As
String
.
.
.
Private Sub picSquarePB_DragDrop(Index As Integer, source As Control,
X As Single, Y As Single)
Dim boardStr As String
If MustJump(Index) = 0 Then
boardStr = FindYourMove()
If (Mid(boardStr, 1, 3) = "END") Then
'Do action 1
Else
'Do action 2
End If
End If
End Sub
Something was behaving very strangely and I used Trace to see step by
step what the program is doing.
I noticed that boardStr is always assigned a value returned from
FindYourMove (which is good) but sometimes (not always) FindYourMove()
is called a second time in the line:
If (Mid(boardStr, 1, 3) = "END") Then
I don't want it to do this as it gives a different result.
Does anyone know what's happening?
Thanks alot for your help...