知道一个窗口的句柄,这样访问不行吗?(30分)

  • 主题发起人 cowboy1999
  • 开始时间
C

cowboy1999

Unregistered / Unconfirmed
GUEST, unregistred user!
假设一个TMyForm类型的窗口MyForm,知道其句柄handle,这样访问该窗口不行
TMyForm(handle),怎么才能根据句柄访问窗口
 
function FindControl(Handle: HWnd): TWinControl;
如果你确定handle肯定就是TMyForm的,那么 TMyForm(FindControl(handle))
否则,安全的方式是
c:=FindControl(handle);
if c<>nil then
if c is TmyForm then
……
 
如果你的handle是TMyForm类型可以,否则不行
 
嗯,Pipi的方法可以啊!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部