I want to create a manifest file for my VB 6.0 program, so that when I launch my application, the OS should ask the user for administrator privilege.
I also want to know how it can be embedded in the application?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t actually create the manifest file in VB. A Windows application manifest is a standard text document, formatted as XML. You can create it in Notepad and save it with the appropriate file name in your application’s directory (
YourAppName.exe.manifest).Microsoft has more information available here: Application Manifests. It even includes a sample manifest that you can simply copy and paste into a blank text file to get started.
The important thing, if you want your application to prompt the user for elevation, is to set the
requestedExecutionLeveltorequireAdministrator, rather thanasInvoker. Specific information on using manifests with UAC is available here.So a full sample might look something like this:
The traditional way to embed a manifest into an executable is using the
mt.exeutility, available as part of the Windows SDK.The VBAccelerator site also has some information about embedding manifests in a VB 6 application. Specifically, it says:
But if you want to embed the manifest automatically when you build your application from the VB 6 IDE, you’re in for a little more difficulty. The VB 6 IDE doesn’t support post-build steps, so you can’t simply run
mt.exeon the command line to do it for you. There are a couple of utilities I’ve seen around the web that claim to automatically embed manifests for you, but I believe most of these are older utilities that only handle requesting v6 of ComCtl32.dll. I’m not sure if they’re easily extensible to include the UAC permissions as well, but it’s worth a shot. Here are some links to check out: