Declarations that work with vb6 and not with vba - Handling activeX actions (1 Viewer)

Pleasure

Registered User.
Local time
Today, 05:46
Joined
Jul 26, 2005
Messages
44
Dear all my friends

I am searching for an alternative activex control of web brower and come to the mobileFX WebKitX ActiveX
Company tells that cannot support Access or any other VBA applications, despite that web site tells that can be used.
Legal Link to download the ActiveX: Link. Please try it, it has excellent features and an easy uninstall !!!

So I downloaded the trial and the control works fine with Access Forms.
I used code from the VB6 examples that are provided with some changes. But I have a problem passing "settings" to the control.

I believe it is a declarations problem since it works fine with VB6 but I miss something in VBA.
Lets say that the name of the embedded control to my form is "WebKitXCEF33"

Code:
Private Sub WebKitXCEF33_OnBrowserReady()
          WebKitXCEF33.Move 0, 0, 15000, 8000
          WebKitXCEF33.IPC_TIMEOUT_MILLIS = 5000
          WebKitXCEF33.EnableHighDPISupport
          WebKitXCEF33.DownloadScripts = True
          WebKitXCEF33.Open "www.google.com"
End Sub


But this is not working


Code:
Private Sub WebKitXCEF33_OnCreate(ByVal Settings As WebKitXCEF3Lib.iSettings, CommandLineSwitches As String)
    Settings.plugins = True
    Settings.cache_path = CurrentProject.Path + "\MyCache"
    Settings.application_cache = CurrentProject.Path + "\MyAppCache"
End sub


Compile gives an error to the "Private Sub WebKitXCEF33_OnCreate" with the description

"Procedure declaration does not match description or event or procedure having the same name"

Any ideas from the specialists ?

Thanks a lot
 

Attachments

  • TEST_DB.zip
    19.9 KB · Views: 80

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:46
Joined
Oct 29, 2018
Messages
21,477
Just FYI, previous discussions with more info just for reference is available at UA.
 

sonic8

AWF VIP
Local time
Today, 04:46
Joined
Oct 27, 2015
Messages
998
I just posted an answer in the original thread on UA, which I believe to be the solution to this problem. For your convenience I quote it here:

I have no clue what these guys are doing. Their documentation contradicts what their library displays in the VBA Object Browser and neither is actually correct/working. - I wouldn't even know how to create such a mess.

Anyways, the "correct" (=working) declaration of the event is:

Code:
Private Sub YourControlName_OnCreate(ByVal Settings As Object, CommandLineSwitches As String)

End Sub

The declarations generated when selecting events in the Event drop down in the VBA editor appear to be "correct".
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 10:46
Joined
May 7, 2009
Messages
19,247
i am starting to download the webkit, but
don't you think you need to change the declaration to:

Private Sub WebKitXCEF33_OnCreate(ByRef Settings As WebKitXCEF3Lib.iSettings, CommandLineSwitches As String)

since you are Updating it's property?
 

MarkK

bit cruncher
Local time
Yesterday, 19:46
Joined
Mar 17, 2004
Messages
8,183
When you pass an object you are only really passing its memory address--a pointer--so it doesn't make any difference if it is ByRef or ByVal. The value of the pointer will not change during the execution of the subroutine, even if members of the object do.
 

Users who are viewing this thread

Top Bottom