在 DLL 中怎么修改 Form.Font
// dll
procedure test(AForm:TForm);stdcall;export;
begin
AForm.Caption := 'test';
ShowMessage('1');
AForm.Font.Charset := GB2312_CHARSET;
AForm.Font.Name := '宋体';
ShowMessage('2');
AForm.Font.Size := 9; // 这里出错
end;
// exe
procedure TForm1.Button1Click(Sender: TObject);
var
hh:THandle;
proc:procedure (AForm:TForm);stdcall;
begin
hh := LoadLibrary('D:\DuoEditor\Bin\Form.dll');
@proc := GetProcAddress(hh,'test');
proc(Self);
FreeLibrary(hh);
end;
请问谁知道,怎么处理?
奇怪的是 AForm.Font.Name 都修改成功了。
为什么 size 不行?
不用 ShareMM。