我是这样写的
library Project1;
uses
Windows,
Messages,
SysUtils,
Classes,
Forms; procedure ShowForm_Center(H:THandle;Dest_Form:TForm);StdCall;
Begin
Application.Handle:=H;
Dest_Form.Top:=(Screen.Height-Dest_Form.Height) div 2;
Dest_Form.Left:=(Screen.Width-Dest_Form.Width) div 2;
End;
exports ShowForm_Center;但是在窗口的onshow事件中调用时ShowForm_Center_A(Application.Handle,Form1);
却报以下错误:
project project1.exe raised exception class EAccessViolation with message 'Access violation at address 0024EA69 in module 'Project1.dll'.Read of address B88366CF'.Process stopped.Use Step or Run to continue.
library Project1;
uses
Windows,
Messages,
SysUtils,
Classes,
Forms; procedure ShowForm_Center(H:THandle;Dest_Form:TForm);StdCall;
Begin
Application.Handle:=H;
Dest_Form.Top:=(Screen.Height-Dest_Form.Height) div 2;
Dest_Form.Left:=(Screen.Width-Dest_Form.Width) div 2;
End;
exports ShowForm_Center;但是在窗口的onshow事件中调用时ShowForm_Center_A(Application.Handle,Form1);
却报以下错误:
project project1.exe raised exception class EAccessViolation with message 'Access violation at address 0024EA69 in module 'Project1.dll'.Read of address B88366CF'.Process stopped.Use Step or Run to continue.
procedure ShowForm_Center_A(Handle:THandle;Dest_Form:TForm);far;external 'Project1.dll' name 'ShowForm_Center_';
procedure ShowForm_Center(H:THandle;Dest_Form:TForm);StdCall;
procedure ShowForm_Center_A(Handle:THandle;Dest_Form:TForm);external;然后在impelmention里实现
procedure ShowForm_Center_A(Handle:THandle;Dest_Form:TForm);external 'Project1.dll' name 'ShowForm_Center';应该没有什么问题吧?
不过我觉得你那好象麻烦了吧?
直接调用form.positon属性不就行了??
没有报错,窗口并未居中
procedure ShowForm_Center_A(Handle:THandle;Dest_Form:TForm);stdcall;external 'Project1.dll' name 'ShowForm_Center_';