Spy++ 같은데서 보면 윈도우 스타일을 보여주는 부분이 있는데 어케 하는지 모르겠어서,
그냥 무식하게 다 때려보는 버전을 만들었음.
윈도우 뒤적거리는 디버깅용으로나 쓸 수 있을 듯.
아래 코드를 돌려보면 뭔지 단박에 알 수 있음.
OutputDebugString(PWideChar(GetWindowStyleStr(FindWindow(클래스, 캡션)));
unit uWindowStyle;
interface
uses
Windows;
const
// GWL_STYLE
WS_VAL: array [0..19] of LongInt = (
WS_OVERLAPPED, WS_POPUP, WS_CHILD, WS_MINIMIZE, WS_VISIBLE, WS_DISABLED,
WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_MAXIMIZE, WS_CAPTION, WS_BORDER,
WS_DLGFRAME, WS_VSCROLL, WS_HSCROLL, WS_SYSMENU, WS_THICKFRAME, WS_GROUP,
WS_TABSTOP, WS_MINIMIZEBOX, WS_MAXIMIZEBOX
);
WS_STR: array [0..19] of String = (
'WS_OVERLAPPED', 'WS_POPUP', 'WS_CHILD', 'WS_MINIMIZE', 'WS_VISIBLE', 'WS_DISABLED',
'WS_CLIPSIBLINGS', 'WS_CLIPCHILDREN', 'WS_MAXIMIZE', 'WS_CAPTION', 'WS_BORDER',
'WS_DLGFRAME', 'WS_VSCROLL', 'WS_HSCROLL', 'WS_SYSMENU', 'WS_THICKFRAME', 'WS_GROUP',
'WS_TABSTOP', 'WS_MINIMIZEBOX', 'WS_MAXIMIZEBOX'
);
// GWL_EXSTYLE
WS_EX_VAL: array [0..23] of LongInt = (
WS_EX_DLGMODALFRAME, WS_EX_NOPARENTNOTIFY, WS_EX_TOPMOST, WS_EX_ACCEPTFILES,
WS_EX_TRANSPARENT, WS_EX_MDICHILD, WS_EX_TOOLWINDOW, WS_EX_WINDOWEDGE,
WS_EX_CLIENTEDGE, WS_EX_CONTEXTHELP, WS_EX_RIGHT, WS_EX_LEFT, WS_EX_RTLREADING,
WS_EX_LTRREADING, WS_EX_LEFTSCROLLBAR, WS_EX_RIGHTSCROLLBAR, WS_EX_CONTROLPARENT,
WS_EX_STATICEDGE, WS_EX_APPWINDOW, WS_EX_LAYERED, WS_EX_NOINHERITLAYOUT,
WS_EX_LAYOUTRTL, WS_EX_COMPOSITED, WS_EX_NOACTIVATE
);
WS_EX_STR: array [0..23] of String = (
'WS_EX_DLGMODALFRAME', 'WS_EX_NOPARENTNOTIFY', 'WS_EX_TOPMOST', 'WS_EX_ACCEPTFILES',
'WS_EX_TRANSPARENT', 'WS_EX_MDICHILD', 'WS_EX_TOOLWINDOW', 'WS_EX_WINDOWEDGE',
'WS_EX_CLIENTEDGE', 'WS_EX_CONTEXTHELP', 'WS_EX_RIGHT', 'WS_EX_LEFT', 'WS_EX_RTLREADING',
'WS_EX_LTRREADING', 'WS_EX_LEFTSCROLLBAR', 'WS_EX_RIGHTSCROLLBAR', 'WS_EX_CONTROLPARENT',
'WS_EX_STATICEDGE', 'WS_EX_APPWINDOW', 'WS_EX_LAYERED', 'WS_EX_NOINHERITLAYOUT',
'WS_EX_LAYOUTRTL', 'WS_EX_COMPOSITED', 'WS_EX_NOACTIVATE'
);
function GetWindowStyle(h: HWND): LongInt;
function GetWindowStyleStr(h: HWND): String;
function GetWindowExStyle(h: HWND): LongInt;
function GetWindowExStyleStr(h: HWND): String;
implementation
// GWL_STYLE
// _________________________________________________________________________________________________
function GetWindowStyle(h: HWND): LongInt;
begin
Result:=0;
if h<>0 then Result:=GetWindowLong(h, GWL_STYLE);
end;
function GetWindowStyleStr(h: HWND): String;
var
i: Integer;
wStyle: LongInt;
begin
Result:='';
wStyle:=GetWindowStyle(h);
if wStyle<>0 then begin
for i:=0 to Length(WS_VAL)-1 do begin
if (WS_VAL[i] and wStyle)=WS_VAL[i] then begin
if Length(Result)>0 then Result:=Result+'|'+WS_STR[i]
else Result:=WS_STR[i];
end;
end;
end;
end;
// GWL_EXSTYLE
// _________________________________________________________________________________________________
function GetWindowExStyle(h: HWND): LongInt;
begin
Result:=0;
if h<>0 then Result:=GetWindowLong(h, GWL_EXSTYLE);
end;
function GetWindowExStyleStr(h: HWND): String;
var
i: Integer;
wExStyle: LongInt;
begin
Result:='';
wExStyle:=GetWindowExStyle(h);
if wExStyle<>0 then begin
for i:=0 to Length(WS_EX_VAL)-1 do begin
if (WS_EX_VAL[i] and wExStyle)=WS_EX_VAL[i] then begin
if Length(Result)>0 then Result:=Result+'|'+WS_EX_STR[i]
else Result:=WS_EX_STR[i];
end;
end;
end;
end;
end.
interface
uses
Windows;
const
// GWL_STYLE
WS_VAL: array [0..19] of LongInt = (
WS_OVERLAPPED, WS_POPUP, WS_CHILD, WS_MINIMIZE, WS_VISIBLE, WS_DISABLED,
WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_MAXIMIZE, WS_CAPTION, WS_BORDER,
WS_DLGFRAME, WS_VSCROLL, WS_HSCROLL, WS_SYSMENU, WS_THICKFRAME, WS_GROUP,
WS_TABSTOP, WS_MINIMIZEBOX, WS_MAXIMIZEBOX
);
WS_STR: array [0..19] of String = (
'WS_OVERLAPPED', 'WS_POPUP', 'WS_CHILD', 'WS_MINIMIZE', 'WS_VISIBLE', 'WS_DISABLED',
'WS_CLIPSIBLINGS', 'WS_CLIPCHILDREN', 'WS_MAXIMIZE', 'WS_CAPTION', 'WS_BORDER',
'WS_DLGFRAME', 'WS_VSCROLL', 'WS_HSCROLL', 'WS_SYSMENU', 'WS_THICKFRAME', 'WS_GROUP',
'WS_TABSTOP', 'WS_MINIMIZEBOX', 'WS_MAXIMIZEBOX'
);
// GWL_EXSTYLE
WS_EX_VAL: array [0..23] of LongInt = (
WS_EX_DLGMODALFRAME, WS_EX_NOPARENTNOTIFY, WS_EX_TOPMOST, WS_EX_ACCEPTFILES,
WS_EX_TRANSPARENT, WS_EX_MDICHILD, WS_EX_TOOLWINDOW, WS_EX_WINDOWEDGE,
WS_EX_CLIENTEDGE, WS_EX_CONTEXTHELP, WS_EX_RIGHT, WS_EX_LEFT, WS_EX_RTLREADING,
WS_EX_LTRREADING, WS_EX_LEFTSCROLLBAR, WS_EX_RIGHTSCROLLBAR, WS_EX_CONTROLPARENT,
WS_EX_STATICEDGE, WS_EX_APPWINDOW, WS_EX_LAYERED, WS_EX_NOINHERITLAYOUT,
WS_EX_LAYOUTRTL, WS_EX_COMPOSITED, WS_EX_NOACTIVATE
);
WS_EX_STR: array [0..23] of String = (
'WS_EX_DLGMODALFRAME', 'WS_EX_NOPARENTNOTIFY', 'WS_EX_TOPMOST', 'WS_EX_ACCEPTFILES',
'WS_EX_TRANSPARENT', 'WS_EX_MDICHILD', 'WS_EX_TOOLWINDOW', 'WS_EX_WINDOWEDGE',
'WS_EX_CLIENTEDGE', 'WS_EX_CONTEXTHELP', 'WS_EX_RIGHT', 'WS_EX_LEFT', 'WS_EX_RTLREADING',
'WS_EX_LTRREADING', 'WS_EX_LEFTSCROLLBAR', 'WS_EX_RIGHTSCROLLBAR', 'WS_EX_CONTROLPARENT',
'WS_EX_STATICEDGE', 'WS_EX_APPWINDOW', 'WS_EX_LAYERED', 'WS_EX_NOINHERITLAYOUT',
'WS_EX_LAYOUTRTL', 'WS_EX_COMPOSITED', 'WS_EX_NOACTIVATE'
);
function GetWindowStyle(h: HWND): LongInt;
function GetWindowStyleStr(h: HWND): String;
function GetWindowExStyle(h: HWND): LongInt;
function GetWindowExStyleStr(h: HWND): String;
implementation
// GWL_STYLE
// _________________________________________________________________________________________________
function GetWindowStyle(h: HWND): LongInt;
begin
Result:=0;
if h<>0 then Result:=GetWindowLong(h, GWL_STYLE);
end;
function GetWindowStyleStr(h: HWND): String;
var
i: Integer;
wStyle: LongInt;
begin
Result:='';
wStyle:=GetWindowStyle(h);
if wStyle<>0 then begin
for i:=0 to Length(WS_VAL)-1 do begin
if (WS_VAL[i] and wStyle)=WS_VAL[i] then begin
if Length(Result)>0 then Result:=Result+'|'+WS_STR[i]
else Result:=WS_STR[i];
end;
end;
end;
end;
// GWL_EXSTYLE
// _________________________________________________________________________________________________
function GetWindowExStyle(h: HWND): LongInt;
begin
Result:=0;
if h<>0 then Result:=GetWindowLong(h, GWL_EXSTYLE);
end;
function GetWindowExStyleStr(h: HWND): String;
var
i: Integer;
wExStyle: LongInt;
begin
Result:='';
wExStyle:=GetWindowExStyle(h);
if wExStyle<>0 then begin
for i:=0 to Length(WS_EX_VAL)-1 do begin
if (WS_EX_VAL[i] and wExStyle)=WS_EX_VAL[i] then begin
if Length(Result)>0 then Result:=Result+'|'+WS_EX_STR[i]
else Result:=WS_EX_STR[i];
end;
end;
end;
end;
end.
'Delphi' 카테고리의 다른 글
[Delphi] 바탕화면, 시작메뉴>프로그램 등 특수 디렉토리 가져오기 (0) | 2010.06.08 |
---|---|
[Delphi] bsNone이면서 Resize는 가능한 폼 (0) | 2010.06.08 |
[Delphi] 폰트 크기 픽셀로 가져오기. (Font, Pixel) (0) | 2010.06.08 |
[Delphi] Hook (WH_GETMESSAGE, WH_CALLWNDPROC) (0) | 2010.06.07 |
[Delphi] 각 OS별 NewLine 처리 (CR/LF) (0) | 2010.06.07 |