Plugin without packages and Application.Handle

Hello,

I use visual plugins without runtime packages. In some of these plugins I use DevExpress components and some require the Application.Handle parameter to be set. What is the correct logic in this condition to pass the handle from the host to the plugin?

Thank you very much!

Hi,

You can create a custom interface from IHYCrossPlatformHost that will return Application.Handle.
later from plugin side you can cast plugin.CrossPlatformHost to your custom interface and ask for that value.

Thank you EvgenyK.

but I can set the Application.Handle (and other params) in modulecontroller?

I would like to centralize some parameters that I need when the plugin is loaded. In the OnSetHost event I will set the values. I tried to pass values in the HostParameters property. They arrive to me correctly but then it raises an access violation. I think it is related to it being a TStrings object and not using the packages raises the error. Correct?

Thank you very much

Hi,

Module Controller is plugin-side component so you can’t set it in it.

you can implement custom interface on form/datamodule that contains ModuleManager.
Check the Passing Interfaces between Host and Plugins article for more details.

You can’t pass delphi objects or delphi strings between host and plugin when shared runtime packages aren’t used.

Note: You can’t use Hydra/VCL interfaces (interfaces from Hydra.VCL.Interfaces.pas) because they pass objects & strings.

By other hand, you can use cross platform interfaces (interfaces from Hydra.Core.Interfaces.pas). They use interfaces and WideStrings for communication

1 Like

work fine! Thank you very much EvgenyK!!!

1 Like