example of embarcadero WindowHandleToPlatform c++

example of embarcadero WindowHandleToPlatform c++

本文关键字:c++ WindowHandleToPlatform embarcadero of example      更新时间:2023-10-16

我需要一个c++生成器的WindowHandleToPlatform示例我想使用句柄对窗体执行bitblt和其他函数我可以使用VCL做到这一点,效果很好。认为WindowHandleToPlatform是firemonkey的解决方案,但文档非常差

感谢

试试这个:

#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...
        }
    }
}

或者使用FormToHWND()(内部使用WindowHandleToPlatform()):

#include <FMX.Platform.Win.hpp>
void __fastcall TMyForm::DoSomething()
{
    HWND ThisWnd = FormToHWND(this);
    if (ThisWnd != NULL)
    {
        // use ThisWnd as needed...
    }
}

无论哪种方式,请记住这些功能都是特定的Windows。如果你想要跨平台的东西,你必须找到另一个解决方案。

相关文章:
  • 没有找到相关文章