Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am creating a sample VB6 application with CEF to embed a browser into the application. I used WebKitX control to achieve the same. Here is my sample code

VB
Private Sub WebKitXCEF31_OnBrowserReady()

 WebKitXCEF31.ExecCommandSetFocus = True
 WebKitXCEF31.FormatUsingInternalSelectionAPI = True
 WebKitXCEF31.DownloadScripts = True
 WebKitXCEF31.Open "http://www.google.com/"

End Sub

Private Sub WebKitXCEF31_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As 
String)

 Settings.cache_path = App.Path + "\MyCache"
 Settings.application_cache = App.Path + "\MyAppCache"
 Settings.persist_session_cookies = 1
 Settings.persist_user_preferences = 1
 AddLog "CommandLineSwitches=" + CommandLineSwitches

End Sub

Private Sub WebKitXCEF31_OnLoadEnd()

 WebKitXCEF31.Preview
 WebKitXCEF31.Events = DOM_EVENT_SELECTSTART Or _
 DOM_EVENT_DOMSUBTREEMODIFIED Or _
 DOM_EVENT_DOMFOCUSIN Or _
 DOM_EVENT_CLICK Or _
 DOM_EVENT_EDITABLE_ELEMENT_CHANGED

End Sub


The
Form_Load
method is empty. When I run the application, an error is thrown at the OnCreate stub with the message 'Compile Error: Sub or Function not defined.'. Is there any place specific where we need to define the stub/method before implementing it? I am new to VB6 and this is the first code that i have written. This code is available on WebKitX. Link : https://www.webkitx.com/webkitx.html

What I have tried:

Tried to find how to initialize the control.
Posted
Updated 25-Sep-20 1:51am
Comments
Richard Deeming 25-Sep-20 4:48am    
Why are you trying to learn a language that's been dead for two decades? Start with VB.NET instead.
Member 10822665 25-Sep-20 4:52am    
It's because the product is an already existing one written in VB6. I am doing R&D now to see to embed a browser into the VB6 app. Can't seem to find out why the error is coming. I want to know if there is any place where I need to initialize the control? When I used the internal WebBrowser available it was working fine.
Richard MacCutchan 25-Sep-20 5:10am    
What is the exact text of the error message, and which line does it occur on?
Member 10822665 25-Sep-20 5:25am    
Error text: "Compile Error: Sub or Function not defined."
When I press okay on the dialog box, the debugger points to " Private Sub WebKitXCEF31_OnCreate(ByVal Settings As WebKitXCEF3Lib.ISettings, CommandLineSwitches As String)" method.
Richard MacCutchan 25-Sep-20 5:51am    
The error message is not actually helping. So unless you can find out which Sub or Function it is looking for ...

1 solution

The AddLog was responsible for throwing error. I had not defined the method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900