안녕 하세요?
BacTeria 박종민 입니다.
제목 그대로 다른 윈도우의 State를 얻어내는 허접팁입니다.
그럼 오늘 하루도 마무리 잘하세요~
procedure TForm1.Button1Click(Sender: TObject);
begin
WinExec('Notepad.exe', SW_SHOWNORMAL);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
H: HWND;
WinPlace: TWindowPlacement;
Left, Top, Right, Bottom: Integer;
begin
H := FindWindow('Notepad', nil);
if (H > 0) and IsWindowVisible(H) then
begin
FillChar(WinPlace, SizeOf(WinPlace), 0);
WinPlace.length := SizeOf(WinPlace);
GetWindowPlacement(H, @WinPlace);
Left := WinPlace.rcNormalPosition.Left;
Top := WinPlace.rcNormalPosition.Top;
Right := WinPlace.rcNormalPosition.Right;
Bottom := WinPlace.rcNormalPosition.Bottom;
case WinPlace.showCmd of // Show State
SW_HIDE: ;
SW_MINIMIZE: ;
SW_RESTORE: ;
SW_SHOW: ;
SW_SHOWMAXIMIZED: ;
SW_SHOWMINIMIZED: ;
SW_SHOWMINNOACTIVE: ;
SW_SHOWNA: ;
SW_SHOWNOACTIVATE: ;
SW_SHOWNORMAL: ;
end;
end;
end;
|