mfc >> cannot create a child window

by May Young » Wed, 03 Dec 2003 10:49:55 GMT

Hi,

In the rbuttondown event handler of a CView derived class, I intend to
create a child window as below. No matter how I adjust the CRect or
class name, the child window cannot show up. I specify WS_EX_TOPMOST
but see the child window maximized and then immediately hidden by the
CView derived class. Do you know why? Thanks for your help.

// m_wnd is a CWnd member in the CView derived class
CRect rect(32, 64, 152, 154);
//CalcWindowRect(&rect);
m_wnd.CreateEx(WS_EX_TOPMOST, _T("LISTBOX"), _T("My Window Title"),
WS_VISIBLE|WS_CHILD, rect, this, 0);
//m_wnd.ShowWindow(SW_SHOW);
m_wnd.ShowWindow(SW_SHOWMAXIMIZED);

Tony



mfc >> cannot create a child window

by May Young » Wed, 03 Dec 2003 11:11:42 GMT


Never mind. I forget to specify the boarder option. Sorry for this post.






Similar Threads

1. Child list for field owner-info cannot be created

My name is Norm, I changed something that caused this problem, and I do not 
what it was.  I also do not know how to debug this problem!  The line where 
the crash occures is marked by an *. The windows form will not display in the 
designer.
Please help!!

//
// Animal
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(822, 554);
this.Controls.Add(this.label10);
this.Controls.Add(this.groupbox3);
this.Controls.Add(this.groupBox1);
* this.Font = new System.Drawing.Font("Times New Roman", 8.25F, 
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 
((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Menu = this.mainMenu1;
this.Name = "Animal";
this.Text = "Animal Information";
this.Load += new System.EventHandler(this.Animal_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupbox3.ResumeLayout(false);
this.groupbox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dsAnimal1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdShots)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdHistory)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.grdMedications)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pcAnimalPhoto)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

2. "Cannot create a child list for field tblProjects" error - CSharp/C#

3. Child list for field x cannot be created.

Well, i found the solution, it was so easy :)

I set the DataMember and DataSource to null before i reinitialized again...

/Martin

"Martin Arvidsson, Visual Systems AB" < XXXX@XXXXX.COM > skrev i 
meddelandet news: XXXX@XXXXX.COM ...
> Hi!
>
> Have a little problem when i want to use the other dataset with the same 
> grid.
>
> When i display the form i use the UniqueFolders. All works fine, then 
> click a button
> and send InitializeGrid with FileDeletion as parameter and the exception 
> is raised. (See subject)
>
> What to do? Do i have to clear the datagridview with some method or what?
>
> This is my code:
>
> void InitializeGrid(EGridInitialize gridInitialize)
> {
>    switch (gridInitialize)
> {
>    case EGridInitialize.UniqueFolders:
>        this.dataGridView1.DataMember = 
> DataSetUniqueFolders.Tables[0].TableName;
>        this.dataGridView1.DataSource = DataSetUniqueFolders;
>        this.dataGridView1.Columns[0].HeaderText = "Compare/Delete";
>        this.dataGridView1.Columns[1].HeaderText = "Project Path";
>        break;
>    case EGridInitialize.FileDeletion:
>        this.dataGridView1.DataMember = 
> DataSetUnusedFiles.Tables[0].TableName;
>        this.dataGridView1.DataSource = DataSetUnusedFiles; ;
>        this.dataGridView1.Columns[0].HeaderText = "/Delete";
>        this.dataGridView1.Columns[1].HeaderText = "File";
>        this.dataGridView1.Columns[2].HeaderText = "Complete path and 
> file";
>        break;
>    default:
>        break;
>    }
> }
>
> /Martin
> 


4. Child Window Cannot Receive Messages

5. How to make a new document window be a child of an MDI child window

I registered a document template in InitInstance(). 

In onFileNew(), I first created an MDI child window, then 
use OpenDocumentFile(NULL) to create a new empty document 
(not necessarilly an MDI child). Both works fine. 

However, when I tried to make this new empty document 
window a child of the MDI child window, (which was created 
in the same onFileNew()), I could not.

Could anyone please tell me how to do it? I tried a couple 
of ways, and no luck. Thanks a lot.

Andrew

6. How do I make a new document window a child of MDI child window

7. newbie: How to create a child window?

How can I create a form with attribute like WS_CHILD?


8. Creating MDI Child Windows