I'm with a little problem when trying to show more than one form on taskbar on the same time. I found I need to use the following:
WS_EX_APPWINDOW
So I search a little bit more about and then found it:
class TForm2 : public TForm
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TForm2(TComponent* Owner);
void __fastcall CreateParams(Controls::TCreateParams &Params);
};
void __fastcall TForm2::CreateParams(Controls::TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.ExStyle = Params.ExStyle | WS_EX_APPWINDOW;
Params.WndParent = ParentWindow;
}
However that function works just with VCL (TCreateParams is not a member of Fmx::Controls).
So, I search a little bit more again and found it (This function goes at OnCreate form function):
SetWindowLong(Handle, GWL_EXSTYLE, WS_EX_APPWINDOW);
But I got something wrong saying the following:
[bcc32 Error] Codigo.cpp(19): E2034 Cannot convert 'TWindowHandle * const' to 'HWND__ *'
Full parser context
Codigo.cpp(18): parsing: void _fastcall TfrmCodigo::FormCreate(TObject *)
[bcc32 Error] Codigo.cpp(19): E2342 Type mismatch in parameter 'hWnd' (wanted 'HWND__ *', got 'TWindowHandle *')
Full parser context
Codigo.cpp(18): parsing: void _fastcall TfrmCodigo::FormCreate(TObject *)
Do you know any other alternative to do this? If you can help me or not, since now, thanks A LOT!
The code snippets you have shown are for VCL only.
FireMonkey does not allow you to customize the creation of a Form's HWND like VCL does. The HWND creation is hidden behind a private interface that FireMonkey uses internally (
TPlatformWin.CreateWindow()
). That is why there is noCreateParams
in FireMonkey.However, you can still access the HWND, but only after it has been created. There is a
WindowHandleToPlatform()
function (which replaces the olderFmxHandleToHWND()
function), and aFormToHWND
function (which usesWindowHandleToPlatform()
internally). All of these functions are Windows-specific, so you have to wrap them with an#ifdef
if you are writing FireMonkey code that runs on multiple platforms.Try this:
Also see:
example of embarcadero WindowHandleToPlatform c++