Link to home
Start Free TrialLog in
Avatar of gurgief
gurgief

asked on

Visual C++ and Windows 3.1

I have an application realized with Visual C++ 5.0 for Windows 95.
Then I have made a file .exe of this application.
What  can I do to run this execute in Windows 3.1 ??  
Is it possible ?? or I have to write again the application with Visual C++ for Windows 3.1??
ASKER CERTIFIED SOLUTION
Avatar of nietod
nietod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

If the application uses only the windows API functions that are available on windows 3.1, then the application will run under windows 3.1.  However, if you use functions that are only available on windows 95 or NT, then the program will not run.  When the user tries to run the application windows will display an error message saying that the application could not be loaded.
I believe that you can use the WINVER preprocessor definition to indicate what target operating system you want.  If you set winver to 0x0310 then, the preprocessor will not include procedures that are not available on 3.1.  Thus if you try to use one of these procedures, you will get a compiler error.  You can set WINVER by placing the line

#define WINVER 0X0310

before the line where you include windows.h.  Or you can place the definition in your project settings.
Avatar of gurgief

ASKER

I have a Dialog Based Application composed by CBandoAppl and CBandoDlg classes
There is not included windows.h. Where I have to place
 #define WINVER 0X0310  ??
or where I have to place it in my project settings ??
thanks in advance
You must be including some file that is including windows.h.  If you are using MFC, there must be an MFC include file that includes windows.h.  Place the #define above the line that includes this file.  You could put it before the first include to be safe.

It turns out this sort of definition can't be placed in the project settings, so use the #define.