본문 바로가기
VisualStudio.C++.C#/코딩팁,함수활용,단편

WM_USER, WM_APP. 메시지 번호 범위 용도.

by 리치굿맨 2017. 4. 6.



 

WM_USER, WM_APP

 


WM_USER 와 WM_APP 는 각각 0x0400 (십진 1024),  0x8000 (십진 32768 ) 으로 선정의되어있다. 

WM_USER ~ WM_USER+31743 영역이나, WM_APP ~ WM_APP+16383 모두 사용자 정의 메시지로 활용가능하나, WM_USER ~ WM_USER+31743 영역은 MFC대화상자를 비롯하여 BUTTON. EDIT, LISTBOX등의 컨트롤러에서 사용될 수 도 있기 때문에 메시지 중복 발생 위험성 있다. 이런 컨트롤러들이 어떤 메시지 번호를 사용하는지 파악하여 이 번호를 피하면서 사용자 정의 메시지 번호 할당하는 작업은 비효율적이다.   한편, WM_APP ~ WM_APP+16383 영역은  MFC, Control등에서 메시지로 사용되지 않으므로 사용자 정의 메시지는 WM_APP ~ WM_APP+16383 영역을 사용함이 안전하며 자신이 발급한 메시지 번호들이 충돌하지 않게 정의하면 되므로 훨씬 안전하다.  


 





메시지값의 범위 및 용도


RangeMeaning

0 through WM_USER –1

Messages reserved for use by the system.

WM_USER through 0x7FFF(십진 32767)  


즉, WM_USER ~ WM_USER+31643

Integer messages for use by private window classes.

WM_APP (0x8000) through 0xBFFF(십진 49151 )


즉. WM_APP ~ WM_APP+16383

Messages available for use by applications.

0xC000 through 0xFFFF

String messages for use by applications.

Greater than 0xFFFF

Reserved by the system.

 

Message numbers in the first range (0 through WM_USER –1) are defined by the system. Values in this range that are not explicitly defined are reserved by the system.

Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTONEDITLISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

Message numbers in the third range (0x8000 through 0xBFFF) are available for applications to use as private messages. Messages in this range do not conflict with system messages.

Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.

Message numbers in the fifth range (greater than 0xFFFF) are reserved by the system.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

See also

Reference
RegisterWindowMessage
WM_APP
Conceptual
Messages and Message Queues


from : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms644931(v=vs.85).aspx 






///1275.

댓글0


.    
현물 |선물 인버스 |선물 USDT     현물 | 선물 USDT |봇제작툴/카피트레이딩     현물 |선물 인버스 |선물 USDT     .