Results 1 to 4 of 4

Thread: [RESOLVED] Getting a compile error : stub or function not defined error in VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2020
    Posts
    2

    Resolved [RESOLVED] Getting a compile error : stub or function not defined error in VB6

    I am creating a sample VB6 application. I used WebKitX control to embed a browser into my app. 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 WebKitXCEF31_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

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Getting a compile error : stub or function not defined error in VB6

    do you have a sub or function addlog?
    i am guessing that is the one it is not finding, test if it will run if you comment out that line
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2020
    Posts
    2

    Re: Getting a compile error : stub or function not defined error in VB6

    Quote Originally Posted by westconn1 View Post
    do you have a sub or function addlog?
    i am guessing that is the one it is not finding, test if it will run if you comment out that line
    Thanks a lot sir. I don't know why i did not look at that part, every time the debugger pointed to the method declaration and i thought there was something wrong with that.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Getting a compile error : stub or function not defined error in VB6

    option explicit at the top of all modules, will help to prevent those type of errors
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width