# Qt application with autoupdate feature

 1 Hello, I am a Qt Developer with no knowledge on Windows specific development what so ever. Qt is great to allow developers like myself (more from the *nix world) to develop on Windows platforms as well with the same codebase. All is well with InstallBuilder when it comes to bundling and customizing my installer but the main feature I was looking for is the possibility to autoupdate my application. On the Install Builder documentation there is a chapter about that specific subject and a suggestion on how to automate the update checking process using the autoupdate executable generated from a XML on unattended mode. For that to work, you need to spawn the process from your application to avoid having the user to interact with that application by himself. The idea is great, but I am having quite a few problems accomplishing that in Windows. The Qt way to spawn a new process is using QProcess. The problem I am encountering is that QProcess does not solve problems with Windows Vista/7 UAC "feature". Whenever the underlying implementation calls CreateProcess, UAC denies it and we are left with no autoupdate. Back to the Install Builder documentation, we see something around these lines:  if (system("path/to/autoupdater --mode unattended") == 0){ printf("Update available. Run autoupdate to apply it."); }  But that does not look like a code that can be used. Can you guys provide us with a real example on how to: Check if there is an update If there is, do a unattended update and quitting the application when you make sure that it is updating I am able to accomplish those on Mac and Linux, but Windows documentation is a mess and QProcess does not look like the way out. Thank you very much for the help. Regards, João Mesquita asked 30 Jan '12, 21:01 JMesquita 26●2●2●5 accept rate: 0%

 3 The issue is related to UAC feature and is not specific to Qt, but is how Windows Vista and newer versions are designed. By default the autoupdate binary is set to run as elevated and this is why you cannot run it as on Windows, non-elevated processes cannot run elevated processes for security reasons. What you can do is set autoupdate binary to run as normal binary and have the installer elevated. You can set the autoupdate not to be elevated by doing:  autoupdate asInvoker  And then building the autoupdate binary by doing: C> path\\to\\autoupdate\\bin\\customize build autoupdate-windows.xml windows  This way the autoupdate binary can be run mechanisms such as QProcess. However, this will also require that the binary be started as elevated. In this case, autoupdate binary needs to invoke it using "cmd /c start" syntax. It will run the binary using the system shell and prompt the user for elevation (and/or elevated username/password). This can be done in :  autoupdate asInvoker cmd /c start "\${downloadedFilePath.dos}" &  answered 31 Jan '12, 05:05 wojciechka ♦♦ 7.7k●6●11●22 accept rate: 25% Thank you very much! It seems to have worked. At least I can see that it is properly executed and that the exitCode is the proper one. I will try to make a real update and come back to this forum so that ppl can have a sample Qt code that works for learning purposes. Once again, greatly appreciated. We are evaluating the product and support is always a big plus. Regards (31 Jan '12, 16:06) JMesquita
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×46
×17
×8
×8
×2