Global async acq crashes my application?!

Hi, I’m using CVB with VB6. Currently I have a simple acquisition application that captures from two cameras simultaneously. I would now like to process the images from both cameras independent from each other while capturing. I’ve read in the manual that there is a “global async acq” flag that should enable me to do what I want.
But, whenever I have the flag enabled my application crashes. Are there any additional things that I could have missed in order to use the global async acq?

Hi @BearTram

The “Global Async Acq Enabled” flag is generally problematic, and under Visual Basic 6 especially so. “Global Async Acq Enabled” changes the way the ImageSnaped (sic! sorry for the typo…) event is propagated from the image control to the application. If “Global Async Acq Enabled” is not set, then the ImageSnaped event will be processed in the application’s UI thread, whereas if it is set, then it will be processed in the context of the image control’s acquisition thread.

The implications of that difference are far ranging: If “Global Async Acq Enabled” is set, accessing user interface components will usually lead to undefined behavior regardless of the programming language being used (the only safe and permissible way to access UI components in this scenario are through SendMessage/PostMessage, or - in the case of a Windows Forms application - through Invoke/BeginInvoke).

One of the restrictions of Visual Basic 6 is that it does not directly support multithreading, so in Visual Basic 6 no safe option for accessing user interface components when “Global Async Acq Enabled” has been set is available and on top of that, with the “Global Async Acq Enabled” option set the Visual Basic 6 debugger is known to crash if a breakpoint is set in the ImageSnaped handler.

For these reasons, starting with Common Vision Blox 12 the Global Async Acq Enabled flag has been removed from the Common Vision Blox Management Console, but the flag is still accessible through the CVCUtilities.dll functions SetGlobalAsyncACQEnabled and GetGlobalAsyncAcqEnabled (kudos for finding them in the documentation!).

As a more general remark: Please consider switching to a more modern development environment. I know it is not my place to question your choice of programming languages, and I certainly do not want to push you into any particular direction. However, mainstream support for Visual Basic 6, a product released in 1999, officially ended in April 2005 (extended support in March 2008) and still using it 10+ years on has tangible disadvantages (friction with the UAC on post-XP Windows operating systems, vulnerabilities in the runtime). For example VB.Net offers a very similar syntax, a similarly easy composition of UIs and at the same time provides access to multi threading.

Yeh, I know, VB6 is kind of outdated. :flushed: I’ll see if I can switch to VB Net. Anyhow, thank you for the explanation!