Events back from a DLL? 
Author Message
 Events back from a DLL?

Is there a way to send back events from a DLL to the calling program if the
DLL is called using the following type of code?

            Dim MyAssembly As Reflection.Assembly
            Dim oItem As Object
            Dim nResult As Decimal
            MyAssembly =
MyAssembly.LoadFrom(DacsaSetup.SetupItems(DacsaSetup.INSTALLDIR) &
"\Dacsa_CompanySpecific_" & DatabaseConnection.nCompany_ID.ToString &
".dll")

            If MyAssembly Is Nothing Then
                Return False
                Exit Function
            End If

            oItem = MyAssembly.CreateInstance("Dacsa_CompanySpecific_" &
DatabaseConnection.nCompany_ID.ToString & ".Functions")
            If oItem Is Nothing Then
                Return False
                Exit Function
            End If

            nResult = CType(oItem.GetType().InvokeMember("AddFreight",
Reflection.BindingFlags.DeclaredOnly Or Reflection.BindingFlags.Public _
             Or Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.Instance Or Reflection.BindingFlags.InvokeMethod,
Nothing, oItem, New [Object]() {nDelivery_Method, nCredit_Type,
nNumber_Of_Labels}), Boolean)

            If nResult > 0 Then
                nAmount_Freight += nResult
            End If

Regards
Fredrik



Fri, 16 Sep 2005 21:20:16 GMT  
 Events back from a DLL?

The problem that you are going to have is setting up the event handlers to
catch the event -- either using 'Handles' or 'AddHandler.' (I assume that
the object on which the event would be raised is declared in the DLL that
you're calling...) You might therefore be better off passing in a delegate
to the DLL, which it used to call back to the calling assembly.

--
Niklas, VB Compiler Team
This posting is provided "AS IS" with no warranties, and confers no rights.



Sat, 17 Sep 2005 05:01:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Mouse back event?

2. Windows Form and call back events

3. Backing up Event Logs

4. Backing up the Event Log to a central location

5. trap back() event

6. ActiveX DLL events won't fire when DLL shows Modal Form

7. VB Front end dll loses connection to back end SQL server db after an hour

8. Plug-In ActiveX DLL As Back-end

9. Passing Matrix from vb to a dll and back

10. call-back functions in a fortran dll

11. Dll registering?, back

12. VB5: Passing Arrays to a DLL and back

 

 
Powered by phpBB® Forum Software