delphi - Making VCL Forms and Dialogs play nicely with WinApi Window -
the short version -
i have opengl window created using winapi calls. prefer keep way, instead of wrapping opengl vcl form.
to provide preference menus , file dialogs, resorted using vcl forms, , typical dialogs (topendialog, tsavedialog).
what i'm wondering - how these forms , dialogs see opengl window owner?
i have attempted pass window handle on forms, feel i'm doing improperly, has no effect.
form1 := tform1.create(nil); form1.parentwindow := hwnd; //handle opengl window
what vcl form requires in order see native window it's owner?
the long version -
my application has 2 modes. standalone mode, runs itself. secondarily, there's plugin mode runs in process space of host application.
when in standalone mode, have no issues vcl forms , dialogs. though ownership uncertain, doesn't affect usability in way.
when in plugin mode, finding host application take control of vcl forms, , open&save dialogs.
so, when running in host's process space, vcl forms rendered strangely. i've attempted repair them manually, not respond style changes.
edit - details on dialogs
my main concern rendering of vcl forms, here more details on dialogs, if it's of use.
i'm executing dialogs this:
if fileopendialog.execute(hwnd) begin //open file end;
and has no effect. dialog act same though had not passed handle it. bear in mind using delphi 2006, , version of delphi still utilizing old file dialogs, introduced in windows xp.
finally - when running plugin, open/save dialogs appear as though belong host application on taskbar. so, host has taskbar tab. application has it's own tab. open dialog appears attached host's tab, when execute it.
images
preference menu in standalone mode:
preference menu plugin in host:
if change color of black text, enough, can't seem it.
for vcl forms need override createparams , set params.wndparent owning window. opengl window understand.
procedure tmyform.createparams(var params: tcreateparams); begin inherited; params.wndparent := myopenglwindow; end;
the common dialog classes have execute overload receives window handle. pass handle of opengl window , opengl window owner window of dialog.
on subject of forms rendering strangely it's hard give definitive advice. guess strangeness due host app not enabling themes. if control host fix there. otherwise need use activation contexts. answer question gives sample code: possible runtime optional toggling of **runtime themes** adding application manifest @ runtime?
Comments
Post a Comment