Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Determine if program running in XP SP3 compatibility mode

16 May 2015   #1
dianedebuda

Windows 7 Pro 64bit
 
 
Determine if program running in XP SP3 compatibility mode

Is there way to tell if a program is running on Win7 in XP SP3 compatibility mode? (not VM XP Mode) Have an msaccess app where 1 of its functions only works if yes, so want to disable internal menu item to it if no. Would like to do this in VBA from within msaccess, but other examples welcome.


My System SpecsSystem Spec
.
16 May 2015   #2
Brink

64-bit Windows 10 Pro
 
 

Hello Diane,

You could check the program's compatibility mode settings using OPTION ONE in the tutorial below to see what it's currently set at if using compatibility mode.

Compatibility Mode
My System SpecsSystem Spec
16 May 2015   #3
dianedebuda

Windows 7 Pro 64bit
 
 

Thanks, but what I need is to be able to look at those settings programmatically. Where are they stored? If I can get to them from within msaccess, that'd be great. If there's a way to get them using the command line and store an environmental variable or create a txt file, that'd work too.

So far, it looks like the value may be in HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\programpath. I think I've found a method to read the registry, so I may be off & running. If not, I believe there's a way to save the reg value to a text file as a backup, but syntax is tripping me up. Missing quotes?

reg save HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers\C:\Program Files\Office97\Office\WINWORD.EXE d:\data\reg.txt

edit: Brink, I've use tons of your tutorials and your .reg files. Many, many thanks. What would be the contents for the .reg to add/remove this entry?
My System SpecsSystem Spec
.

16 May 2015   #4
Brink

64-bit Windows 10 Pro
 
 

A .reg file is basically just a text file with a renamed file extension. When you edit a .reg file, it'll open in Notepad.

If you like, once you set them how you like, you could export the Layers key below as a .reg file for a backup of your compatibility mode settings for all programs. Merging the .reg file would restore them.

HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
My System SpecsSystem Spec
16 May 2015   #5
Alejandro85

Windows 7 Ultimate x64
 
 

You may guess it by using the Windows API directly from VBA. In particular, the GetVersionEx API function does that. In the remarks section it explains that this API is affected by the current compatibility mode:

Quote:
If compatibility mode is in effect, the GetVersionEx function reports the operating system as it identifies itself, which may not be the operating system that is installed. For example, if compatibility mode is in effect, GetVersionEx reports the operating system that is selected for application compatibility.
So by calling it, it returns the Windows version. But if compatibility is used, it will return the version that's indicated to be compatible, NOT the real Windows version actually used.
You can use the Declare Function statement together with a custom type for the return struct for calling this.
My System SpecsSystem Spec
16 May 2015   #6
dianedebuda

Windows 7 Pro 64bit
 
 

Brink -
But I only want to control 2 entries under Layers, msaccess & winword. Can I not just isolate to those or do I have to do the whole Layers? What I'm thinking is that i could create a bat file for the app & force the Compat Mode before & after. I'd be calling the bat with a shortcut that avoids UAC like one of your tutorials outlined.

Maybe something like the following?

reg.exe Add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Program Files\MyApp\Test.exe" /d "WINXPSP3"

reg.exe Delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Program Files\MyApp\Text.exe"

The Goggled source for the delete was actually:

for %x in ("*.exe") do reg.exe Delete "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%~fx"


Have no idea what the "%~fx" is.


Alejandro85 -
That looks really promising. One of those "is it a feature or a bug" deals?
My System SpecsSystem Spec
16 May 2015   #7
dianedebuda

Windows 7 Pro 64bit
 
 

Got .reg stuff working

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\_Program Files\\Office97\\Office\\MSACCESS.EXE"="WINXPSP3"
"C:\\_Program Files\\Office97\\Office\\WINWORD.EXE"="WINXPSP3"


Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\_Program Files\\Office97\\Office\\MSACCESS.EXE"=-
"C:\\_Program Files\\Office97\\Office\\WINWORD.EXE"=-

Thanks for helping a .reg neophyte. Now onwards to GetVersionEX
My System SpecsSystem Spec
16 May 2015   #8
dianedebuda

Windows 7 Pro 64bit
 
 

All is working. Thanks for help. Been many, many years since I've programmed Access.
My System SpecsSystem Spec
16 May 2015   #9
Brink

64-bit Windows 10 Pro
 
 

Great news. Glad we could help some.
My System SpecsSystem Spec
Reply

 Determine if program running in XP SP3 compatibility mode




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Compatibility Mode causing problems, How to remove this mode?
Our old computer (A Windows XP) went kepoot and my father tried installing a windows XP Quicken onto this Windows 7 computer, but it seems in his failed installation he enabled a Compatibility Mode, since I have noticed these things different with the computer: Local Disc C: Program Files are no...
Software
Window size running DOS program in Virtual Mode
Have finally gotten my OLD DOS program (Smartware) to run in vertual mode under Windows 7. However the window size is too small and I can not figure how to increase it so more of the speadsheet's rows and columns are visible. Any known work arrounds?
Virtualization
What lack of events determine when sleep mode initiates?
In control panel/power options you can set sleep mode to occur for both the display and the hard disk. I've set both of these to sleep after 20 minutes. Is it just pressing a keyboard key or moving the mouse or pressing a mouse button that triggers a reset of the countdown clock for sleep...
Performance & Maintenance
How to determine what program is creating a file
Every so often, I see the file debug.log appear in /Users/<me>/Documents. The file has a size of zero bytes. I delete it and it eventually reappears. I do not believe that this is virus related, but I would like to figure out what program is creating it. Can you please offer some suggestions. ...
General Discussion
IE9 How do I determine if I'm in Compatibility Mode?
I have the new 64 bit version. On some sites, IE 9 automatically comes up with the symbol for compatibility mode. On some it's sort of grey color but if I click on it, the icon turns blue. On other sites it does not come up with any icon, such as this site, so I assume this is fully...
Browsers & Mail
Does Windows XP Mode = Compatibility Mode?
Hi all! I've heard that Windows 7 Home Premium doesn't include the "Windows XP Mode" and I'm told on the MS's website that it's a separate download, with an image showing totally XP-themed window in the 7 environment. Windows 7 Features: Windows XP Mode I'm running Ultimate and I recall no...
Virtualization


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 05:31.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App