Hello,
I hope the question request is not wrong there, but I can not find a right Forum anymore as BORLAND goes down.
In C++ Builder 6 (32-Bit), I created a Package, that includes a TFrame.
This TFrame, I can use/place into Delphi7 (32-Bit, too) Application without problems.
Except TSplitter's.
When I add TSplitter into the TFrame (C++), and Compile the Delphi RunTime, I get Exception Message, that the
Splitter1 has no parent window.
So the question is:
How can I fix this problem ?
Here are some Code snippet artefacts:
C++ Builder:
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TBCB6_Frame *BCB6_Frame;
static int pos_left;
static int pos_width;
static int pos_height;
static int pos_top;
static TBCB6_Frame *my_parent = NULL;
//---------------------------------------------------------------------------
__fastcall TBCB6_Frame::TBCB6_Frame(TComponent* Owner)
: TFrame(Owner)
{
Width = pos_width;
Height = pos_height;
Top = pos_top;
Left = pos_left;
Panel1 ->Parent = this;
Panel2 ->Parent = Panel1;
}
//---------------------------------------------------------------------------
extern "C"
__declspec(dllexport) TCustomFrameClass
__stdcall getMyCppFrameClass(TScrollBox *hwndParent, int X, int Y, int W, int H)
{
pos_width = W;
pos_height = H;
pos_left = X;
pos_top = Y;
BCB6_Frame = new TBCB6_Frame(hwndParent);
BCB6_Frame->Parent = hwndParent;
BCB6_Frame->Align = alClient;
my_parent = BCB6_Frame;
return __classid(TBCB6_Frame);
}
Delphi7:
type
TFrameClassFunc = function(scr: TScrollBox; x,y,w,h:Integer): TCustomFrameClass; stdcall;
var
CppModule: HMODULE = 0;
FrameClassFunc : TFrameClassFunc;
FFrame: TCustomFrame;
// debug
if CppModule = 0 then
begin
CppModule := LoadPackage('dbgFrame.bpl');
if CppModule < 1 then
begin
ShowMessage('can''t load: dbgFrame.bpl');
exit;
end;
end;
FrameClassFunc := TFrameClassFunc(
GetProcAddress(CppModule, 'getMyCppFrameClass'));
if not Assigned(FrameClassFunc) then
raise Exception.Create(
'can not find export symbol: ' +
'getMyCppFrameClass() in:' + #13#10 +
'dbgFrame.bpl');
FFrame := FrameClassFunc(
ScrollBox29, 0,0,
ScrollBox29.Width + 200 ,
ScrollBox29.Height + 200).CreateParented(Form2.Handle);
FFrame.Parent := ScrollBox29;
Für Alle Hinweise dankend:
paule32