Results 1 to 40 of 172

Thread: using VbTrickThreading-master examples without the typelibs for Callback and Marshal

Threaded View

  1. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2015
    Posts
    356

    Re: using VbTrickThreading-master examples without the typelibs for Callback and Mar

    Quote Originally Posted by Schmidt View Post
    I thought you found a workaround already (by showing these Forms modally)...

    But anyways, there's no hacks required to make "Project-Private-UserControls" work with threaded Forms.
    You just have to embrace and learn about:
    - VB6-Classes
    - how to implement and test them as "Private Classes" in an isolated Test-Project
    - how to later move - and encapsulate them in Ax-Dlls (after they become stable)
    - and how to load Ax-Classes from such Ax-Dlls regfree

    The VB6-STA-based threading-model (which is all about "Public Classes on their own Threads"), works rock-solid -
    whereas attempts at FreeThreading in VB6 will always be "fragile" at best.

    So, the solution for your "Private UC on a threaded Form" is, to move the threaded Form out of the Ax-Exe-Project...
    And into a separate ActiveX-Dll-Project (together with any Private UCs you want to use on these threaded Forms).

    I've added a second example (which shows how to do that) to the AxExeThreading article here:
    http://www.vbforums.com/showthread.p...-(simple-Demo)


    HTH

    Olaf
    Dear olaf,

    First thankyou for the example.

    As I said when we add a button to fThreaded form in activex dll project MyForms and try to add the usercontrol through the button as follows:


    Code:
    Private Sub Command1_Click()
        On Error GoTo err1
        Controls.Add("MyForms.ucTest", "Ctl2").Visible = True
        Exit Sub
    err1:
        MsgBox "err:" & Err.Number & "," & Err.Description & "," & Err.Source
    End Sub

    which adds usercontrol to the form at runtime we get the following error( in msgbox )when we run the app in compiled mode and click on this button on displayed fThreaded form.

    ---------------------------
    MyForms
    ---------------------------
    err:711,Invalid class string.
    Looking for object with ProgID: MyForms.ucTest,MyForms
    ---------------------------
    OK
    ---------------------------



    This is the reason I asked Trick for help.


    regards,
    JSVenu
    Last edited by jsvenu; Feb 6th, 2020 at 12:41 AM.

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