Access Main Form from a DLL

2004-04-14 11:27:24 PM
I want to make DLLs plugins for my application. I want the DLL to add a
new ToolButton to the main form of my app.
I tried that in the DLL:
extern "C" __declspec(dllexport) __stdcall InitDLL(TFormMain *Main);
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
return 1;
__stdcall InitDLL(TFormMain *Main){
TToolButton *NewButton;
NewButton=new TToolButton(Main->ToolBar);
Then I called InitDLL from the Main Form using "ImpFuncDLL(this);"
In that case, the Caption of the Main Form change to "hello", but I get the
error "Impossible to affect TFont to TFont after
So I think I'm not using the right thing to do what I want to do.
Is somebody already make something like that ?