Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: Delphi-BCB/Compiler    [ Add a report in this area ]  
Report #:  6130   Status: Reported
Frame can't be created dynamically when contains PageControl
Project:  C++Builder Build #:  6.0
Version:    6.0 Submitted By:   xiao zhen
Report Type:  Crash / Data loss / Total failure Date Reported:  10/6/2003 2:28:50 AM
Severity:    Critical / Show Stopper Last Updated: 3/2/2011 6:51:59 AM
Platform:    All versions Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
4.00 out of 5
Total Votes: None

I think I found a BUG in C++ Builder6. try following steps.

1. use Dll wizard creat a dll project named "test.dll"
2. use __declspec(dllexport) to export an function, for example "SetupDll"
3. in the body of SetupDll, reference an exported object in VCL60.bpl, such
as Forms::Screen, for example
   void SetupDll(void)

4. Create a new project named "testprj"
5. add test.lib to project testprj
6. add code "SetupDll();" to a function, force testprj.exe link with
7. new a frame "Frame1", put a page control "PageControl1" in it, and new a
tab sheet "TabSheet1" in "PageControl1";
8. put a button "Button1" in the main form of testprj;
9. write the OnClick function of Button1 as following:
   void __fastcall TForm1::Button1Click(TObject * Sender)
       TFrame1 *f1 = new TFrame1(this);
       f1->Parent = this;
       f1->Visible = true;

10. Build test.dll and testprj.exe
11. Run testprj.exe, there is a window with a button named "button1", click
the button, you will get an
    exception EInvalidOperation, message is "Frame1 has no parent window".

I had tested for a long time, following is some phenonmenion:

a. if test.dll or testprj.exe is not built with option "Package|build with
runtime package", no exception thrown.
b. if frame is not created dynamically, no exception thrown,
c. if no tab sheet control in frame, no exception thrown
d. if no object in VCL60.bpl was referenced in test.dll, no exception

According to those evidents, I think this is a BUG in c++builder 6.0

Steps to Reproduce:

Robert Cerny at 10/7/2003 2:55:47 AM -
IIRC, that's a known problem in Delphi too, when you build a project with runtime packages and statically imported DLL that also uses packages. No fixes so far, just a workaround: don't do this, IOW bind the DLL dynamically.

xiao zhen at 10/8/2003 5:09:48 AM -
Does not Borland believe it is a problem need to be resolved?
if so, I think Borland company maybe really need be involved by M$.

Robert Cerny at 10/9/2003 8:22:21 AM -
No, you'd better use the workaround

Server Response from: ETNACODE01