ADO DOT NET Posted May 23, 2007 Posted May 23, 2007 Hi, I want to get the prompt to elevate to admin in Vista for my application written in VB6. I found a tutorial here: http://www.xtremedotnettalk.com/showthread.php?t=98234 But it's only valid for VB.NET, how should I do the same in VB 6? Thanks :) Quote
Administrators PlausiblyDamp Posted May 23, 2007 Administrators Posted May 23, 2007 Not tried this but you should be able to compile a valid manifest (like the one in the linked article) to a .res file with the rc.exe utility. You would need to generate a .rc file that refers to the manifest. Firstly create a file call .rc #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #define RT_MANIFEST 24 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST ".manifest" Then compile it with the following command line RC.EXE /r /fo .res .rc You can then add the resulting .res file to you VB6 project. Haven't tried it (no VB6 handy) but I've used a similar trick in the past to build custom resource files for VB6 and it has worked fine.... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ADO DOT NET Posted May 23, 2007 Author Posted May 23, 2007 Hi again :) Many thanks for your help, yes I am familiar with the rest of process, but because I have to enable visual styles also, I got a problem, here is my manifest file: <?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="X86" name="company.file.exe" type="win32"/> <description>My Software.</description> <dependency> <dependentAssembly> <assemblyIdentity processorArchitecture="X86" name="Microsoft.Windows.Common-Controls" type="win32" language="*" publicKeyToken="6595b64144ccf1df"/> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> And here is my rc file: #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #define RT_MANIFEST 24 #define CONTROL_PANEL_RESOURCE_ID 123 CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "file.exe.manifest" But after compile and run I got this error: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. It was working correctly when I was only enabling visual styles, but not now, I think the problem is from manifest! Quote
Administrators PlausiblyDamp Posted May 23, 2007 Administrators Posted May 23, 2007 Does the event log give any more information? Other than that does the version of the .exe match with the version number in the manifest? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.