How to delay app autostart or make sure drivers (Qt dll's) are loaded on Windows startup?
My app is set to start automatically with Windows (autostart).
In 99% of cases it works correctly, but once in a while I get an error, that the Qt .dll's couldn't been found (Qt5WinExtras.dll, Qt5Widgets.dll, and such).
How can I set the app to load the drivers correctly in 100% of cases?
Is there a way to postpone the app, so that it searches for the drivers affter the system is loaded?
Or is there a different solution?
@michalos What drivers do you mean? Those Qt DLLs are not drivers.
Shared libraries are loaded by the loader (system component) when your app is started.
If you get such error messages then probably the environment isn't set up properly yet (environment variables not set yet properly).
How did you deploy your app and how do you start it?
@jsulm Thank You for Your answer.
My mistake, I meant Qt shared libraries.
I use InnoSetup to copy my exe file and all shared libraries to a location of user choice. Than, from the app, I use QSettings to alter the registry, and add my app in the Windows Registry "CurrentVersion\Run".
QSettings settings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); settings.setValue(QApplication::applicationName(), QCoreApplication::applicationFilePath().replace('/', '\\'));
I am the main user of the app right now, and as far, the problem occurred only on my pc, but I am afraid, that it can happen on the clients pc as well.
Hi, I had the same problem, the autostart feature of Windows is a bit random, sometimes the network isn't up and running etc. I solved it as you suggest (a delay) by creating a separate non-Qt Win32 console program that just sleeps for 10 seconds and then launches the real program.