How to check which .bpl package an object belongs to
My Win32 application is built with runtime packages. We may always use HInstance as a reference to know th开发者_如何学JAVAe runtime package of current execution point for a process.
My application may load few runtime packages at runtime. Given an object, is that possible to know which runtime package (or package THandle) the object (or class) belongs to?
You can use FindClassHInstance for this, but whether it returns a package or the exe file will depend upon whether you build with runtime packages or not.
var
instance: HMODULE;
begin
instance := FindClassHInstance(TButton);
Caption := GetModuleName(instance);
精彩评论