如题!
解决方案 »
- changecount为什么总是0
- 请教一个基础性问题。
- 请问哪儿有免费的delphi可下载
- FastReport报表中如何取得用户在当前窗体(如ReportForm)的TEdit中输入的内容?
- 在线等
- 请问大家,在一个应用服务器中如何解决二个以上的数据模块窗体问题???
- 简单问题,但我不知道!200分给第一个给出准确答案的人。桌面上的IE图标被删,如何将它恢复出来?
- kankan
- Meno 2 记事本
- 谁用过Ehlib控件?DBGridEh控件的页脚属性怎么设?我想用页脚来计算一列的总值,怎么总显示0
- 一个关于Paradox数据库连接的送分题,问题解决马上给分~!
- 关于DBGrid里面显示Memo字段。
http://www.newhua.com/soft/15963.htm
HWND hWnd, // handle to window
LPDWORD lpdwProcessId // process identifier
);
TWndInfRec = record
Wnd: HWND;
Caption: string;
Handle: string[8];
ClassName: string;
Rect: string[51];
Owner: HWND;
ProcessID: string[8];
ThreadID: string[8];
end;// 获得句柄的相关信息
function GetWindowInformation(Wnd: HWND; var WndInfRec: TWndInfRec): Boolean;
var
Buf : array [0..255] of Char;
R : TRect;
ThreadID,
ProcessID : DWORD;
begin
Result := False;
if Wnd = 0 then Exit;
WndInfRec.Handle := IntToHex(Wnd, 8);
if GetWindowText(Wnd, Buf, sizeof(Buf)) = 0 then Exit;
WndInfRec.Caption := Buf;
if GetClassName(Wnd, Buf, sizeof(Buf))= 0 then Exit;
WndInfRec.ClassName := Buf;
if not GetWindowRect(Wnd, R) then Exit;
WndInfRec.Rect := format('(%d,%d)-(%d,%d) %dx%d',
[R.left, R.top, R.right, R.bottom, R.right - R.left, R.bottom - R.top]);
WndInfRec.Owner := GetWindow(Wnd, GW_OWNER); ThreadID := GetWindowThreadProcessId(Wnd, ProcessId); WndInfRec.ProcessID := IntToStr(ProcessId);
WndInfRec.ThreadID := IntToStr(ThreadId);{ BOOL GetGUIThreadInfo(
DWORD idThread, // thread identifier
LPGUITHREADINFO lpgui // thread information
);}end;function GetApplicationWindow(ParentWnd: HWND; Pt: TPoint): HWND;
var
R: TRect;
begin
Result := GetWindow(ParentWnd, GW_CHILD); // 取得第一個子視窗
while Result <> 0 do
begin
GetWindowRect(Result, R); // 取得視窗矩形區域
if IsWindowVisible(Result) and PtInRect(R, Pt) then
begin
if Result = frmWndExplorer.Form.Handle then // 忽略程式的 Main Form
begin
Result := 0;
Exit;
end;
Exit;
end;
Result := GetWindow(Result, GW_HWNDNEXT); // 取得下一個 siblings 視窗
end;
Result := ParentWnd; // 找不到, 它就是我們要找的
end;