Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FMX: Handle of controls

I'm working with DirectShow in firemonkey, and i have a problem with outputting Video.

iVideoWindow.Put_Owner(Panel1.Handle); 

I need handle of TPanel, to display video at it. But FMX controls have no handle. I know, that Firemonkey is not based on traditional windows and FMX do not provide this, but how to solve this problem? I have no idea, please, help me.

like image 484
user2202896 Avatar asked Mar 23 '13 18:03

user2202896


Video Answer


1 Answers

If you want to get a window handle as an HWND (windows api) type, you can now call this function:

WindowHandleToPlatform(form1.Handle).wnd

Put in your uses section:

uses
  FMX.Platform.Win;

Note that just calling WindowHandleToPlatform(form1.Handle) will not work, you have to access .wnd to obtain the winapi handle.

Since this makes an application less portable, it is also a good idea to put {$IFDEF MSWINDOWS} whenever doing this, and if you ever port to MacOS, you'll have to write code for that platform. Or put this code into a separate unit that deals with MS Windows related code only, and IFDEF the unit into your uses.

like image 166
Another Prog Avatar answered Sep 22 '22 23:09

Another Prog