Solved

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

Posted on 2011-03-25
14
1,269 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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 78

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

758 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

20 Experts available now in Live!

Get 1:1 Help Now