1
votes

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 "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

1
Is there an AddLog() method present in your project? Also, as a general rule of thumb in such cases: strip down the offending code to be as minimalistic as possible. In that case, I'd comment out all but the first line of code in Sub WebKitXCEF31_OnCreate() If that works, uncomment the next line etc. You'll eventually end up at the line that actually causes the error.Hel O'Ween
Agree, change AddLog to Debug.Print and see if that works for you.tcarvin

1 Answers

0
votes