604
社区成员
发帖
与我相关
我的任务
分享
DLL:
extern "C" int __declspec(dllexport) __stdcall CreateSubForm(TApplication * AOwner, int AParam);
int __stdcall CreateSubForm(TApplication * AOwner, int AParam)
{
Form1 = new TForm1(AOwner);
// AParam 参数到底怎么用,自己写吧
return (int)Form1 // 怎么可以使用 FrmUnit1 ?
}
EXE:
HINSTANCE DLLInst;
//---------------------------------------------------------------------------
void __fastcall TFrmMain::Button1Click(TObject *Sender)
{
int (__stdcall *CreateSubForm)(TApplication *, int); // 我喜欢在内部声明。
if( NULL == DLLInst ) DLLInst = LoadLibrary("A\\ADLL.dll");
(FARPROC) CreateSForm = GetProcAddress(DLLInst,"CreateSForm");
int i = CreateSForm(Application, 100100100);
//这个i可以得到,怎样通过这个i Show 出这个窗体?
TForm *Form = (TForm *)(void *)i;
Form->Show();
}