Migrating VB6 IDEA app to VB.Net

Extrasoft

Member
Join Date
Nov 2007
Location
Vitoria
Posts
3
Hello Experts!
I have a VB6 app that communicates (reads and writes) with the InTouch Tag Database.
The app contains only to small files, the Ptacc.bas and a test form.
The code for the Ptacc.bas file is this:

#If Win32 Then
Declare Function wwHeap_Register Lib "wwheap.dll" (ByVal hWnd As Long, ByRef NotifyMessage As Integer) As Boolean
Declare Function wwHeap_Unregister Lib "wwheap.dll" () As Boolean
Declare Function PtAccInit Lib "ptacc.dll" (ByVal hWnd As Long, ByVal nExtra As Integer) As Long
Declare Function PtAccShutdown Lib "ptacc.dll" (ByVal accid As Long) As Long
Declare Function PtAccOK Lib "ptacc.dll" (ByVal accid As Long) As Long
Declare Function PtAccHandleCreate Lib "ptacc.dll" (ByVal accid As Long, ByVal nme As String) As Long
Declare Function PtAccHandleActivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccHandleDeactivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccHandleDelete Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccActivate Lib "ptacc.dll" (ByVal accid As Long, ByVal ptname As String) As Long
Declare Function PtAccType Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccDeactivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccDelete Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccSetExtraInt Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer, ByVal nValue As Integer) As Long
Declare Function PtAccGetExtraInt Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer) As Long
Declare Function PtAccSetExtraLong Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer, ByVal lValue As Long) As Long
Declare Function PtAccGetExtraLong Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer) As Long
Declare Function PtAccReadD Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccReadI Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccReadR Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Single
Declare Function PtAccReadA Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Double
Declare Function PtAccReadM Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nm As String, ByVal nMax As Long) As Long
Declare Function PtAccWriteD Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Integer) As Long
Declare Function PtAccWriteI Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Long) As Long
Declare Function PtAccWriteR Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Single) As Long
Declare Function PtAccWriteA Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Double) As Long
Declare Function PtAccWriteM Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As String) As Long


#Else
Declare Function PtAccInit Lib "ptacc.dll" (ByVal hWnd As Integer, ByVal nExtra As Integer) As Long
Declare Function PtAccShutdown Lib "ptacc.dll" (ByVal accid As Long) As Integer
Declare Function PtAccOK Lib "ptacc.dll" (ByVal accid As Long) As Integer
Declare Function PtAccHandleCreate Lib "ptacc.dll" (ByVal accid As Long, ByVal nme As String) As Long
Declare Function PtAccHandleActivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccHandleDeactivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccHandleDelete Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccActivate Lib "ptacc.dll" (ByVal accid As Long, ByVal ptname As String) As Long
Declare Function PtAccDeactivate Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccDelete Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccSetExtraInt Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer, ByVal nValue As Integer) As Integer
Declare Function PtAccGetExtraInt Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer) As Integer
Declare Function PtAccSetExtraLong Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer, ByVal lValue As Long) As Long
Declare Function PtAccGetExtraLong Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nOffset As Integer) As Long
Declare Function PtAccReadD Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Integer
Declare Function PtAccReadI Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Long
Declare Function PtAccReadR Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Single
Declare Function PtAccReadA Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long) As Double
Declare Function PtAccReadM Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal nm As String, ByVal nMax As Long) As Integer
Declare Function PtAccWriteD Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Integer) As Integer
Declare Function PtAccWriteI Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Long) As Integer
Declare Function PtAccWriteA Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As Double) As Integer
Declare Function PtAccWriteM Lib "ptacc.dll" (ByVal accid As Long, ByVal hPt As Long, ByVal value As String) As Integer

#End If

The code for the test just makes use of the module above and is not important.

The questions are:
1) Does anyone know how to convert the code above to VB.Net?
2) Actually I'm not sure if converting the code would be the best approach. Is it possible to create a VB.Net wrapper that would do the job instead of converting the code above?
3) Am I right or wrong if I say that all I need to to is creating a .Net Interface that implements both InTouch dlls (ptacc.dll and wwheap.dll) used by the module above?

Any help would be very appreciated.

Thanks!
 
Those are all functions in a DLL file. Is it as simple as creating a reference in your vb.net program too reference the dll?

Then declare are veriable such as ptacc, then the program would reference the functions something like ptacc.PtAccWriteM

Not sure if its that easy or not, but seems it should be.

Good Luck,

Rich
 
We have a similar setup with a VB app reading and writing WW tags. Our integrator told us that he tried developing a similar HMI with VB.net and went back to VB because .net was way slower.

I'm not a programmer, just letting you know what I was told.
 
Rich,
I noticed that the dlls (ptacc and wwheap) are not COM, so I cannot create references to them in VB.Net. I cannot use tblimp to create the interop code as well.
So, I decided to use the VB.Net migration tool to migrate the vb6 projet to VB.Net. The resultant project uses VB6 compatibility classes and I just fixed some errors and it is building "correctly".
Then problem now is that it is saying that the project cannot find ptacc.dll and wwheap.dll.
Any ideas?
Thank you for the tips Allscot!
 

Similar Topics

We are upgrading our FTV ME v8.1 program to SE v12. Is there any way to migrate the alarm tags (about 600ish) from ME to SE. The import / export...
Replies
2
Views
822
Can it easily be done ? We have a legacy project written on Allen Bradly 1746-l542 with Several racks of some on an extension rack and some on A...
Replies
3
Views
1,721
I just want to get others thoughts on what is the biggest obstacle one faces in migrating to a newer system? For me with the few systems I have...
Replies
17
Views
4,077
Hi all, I'm working on migrating some old Sinamics S120 drive units currently integrated in Step 7 5.6/WinCC Flexible 2008 RT to TIA Portal V14...
Replies
7
Views
3,286
Hi all, Has anyone here ever converted Wonderware tag history and added it to ignition's historical database? If so, how did you do it? Are...
Replies
5
Views
2,379
Back
Top Bottom