带窗体的DLL使用问题
各位:
我有个已经做好的带窗体的DLL,现在想把这个窗体嵌到主程序的Panel或者是ScrollBox中去,但是嵌进去是空白的,什么控件都不显示,请问要这么写才行? BCB6+XP(SP2)
调用主程序
void __fastcall TForm_Console::Button_UpClick(TObject *Sender)
{
if( NULL == DLLInst )
DLLInst = LoadLibrary("setup.dll");
if (DLLInst)
{
ShowForm = (void (__stdcall*)(TWinControl *Parent)) GetProcAddress(DLLInst,
"ShowForm");
if (ShowForm)
ShowForm(ScrollBox);
else ShowMessage("Could not obtain function pointer");
FreeLibrary(".\\bin\\setup.dll");
}
else ShowMessage("Could not load Setup.dll");
}
DLL中的程序:
extern "C" __declspec(dllexport) __stdcall void ShowForm(TWinControl *Parent);
void __stdcall ShowForm(TWinControl *Parent)
{
Setup = new TForm_Setup(Parent);
Setup->Parent=Parent;
Setup->BringToFront();
Setup->Show();
}