dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] Run Time Error 398 Ambient.UserMode - Client site not available - ccXPButton

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2011
    Posts
    28

    Resolved [RESOLVED] Run Time Error 398 Ambient.UserMode - Client site not available - ccXPButton

    This will sound crazy but having tried to compile an old and faithful piece of code I am all of a sudden getting an error in a button control called ccXPButton run time error 398

    The error is on the following Ambient.UserMode line.

    Code:
    Private Sub UserControl_Terminate()
    On Error GoTo Errs
        Set pFONT = Nothing
        If Ambient.UserMode Then
            Call Subclass_Stop(pHWND)
            Call Subclass_Stop(lParentHwnd)
        End If
    Errs:
    End Sub
    This is very weird because I have never had this error previously in all the hundreds of times probably this has been compiled over the years.

    Reading around for examples ;

    http://www.vbforums.com/showthread.p...-not-available

    I tried those suggestions but I still get the error when compiling.

    Any help would be appreciated.

    thanks

    ** UPDATE **

    Just tried a different DLL that uses the same control, it compiled just fine.
    Also tried a backup of the troublesome DLL, it also fails to compile.
    Copied the ccXPButton control from the good compiling dll to the troublesome one, and it still fails to compile.
    Last edited by Krammig; Apr 4th, 2019 at 02:51 AM. Reason: Update

  2. #2
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,491

    Re: Run Time Error 398 Ambient.UserMode - Client site not available - ccXPButton

    You'll probably need to set Break on Unhandled Errors in General tab of Tools->Options dialog in VBIDE just to compile this code.

    If you do want to fix this control just remove the whole Terminate event as it's *not* doing anything reasonable unless there is more code to it that you are not showing us.

    Ambient.UserMode is never available in Terminate event so both Subclass_Stop are never called. Clearing member variables in Terminate makes sense only for your VB6 classes to get instances terminated before current object for logging reasons or whatever, for StdFont (or any 1st or 3rd party classes) it's completely unnecessary and makes no differences.

    cheers,
    </wqw>

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2011
    Posts
    28

    Re: Run Time Error 398 Ambient.UserMode - Client site not available - ccXPButton

    Thanks for the swift feedback and suggested fix wqw.

    I removed that Terminate event and it compiles just fine, better still, it seems to be working

    Appreciated
    Cheers

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width