본문 바로가기
코드/c/c++

IsWindowUnicode

by WeZZ 2011. 4. 7.

IsWindowUnicode Function

Determines whether the specified window is a native Unicode window.

Syntax

BOOL WINAPI IsWindowUnicode(
  __in  HWND hWnd
);

Parameters

hWnd [in]

Type: HWND

A handle to the window to be tested.

Return Value

Type: BOOL

If the window is a native Unicode window, the return value is nonzero.

If the window is not a native Unicode window, the return value is zero. The window is a native ANSI window.

Remarks

The character set of a window is determined by the use of the RegisterClass function. If the window class was registered with the ANSI version of RegisterClass (RegisterClassA), the character set of the window is ANSI. If the window class was registered with the Unicode version of RegisterClass (RegisterClassW), the character set of the window is Unicode.

The system does automatic two-way translation (Unicode to ANSI) for window messages. For example, if an ANSI window message is sent to a window that uses the Unicode character set, the system translates that message into a Unicode message before calling the window procedure. The system calls IsWindowUnicode to determine whether to translate the message.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See Also

Windows Overview

Send comments about this topic to Microsoft

Build date: 12/1/2010




GWL_WNDPROC 를 가져온느 코드를 짜던중

어떤넘의 프로세스는 잘 가져와 지는데 어떤넘은 이상한넘을 던져주는 상황이 발생함..
마이크로 소프트 spy++ 로 확인해보면 잘 얻어와 져있는데..

결국 SPY++.dll 를 열여봐서 위의 함수를 알았다..
별것도 아닌데..OTL...

위에 함수는 간단히 WndProc가  RegisterClass 로 등독된  코드 타입에 따라 GetWIndowsLongPtr을
호출해줘야한다.

아래 처럼 처리를 해주면 된다.
if(IsWindowUnicode(핸들)
{
 GetWIndowsLongPtrW(핸들,인덱스);
}
else
{
GetWindowsLongPtrA(핸들,인덱스);
}