将自己写的组件放在Form上时候,总会报错!:(
wu_07 2003-03-06 11:22:28 这是我写的组件的构造函数
//----------------------------------------------------------
__fastcall TImFormTitleSkin::TImFormTitleSkin(TComponent* Owner)
: TComponent(Owner)
{
ParentForm =dynamic_cast<TForm *>(this->Owner);
if (ParentForm!=NULL)
{
TBorderIcons tempBI = ParentForm->BorderIcons;
tempBI >> biSystemMenu;
ParentForm->BorderIcons = tempBI;
// subclass the window
NewClientWP = (FARPROC)MakeObjectInstance(CustomWndProc);
OldClientWP = (FARPROC)SetWindowLong(ParentForm->Handle, GWL_WNDPROC,(LONG)NewClientWP);
tempBMP= new Graphics::TBitmap();
tempBMP->Height = 28;
tempBMP->Width = 1024;
tempCanvas= tempBMP->Canvas;
BMP= new Graphics::TBitmap();
BMP->LoadFromResourceName((int)HInstance, "RESOURCE_Blue");
}
else if(ComponentState.Contains(csDesigning))
{
Application->MessageBox("This should be on window.", "Look", MB_OK);
delete this;
}
else
{
delete this;
}
每当我将此组件放在Form上时候,总会报下边的错
Access violation at address 05E1EA6 in module 'ImPackage.bpl'.
Read of address 00000000.
初次写组件,请大家帮忙分析分析原因: