我的代码如下:
void __fastcall TMainForm::CreateMDIChild(TFormClass FormClass,
void *fm, TComponent *AOwner)
{
//--- only open one new MDI child window ----
int i;
TForm *Child;
for( i=0;i<Screen->FormCount -1; i++)
if(Screen->Forms->ClassType() == FormClass)
{
Child = Screen->Forms;
if(Child->WindowState==wsMinimized)
ShowWindow(Child->Handle,SW_SHOWNORMAL);
else
ShowWindow(Child->Handle,SW_SHOWNA);
if(!Child->Visible) Child->Visible = True;
Child->BringToFront();
Child->SetFocus();
(TForm*)fm = Child;
return;
}
/*Child = (TForm*)TForm::NewInstance();
(TForm*)fm = Child;
Child.TForm::Tform(AQwner);
*/
(TForm*)fm = Child = new TForm(AOwner);
}
void __fastcall TMainForm::FileNew1Execute(TObject *Sender)
{
CreateMDIChild(__classid(TfrmChild0) , Child0, this);
}
编译全通过,但运行时,无法建立新窗体。