|
-
Apr 23rd, 2017, 12:20 PM
#5
Re: Problems with ActiveX exe
 Originally Posted by Davor Geci
Will I gain on speed if I separete it in this 2 parts "32Bit AX-Dll" & "Ax-Exe-Host". Will the code execution in 32Bit AX-Dll be faster or will it be detained within the Ax-Exe-Host process that has called it?
You will gain speed (due to running a normal "Dll-based InProcess-Server"), when
(in case of a 32Bit Host-Process), you will instantiate your Dll directly (not over the AXexe-Host).
 Originally Posted by Davor Geci
I tried with with the code suggested:
...but can't get the events firing.
As for the Events, unfortunately I don't have a VM set up currently, which does host
a 64Bit VBA-Environment ... but I think I've tested this a few years ago - and Events
should be marshalled from the AXExe-Host properly, when you declare the
Instance-Variable properly typed and WithEvents in VBA-64.
The only 64bit-testing I was able to do here now, was with the Windows-Scripting-Host -
and there the "32bit-Events from a 32bit-Dll-Class" were received within the 64bit-WSH...
The following Zip contains a VB6 (32bit) AXExe-Host - and two VBScripts, which make use of Forms
from a "normal VB6-compiled Dll" (vbRichClient5.dll) - so that should be quite similar to your scenario:
http://vbRichClient.com/Downloads/Ev...64BitHosts.zip
(needs a registered vbRichClient5 on your machine - and please compile the AXExe-Project first, before running the Scripts)
In case the above does work (showing a Form, which you can click, reporting the received Event in its Caption) -
the next test you could do (still with the vbRichClient5.dll as an example of a 32bit-InProcess-Server) -
would be within VBA-64.
In a VBA-Userform (something that remains alive for a while) - could you declare a WithEvents-Variable
(after putting a reference to vbRichClient5 into the Excel-64-Project) - something similar to the following
VB6-Code (which you could test in the VB6-IDE first, after you compiled the AXExe-Host from the above Zip):
VB6-IDE-code, which you would need to adapt to VBA64-Form-Code
Code:
Option Explicit
Private AXH32 As Object, WithEvents tmrTest As cTimer
Private Sub Form_Load()
Set AXH32 = CreateObject("AxHost32.cConstructor")
Set tmrTest = AXH32.CreateInstance32("vbRichClient5.cTimer")
tmrTest.Interval = 500
tmrTest.Enabled = True
End Sub
Private Sub tmrTest_Timer()
Debug.Print "Timer-Event, received at: " & Time
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set tmrTest = Nothing 'cleanup the Timer-Proxy-Instance
Set AXH32 = Nothing 'cleanup the AXExe-Helper-Instance
End Sub
Just something to experiment with - please let me know what you find out...
Olaf
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|