Results 1 to 14 of 14

Thread: Synchronous processing?

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Posts
    8

    Synchronous processing?

    Hi All,

    New to this forum but so pleased to have found it. I'm more than twice the age of VB and detest VB.Net... so maybe I'm just a grumpy ol' coder.

    Anyway I've never really got my head around Synchronous Processing in VB6 and was hoping someone might be kind enough to point me in the right direction foe any code samples or documentation on the subject.

    Maybe I'm on the wrong track altogether but I believe I could possibly achieve this by using an ActiveX EXE from my VB app? I'm really only looking at a very simple setup where say the main program (A) kicks off program (B) to do some lengthy time consuming task, whilst program (A) continues to do other things. When program (B) completes its task it somehow informs program (A) that it's finished, but that final event shouldn't interrupt or stop program (A) if it's still in the middle of doing something. If that makes sense?

    Is this something that could be done with a standard VB6 app and an ActiveX EXE or DLL maybe?

    Any help/advice would be most appreciated

    Thank you

  2. #2
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    858

    Re: Synchronous processing?

    In your above request for help, you already have your answer.
    Create two apps (A and B). In App A write some code to receive a notice from AppB. This could be as simple as putting a hidden textbox on AppA.
    When AppB is done, have it make a XProcess call to the AppA textbox (your notification code would go in the textbox change event) and you have your notification. There are a number of other ways to do this.
    Search the forum for XProcess or Call Another Process.
    Last edited by vb6forever; Oct 22nd, 2020 at 08:38 AM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Posts
    8

    Re: Synchronous processing?

    Thanks for the reply. I didn't really want two separate apps. If I did then yes I could easily achieve what I want using the Winsock control but having two apps presents its own problems.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Synchronous processing?

    I'm not sure there is any way to have a stable background worker thread in VB6 without using a separate DLL.

    Either go with an ActiveX EXE or a worker process program. There are ways to do both of these compiled as a single EXE.

  5. #5
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Synchronous processing?

    Quote Originally Posted by dilettante View Post
    Either go with an ActiveX EXE or a worker process program. There are ways to do both of these compiled as a single EXE.
    I would go with multi-process *Standard* EXE the way chrome or AnyDesk are implemented.

    For instance AnyDesk spawn multiple processes of the single portable application with parameters like AnyDesk.exe --backend or AnyDesk.exe --service or AnyDesk.exe --control.

    Each of these can register file monikers in ROT to be available to service out-of-process requests asynchronously in the same manner ActiveX EXEs register their class factories. The name of the registered moniker can include a generated GUID (or parent process ID) which can be received as a command line parameter too.

    This is firefox command line:

    Code:
    "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -contentproc
        --channel="2768.0.206578502\1378895978" 
        -parentBuildID 20181030165643 
        -greomni "C:\Program Files (x86)\Mozilla Firefox\omni.ja" 
        -appomni "C:\Program Files (x86)\Mozilla Firefox\browser\omni.ja" 
        -appdir "C:\Program Files (x86)\Mozilla Firefox\browser" 
        - "C:\Users\xxx\AppData\LocalLow\Mozilla\Temp-{98bf7eaf-7cbf-46a5-8d27-bbea0a9efccb}"
            2768 "\\.\pipe\gecko-crash-server-pipe.2768" 944 gpu
    Added bonus is that whenever the worker process crashes it does not bring down the whole application and also the worker process can be spawned elevated or under NT AUTHORITY\SYSTEM security credentials for instance.

    cheers,
    </wqw>

  6. #6

    Thread Starter
    New Member
    Join Date
    Oct 2020
    Posts
    8

    Re: Synchronous processing?

    Thanks for all the replies. I found the following website really useful and have now cobbled together an ActiveX.exe to do what I want.

    https://www.tutorialsweb.com/activex/activex.htm

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: Synchronous processing?

    Quote Originally Posted by OnCourse View Post
    Thanks for all the replies. I found the following website really useful and have now cobbled together an ActiveX.exe to do what I want.

    https://www.tutorialsweb.com/activex/activex.htm
    These have troubles when run by non-admin users on Win10. Test yourself if working ok once registered on the machine by an admin.

    cheers,
    </wqw>

  8. #8
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,834

    Re: Synchronous processing?

    I felt the same way but bit the bullet and switched to VB .NET and I'm glad I did. Here is a sample background worker that someone on this forum put together. It runs right out of the box. Just for grins you might download Visual Studio and run it. You might be pleasantly surprised.

    http://www.vbforums.com/showthread.p...ckgroundWorker
    Please remember next time...elections matter!

  9. #9
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Synchronous processing?

    I think you meant Asynchronous. Here there is an approach using processes. (I didn't use or tested it).

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Synchronous processing?

    No, I think he meant synchronous as in blocking. He wants to write QBasic in VB6.

  11. #11
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Synchronous processing?

    Quote Originally Posted by dilettante View Post
    No, I think he meant synchronous as in blocking. He wants to write QBasic in VB6.
    For synchronous he does not need to launch anything external, just to write VB code.

    Quote Originally Posted by OnCourse View Post
    the main program (A) kicks off program (B) to do some lengthy time consuming task, whilst program (A) continues to do other things. When program (B) completes its task it somehow informs program (A)
    That looks asynchronous to me.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Synchronous processing?

    I'm pretty sure the question is seeking ways to write blocking code without tying up the UI thread.

  13. #13
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Synchronous processing?

    Quote Originally Posted by dilettante View Post
    I'm pretty sure the question is seeking ways to write blocking code without tying up the UI thread.
    Quote Originally Posted by OnCourse View Post
    whilst program (A) continues to do other things.
    Then the only "other things" is to wait for the other program to finish.

    There are several ways to do that, for example this one.

  14. #14

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