Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

event in DLL

Status
Not open for further replies.

valdenir

Programmer
Aug 14, 2009
3
BR
Hello people, I am new in this forum
I am creating a DLL that raises a form in runtimer.
Inside this form it has 1 ProgressBar and 1 Timer.
I need to create an event for the Timer. how I do that? I tried so it did not give them to me right.

TForm *Form;
TProgressBar *ProgressBar;
TTimer *Timer;

#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
//-----------------------------------------------------

//components
extern "C" __declspec(dllexport)int PROGRESS_BAR()
{
Form = new TForm(Form);
Form->Width = 500;
Form->Height = 25;
Form->Position = poScreenCenter;
Form->BorderStyle = bsNone;

ProgressBar = new TProgressBar(Form);
ProgressBar->Parent = Form;
ProgressBar->Align = alClient;
ProgressBar->Visible = true;
Form->Show();

Timer = new TTimer(Form);
Timer->Parent = Form;
Timer->Interval = 50;
Timer->OnTimer = Form->PROGRESS;
}
//---------------------------------------------------

//event created
void __fastcall TForm::pROGRESS(TObject *Sender)
{
//my code
}
 
I am confused.
Do you use C++ Borland?
The latest C++, version 5.5 doesn't has VCL.
Are isn't this correct and are there newer versions?
In C++ 5.5 we used OWL.
If you do use TForm in C++ 5.5, I'm curious how?

Is it possible this concern C++Builder?
And if so which version do you use, because there are quit some differences.

Are could it be you are looking how to get control over the Timer functions of the WINAPI?
 
hello,luckieluc
I expressed badly, must use the event created in the runtime DLL. I found this trick on the internet

//--------------------------------------------------------
1) Create new project: File -> New -> Other -> Dll Wizard
Project1 -> ProjDll.bpr
Unit1 -> DllMain.cpp
2) Add a Header File for the DLL: File -> New -> Other -> File Header
File1.h -> DllMain.h
3) Include in the policy of DllMain.h compiler:
# include "MinhaClasse.h"
4) Include in the policy of DllMain.cpp compiler:
# include "DllMain.h"
5) Create New Unit: File -> New -> Unit
Unit2.cpp -> MinhaClasse.cpp
Unit2.h -> MinhaClasse.h
6) Declare the class in the specified MinhaClasse.h? O:
class __declspec (dllexport) MinhaClasse
(
...
);
7) Generate the DLL: Project -> Build ProjDLL
//---------------------------------------------------------

was all right, but I do not use the event created
how can I use the event created in onTimer?

now thanks and sorry my english, I'm Brazilian and use online translator
 
hello,luckieluc
I expressed badly, must use the event created in the runtime DLL. I found this trick on the internet

//--------------------------------------------------------
1) Create new project: File -> New -> Other -> Dll Wizard
Project1 -> ProjDll.bpr
Unit1 -> DllMain.cpp
2) Add a Header File for the DLL: File -> New -> Other -> File Header
File1.h -> DllMain.h
3) Include in the policy of DllMain.h compiler:
# include "MinhaClasse.h"
4) Include in the policy of DllMain.cpp compiler:
# include "DllMain.h"
5) Create New Unit: File -> New -> Unit
Unit2.cpp -> MinhaClasse.cpp
Unit2.h -> MinhaClasse.h
6) Declare the class in the specified MinhaClasse.h? O:
class __declspec (dllexport) MinhaClasse
(
...
);
7) Generate the DLL: Project -> Build ProjDLL
//---------------------------------------------------------

was all right, but I do not use the event created
how can I use the event created in onTimer?

now thanks and sorry my english, I'm Brazilian and use online translator
 
I am still not sure if I understand your question, But..

If you want to create additional events it is better to overwrite the VCL component: TTimer.

Component/new VCL....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top