Create MDI Child inside a thread?

I have attempted this through a CWinThread derived class but have been
unable to get the window creation to work correctly. This is what I have so
far:

BOOL CSecurityFrameThread::InitInstance()
{
                CRuntimeClass *pRT = RUNTIME_CLASS( CSecurityFrame );
     CFrameWnd *pFrame = (CFrameWnd *)pRT->CreateObject();

     CCreateContext ct;

     ct.m_pCurrentDoc = NULL;
     ct.m_pCurrentFrame = (CFrameWnd *)m_pParent;
     ct.m_pLastView = NULL;
     ct.m_pNewDocTemplate = NULL;

     BOOL bSuccess = pFrame->LoadFrame(IDR_TRUSSVIEWER, WS_VISIBLE |
WS_OVERLAPPEDWINDOW | WS_CHILD, m_pParent, &ct);

     if( !bSuccess )
     {
          pFrame = NULL;
     }
     else
     {
          pFrame->ShowWindow(SW_SHOW);
          pFrame->UpdateWindow();
     }
     return TRUE;
}

The code fails in

BOOL CMDIChildWnd::Create(LPCTSTR lpszClassName,
     LPCTSTR lpszWindowName, DWORD dwStyle,
     const RECT& rect, CMDIFrameWnd* pParentWnd,
     CCreateContext* pContext)
{
         ............

        HWND hWnd = (HWND)::SendMessage(pParentWnd->m_hWndMDIClient,
          WM_MDICREATE, 0, (LPARAM)&mcs);
}

The message seems to fail and therefore the MDI Child never created. This
works fine if I create the frame window from the main thread (using the same
code)

Thanks in advance :)


0
coderman (1)
11/12/2003 4:59:19 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
812 Views

Similar Articles

[PageSpeed] 59

Hi Craig,

Multithreading your UI can be "challenging". Especially with MFC, which
stores handle maps per thread. You might find the MTMDI sample helpful.


http://msdn.microsoft.com/library/en-us/vcsample/html/_sample_mfc_MTMDI.asp

Sincerely,
Ed Dore [MSFT]

This post is "AS IS" with no warranties, and confers no rights.


0
eddo (46)
11/13/2003 4:34:47 AM
Reply:

Similar Artilces:

Creating new tickets
Is it possible to create a new ticket from an e-mail received in Outlook. Having selected Track in CRM it only seems possible to convert the email to an opportunity. I see no one has replied to your post. Have you come up with a solution on your own? "GrahamB" wrote: > Is it possible to create a new ticket from an e-mail received in Outlook. > Having selected Track in CRM it only seems possible to convert the email to > an opportunity. ...

Add-in to create basic canned answers ?
Hi, I sell a lot on ebay, and I get many exact questions from buyers. I use Outlook 2003 and I have a little FAQ based on Outlooks signatures... this solution is not that good as I wanted it to be, since I need a faster access to it and a little more flexibilty. Does anybody know of a basic add-in I can buy that could help me out ?? I don't need fancy things, just flexible canned answering. Thanks Alex See if this product meets your needs: http://www.emailtemplates.com/et/ I'm not sure it works with Outlook 2003 though. You can ask them about that. -- Ken Slovak [MVP - Outlook] ...

Outlook creating attachment to incoming messages
This just started today... Every email I receive has an attachemnt that is just a .txt version of the real email message that someone is sending me... I looked at my settings and I see no options for something like this... So what is causing this to happen?? Thanks Close Outlook and reboot your computer. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and finding no answer, paul asked: ...

Creating checkboxes that change data
Hello everyone, Can anyone help / make suggestions in achieving the following: I am trying to create an invoice that summarises the total of the products at the bottom of the spreadsheet. What I want to achieve is some way of having various products in a row which a user can select via some sort of check box (giving the product a boolean value). Each product would have a price value attached to it and when it is selected the price should be added to the total. This would therefore allow the user to select various products and the total would be calculated accordingly. This seems relativel...

How do I create a lesson plan template?
I am new third grade teacher and I'm wanting to create a lesson plan template to fill in each week rather than doing it manually each week. On Sun, 19 Aug 2007, in microsoft.public.excel.charting, Ms. Agner <Ms.Agner@discussions.microsoft.com> said: >I am new third grade teacher and I'm wanting to create a lesson plan template >to fill in each week rather than doing it manually each week. Do it manually once, then set all the cells you would fill to zero, or "XXX" or whatever, and save that. Next week, open the file you saved and fill it in with the new week&...

How can I create SPC charts in Excel
Looking to use SPC charts in my company to monitor process performance. It wouldn't be feasible to provide specialist software to teams - the only workable option is for them to use Excel to log data and produce the charts. Is this possible ? Are there any templates available ? Hi, Maybe on of Jon's examples will help. http://peltiertech.com/Excel/Charts/statscharts.html Cheers Andy Sarahp wrote: > Looking to use SPC charts in my company to monitor process performance. It > wouldn't be feasible to provide specialist software to teams - the only > workable opti...

