Solved

How should I properly compile VB6 programs to run on Windows 7?

Posted on 2011-03-25
14
1,272 Views
Last Modified: 2012-05-11
I have run into an issue with my vb6 applications on windows 7.  Because I am using the Intuit SDK, I need to compile using x86 and need to run the programs under a standard user account NOT with 'run as administrator'.

I'm not sure what I am doing wrong,  but I have 2 problems with this:

1 - I can't figure out where to set the project to compile using x86.
2 - When I compile my programs and then try to run under a standard user account, there is a windows security shield on my icon, indicating it will run as administrator, and when I run, it does as for the admin password.  I can't figure out how to get around this.

Thanks for any help you can offer on either issue!

Lynn
0
Comment
Question by:lthames
  • 7
  • 6
14 Comments
 
LVL 5

Accepted Solution

by:
MedievalWarrior earned 500 total points
ID: 35217399
Hi,

1) All VB6 programs compile for 32 bit. There is nothing you have to do to change this so rule out this option.
2) Double check and make sure your executable name doesn't contain keywords like Setup, Install because UAC uses keywords for compatability with installers that were developed without the new manifests.

To resolve problem two you want to create a manifest for your application that uses uses "AsInvoker" this will disable virtualization and ensure your executable always runs with standard privileges.

Step 6: Create and Embed an Application Manifest (UAC)
http://msdn.microsoft.com/en-us/library/bb756929.aspx
<?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="IsUserAdmin"
     type="win32"/> 
  <description>Description of your application</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="AsInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

Open in new window

0
 

Author Comment

by:lthames
ID: 35217579
I clicked on your link and it has instructions listed as for Vista. . . can I assume this is relative to Windows 7 as well?

Thanks!!!!!!!
0
 

Author Comment

by:lthames
ID: 35217621
Also, I am not seeing instructions for VB6 . . . only Visual Studio.  

0
 
LVL 5

Expert Comment

by:MedievalWarrior
ID: 35217623
Yes the concept is the same for Vista or later...

Lets assume your executable is named Project1.exe then you want to create manifest file in the same location as your executable and add the code.

Ex.
C:\App\Project1.exe
C:\App\Project1.exe.manifest

Add the code into Project1.exe.manifest file using notepad.
<?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="Project1"
     type="win32"/> 
  <description>Description of your application</description> 
  <!-- Identify the application security requirements. -->
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
          level="AsInvoker"
          uiAccess="false"/>
        </requestedPrivileges>
       </security>
  </trustInfo>
</assembly>

Open in new window

0
 

Author Comment

by:lthames
ID: 35217701
THANKS!   Trying that now.
0
 

Author Comment

by:lthames
ID: 35218402
I tried this and I'm not sure if it DIDN'T work, or if it worked but exposed another problem.

Now when I try to run the program (which DOES NOT have the security shield on the icon), it says "The requested operation requires elevation"

Any thoughts?
0
 

Author Comment

by:lthames
ID: 35218436
Could it be that some component of my application requires elevated permissions?  Hmmm that would be a problem because Intuit QB SDK's require you NOT to have required elevations!

Thanks again for all of your help.
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 5

Expert Comment

by:MedievalWarrior
ID: 35218464
Yes. It sounds like the UAC cache behavior so have you tried moving your files to another location or performing log off/ log on / reboot.
0
 

Author Comment

by:lthames
ID: 35218512
log off/log on/reboot several times.  

moving the files to a public location maybe?  They are currently on a c:\clients folder.



0
 
LVL 5

Expert Comment

by:MedievalWarrior
ID: 35218525
Sorry. I meant to try either log off and back on or reboot not all three ;)
0
 
LVL 5

Expert Comment

by:MedievalWarrior
ID: 35218622
Did you change line 5 of the manifest code to reflect the name of your executable file without the .exe extension.
name="Project1" <--- name of your exectuable

Open in new window

0
 
LVL 79

Expert Comment

by:David Johnson, CD, MVP
ID: 35219170
have you ever tried to use visual studio express to compile your applications?
0
 

Author Comment

by:lthames
ID: 35222652
Warrior,

The manifest worked . . . . I just had some offending code in a module of my application that I wasn't even using.  I decided to delete everything from a public utilities module that I wasn't using and it solved ALL of my problems!

Thanks so much for all of your help.

Lynn
0
 
LVL 5

Expert Comment

by:MedievalWarrior
ID: 35222746
Great! Good luck with your project
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now