Click here to Skip to main content
14,733,542 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

Private Sub WebKitXCEF31_OnBrowserReady()

 WebKitXCEF31.ExecCommandSetFocus = True
 WebKitXCEF31.FormatUsingInternalSelectionAPI = True
 WebKitXCEF31.DownloadScripts = True
 WebKitXCEF31.Open ""

End Sub

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

 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()


End Sub

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 :

What I have tried:

Tried to find how to initialize the control.
Updated 25-Sep-20 2:51am
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 ...
Member 10822665 25-Sep-20 6:06am
Private Sub WebKitXCEF31_OnCreate - this is the function that throws the error.
Richard MacCutchan 25-Sep-20 5:54am
Are you sure the OnCreate member is spelled correctly? Where is it getting called from?
Member 10822665 25-Sep-20 6:02am
Yes, the spelling is correct for the event. That is where I have my doubt, where do I need to call it from? The code was mentioned on their official site , section 4.4 Getting started with visual studio.
Richard MacCutchan 25-Sep-20 6:04am
Sorry, no idea. I had not even heard of this library until today. However, the documentation implies that the OnCreate is called by the framework itself, hence the error.
Member 10822665 25-Sep-20 6:04am
They have defined the Form_Load() but that is only if you have a license version. I am trying with the trial version.
Richard MacCutchan 25-Sep-20 6:05am
Try their help forum, that's where the expertise is likely to be.
Member 10822665 25-Sep-20 6:05am

The download option is available here.

1 solution

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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