How do I get a WinAPI HWnd in a FireMonkey application? [duplicate]

  

This question already has an answer here:

Delphi Firemonkey Cross Platform – Generic way to pass a Windows Handle

1 answer

We have written a FireMonkey application using Delphi XE8.

In a Delphi 2010 VCL application I’d pass Application.Handle and it worked perfectly.

We are trying to send an email using MAPI, but we are getting a compile error on Application.Handle.

The code:

MAPIModule:=LoadLibrary(PChar(MAPIDLL));
If MAPIModule=0 then
Result:=-1
else
try
@SM:=GetProcAddress(MAPIModule,’MAPISendMail’);
If @SM<>nil then
begin
Result:=SM(0,Application.Handle,Email_message,MAPI_DIALOG or MAPI_LOGON_UI,0);

The compile error is: Undeclared identifier: ‘Handle’

If I hover over ‘Application’ in the code, I see Application – FMX.Forms.TApplication, and if I hover over the ‘Handle’ it says TApplication does not have a member named ‘Handle’.

Comments are closed.