MFC의 MessageBox 함수의 사용법!!
MessageBox 함수의 리턴값은 다음과 같다.
#define IDOK 1 #define IDCANCEL 2 #define IDABORT 3 #define IDRETRY 4 #define IDIGNORE 5 #define IDYES 6 #define IDNO 7
MessageBox( 출력할 문자열, 메시지박스 제목, 메시지 박스의 종류 )
메시지 박스의 종류는 다음과 같다.
/* * MessageBox() Flags */ #define MB_OK 0x00000000L #define MB_OKCANCEL 0x00000001L #define MB_ABORTRETRYIGNORE 0x00000002L #define MB_YESNOCANCEL 0x00000003L #define MB_YESNO 0x00000004L #define MB_RETRYCANCEL 0x00000005L #if(WINVER >= 0x0500) #define MB_CANCELTRYCONTINUE 0x00000006L
사용방법은 아래의 예시를 참고
// OK를 눌렀을 경우 if문
if ( MessageBox("테스트용 메시지 박스입니다", "메시지창", MB_OKCANCEL) == IDOK )
// cancel을 눌렀을 경우 else문을 실행. 함수의 리턴값은 IDCANCEL
else
...