Forum > Debugger
runtime Error 740
Badscales:
Error 740 came out of the blue to spoil my Lazarus experience this morning. It wouldn't go away... Every time I tried to run the (splendid and magnificent!) software I had been testing and re-writing successfully for a couple of weeks I was told by Lazarus that the programme could not be made to run. In desperation, I eventually tried double-clicking the newly-compiled version outside Lazarus. I found I had to confirm that I wanted to allow my software to make changes to the system before it would start my programme, which ran (beautifully and perfectly - well, almost!) thereafter. To cut a long story short, I had to invent another user for my computer, make him/her/it an 'administrator' and demote myself from that exalted status. Problem solved, and the solution might be worth trying, but no guarantees!
Thaddy:
Is absolutely wrong and very bad advice. I gave the correct answer above and many years ago (2016).
740 can only be caused by a missing or malformed manifest. All that is explained above,
Simply study how manifest resources work. No need for administrator rights.
so:
- A proper manifest file or resource (asInVoker, unless the application needs access to other user accounts, then and only then requireAdministrator - which is restricted to the application, not the user!)
- Optionally a firewall rule, usually unlikely. when asInvoker applies.
Additional remarks:
During debugging your own code you might use administrator rights, but not for distribution.
Depending on the application, it may be the case that the application is so intrusive or exposed it needs to be code signed.
The latter is unlikely in most normal cases.
And a very belated post script to cpicanco: That is indeed the same manifest file, but you already knew that!
Usually this example manifest is enough:
--- Code: XML [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="MyApp" type="win32" /> <description>My App</description> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo></assembly>You may want to set uiAccess to true if applicable, usually not, along with the application name and the platform in the correct places.
Adapt an existing manifest file to include all of the application description part or simply replace or add the trust info part.
If your application has no manifest yet, the above should work immediately.
Simplest way to test: save the above as <your executable name>.manifest in the same directory as your executable.
If it works, compile it into a resource file and include the rc in your application. The resource constant is 24.
Note manifests are case sensitive, be aware of that.
A useful msdn entry is here: https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests?redirectedfrom=MSDN
gfkat:
In some case you just need to edit the configuration of the project and configure the execution level to AsInvoker, see attachment.
Thaddy:
--- Quote from: gfkat on January 17, 2023, 09:52:06 am ---In some case you just need to edit the configuration of the project and configure the execution level to AsInvoker, see attachment.
--- End quote ---
Correct.
Navigation
[0] Message Index
[*] Previous page