dll中的接口函数function Init(hWndParent: HWND; gid: Int64; pszUserPath: LPCTSTR): HWND; stdcall;
begin
CoInitialize(nil);
FrmPCDll := TFrmPCDll.CreateParented(hWndParent);
FrmPCDll.Visible := True;
Result := FrmPCDll.Handle;
end;
调用时
begin
Init(Handle, 0, 'aaa');
end;在关闭主程序时总是出错,提示Runtime error 216 at 004A661D应该如何处理?
begin
CoInitialize(nil);
FrmPCDll := TFrmPCDll.CreateParented(hWndParent);
FrmPCDll.Visible := True;
Result := FrmPCDll.Handle;
end;
调用时
begin
Init(Handle, 0, 'aaa');
end;在关闭主程序时总是出错,提示Runtime error 216 at 004A661D应该如何处理?
library Project1;uses
Windows,
ActiveX,
Forms,
UnitPCDll in 'UnitPCDll.pas' {FrmPCDll},
Unit1 in 'Unit1.pas' {Form1};{$R *.res}function Init(hWndParent: HWND; gid: Int64; pszUserPath: LPCTSTR): HWND; stdcall;
begin
CoInitialize(nil); Application.Handle := hWndParent;
FrmPCDll := TFrmPCDll.Create(Application);
FrmPCDll.ParentWindow := hWndParent;
FrmPCDll.Visible := True;
Result := FrmPCDll.Handle;
end;procedure Quit; stdcall;
begin
if Assigned(FrmPCDll) then
begin
FrmPCDll.Free;
FrmPCDll := nil;
end; CoUninitialize;
end;
exports
Init name 'Init',
Quit name 'Quit';beginend.
Quit name 'Quit';输出的函数为什么要这么写
直接写
Init
Quit
初始和结束函数?