C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 팁&트릭
C++Builder Programming Tip&Tricks
[662] OS별 조건 컴파일할 수 있는 predefined 값.
김태선 [cppbuilder] 7353 읽음    2007-06-25 17:15
WINVER 이고요,
이 값이 뭘 가지느냐에 따라 
OS를 판단하면 됩니다.


Windows "Longhorn" WINVER>=0x0600
Windows Server 2003 WINVER>=0x0503
Windows XP WINVER>=0x0501
Windows 2000 WINVER>=0x0500
Windows NT 4.0 WINVER>=0x0400

XP를 쓰면 보통
WINVER == 0x0501
값이 됩니다.


아래는 간단히 윈도 버전을 판단할 수 있는 매크로입니다.

//Windows version macros

#define WinVerMajor()        LOBYTE(LOWORD(GetVersion()))
#define WinVerMinor()        HIBYTE(LOWORD(GetVersion()))

#define IsWinVerNTs()        (GetVersion() < 0x80000000)
#define IsWinVerNT351Plus()  (IsWinVerNTs() && WinVerMajor() >= 3)
#define IsWinVerNT4Plus()    (IsWinVerNTs() && WinVerMajor() > 3)
#define IsWinVer98Plus()     (LOWORD(GetVersion()) != 4)
#define IsWinVerMEPlus()     (WinVerMajor() >= 5 || WinVerMinor() > 10)
#define IsWinVer2000Plus()   (WinVerMajor() >= 5)
#define IsWinVerXPPlus()     (WinVerMajor() >= 5 && LOWORD(GetVersion()) != 5)



Using the macros
These examples will show you how easilyy you can use the macros in your applications:

// Example 1:
if (IsWinVerMEPlus())
{
    printf("If you can see this message you"
           " are running Windows ME or higher! \n");
}
else
{
    printf("If you can see this message you are running Windows 95 or 98! \n");
}

// Example 2:
if (IsWinVerXPPlus())
{
    // Jun-01-2005
    printf("If you can see this message you are running Windows XP or 2003! \n");
}

// Example 3:
if (IsWinVer2000Plus())
{
    printf("Your operating system supports the opacity"
           " and transparency color key of a layered window! \n");
}

이 부분 출처는 코플
http://www.codeproject.com/macro/winver_macros.asp

+ -

관련 글 리스트
662 OS별 조건 컴파일할 수 있는 predefined 값. 김태선 7353 2007/06/25
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.