Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2011-03-25
14
1,278 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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
 
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 80

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

Back Up Your Microsoft Windows Server®

Back up 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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

840 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