본문 바로가기

InstallShield

checking windows version

Link : http://www.devpia.com/MAEUL/Contents/Detail.aspx?BoardID=32&MAEULNo=13&no=3554&ref=3554

뉴스레터에서 받아본글 입니다...

// InstallShield 6 requires    that ifx.h be included

#if    _ISCRIPT_VER >=    0x600
    #include "ifx.h"
#endif

NUMBER nvWinFamily,    nvWinMajor,    nvWinMinor;
STRING svResult;

program
    // Detect Windows family
    GetSystemInfo(OS, nvWinFamily, svResult);
    
    if ( nvWinFamily = IS_WINDOWSNT    ) then
    
        // Check for NT    4 or Windows 2000
        GetSystemInfo(WINMAJOR,    nvWinMajor,    svResult);
        if ( nvWinMajor    >= 5 ) then
            MessageBox("Windows    2000 or    above detected", INFORMATION);
        elseif ( nvWinMajor    = 4    ) then
            MessageBox("Windows    NT 4 detected",    INFORMATION);
        elseif ( nvWinMajor    = 3    ) then
            MessageBox("Windows    NT 3 detected",    INFORMATION);
        else
            MessageBox("Unknown    Windows    NT version", INFORMATION);
        endif;
    
    elseif ( nvWinFamily = IS_WINDOWS95    ) then
    
        // Check for Windows 95, Windows 98, or    Windows    Me
        GetSystemInfo(WINMAJOR,    nvWinMajor,    svResult);
        GetSystemInfo(WINMINOR,    nvWinMinor,    svResult);

        if ( nvWinMajor = 4 ) then
            if ( nvWinMinor >= 90 ) then
                MessageBox("Windows Me or above    detected", INFORMATION);
            elseif ( nvWinMinor >= 10) then
#if    _ISCRIPT_VER >=    0x600
                MessageBox("Windows    98 detected", INFORMATION);
#else
                // In IS5 Windows Me lies about    its    version
                // so we check the file    version    of kernel32.dll
                VerGetFileVersion(WINSYSDIR    ^ "kernel32.dll", svResult);
                if ( VerCompare(svResult, "4.90.0.0", VERSION) = LESS_THAN ) then
                    MessageBox("Windows    98 detected", INFORMATION);
                else
                    MessageBox("Windows    Me or above    detected", INFORMATION);
                endif;
#endif
            else
                MessageBox("Windows    95 detected", INFORMATION);
            endif;
        else
            MessageBox("Unknown    Windows    9x version", INFORMATION);
        endif;
    
    else
        MessageBox("No 32 bit operating    system", WARNING);
    endif;
endprogram

Remarks    about code sample 1:

The header file ifx.h is required for InstallShield 6.x, but doesn"t exist in
InstallShield 5.x. To make the source code compatible with both versions, the built in
constant _ISCRIPT_VER is used to detect the version of InstallShield. _ISCRIPT_VER is
0x600 in IS6, and undefined in IS5.
Instead of the constant IS_WINDOWS95 we could have used IS_WINDOWS9X, they are identical.
However IS_WINDOWS9X was introduced with IS 5.5. To make the script also compatible with
IS 5.0 and 5.1, the older constant IS_WINDOWS95 was used here.
The Kernel32.dll file version check is only used in InstalShield 5. GetSystemInfo
correctly returns 4.90 for Windows Me in InstallShield 6.

'InstallShield' 카테고리의 다른 글

serial number 창 넣기  (0) 2013.09.27
설치후 reboot 하기  (0) 2013.09.27
Modify, Repair, Remove 창 안뜨게 하기  (0) 2013.09.27
[installshield] Uninstall icon 만들기  (0) 2013.09.27
InstallShield 에서 외부 Dll 사용하기  (0) 2013.09.27