dearn44
dearn44

Reputation: 3432

Delphi, Handles in TPanel objects

I was reading the source code for tmplayer and MPUI, both media players that use MPlayer as a backend to play media files in Delphi and I noticed here as well as in other older codes that I tried to experiment with that I can't use

Form1.Rectangle1.Handle

or as it is in this example for tmp layer that is trying to pipe the video output at a TPanel

CmdLine := HomeDir + 'mplayer.exe -slave -identify'
+' -wid ' + IntToStr(Form1.Panel1.Handle) + ' -colorkey 0x101010'
+' -nokeepaspect -framedrop -autosync 100' + #32 + Media;

As you may see RAD studio xe6/7 complains that the element does not contain a parameter named Handle. Is this something that used to be valid in older versions but can't be used anymore, and if yes how can I accomplish the same task in a simple Firemonkey form.

EDIT

Ok, so now it is clear to me that the Handle parameter is only applicable for VCL Forms. Trying to rephrase my question,

How can I port that particular line of code (getting the handle of a component) in a Firemonkey form?

Upvotes: 1

Views: 1874

Answers (1)

aleroot
aleroot

Reputation: 72636

Panels and/or Rectangle in Firemonkey doesn't have Handle as member. FireMonkey Handle is member of Form component instead .

You can convert a FireMonkey handle to the platform specific handle with the function : WindowHandleToPlatform, but there is no way to get the handle of a control inside a Form .

Maybe you can replace the Rectangle with another inner form and get the handle of it. Take a look at the FMXEmbeddedForm .

Upvotes: 2

Related Questions