P
pch
Guest
I have an application that was originally writen in VB 6.0 that uses a DLL implemented in C++ 6.0. I use callback functions to return data from the DLL back to the VB environment. I also have a class implemented in the VB side that acts primarily as a wrapper for the code in the DLL.
I am trying to convert the VB 6.0 side to .NET and having a real headache with the Delegate functions.
Basically the layout is as follows;
1) The VB app creates an instance of the VB class. In the VB class is a method that sets the callback address of a function defined in a BAS module (because the procname for AddressOf calls cannot reside in a class module) So, the class initialization calls something like;
InDLLSaveCallBackAddr(AddressOf SomeFunctionInBASModule)
2) A global variable of type MyClass exists in the application which points to the class instance Im talking about above.
When the DLL uses the callback, the function in the BAS module is called, which in turn uses reference to the class to get back inside it. IE;
In BAS Module
Sub MyCallBack(psStr as String)
mObj.ClassFunc(psStr) mObj is pointer to my class
End Sub
My problem is that in the conversion to .DOT, the AddressOf statement apparently has to be a delegate function, and either I have become really stupid, or these thingys just dont make sense.
If anyone can shed any words of wisdom on this while I still have some hair left, Id really appreciate it.
Thanks in advance.
I am trying to convert the VB 6.0 side to .NET and having a real headache with the Delegate functions.
Basically the layout is as follows;
1) The VB app creates an instance of the VB class. In the VB class is a method that sets the callback address of a function defined in a BAS module (because the procname for AddressOf calls cannot reside in a class module) So, the class initialization calls something like;
InDLLSaveCallBackAddr(AddressOf SomeFunctionInBASModule)
2) A global variable of type MyClass exists in the application which points to the class instance Im talking about above.
When the DLL uses the callback, the function in the BAS module is called, which in turn uses reference to the class to get back inside it. IE;
In BAS Module
Sub MyCallBack(psStr as String)
mObj.ClassFunc(psStr) mObj is pointer to my class
End Sub
My problem is that in the conversion to .DOT, the AddressOf statement apparently has to be a delegate function, and either I have become really stupid, or these thingys just dont make sense.
If anyone can shed any words of wisdom on this while I still have some hair left, Id really appreciate it.
Thanks in advance.