当窗体最小化到任务栏时,就没法取得上面控件的TEXT了;如果不最小化到任务栏就是好的,为什么?

xxxfffcn 2005-01-31 05:18:15
问题1
当窗体最小化到任务栏时,就没法取得上面控件的TEXT了;如果不最小化到任务栏就是好的,为什么?

hCurrentWindow_Sub1 := ChildWindowFromPointEx(hCurrentWindow, Point(25,105),CWP_ALL);
hCurrentWindow_ComeFrom := ChildWindowFromPointEx(hCurrentWindow_Sub1, Point(25,85),CWP_ALL);
GetWindowText(hCurrentWindow_ComeFrom,@L_FromText,255
L_FromStr := StrPas(@L_FromText);

edit1.text := l_fromstr;

有没有更好的解决方法???

-------------------------------------------------------------
问题2
我知道窗体句柄,如果窗体被关闭了,我怎么判断它是否关闭??
我是这么做的

if IsWindowVisible(StrToInt('$'+ L_Caption_HWND)) then//判断当前句柄的窗体是否存在,如果窗体不可见了,就表示不存了;用16进制来比较
begin
//句柄为L_Caption_HWND的窗体存在
end
else
begin
//句柄为L_Caption_HWND的窗体不存在
end;

上面的代码是可以实现的,但有没有更好的思路???
...全文
96 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxxfffcn 2005-02-17
  • 打赏
  • 举报
回复
why?
xxxfffcn 2005-01-31
  • 打赏
  • 举报
回复
兄弟:
我说的是监视其它程序,不是本身程序
cdsgajxlp 2005-01-31
  • 打赏
  • 举报
回复
procedure TForm1.Button1Click(Sender: TObject);
var
mHandle, fHandle: THandle;
begin
Application.Initialize;
mHandle := Windows.CreateMutex(nil, true, 'SendMessage');//SendMessage
if mHandle <> 0 then
begin
if GetLastError = ERROR_ALREADY_EXISTS then
begin
fHandle := FindWindow(PChar('Tfrom'), nil);
if (fHandle>0) then
begin
ShowWindow(fHandle, SW_RESTORE);
SetForeGroundWindow(fHandle);
Windows.ReleaseMutex(mHandle);
end;
Halt;
end;
end;
end;
cdsgajxlp 2005-01-31
  • 打赏
  • 举报
回复
一个工程里
if Form1=nil then
begin
...
end
else
begin
...
end;

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