L
lwaif
Unregistered / Unconfirmed
GUEST, unregistred user!
Project2.dpr:
library Project2;
uses
SysUtils,
Classes,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
exports
LoadAboutbox;
begin
end.
Unit1.pas:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
ADOQuery1: TADOQuery;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
var
WAbout: TForm1;
procedure LoadAboutbox(Handle: THandle); export;
implementation
{$R *.dfm}
procedure LoadAboutbox(Handle: THandle); //-- Our procedure
begin
Application.Handle := Handle; //-- Delphi default application calling
WAbout := TForm1.Create(Application); //-- Create the Aboutbox
try
WAbout.ShowModal; //-- Try and make the Aboutbox modal
finally //-- Finally, or "make sure"
WAbout.Free; //-- Unload the instance of our Aboutbox
end;
end;
end.
VC调用的事件:
void CMainFrame::Onyyyyy()
{
HINSTANCE hinstDlltest =::LoadLibrary("Project2.dll");
if (hinstDlltest!= NULL)
{
typedef BOOL (WINAPI *MYFUNC)(HWND);
MYFUNC fun = NULL;
fun=(MYFUNC)::GetProcAddress(hinstDlltest, "LoadAboutbox");
if(fun)
fun(this->GetSafeHwnd());
}
FreeLibrary(hinstDlltest);
}
VC程序编译没问题,也可以运行,调用事件就弹出错误窗口并退出了
不知道问题在哪里啊?
library Project2;
uses
SysUtils,
Classes,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
exports
LoadAboutbox;
begin
end.
Unit1.pas:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
ADOQuery1: TADOQuery;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
var
WAbout: TForm1;
procedure LoadAboutbox(Handle: THandle); export;
implementation
{$R *.dfm}
procedure LoadAboutbox(Handle: THandle); //-- Our procedure
begin
Application.Handle := Handle; //-- Delphi default application calling
WAbout := TForm1.Create(Application); //-- Create the Aboutbox
try
WAbout.ShowModal; //-- Try and make the Aboutbox modal
finally //-- Finally, or "make sure"
WAbout.Free; //-- Unload the instance of our Aboutbox
end;
end;
end.
VC调用的事件:
void CMainFrame::Onyyyyy()
{
HINSTANCE hinstDlltest =::LoadLibrary("Project2.dll");
if (hinstDlltest!= NULL)
{
typedef BOOL (WINAPI *MYFUNC)(HWND);
MYFUNC fun = NULL;
fun=(MYFUNC)::GetProcAddress(hinstDlltest, "LoadAboutbox");
if(fun)
fun(this->GetSafeHwnd());
}
FreeLibrary(hinstDlltest);
}
VC程序编译没问题,也可以运行,调用事件就弹出错误窗口并退出了
不知道问题在哪里啊?