Examples Delphi

Problem:
I have been using a custom open file dialog, specifying a resource template, much like TOpenPictureDialog does. Works fine. However, when I use the run-time package VCL50 for my application, the open dialog no longer works.
It probably has to do with the instance of the module where the template resides (not the package VCL50, but my EXE). As I see it, the problem sits in Dialogs.TOpenDialog.DoExecute(), where the source of the template is specified as SysInit.HInstance. Does anyone know how to work around this?
Solution:
Peter Below advises:
Override the TaskModalDialog method of your custom dialog class, there you can cast the Dialogdata parameter to TOpenfilename and change the hInstance field to FindClassHInstance(Classtype) to get the module handle of the module your dialog class is in.