Delphi XE2を使用すると、カスタムスタイル(スキン)をVCLプロジェクトに埋め込むことができます。
すべてが正常に動作します。これで、動的に表示する個別のdllにいくつかのフォームがあります。
もちろん、それらはスキンされていません。どうすれば修正できますか?
どういうわけかTVisualStyleを呼び出す必要があると思いますが、運がありません。
ザ・ホスト:
procedure TForm1.Button1Click(Sender: TObject);
var
l: THandle;
p: procedure (const h: THandle); stdcall;
begin
l:= LoadLibrary('project1.dll');
if l > 0 then
begin
@p:= GetProcAddress(l,'ShowIt');
p(Application.Handle);
FreeLibrary(l);
end;
end;
dll:
procedure ShowIt(const h: THandle);stdcall;
var
form: TForm;
b: TButton;
han: THandle;
begin
han:= Application.Handle;
Application.Handle:= h;
form :=Tform.Create(Application);
b:= TButton.Create(form);
b.Parent:= form;
b.Caption:= 'ytes';
b.Left:= 2;
b.Top:= 2;
form.ShowModal;
form.Release;
Application.Handle:= han;
end;
exports ShowIt ;
begin
end.
かなり標準的なもの。さて、dllフォームにホストのスタイルテーマを使用させるには、正確に何をする必要がありますか?