CTAPI in VB?

Oct 09, 2003 2 Replies

Hi,



I tried to use Citect CTAPI in Microsoft VB6 SP3 but fail. VB crashes each time the program terminates after calling one or more CTAPI functions. The problem is easily reproduced using the following code simply pasted in a new VB project:



'---------------------------------------------------------------------------



------------------ Option Explicit Private Declare Function ctOpen Lib "ctapi" (ByVal sServer As String, ByVal sUser As String, ByVal sPassword As String, ByVal lType As Long) As Long Private Declare Function ctClose Lib "ctapi" (ByVal lCtHandle) As Boolean Dim lCtHandle As Long



Private Sub Form_Load() lCtHandle = ctOpen("", "", "", 0) If lCtHandle = 0 Then MsgBox "Citect is not running" End Sub



Private Sub Form_Unload(Cancel As Integer) If lCtHandle 0 Then ctClose lCtHandle End Sub



'---------------------------------------------------------------------------



------------------


  1. Do anyone have any experience of using CTAPI in VB?
  2. Any other comments or solutions?


/Sven


After a tip, I got ctOpen and ctClose to work.

Private Declare Function ctOpen Lib "ctapi" (ByVal sServer As String, ByVal sUser As String, ByVal sPassword As String, ByVal lType As Long) As Long Private Declare Function ctClose Lib "ctapi" (ByVal lCtHandle as Long) As Boolean

I think I need to use the following functions:

ctTagRead ctTagWrite

ctStrToPoint ctTagToPoint ctPointRead ctPointClose ctPointToStr ctPointWrite ctRawToEng

ctCicode

I need VB declarations for them and some sample VB code if possible. If anyone used CTAPI in VB, please e-mail me (just remove NOSPAM from my e-mail address) or post an answer here!

/Sven

See my new posting "CTAPI (Citect API) in VB, ¡¡HELP NEEDED!!" dated October

14, 2003 at 12:30 CET.

/Sven

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required