Converting Windows App written on XP to Windows 7 - visual-c++

I inherited a huge code base which was written to work on Windows XP. Now we would like to migrate to Windows 7. I do not know what is the proper way to go about this. What is the proper approach to do the above task? I did some googling on differences between XP and Windows 7 but I do not get any proper links which describe how the internals of 7 differ from XP. Any links will be appreciated.
Usually how do S/W developers migrate their code/apps written for one version of OS say Vista to Windows 7?

I sell an autoupdate solution (AutoUpdate+, minor plug) and so have lots of experience porting Windows apps to the latest releases, and yet still maintaining backwards compatibility. Porting from Windows XP to Windows 7 can be a big challenge (there should be almost no difference in a move from Windows Vista to Window 7).
Window XP doesn't care where your application exists, and hence programmers would dump both their application and support logic (log files, config files, user profiles etc.) into the same location under "C:\Program Files\". Take this application to Windows 7 and you'll start finding some unusual behaviors. For starters, you will notice that files seem to 'disappear'. Instead of a log file being modified under the common Program Files location, you may end up with multiple, and separate, copies for each user under "Compatibility / Program Files". Windows Vista/7 introduced file system virtualization, and will now create separate user instances of files to ensure to ensure that each user has their own secure copy.
Another problem you will encounter on Windows Vista, and to a lesser extent on Windows 7, is User Account Control (UAC) prompts. It's similar to the issue above, in that new security restrictions will now cause Windows Vista/7 to prompt the user for approval to proceed. The most noticeable area where this occurs is when you are tampering with executable files in sensitive directories, installing applications and drivers, and sometimes when trying to self-update an app (the abovementioned app actually works around these prompts with some smart logic).
So in short, security changes are the biggest difference between Windows XP and Windows Vista/7. Your best start is to separate application logic (binaries) from supporting logic, by putting the latter into user specific directories. Some apps may never be fixable and can be forced instead to work in Compatibility Mode or to launch always under the Admin account context --- poor workarounds, but may be suitable in your company.
Simon # http://AutoUpdatePlus.com

