Delphi Firemonkey跨平台

编程入门 行业动态 更新时间:2024-10-24 20:11:08
本文介绍了Delphi Firemonkey跨平台 - 通用Windows句柄的通用方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Windows和OSX的第二个Firemonkey应用程序中处于深深的位置,并缓慢转换我的函数库来处理跨平台问题。我正在尝试创建一个通用的SelectDirectory函数,它将为Windows或OSX运行特定于平台的代码。我有SelectDirectory对于单独调用的两个平台都很好,但Windows具体需要一个hwndparent句柄来运行。

I'm knee deep in my second Firemonkey app for Windows and OSX and slowly converting my library of functions to handle cross platform issues. I am trying to create a generic SelectDirectory function that will run platform specific code for Windows or OSX. I have SelectDirectory working great for both platforms called individually, but the Windows specific one requires a hwndparent handle to run.

这是在IFDEF MSWINDOWS指令中运行(就像OSX一个在其编译器指令中)。我如何传递一个通用的句柄到这个函数,或者如何引用Application.MainForm或一些可以投射到这个函数中的Windows句柄?我希望避免在这个库的uses子句中使用Firemonkey特定的单元。我宁愿以某种方式传递一个THANDLE,并将其转换为函数内的一个TWindowHandle,但是经过一个小时的工作之后,我没有看到如何做,而不会影响我的库的有用性。

This is being run in a IFDEF MSWINDOWS directive (just as the OSX one is in its compiler directive). How can I pass a generic handle to this function or how can I reference Application.MainForm or something that can be cast into a Windows handle inside this function? I am hoping to avoid using Firemonkey specific units in the uses clause of this library. I would rather pass in a THandle somehow and cast it into a TWindowHandle inside the function, but after an hour of working on it, I don't see how to do it without compromising the usefulness of my library.

任何帮助赞赏。

推荐答案

使用 WindowHandleToPlatform 获取Windows特定的具有 Wnd 属性的TWinWindowHandle 。这是本机窗口句柄( HWND )。

Use WindowHandleToPlatform to get the Windows-specific TWinWindowHandle which has the Wnd property. This is the native window handle (HWND).

更多推荐

Delphi Firemonkey跨平台

本文发布于:2023-11-03 12:52:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555183.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:平台   Delphi   Firemonkey

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!