掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
[DX10]dll側でSetStyleするとメイン側でアドレスエラー発生する (ID:47853)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
XE5のVCLプログラムを10Seattleにコンバートしています。 メイン側のStyleをDll側TFormにも適用する処理で、XE5では問題ないのですが 10SeattleではDll側のTStyleManager.SetStyleコール後、メイン側のTMainMenuを DropDownしてClickすると「access violation」エラーが発生してしまいます。 (メインとDll両方が10Seattleでビルドされている時のみの様です) どなたか対処法が解る方いらっしゃいますか? 環境は Win10+Delphi10 Seattle(Update 1とUpdate 1 Hotfixまでは適用済)です。 よろしくお願いします。 [Unit1.pasの一部] object MainMenu1: TMainMenu Left = 40 Top = 32 object N0: TMenuItem Caption = #12501#12449#12452#12523 object N1: TMenuItem Caption = #32066#20102 OnClick = N1Click end end end [Unit1.pas] unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Menus, Vcl.StdCtrls; type TForm1 = class(TForm) MainMenu1: TMainMenu; N0: TMenuItem; N1: TMenuItem; Button1: TButton; procedure Button1Click(Sender: TObject); procedure N1Click(Sender: TObject); private public end; var Form1: TForm1; procedure DllSetStyle(AFileName: string); external 'DllForm.dll'; implementation uses Vcl.Themes, Vcl.Styles; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var FileName: string; begin FileName := ExtractFilePath(Application.ExeName) + 'Auric.vsf'; TStyleManager.SetStyle(TStyleManager.LoadFromFile(FileName)); DllSetStyle(FileName); end; procedure TForm1.N1Click(Sender: TObject); begin Self.Close; end; end. [DllForm.dpr] library DllForm; uses System.SysUtils, System.Classes, Vcl.Themes, Vcl.Styles; {$R *.res} procedure DllSetStyle(AFileName: string); begin TStyleManager.SetStyle(TStyleManager.LoadFromFile(AFileName)); end; exports DllSetStyle; begin end.
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.