There are three parts to the migration. First, make it just plain work. This means fixing up hardcoded file paths (there's no more Documents and Settings), changing some of your save locations so you don't need to be elevated to work properly and don't rely on virtualization, changing some of your registry key locations for the same reason, and coping with high-DPI which might now be applied automatically based on screen size rather than as a user's choice.
Second, make it look and work like a Windows 7 application. Is your jumplist usable? Your thumbnail? You get some things for free, do you like what you get or would you like to take control? Are there obvious wins you could use like thumbnail buttons, jumplist tasks, taskbar overlays, etc. Don't surprise your users and don't disappoint your users. (Example of disappointment: VS 2008 and the crummy jumplists it offered. They had the excuse of being released before Windows 7 - you don't.)
Third, take advantage of Windows 7 to be greater than you otherwise would. Stop polling for network joins, file creation, hardware being plugged in, going on and off AC power etc and learn how to get notified when those things happen. Add touch support beyond what you get for free. Talk to a sensor or GPS for the first time, since Windows 7 makes it simpler than it ever was. That sort of thing.
1 is not optional. 2 is really not optional either, a year after Windows 7 is released. 3 will differentiate you and I recommend, once you get past 1 and 2, you look into it.

Basically Windows7 is a 4bit OS and so necessarily runs on a 64bit processor environment. XP has 32bit as well as 4 bit flavours. If your application is for the 32bit version of XP, in that case, the major migration means making the application run on 4bit OS effectively.
The basic steps can be something like this:
Make it compatible to 64bit win7. So you may just compile the code off a win7 machine (on 64bit). If the compilation works fine, you might be able to run the app successfully.
The first step just allows to move ahead. But your application might not be effective. In that case, you might have to review the code for any specific implementation coupled on 32bit os and upgrade them to take advantage of 64bit OS.
The major advantages on 64bit OS is higher address-ability (so access more RAM) and also cache etc.

I did some googling on differences between XP and Windows 7 but I do not get any proper links which describe how the internals of 7 differ from XP. Any links will be appreciated.
API diff report between XP and Vista: https://abi-laboratory.pro/compatibility/Windows_5.0_to_Windows_6.0/x86_64/abi_compat_report.html
API diff report between Vista and 7: https://abi-laboratory.pro/compatibility/Windows_6.0_to_Windows_7.0/x86_64/abi_compat_report.html
The reports are generated by the abi-compliance-checker tool.

Related

Using AppLocale with LabVIEW

I am running LabVIEW 2013 Dev Environment on a Chinese Windows 8 platform. LabVIEW is not a Unicode-base program, and consequently on Asian Windows there are display issues for our interfaces created with US-English character sets. I can fix this problem by setting the language settings for non-unicode programs to English. This works fine, except that all my other non-unicode-based programs are totally illegible.
A quick google search turned up Microsoft's utility for running application with a user-specified code page, AppLocale. The utility is only written to be compatible up to Windows XP. There are two suggested methods I ran accross for installing it: 1. run installer using compatibility settings 2. install using command prompt with admin privileges (apparently it doesn't play well with UAC. You can find one set of instructions here for installing AppLocale on Windows with UAC.
Unfortunately, nothing I have tried has been able to get LabVIEW to use the code page I would like it to. When I run LabVIEW through AppLocale and open the user-interface I am concerned about, the characters still do not display properly.
Any ideas what I might be doing wrong? Could there be a fundamental incompatibility with LabVIEW?
Does anyone know of an alternative to AppLocale that might work for me?
One alternative to Applocale on windows 8 is Locale Emulator created by xupefei. You will have to have visual studio to build the project.
Make sure that your region settings are set to an english speaking region such as the united states of america. You can check this under
control panel >> clock, language, and region >> region settings
Additionally ensure that you have the language packs installed for the character sets used by LabVIEW. You can check which language packs you have installed under control panel >> clock, language, and region >> language
You will want to have installed support for complex languages
If none of these things work I would try upgrading to windows 10 as it has much better language support

Porting a Windows-CE application to Windows Desktop

I have taken over a Windows-CE 6.0 application that I would like to port to other platforms. It is a relatively straightforward, self-contained GUI application, written in Embedded C++ Version 4.0
The very first target I am interested in would be a regular Windows desktop (i.e. XP, Vista, Windows-7).
I understand that porting a desktop application to CE is nontrivial; but what about the reverse, which is what I am interested in? Is going from Windows-CE to Windows Desktop (somewhat) upward-compatible? I sure would love to hear "buy this $1000 Microsoft XYZ C++ development environment and just compile and go!"
(FYI I have no experience with GUI applications nor with programming in the Windows environment; pretend I am but a simple linux/unix guy with decades of C/C++ experience but absolutely no Windows-Fu... ;-)
Porting up should, actually, be pretty straightforward. CE is mostly a subset of Win32, with heavy emphasis on Unicode.
You can probably make sure UNICODE is defined, build and, with a little luck, most of it will "just work". Places that are going to be hangups are:
The UI is likely to be set for a resolution that doesn't match your PC - often CE apps are targeted to a specific device and resolution and this doesn't necessarily come out very aesthetic on a PC.
Anything dynamically loaded (GetProcAddress) from coredll will have to be re-mapped to kernel32/user32/etc
If the device uses the SIP (software input panel - i.e. on-screen keyboard) then all of that has to get stripped out.
If the app uses any Notifications (icons, etc) that has to get replaced
If the app uses any power management, that has to get ripped out
If the app uses any device-specific stuff - especially direct calls to drivers, all of that has to be replaced
If the app is using point to point queues, that has to get replaced
If the app is using the device manager (e.g. to get notifications of copnnected devices) that has to get replaced
Any calls into aygshell.dll are likely to be problematic as well.

How a Windows Developer can most easily get his software to work well under Wine

Many of my users have been telling me that they'd like to run my software on their Linux machines under Wine.
But I'm a Windows Developer who has practically no experience with Linux.
Now I could spend a month or two installing Linux, learning Linux, installing Wine, learning Wine, and thoroughly ensure my application runs well under Wine. But I am still developing for Windows, so I don't want to take so much time away from development right now.
So what can I do without too much effort to get my program running as well as possible under Wine?
I did find this General help on running applications under Wine.
Download VMWare and an Ubuntu virtual machine (Ubuntu is a popular Linux distribution) from the VMWare site. This will provide you with a working Linux O/S inside your Windows environment without needing to install Linux manually.
You can then use the instructions here to install Wine, that Wiki page also provides you with some instructions on how to use it.
If you follow what Adam Rosenfield suggested and just try running your application in Wine unmodified, you will be able to determine quickly whether there are problems. My guess would be that there are some, otherwise your users would not have contacted you about it :)
There are many ways for getting help with debugging applications in Wine, consult the website for options and pick a few ways that suit you. As always, it's best not to rely on a single channel for communication.
Also, if you are more comfortable with developing in Windows, the approach of using a virtual machine will allow you to compile your code as usual in Windows and copy the binary into the virtual machine for testing (Ubuntu supports browsing/mounting Windows shares).
As long as you're not doing anything unusual such as playing around with hardware or poking around in undocumented API calls and data structures, you should be able to run your code under Wine with few or no modifications. Wine has a fairly complete implementation of the public Windows APIs, so if your program plays nice and doesn't mess around, it should just work.
Don't use too much of the windows API! Don't use anything new from Microsoft ;)
Avoid using WPF is the #1 suggestion.
But it really wouldn't kill you to test your app under Wine. It's not that hard to try; it certainly won't take months. For instance:
Use http://www.ubuntu.com/getubuntu/downloadmirrors#wubi to install
Ubuntu into a file on your Windows machine, then start ubuntu and install the latest Wine from
http://winehq.org/download/deb
Then try running your app's installer.
If it doesn't work, check the Wine FAQ, ask for help in one of the wine forums, and/or file bugs in wine's bug tracker.
Should take about three hours from a dead start to trying out your installer.
I was rather surprised when one of my Delphi5 applications just worked out of the zip.
The only real way this is going to work is to do it yourself, i.e. install vmware and a linux distro as Sean suggested. Linux isn't actually that hard, and we're all here to help.
Having done a quick test I can confirm that it largely works. There is an ACCVIO reading 0x34 during start up, the error dialog can be ignored and the application runs, I opened the Steve McCarthy GEDCOM.
Screenshot
This was using Wine 1.1.12 under MEPIS 7.9.94-rc1_32 under VMWare. Highly recommend to use VMWare for this sort of thing.
What language/platform do you develop with? Depending on which it is, it should be no trouble to get it running native. For example, if you use Java or Python, both operate very cleanly on Linux. Likewise, if you're a .NET developer, you should be able, with some pain, to get your app running in Mono.
Find Linux beta testers. It can reports a bug to WINE developers or find a bug in your application.
Wine is more sensitive to errors than Windows. For example, Wine will crash on NULL window handles, and fail to create windows if the class is invalid, whereas Windows is more robust and will just circumvent the error.
It's an opportunity to clean up your code.
I was amazed at how well Wine ran my app the first time I tried. However, I had to get rid of a third-party driver-based component.

