带窗体的DLL使用问题

checka 2005-11-02 10:08:59
各位:
我有个已经做好的带窗体的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();
}
...全文
145 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
编译失败 2005-12-20
  • 打赏
  • 举报
回复
你已经FreeLibrary了,怎么会有?!
还有建议你不要把参数命名为Parent
痞子酷 2005-11-03
  • 打赏
  • 举报
回复
void __stdcall ShowForm(TWinControl *Parent)
{

Setup = new TForm_Setup(Application);
Setup->Parent=Parent;
setup->Name="唯一";
Setup->Show();
}


呵呵~~~~~
痞子酷 2005-11-03
  • 打赏
  • 举报
回复
void __stdcall ShowForm(TWinControl *Parent)
{

Setup = new TForm_Setup(Application);
Setup->Parent=Parent;
Setup->Name="Setup"+"Seq"; //名字不能重复,一个面板上只有一个唯一的名字
//Setup->BringToFront();
Setup->Show();
}


呵呵~~~~~
checka 2005-11-02
  • 打赏
  • 举报
回复
Setup->Parent=Parent;
这句改了以后提示不能存取
__fastcall TCustomForm::SetParent(TWinControl* )is not accessible
ccrun.com 2005-11-02
  • 打赏
  • 举报
回复
用SetParent试试。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