BCB 里面如何通过句柄获取对象的指针
知道一个TWinControl 对象的句柄
如何通过这个句柄获得这个TWinControl的指针?
(TWinControl *)HWND X
TWinControl *p-> Handle = HWND X
vc里面有一个FormHanle
不知道BCB里面有没有
不得要领 请教
[解决办法]
最近我也在查找这个方法.但没找到.现在我自己用一个映射来维护它们之间的对应关系.这样就可以实现通过句柄查找到对象指针了
[解决办法]
Returns the windowed control (Windows) or widget (cross-platform) whose window is identified by the specified handle or which appears at a specified position.
Unit
Controlsor QControls
Category
Windows controls utilities (Windows) or control and form location (cross-platform)Windows controls utilities (Windows)
or control and form location (cross-platform)
Delphi syntax:
function FindControl(Handle: HWnd): TWinControl;
function FindControl(Handle: QWidgetH): TWidgetControl;
function FindControl(const Pos: TPoint): TWidgetControl;
C++ syntax:
extern PACKAGE TWinControl* __fastcall FindControl(HWND Handle);
extern PACKAGE TWidgetControl* __fastcall FindControl(Qt::QWidgetH* Handle);
extern PACKAGE TWidgetControl* __fastcall FindControl(const Types::TPoint &Pos);
Description
Call FindControl to access the control whose underlying screen object is identified by the Handle parameter or which appears at the position specified by the Pos parameter. If Handle is not the handle of a screen object or if there is no widget at the specified position, FindControl returns nil (Delphi) or NULL (C++).