Create Item Number from Web Services Question
Hi All, I am trying to create a new item number in GP so that it's existed before I can create salesorder and salesitem but I don't know which method/methods from GP Web Services to do so. I found that there are CreateSalesOrder, CreateSalesItem, GetItemByKey but I could not find where CreateItem? Anyone has ideas, please let me know and I'd appreciate -Toi Use the CreateSalesItem method. The name is not as intuitive as it should be, but it's the method you need for a new item. You can find more info in the Web Services SDK. Best regards, -- MG.- Mariano Gomez, MIS,...

Problems with external references when creating a drop down list
I have a large spreadsheet with several large drop down lists. The lists are all in a separate workbook so I have defined a name with an external reference to the lists. The problem is that the drop down lists will only work when both spreadsheets are open but I don't want to open the spreadsheet containing the lists everytime as it is a really large workbook. How can I get the drop down list to work with just the workbook open where I have validated the cells? Thanks. Write 2 macros.. in the workbook that is the 'source' of the dropdowns, have it export the list to a ge...

Creating Login with permissions
Hello all, I want to create a login form that would verify the users and their permissions; admin, read only, read and write. tips or help please. thank you very much. paul. Well, Access has built in user-level security. Instead of reinventing the wheel, look at the features available in Access. It is not a simple process, and a mistake can lock up your data, so I would suggest you make at least one backup before proceeding. I'd also recommend you read, and re-read, the following links before starting. Security Security FAQ http://support.microsoft.com/?id=207793 The...

Create group out of vba code
Hi, When a new database is created a group 'Favorites' exists already. I would like to create additional ones, but with vba code. Furthermore it would be great to assign tables and queries to the groups which have been created. Is that possible? Thanks, Ralf The code below should get you going and the original source is listed if you wish to looked it up further. Public Sub CreateUserGroup(strGroupName As String, _ strPID As String) ' Create a group ' Source: Graham R Seach - MS Access MVP ' http://groups.google.ca/group/microsoft.public.ac...

Date created and date last modified
In previous version of Word, you could check the "date created" and "date last modified" in the document by drilling down through properties, and then summary. This information is not available in Word 2007 documents. Is there any way to discover these attributes of a file in 2007? Click the Office button, click Prepare, and then click Document Properties. In the pane that displays, click Document Properties, and finally click Advanced Properties. You'll find the data you are looking for on the Summary tab. -- Stefan Blom Microsoft Word MVP ...

Display Charts Created In Excel In A Windows Form
Hi, I have several Excel files and each file has several Charts. I have a requirement where i have to display the chart with data points in a windows form. In my WinForms code iam able to access the chart object through the following code Excel.ChartObjects chCharts = (ChartObjects)oWorkSheet.ChartObjects(Missing.Value); Excel.ChartObject chChart = chCharts.Item(1); The problem is how do i use this ChartObject to be displayed in WinForm, I tried using the AxChartSpace control, but iam not able to add this chChartObject to it. The idea is to re-use the charts that has already been cr...

calls to unmanaged dll to create a socket result in debug assertio
I have an unmanaged C++ dll which is an MFC shared DLL that has functions in it to initialize sockets and do other ethernet related things. I have built a managed C++ wrapper project which is also an MFC shared DLL, compiled with /clr that calls functions in the unmanaged dll. Then I have a C# project which instantiates a member of the wrapper class to access the unmanaged functions. One of the functions in the unmanaged dll creates a new CAsyncSocket, checks to see if AfxSocketInit is successful, and if so, calls Create to create a new socket. When I call this function through my wra...

VBA code to create multiple charts in a single Excel sheet Options
Hi, I need to create a macro in Access which creates a report in an excel sheet. The excel sheet needs to contain a number of sheets (Sheet 1,Sheet 2,Sheet 3....).Inside each Sheet around 9 charts have to be displayed. Please can somebody help me with some vba code for the same. Thanks, Sobha ...

Unable to open Money 2005 Standard edition created file in 06 Prem
I'm unable to open my mny file created using Money Standard Edition 2005 with my new software, Money Premium Edition, 2006 Money 2006 PREMIUM crashes when I try to open the old file, how can i retrieve the old data into 2006 premium? Please help In microsoft.public.money, Navs wrote: >I'm unable to open my mny file created using Money Standard Edition 2005 with >my new software, Money Premium Edition, 2006 > >Money 2006 PREMIUM crashes when I try to open the old file, how can i >retrieve the old data into 2006 premium? Any error message? If you have a *.m14 fil...

