## Win32 System Driver

This driver was designed for the modern Microsoft Windows in 32 bits or 64 bits (XP, 2003, Vista, 7, 8, and 10).

### DLL

To use the IUP DLL, it is necessary to link the application with the IUP.lib and IUPSTUB.lib libraries (for technical reasons, these libraries cannot be unified). Note that iup.lib is a library specially generated to work with iup.dll, and is usually distributed in the same directory as iup.dll. The IUP DLL depends on the Visual Studio C++ Run Time Library, MSVCR[XX].DLL, according to the Visuall C++ that built the iup.dll.

For the program to work, IUP.dll must be inside a PATH directory. Usually the program does not need to be re-linked when the DLL is updated.

### Tips

#### Inspecting Native Controls

The Spy++ tool distributed with Microsoft Visual Studio is very useful to inspect windows controls position, size and visibility. It can be found in the Visual Studio "Tools" menu. In a similar way you can also use the IupLayoutDialog to show IUP controls attributes and callbacks, in a interactive display of the dialog layout.

#### Dialog Contents Zoomed by the System

In Windows 8.1, Microsoft introduces a feature to support High DPI screens. If your application does not declares it is DPI aware, and the user configure the screen resolution for values greater than 100%, Windows will report a resolution of 96 DPI for the application and it will scale the contents of the dialog accordingly to the scale factor (actual resolution in DPI/ 96). To avoid that include the Manifest file when building the executable. The "iup.manifest" file in the "iup/etc" folder already contains the necessary changes to declare the application DPI aware.

Text will look better if a high DPI setting is used. For standard monitors (1280x1024) you can use 120 DPI (125%), for FullHD (1920x1080) can use 144 DPI (150%), and for 4k (3840x2160) can use 192 DPI (200%). To be able to respond to these resolution changes the application should avoid using sizes in pixels (like: RASTERSIZE, GAP, MARGIN) use character sizes instead (like: SIZE, CGAP, CMARGIN).

But there is still a problem with the images. Usually applications use 16x16 images for toolbar buttons, in a 4k resolution this looks very small, so ideally the application should have at least 3 sets of buttons: 16x16, 24x24 and 32x32. We recommend using 24x24 images for toolbar buttons when the SCREENDPI (global attribute) is greater than 120 DPI (> 125%), and 32x32 when greater than 144 DPI (> 150%). If that is not possible the global attribute IMAGEAUTOSCALE and the IupImage attribute AUTOSCALE can be used to automatically scale images. Stock image size is already automatically selected and resized if necessary.

#### UTF-8

When IUP is built with UNICODE enabled, it is possible to specify strings in UTF-8. But the default is still to use the current locale. To use UTF-8 strings set the global attribute UTF8MODE to YES.

#### LINK : warning defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

This is a message displayed by Visual C++ compilers when one or more libraries included for linking is not using the same C Run Time Library as the application. In the same Visual C++ compiler there are 4 different libraries resulting from the combination of 2 options: debug/release x dll/static.

The default configuration when a new project is created uses the C Run Time Library in a DLL, options named "Multi-threaded Debug DLL (/MDd)" for the Debug configuration and "Multi-threaded DLL (/MD)" for the Release configuration. The IUP package that matches that configuration is the "dll*" packages.

If you want to use static libraries then use the options "Multi-threaded Debug (/MTd)" for the Debug configuration and "Multi-threaded (/MT)" for the Release configuration. Then use the IUP packages named "vc*".

The IUP pre-compiled packages do not have debug information, so even selecting the correct dll/static combination, the warning will also be displayed. In this case the warning is harmless. But if you really want to avoid the warning simply use the same option without the Debug information for Release and Debug configurations.

Finally one thing that is NOT recommended is to do what the linker warning suggests, to ignore the default libraries using the /NODEFAULTLIB parameter. Only use that parameter if you really know what you are doing, because using it you can create other linking problems.

#### COM Initialization

IupOpen calls "CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);", if you need another concurrency model call CoInitializeEx with other options before calling IupOpen. Be aware that some features in some controls require single-thread apartment, and they will stop working, this includes: IupFileDLg when selecting a folder, and IupOleControl.

#### InitCommonCtrlEx Linker Error

On Windows a common error occurs: "Cannot find function InitCommonCtrlEx()" This error occurs if you forgot to add the comctl32.lib library to be linked with the program. This library is not usually in the libraries list for the Visual C++, you must add it.

#### Custom IupFileDlg

To use some cursors and the preview area of IupFileDlg you must include the "iup.rc" file into your makefile. Or include the contents of it into your resource file, you will need also to copy the cursor files.

#### Windows Native Controls Appearance

By default the Win32 application will look like Windows XP Classic theme, even in Windows 10. To use the new themes in Windows XP and and newer Windows, the build must enable the Windows Visual Styles. It can be enabled using a manifest file. Uncomment the manifest file section in "iup.rc" file or copy it to your own resource file (you will need also to copy the manifest file "iup.manifest" or "iup64.manifest").

When using Visual C++ 8/9/10/... with a manifest file, configure the linker properties of your project to do NOT generate a manifest file or the Windows Visual Styles from the RC file won't work. Also when using Visual C++ 8/9/10/... you can avoid using the manifest by using the following pragma on your code:

    #pragma comment(linker,"\"/manifestdependency:type = 'win32' \
                                                  name = 'Microsoft.Windows.Common-Controls' \
                                               version = '6.0.0.0' \
                                 processorArchitecture = '*' \
                                        publicKeyToken = '6595b64144ccf1df' \
                                              language = '*'\"")

If your Windows is using the Windows Classic theme or any other theme, IUP controls appearance will follow the system appearance only if you are using the manifest. If not using the manifest, then it will always look like Windows Classic.

#### Help in CHM format fail to open

When you download a CHM file from the Internet Windows blocks your access to the file. You must unblock it manually. Right click the file in Explorer and select "Unblock" at the bottom of the dialog.

#### Visual C++ 6

Since 3.0 Visual C++6 is not supported, although we may still provide pre-compiled binaries. To compile the IUP 3 code with VC6 you will need to download a new Platform SDK, because the one included in the compiler is too old. But it cannot be a too new one also, because the compiler will report errors in the newest headers.

We recommend you to upgrade your compiler. Visual C++ Express Edition is a free compiler that has everything VC6 had and more.

#### Control ID (since 3.26)

The attribute CONTROLID can be used to set the Windows control identifier. IUP automatically generates identifiers for controls inside the dialog starting at 100. When using this attribute start with a very large number to avoid conflicts with the generated idetifiers.