How to run MSVC++ 6.0 off a USB drive as a portable app

Without using any third party program to do this (i.e. without VMware ThinApp, U3 or MojoPac etc.) How to move MSVC++ 6.0 from from its install on C: over to a USB drive? So that it can be used on different PCs with no admin rights and without installing anything on the host PC? Even if it's only usable as a console application would be fine, although to have the GUI including Visual Assist etc. would be even better.
Move the two folders that install created under c:\program files\ to the USB drive (e.g. to e:\progs\msvc\msvc6 and e:\progs\msvc\vc98), and append to the file e:\progs\msvc\vc98\bin\vcvars32.bat to suit e.g.
prompt $g
set path=e:\progs\uedit;e:\progs\utl;%PATH%
e:
cd e:\work
start e:\progs\uedit\uedit32.exe /i=e:\progs\uedit\uedit32.ini
cmd /k
Using a shortcut to vcvars32.bat then works fine for doing any simple console programming, which is all I’m using it for so far. I don’t know how well any of the GUI type programs in the tools folder will function.
I am not sure exactly how one would do that.
Here are a few ideas.
The installation procedure creates at least two sets of directories, so you could direct both of them onto the usb drive.
The installation procedure creates a bat file, that sets up the environment variables correctly for command line execution. Modifying it to point to the correct drive letter when your memory stick loads on the other machine may be important.
There are also registry entries for vc 6. Extracting them, and having a script of some sort to load them onto your target machine when needed, might be useful.
Is there a specific reason why vc 6 is required? Would another compiler do?
I haven't done this, but it should "just" be a matter of:
Copying all the application files to a USB drive. Remember there will be shared files and stuff that may need to go into the Windows directory.
Identifying and copying all of the registry entries, although you may need to be admin to create some of these on the target machine.
That's a heck of a lot of work, for little gain in my opinion. I think there may be a command line only version of the Visual C++ tool chain that may better suit your requirements. IIRC it was released to help people create build bots for open source projects, like the Mozilla Tinderbox, and includes the VC++ 7.0 compiler.

What problems do you encounter with VFP apps in a 64 bit environment?

I know that there are issues with the VFP OLEDB provider on 64 bit machines. ... but what issues do you encounter while actually running a VFP application - on a 64 bit machine? Has anyone had any experience in this area?
My first thought was that it would just run as a 32bit app, without making use of the 64 bit power. However, I ran into difficulties with a FoxPro application connecting to a SQL Server database (probably an OLEDB issue as well). Are there other issues as well?
This is somewhat of a specialized scenario, and it may not be related to 64 bitness, but since you asked...
My organization recently hosted a legacy VFP 7 app on a Windows Server 2008 Enterprise 64 bit server for access over Terminal Services. The app runs fine, but there is some kind of bug with the TS Easy Print technology. When you print from the app to a redirected client printer over Easy Print, the top, left, and bottom sides of each page of the document get clipped. The workaround we use is to have the users print to pdfFactory on the server first, then print from pdfFactory to the redirected client printer over Easy Print. Works great.
This is somewhat of a stab in the dark...but I believe there are some drivers with MDAC that aren't available in x64 windows. I think you may be able to install the normal 32-bit MDAC but it will install to the x86 folder.
We've seen zero problems with our VFP9 apps on 64-bit XP, Server 2003, Vista, or Server 2008.
Our print engine is a VB DLL though, so we wouldn't run into any VFP-specific printing issues.

Resources