 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Asger Jorgensen Guest
|
Posted: Wed Mar 28, 2007 3:49 am Post subject: Linker errror when installing an old component |
|
|
Hi there
I am getting this error when i try to install an old component
into my component package.
[Linker Error] Export __fastcall Newbkg::Register() in module G:\BORLAND
\CBUILDER5\COMP\AJ_UTILS\NEWBKG.OBJ references __fastcall
Classes::RegisterComponents(const System::AnsiString, System::TMetaClass
* const *, const int) in unit G:\BORLAND\CBUILDER5\LIB\RELEASE
\VCL50.BPI|Classes
I have no clue what to change to make it work, so i hope somebody can
help me.
Below is the code of the component.
Thanks in advance
Asger
This is the component cpp file:
//--------------------------------------------------------------------
#include <vcl\vcl.h>
#include <assert.h>
#pragma hdrstop
#include "NewBkg.h"
//--------------------------------------------------------------------
static inline void ValidCtrCheck(TNewBkg *)
{
return new TNewBkg(NULL);
}
//--------------------------------------------------------------------
namespace Newbkg
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TNewBkg)};
RegisterComponents("AJ-Utils", classes, 0);
}
}
//--------------------------------------------------------------------
__fastcall TCustomNewBkg::TCustomNewBkg(TComponent* Owner)
: TComponent(Owner)
{
NewHookFormProc = NULL;
FBkgOwner = NULL;
HookForm();
}
//-------------------------------------------------------------------
__fastcall TCustomNewBkg::~TCustomNewBkg()
{
UnhookForm();
}
//-------------------------------------------------------------------
void __fastcall TCustomNewBkg::SetOwner( TWinControl *Owner )
{
if ( Owner != FBkgOwner )
{
UnhookForm();
FBkgOwner = (TWinControl *) Owner;
HookForm();
}
}
//-------------------------------------------------------------------
void __fastcall TCustomNewBkg::HookForm()
{
if ( FBkgOwner )
{
OwnerHandle = FBkgOwner->Handle;
OldHookFormProc = (int (__stdcall *)()) GetWindowLong(OwnerHandle,
GWL_WNDPROC);
NewHookFormProc = (int (__stdcall *)()) MakeObjectInstance
(HookFormProc);
SetWindowLong(OwnerHandle, GWL_WNDPROC, (long) NewHookFormProc);
}
}
//-------------------------------------------------------------------
void __fastcall TCustomNewBkg::UnhookForm()
{
if ( NewHookFormProc )
{
SetWindowLong(OwnerHandle, GWL_WNDPROC, (long) OldHookFormProc);
if (NewHookFormProc)
FreeObjectInstance(NewHookFormProc);
NewHookFormProc = NULL;
}
}
//------------------------------------------------------------------
void __fastcall TCustomNewBkg::HookFormProc( TMessage &aMsg )
{
if ( aMsg.Msg == WM_ERASEBKGND )
{
if ( FOnEraseBackground )
FOnEraseBackground ( this, FBkgOwner );
}
else
aMsg.Result = CallWindowProc(OldHookFormProc, OwnerHandle,
aMsg.Msg, aMsg.WParam, aMsg.LParam);
}
//--------------------------------------------------------------------
H-File:
#ifndef NewBkgH
#define NewBkgH
//--------------------------------------------------------------------
#include <vcl\SysUtils.hpp>
#include <vcl\Controls.hpp>
#include <vcl\Classes.hpp>
#include <vcl\Forms.hpp>
//--------------------------------------------------------------------
typedef void __fastcall (__closure *TEraseBackgroundEvent)
(System::TObject* Sender, TWinControl *RedrawControl );
//--------------------------------------------------------------------
class TCustomNewBkg : public TComponent
{
private:
protected:
TEraseBackgroundEvent FOnEraseBackground;
int (__stdcall *OldHookFormProc) ();
int (__stdcall *NewHookFormProc) ();
TWinControl *FormOwner;
TWinControl *FBkgOwner;
HWND OwnerHandle;
protected:
void __fastcall SetOwner( TWinControl *Owner );
void __fastcall HookForm();
void __fastcall UnhookForm();
void __fastcall HookFormProc(TMessage &aMsg);
public:
__fastcall TCustomNewBkg(TComponent* Owner);
__fastcall ~TCustomNewBkg();
__property TWinControl *BkgOwner = { read=FBkgOwner, write=SetOwner
};
__property TEraseBackgroundEvent OnEraseBackground = {
read=FOnEraseBackground, write=FOnEraseBackground };
__published:
};
//--------------------------------------------------------------------
class TNewBkg : public TCustomNewBkg
{
private:
protected:
public:
__fastcall TNewBkg(TComponent* Owner) : TCustomNewBkg ( Owner )
{}
__published:
__property BkgOwner;
__property OnEraseBackground;
};
//--------------------------------------------------------------------
#endif |
|
| Back to top |
|
 |
Asger Jorgensen Guest
|
Posted: Thu Mar 29, 2007 7:01 pm Post subject: Problem solved |
|
|
Best regards
Asger |
|
| Back to top |
|
 |
DreamChaser Guest
|
Posted: Wed Apr 04, 2007 5:17 am Post subject: Re: Problem solved |
|
|
Asger Jorgensen wrote:
| Quote: | Best regards
Asger
Hey Asger, |
Could it that others *might* have the same problem? Or similar? A brief
explanation of how it was solved would be appreciated. |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group .
|