How can I start my Qt application as administrator or get a prompt when admin privilege is needed? I have tried everything in the posts that I could find about it and most of them are a few years old. Nothing has worked and everyone seems to have a different spin on it. I have downloaded the windows SDK to get mt.exe, created the manifest files, the RC file and every other methods including right click and set the application to start in administrator mode. Nothing has worked. I need it because a task in my program requires administrator privilege. QFile::errorString() says access denied. Does anyone know how to make this work?
Okay so I found the answer to my question. I had found some solutions before, but they were not working. I found the reason why they were not working. The reason was very stupid: It was because the folder that my files were in had a space between the first and second word like (my app) which causes an error about not being able to find the location.It should be (myapp) with no spaces. The error about location not found was only happening when trying to add the adim privileges. Otherwise everything worked fine and there were no errors. So here is the solution and make sure there are no spaces in folder names.
1) Create the rc file :Open notepad and paste the following text inside then
save the file as yourappname.rc This creates the rc
file. Put the file in the folder that has all of your sourcecode and pro
file.
#include <windows.h>
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "yourappname.exe.manifest"
2) Create the manifest file with notepad, paste the following text, and save it
as yourappname.exe.manifest and put it in the same location as above.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="2.0.0.0" processorArchitecture="X86"
name="yourappname.yourappname" type="win32" />
<description>A discription of your app</description>
<dependency />
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
3) In your pro file put the following text:
win32 {
RC_FILE = yourappname.rc
}
That's it. Now your application should start with administrator privileges.
There are similar post that describe this process too. Just make sure there are
no spaces in your folder names or it won't work. Also you MUST run qt with
administrator privileges for it to work. Right click Qt and run as
administrator before trying to compile.
Works for me (add in your_project.pro):
win32 {
CONFIG += embed_manifest_exe
QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:"level='requireAdministrator'"
}
To get the require admin prompt to display, I simply added
QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
to my qmake file. I use this in my projects all the time.
Easiest way is config at project Run configuration, adding this env variable:
__COMPAT_LAYER=RUNASINVOKER
then cleanup and rebuild and run again the proj, it will work.
Related
https://i.stack.imgur.com/S2za3.jpg
Emulator(phone) won't open. What is the problem?
Output: Hardcoded string "Button", should use #string resource
when another emulator(phone) is installed it gives this error
https://i.stack.imgur.com/54dEY.jpg
Output: The package was not installed. Please check you do not have it installed under any other user. If the package does show up on the device, try manually uninstalling it then try again. You should be able to uninstall the app via the Settings app on the device.
NOW
I deleted the old app links. The second error is over. The first error persists. The emulator does not open on the phone.
Output: Hardcoded string "Button", should use #string resource
This is a warning not an error. This warning would not affect the app running. I was able to reproduce this when set the text like below.
<Button
android:id="#+id/button1"
android:text="Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
If you want to fix the warning, add a Strings.xml in you value folder of Resources. Strings.xml is a string table to help with localization of the application.
Add the codes below into Strings.xml:
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<string name="Button_Text">Hello</string>
</resources>
And use it in your Layout:
android:text="#string/Button_Text"
Im using this in my web.config in my VS2019 project with IIS express on windows 10.
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true" />
<anonymousAuthentication enabled="false" />
</authentication>
</security>
</system.webServer>
But I get this error
This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
I looked at the internet to try different things, but none seem to work.
https://digitaldrummerj.me/iis-express-windows-authentication/
https://mpituley.wordpress.com/2016/10/04/http-error-500-19-in-the-iis-express/
Config Error: This configuration section cannot be used at this path
Config Error: This configuration section cannot be used at this path
Config Error: This configuration section cannot be used at this path
IIS Config Error - This configuration section cannot be used at this path
I've modified the files
C:\Users\me\Documents\project\.vs\config\applicationhost.config
C:\Users\me\Documents\IISExpress\config\applicationhost.config
I'm not sure what else to try.
Does anyone know?
Figured it out, there was another file I had to edit
C:\Users\me\Documents\project\.vs\project\config\applicationhost.config
I am trying to make an installer with izpack 4.3.5. While installing, a shortcut should be added to the users Desktop. Though I have added the ShortcutPanel and did not add the skipOnNotSupported no panel is shown and no shortcut is created though it complies successfully.
I already took a look at the following post (izpack: create shortcut on windows) but couldn't figure out my mistake.
Here is part of my install-file:
<panels>
<panel classname="TargetPanel"/>
<panel classname="PacksPanel"/>
<panel classname="ShortcutPanel"/>
<panel classname="InstallPanel"/>
<panel classname="SimpleFinishPanel"/>
</panels>
<packs>
...
</packs>
<resources>
<res src="shortcut.xml" id="shortcut.xml"/>
</resources>
<natives>
<native type="izpack" name="ShellLink.dll"/>
<native type="izpack" name="ShellLink_x64.dll"/>
</natives>
And here is my shortcut XML:
<izpack:shortcuts version="5.0"
xmlns:izpack="http://izpack.org/schema/shortcuts"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/shortcuts http://izpack.org/schema/5.0/izpack-shortcuts-5.0.xsd">
<shortcut
name = "test"
target = "$INSTALL_PATH\test.jar"
description="test"
programGroup="true"
desktop="yes"
applications="yes"
startMenu="yes"/>
<lateShortcutInstall />
</izpack:shortcuts>
Any ideas?
UPDATE:
I also tried to remove the lateShortcutInstall, but nothing changed.
Thanks in advance
You are trying to make install files for izPack version 5 work with izPack 4.3.5 (notice the version="5.0" in the shortcut XML?). This will not work as the format has changed in subtle details.
I suggest that you move to a current izPack 5 version (5.1.0 has just been released). It is actively maintained, more stable and better documented than 4.3.5.
If you are stuck on 4.3.5 please read my other post here: izpack-maven-plugin is not including native libraries by default and remove the <natives> element.
I'm developing a very simple gadget for Windows 7. I have created an index.html file and a gadget.xml file, compressed them as a zip, changed the extension to gadget.
When I double click on the .gadget file I get a window telling me if I'm sure I want to install the gadget as it comes from an untrusted publisher. I click 'Install', and everything seems to be fine.
However, the gadget is not installed.
I've looked at the Event Viewer and found nothing, it just silently fails.
Anyone knows what I might be doing wrong?
Here's the gadget.xml file:
<?xml version="1.0" encoding="utf-8" ?>
<gadget>
<name>Elecciones 2011</name>
<namespace>gnuine.com</namespace>
<version>1.0.0.0</version>
<author name="whatever">
<info url="hiddenforpublicpublish" />
</author>
<copyright>2011</copyright>
<description>Description</description>
<hosts>
<host name="sidebar">
<base type="HTML" apiVersion="1.0.0" src="index.html" />
<platform minPlatformVersion="1.0" />
<permissions>Full</permissions>
</host>
</hosts>
</gadget>
You need to create a .zip which has all the files directly in it.
What you probably have done is, put index.html and gadget.xml in a folder, zipped the folder.
What really needs to be done is, select index.html, gadget.xml and other files and folder and make a .zip out of it.
This was the issue I had faced, and doing this solved the problem.
Please check if that works.
Regards
download gadget
rename to rar extension from gadget extension
go to C:\Program Files\Windows Sidebar\Gadgets
extract all rename files with the same gadget file name like "new.gadget"
move the extracted folders to that directory. (to C:\Program Files\Windows Sidebar\Gadgets)
now you are done, problem solved.
I had issues with the version number, I thought it had to be:
x.x
not
x.x.x.x
For some reason, I can't seem to get CruiseControl.net to checkout code to anywhere but the starteam working folder for a specificed view.
I've tried both overrideViewWorkingDir and overrideFolderWorkingDir, and neither seem to work.
Has anyone been able to do this?
Are you looking for the project's workingDirectory element instead of the starteam override?
<sourcecontrol type="starteam">
<executable>C:\Program Files\starbase\StarTeam 5.4\stcmd.exe</executable>
<project>ProjectName/ViewName</project>
<username>UserName</username>
<password>Password</password>
<host>127.0.0.1</host>
<port>49201</port>
<autoGetSource>true</autoGetSource>
<overrideViewWorkingDir>C:\temp\ProjectName</overrideViewWorkingDir>
</sourcecontrol>
Works fine for me with ccnet 1.4.3 and Startem Cross-Platform Client 2008 R2. Make sure XML is valid. I had overrideViewWorkingDir tag not properly closed and ccnet was ignoring it. Found it by running ccnet.exe from the command line instead of as a service. Also you can use Process Explorer from SysInternals to view command line arguments passed to stcmd.exe
Make sure your working folder properties are set to a relative and not a full path (ex: MyFolder instead of C:\MyProject\MyFolder) or it will override the override. I've seen files checked out to some very odd places in the past when people mistakenly put in full paths when adding a folder to a view.