简体   繁体   中英

Application does not start properly when called on Windows startup

I have a strange problem. I have an Qt application with dynamic linked DLLs.

When I open the .exe file the application starts correctly, even if I open it from a desktop shortcut as soon, as I see the desktop on Windows start.

But when I add it to the HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run it does not start correctly.

eg (edit) the log file is not created and the QlistView doesnt display any information (list of items) from the SQLite database, and I cannot connect to a server via QTcpSocket. (even if the autostart version starts after the manually started).

(edit) the log file doesn't seem to work as well.

(Posted on behalf of the OP) .

The solution was to change the current directory to the app directory by:

QDir::setCurrent(QCoreApplication::applicationDirPath());

At startup the current directory is set to windows/system32.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM