Try this:
#include <FMX.Platform.Win.hpp>
void __fastcall TMyForm::DoSomething()
{
TWinWindowHandle *ThisHandle = WindowHandleToPlatform(this->Handle);
if (ThisHandle != NULL)
{
HWND hWnd = ThisHandle->Wnd;
if (ThisWnd != NULL)
{
// use ThisWnd as needed...
}
}
}
Or use FormToHWND()
instead (which uses WindowHandleToPlatform()
internally):
#include <FMX.Platform.Win.hpp>
void __fastcall TMyForm::DoSomething()
{
HWND ThisWnd = FormToHWND(this);
if (ThisWnd != NULL)
{
// use ThisWnd as needed...
}
}
Either way, keep in mind that these functions are specific Windows. If you want something that is cross-platform, you will have to find another solution.