Start behavior under Windows can be somewhat tricky…
First of all: I assume you are not using a Common Vision Blox version older than 11.00.000 (dubbed Common Vision Blox 2011) because what I write below is only applicable to 11.00.000 and up…
When starting your application through the Startup group or one of the Run keys in the registry, it may indeed happen that it does not “see” the Common Vision Blox license (regardless of what type of license you are actually using - this is equally true for all supported dongles, CameraSuite licenses or Node-Locked licenses). On some systems this only happens sporadically, on others it seems to be common case.
The reason is that while booting the computer, Common Vision Blox needs to launch two interdependent services and one protocol driver before it can access any available licenses. For services it is possible to establish a defined launch sequence by defining a service’s dependencies (the Common Vision Blox installer takes care of that since Common Vision Blox 11.01.000). However, the timing behavior between autostart items (other than services) and services is not definable through any means provided by the operating system.
Processing of auto start items may start as soon as a user has logged on, and it is generally not the case that by then all the necessary services have already started. It may therefore easily happen that your Common Vision Blox based application is launched before the required services have been started. This will not prevent your application from starting, but it means that when your application starts querying the license state it’ll receive a negative response until the required services have been started (which will sooner or later lead to some sort of visual feedback for the operator - either a message box or a label somewhere on the display).
The only reliable workaround for this is to stall the start of your application until the necessary services have been started. There are two possibilities who this may be achieved:
1. Inside your program
Inside your program you may use the two functions
GetLicenseCount to find out whether or not a license is available. Adding a loop like the following to the startup code of your application will stall until a license has been detected:
for (cvbval_t licenseCount = 0; licenseCount == 0; )
cvbres_t result = UpdateLicenses();
if (result < 0)
// wait until services are running
licenseCount = GetLicenseCount();
This loop will wait indefinitely until a license becomes available. If indefinitely is not desirable, it is easily possible to add time checks to the loop and interrupt it after a configurable maximum time span has elapsed. Make sure to choose a reasonable large timeout here - I have seen systems where it would take almost two minutes after the desktop first appeared until all the services were started (the Windows event log can help diagnose how much time is needed).
2. Outside your program
If you do not want to modify your application as outlined above, then WaitForLicense.zip (224.1 KB) might be what you are looking for. The zip archive contains a small command line program that has the above loop and a timeout check implemented. It may be called from within a simple batch file to stall program start until licenses are available (or until a timeout occurred):
start /wait WaitForLicense -t 60000
if %ERRORLEVEL% EQU 3 goto Timeout
if %ERRORLEVEL% EQU 2 goto ConnectError
if %ERRORLEVEL% EQU 0 goto RunApp
rem Error code 1 does not happen (fall-through to ConnectError)
echo Could not connect to CVB license framework!
echo Timeout occurred while waiting for CVB license!
start "C:\Applications\Your Application.exe"
Modify this batch file to fit your requirements, then save it and add this batch file to your auto start rather than your application and you should not see the problem again.
###Remark about Common Vision Blox 10 and older
In Common Vision Blox prior to version 11.00.000 it was possible to simply add your program to any of the auto start facilities of Windows because back then the license was queried through the sentinel.sys driver which could be configured to start before Windows shows the login prompt. Common Vision Blox 9.0.2 and higher did automatically configure sentinel.sys accordingly.