Steps To Create a Microsoft CRM SMTP Subdomain for Exchange
This is my scenario .. In crm server I have an Exchange 2000 (myuser@crm.mycompany.com.mx)installed that only sends emails and I have the Exchange 2003 Organization (myuser@mycompany.com.mx). I want to use the option Creating a Microsoft CRM SMTP Subdomain described in IG but it doesn't work. 1.- We added a subdomain (crm.mycompany.com.mx) where i access crm web interface. 2.- We added a two-way trust relationship between exchange domain and crm domain. 3.- We added a secondary SMTP (@crm.mycompany.com.mx) in Defaul Policy Properties of Exchange 2003 Organization. 4.- We added a s...

how do I create a transparent image in the background?
How do I create a transparent image in Publisher 2000 with text flowing over the image, allowing the image to be seen in the background? Thanks anna Make the Text Frame transparent by going Ctrl+T -- ...

Office 2004, MDI files?
When I installed Microsoft Office 2003 in Windows XP, it installed the "Microsoft Office Document Image Writer" printer driver. I can print to this printer to create documents in the Microsoft Document Imaging Format (*.MDI). In Windows this file format is only readable through the Microsoft Office Document Imaging program installed with Microsoft Office 2003. Will the Microsoft Office 2004 for Mac OS X version install the "Microsoft Office Document Image Writer" printer driver like the Windows version? Will the Microsoft Office 2004 for Mac OS X version be able ...

Easy way to create a bunch of worksheets and name them
Let's say I have a workbook and want to create 60 or so worksheets. But I don't want to go in a name them after I create them. What if I had a list of names...like in a column. Then I wanted to run a macro that would create a worksheet for each name in the list and name it. What would the code look like? Frank it might look something like this: Sub InsertSheets() Dim Cell As Range Dim NewSheet As Worksheet For Each Cell In Range("A1:A" & Range("A65536").End(xlUp).Row) Set NewSheet = _ Sheets.Add(After:=Sheets(Worksheets.Count)) NewSheet.Name =...

How to create nested nodes in XML in C#
Hi, I have to create an XML in the following syntax: <RESPONSE> <QueueItems> <Node1>..... <Node2>..... </QueueItems> <QueueItems> ... </QueueItems> </RESPONSE> Iam building this through a SqlDataReader object. My problem is I cannot get DOM object to create the QueueItems node. Please help! TIA Ramya Ramya A wrote: > I have to create an XML in the following syntax: > > <RESPONSE> > <QueueItems> > <Node1>..... > <Node2&...

Create Form with Dropdown Combo Box
I want to create a form with dropdown combobox based off the Company Names. So, eVerytime i click on any of the companies it will populate the appropriate financial results for the two most recent quarters. I have a query result that shows Company Names with their Financial Information that they file quarterly. Some of the Companies shows more than two quarters of results. What is the best way and how to do it to show only two recent months. Thank you, Jay ...

Can I use data from different worksheets to create a chart
I am running Excel 2000. I have 3 worksheets from different schools. I want to compare ratings from each of the schools in one chart. Can I do that and, if so, how. Thanks Yes you can build a single chart that plots data from 3 different worksheets. You haven't said what type of chart, so I will walk you through an XY (Scatter) chart. Let me know if you need help with another chart type. Step 1 - Create new worksheet where you will place embedded chart. Name your new worksheet Charts Step 2 - In your new Charts sheet, from the top menu select Insert > Chart to start Excel&#...

How to create meeting room reserve application in public folder?
I have three meeting room and reserve by manual. How to use public folder for these requirement? Why not just use resource mailbox instead and setup to auto-accept meetings. Either use AutoAccept Agent (download from microsoft.com) or set up those mailboxes to auto-accept appointments and auto-decline conflicting appointments. http://www.msexchange.org/tutorials/MF019.html -- Bharat Suneja MCSE, MCT -------------------------------- "Mesak" <Mesak@discussions.microsoft.com> wrote in message news:BFEF78FD-E8ED-403F-82F8-8C6D4A8B2E53@microsoft.com... >I have three meet...

create text box alongside last column of table for two rows
What is the optimum method of creating text fields to the right of the last table column when you only require 3 or 4 in a table of 30 rows? -- Concord Text form fields? It might be simplest to add an extra column and put them in that - either manually or by macro. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>...

"CRM Server unavailable" 0x80004005 when trying to create an order from a quote
Hi, We are currently testing CRM 3.0 and are stumbling into a pretty serious problem. When trying to create an order from a quote, we get a "Microsoft CRM Server is unavailable" error (0x80004005). The problem is known and documented in KB #913465. However, the patch is not directly downloadable. Since I don't really want to either wait monthes or fry a support ticket on what appears to be a bug in CRM server, do you guys know if there's a quick workaround for this? Thanks! G. ------=_NextPart_0001_2A6EB238 Content-Type: text/plain Content-Transfer-Encoding: 7bit ...