Qt: Cannot execute '': The requested operation requires elevation - qt

I am not able to run the application the Qt creator. It complains the following error:
Cannot execute '': The requested operation requires elevation
My .exe file has a Windows administrator shield symbol on it. Do I need to make a project settings changes? I am extensively using Qt File library for doing some file operations.

What's your executable's file name? Without an embedded manifest, windows tries to be smart and wants to run executables with "install", "update", "setup", "patch", etc. in the file name as administrator. It even checks for those names within words such as "autoupdate".
The problem is that qmake/mingw doesn't embed those manifests, while MSVC does. If someone has a clean solution to that problem, I'd be interested to learn about it.

If application you develop require administrator privileges, you cannot simply run it from Qt creator, started under non privileged account.
You can run your Qt creator as Administrtor.
Or you can start your application from QtCreator using runas utility.
But in this case you would not be able to see debug output in QtCreator console window and debug application.

If the name of the exe file has some words (update, patch, ...), the Windows UAC ask for admin privilegies. The only solution is that the project generates an exe without these words.
See this: Qt Creator create exes with admin privilegies

Related

Using Qt Project on Another Computer "invalid use of incomplete type ui::ProjectName" error

I followed the steps, to continue programming and debugging a qt project on a computer other than the original, found in another Qt Question page.
Move qt project folder to usb
delete ProjectName.Pro.User file from folder
open qt project on other computer and reconfigure when prompted.
However When I try to build my project now it gives me this error "invalid use of incomplete type ui::ProjectName" whenever there is a line like ui->widgetobject.setText(); or ui->setupUI(this); Any ideas how to fix this? the code has not changed at all
original computer is a windows 7, other is a windows 10 partition

QProcess::start not launching a process

I need to launch an executable when I click a button inside my Qt application. To launch an executable, I am using QProcess object.
QProcess *executable = new QProcess(this);
executable->start("test.exe");
test.exe present on the same location where my Qt application exist.
The problem I am facing here is, when I am debugging, it is launching the test.exe. But when I run without debugging, it is not launching the executable. I dont know what I am missing here.
Directories in which an application tries to find test.exe are different when you run the program in debug and from Explorer. Always use full path instead.
If you place test.exe file in a folder where your application EXE is located, you can use this:
QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("test.exe")

Location of the program in the JDK that opens .jar files(double-click)

I would like to know the LOCATION of the .exe in the JDK that opens .jar files. What I mean is this: Which .exe in C:\Program Files\Java\jdk*version number*\jre\ opens the .jar files, so that they can be opened using a double click? I used to be able to do that, when I newly installed the JDK+JRE. Unfortunately, Nokia PC Suite has made itself the default program for opening .jar files, so that it can install them on my Symbian. Which program do I 'Open With' to get back the old functionality? I already know how to do it from the command line, but this is easier.
There is no specific program to run jar files.
It is java.exe only with the -jar option
For eg.--> java -jar "foo.jar"
Right Click on a jar file and go to its properties. Change the default opening program to java.exe.
I hope that should work.
use javaw.exe if you don't want the command window.
This convention is widely followed by others like perl/python/ruby as well.
I know how frustrating this issue is. I looked all over the internet forums before I finally found the problem...Here is the answer below :
"The root cause for the problem above is, that a program has stolen the .jar association. If you have installed the Java Runtime Environment the first time, the file type called "jar" is assigned to javaw.exe correctly. "jar" is an abbreviation for "java archive" and javaw.exe is the correct program to execute a .jar. However, on Windows any program can steal a file type at any time even if it is already associated with a program. Many zip/unzip programs prefer to do this, because a jar is stored in the .zip format. If you doubleclick on a .jar, your pack program opens the file, rather than javaw runs the program, because your pack program ignores the meta information which are also stored in a .jar."

Disable TideSDK installer dialog when first opening a app?

Is there anyway to disable the TideSDK installer dialog popup when first opening your app. I am submitting an app to a 3rd party distribution site and it was rejected because of this.
Please help?
You could use tidebuilder.py and pass the -n parameter to it. The final command would be:
./tidebuilder.py -n -d {output dir} {source project dir}
If you create the application in bundled mode. There would not be any installer dialog popping up while installing the application. It is likely that you have created a networked installer and while installing and running first time its trying to fetch the modules from internet by popping up the installer dialog.
Can you provide some more details about your application, modules used by the same, are u creating net installer or bundled, which platform you are on ?
Also if possible describe the commands which you are using to create the application. This would be helpful for further investigating the issue.

Run BAT file from Adobe AIR?

To package an .air file into a native installer you have to use a batch program called adt.
The command on Windows will look something like this:
C:\Users\jisaacks>"C:\Program Files
(x86)\Adobe\Adobe Flash Builder
4\sdks\4.1.0\bin\adt" -package -target
native "D:\DEV\Flex4\Workspaces\AIR
Native Packager\AIRNIP\AIRNIP.exe"
"D:\DEV\Flex4\Workspaces\AIR Native
Packager\AIRNIP\AIRNIP.air"
I am trying to author a program in AIR that does this for you. Basically you drag/drop an .air file into it and it packages it into a native installer.
Well It gave me an Error #3219 error, which I looked up and found this:
AIR on Windows does not allow you to
run .bat files directly. Windows .bat
files are executed by the command
interpreter application (cmd.exe).
When you invoke a .bat file, this
command application can interpret
arguments passed to the command as
additional applications to launch. A
malicious injection of extra
characters in the argument string
could cause cmd.exe to execute a
harmful or insecure application. For
example, without proper data
validation, your AIR application may
call myBat.bat myArguments
c:/evil.exe. The command application
would launch the evil.exe application
in addition to running your batch
file.
If you call the start() method with a
.bat file, the NativeProcess object
throws an exception. The message
property of the Error object contains
the string "Error #3219: The
NativeProcess could not be started."
I am wondering if there is a possible work around or if I have hit a brick wall?
I believe you have hit a brick wall, at least with trying to do this in Adobe Air. Executing batch files can be a huge security hole, as your post claimed.
Are you trying to do this in Air for portability, or would you be able to use some other language?
I suggest trying to code this in python. Using the subprocesslibrary can help a lot.
http://docs.python.org/release/2.5.2/lib/module-subprocess.html
Serge Jespers (Adobe Evangelist) (http://www.webkitchen.be/) has done exactly this,
I think you should try to contact him for the details.
I helped him build a first solution by creating a windows executable which executed any bat file you specified, later he changed it by calling the java application (adt) directly which works fine as well.
He'll be very happy to help you.
UPDATE:
You can download the Package Assitant Pro right here: http://www.webkitchen.be/package-assistant-pro/

Resources