Overlay Plugins not showing on Display Control

G’day!

I have ported one of my older applications to a new CVB and Visual studio version. Things generally seem to work fine-ish, but I can’t see any of the overlay I add to my display (Lines, Circles, a few Rectangles - they simply don’t appear at all).

I have checked with the VBnet Overlay Plugin Example that ships with the software - the shipped binary works, but if I compile it myself the same thing happens.

Any ideas??? :confused:

Hi!

there are three possible sources of the problem you describe that I can think of.

First of all, if you installed an x64 build of :cvb: and you are running your application as a 32 bit process, then the application might seem to be working up to a certain degree, but it certainly would not be possible to create overlay plugins on the display OCX (simply because the 32 bit build of the overlay plugins has not been installed). Keep in mind the nefarious “Prefer 32bit” option in the recent versions of Visual Studio which might lead to your “AnyCPU” project coming up as a 32 bit process on a 64 bit machine (in other words: You might be sure you are building for 64 bit, but it can’t hurt to double check if that really is the case; see for example here…).

The other cause for this issue might be a bug that was around before :cvb: 13.01.001: The signature of AddOverlayObjectNET was broken in a way that will lead to pointer aliasing in a 64 bit application on the last parameter of the function. The funny thing is that this was around since the very first 64 bit build of :cvb: but only seems to have kicked in recently. Anyway: If you are using a version prior to 13.01.001, get 13.01.001 or higher and use AddOverlayObjectNET2 instead of AddOverlayObjectNET

The third possible reason: You are running your application on an installation of :cvb: 13.01.001 or higher and you are still using AddOverlayObjectNET. Starting with 13.01.001 (when AddOverlayObjectNET2 was introduced), the old AddOverlayObjectNET will always return false in the 64 bit build. This is a safety precaution because pointer aliasing can lead to undefined behaviour (in other words: crashes…), which is why the decision was taken to shunt that method in the 64 bit build.

Summary:

  1. Make sure you do not have “Prefer 32bit” checked unintentionally in your project settings.
  2. Make sure you are using :cvb: 13.01.001 or higher.
  3. Make sure you are using AddOverlayObjectNET2

(general advice: when switching between versions it generally is a good idea to delete the bin and obj directory of your project to make sure that the OCX wrappers are rebuilt by Visual Studio - otherwise you might not even see new methods like AddOverlayObjectNET2…)

2 Likes

We have just tried this with an old modified tutorial, that a customer uses for calibrating his cameras.
Unfortunately the Display OCX does not have the AddOverlayObjectNet2 Method anymore.
Was this intended?
What can we do to get the solution running anyway (besides downgrading CVB)

Cheers
Chris

This is most probably the wrong wording as AddOverlayObjectNET2 has been introduced last and is currently available on the CVDisplay.ocx. If you do have 13.02.000 installed and do not see AddOverlayObjectNET2, then I guess you are using aximp/tlbimp wrappers generated based on an older version of the OCX. In that case, please close Visual Studio, then delete the bin folder and the obj folder and reopen Visual Studio - this forces a rebuild of the OCX wrapper DLLs based on the type library of the OCX installed on your system.

1 Like

Thats it, thank you.