Re: MDI with child windows controlled by processes?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"L.Allan" <l.allan@xxxxxxxxxxxxxxxx> wrote in message news:u8XYLCBRIHA.3400@xxxxxxxxxxxxxxxxxxxxxxx
I'm trying to update an SDI app so that it can take advantage of multi-core cpu's to do parallel searching of 2 to 20+ relatively large files. The searching is independent enough that separate processes work well, and this relatively inexperienced multi-threader has found this simpler to get sort-of-working than a threaded-approach with one process and several threads.

I'm considering an approach that involves MDI, with a child window for each of the files being searched. However, I'm fuzzy on whether the child windows can be associated with separate processes.

Here is a scenario:
The "parent" would get the specifications for the search ... such as case-insensitive regex for "first.+second.+(third|fourth)". Then it would somehow or other broadcast this spec to the child processes, with the results displayed in the child windows. The "parent" only needs to be informed when all the "children" are done ... everything else is indepedent.

Does this sound feasible ... or flawed? How would I get started to try it out?


This is not really possible. Child windows should be in the same thread as their parent window, and must be in the same process as their parent window.

You should really separate the searching and the windows in your thinking. You can certainly perform searches in multiple threads, but putting interrelated windows in those threads will lead to thread stalls and possibly to deadlocks. The problem is that parent/child windows communicate with each other, and if they are in separate threads each communication attempt blocks one thread waiting for the other window's thread to do something.

The best approach would put all windows in the main thread. The search threads would have no interaction with windows except for PostMessage to ask the main thread to update a window. This will let the search threads run unimpeded. Code details to do this are here:
http://vcfaq.mvps.org/mfc/12.htm

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: MDI with child windows controlled by processes?
    ... The searching is independent enough that separate processes work ... windows can be associated with separate processes. ... I thought multi-core CPU's would be able to multitask a single app ...
    (microsoft.public.vc.mfc)
  • Re: Question about offering solutions here (head up, MVPs!)
    ... I think that people think of searching Help as searching ... Ken Blake - Microsoft MVP Windows: ... of computer terminology that people are just plain afraid of. ... Teach them to fish instead of just giving them a fish. ...
    (microsoft.public.windowsxp.general)
  • Re: Modifying Open and Save As Dialog Boxes
    ... Windows' Help is a nightmare of frustration an inefficient design, allowing you to find what you're looking for only a) by accident or b) if you happen to know EXACTLY what the Help authors have chosen to call it. ... When I'm in Word, searching for help in Word 2007, the Help system shouldn't show me stuff having to do with Access 2003... ... any mix of Favorite Links and Folders. ... Explorer (Organize - Layout - Menu bar), the File dialog boxes and Windows ...
    (microsoft.public.word.docmanagement)
  • RE: KB articles for printing problems missing
    ... IllegalOperatorSequence" the only result is for the same problme, ... When searching for this KB article, ... Excel or Word cannot print multiple copies of a multipage document after you ... This occurs after you install the .NET Framework 3.0 on a Windows ...
    (microsoft.public.windowsxp.general)
  • Re: Periods of Hihg Disk Activity in Win XP
    ... an index of all files on your system for fast searching. ... Google Desktop or MSN Toolbar with Windows Desktop ... When it is in this frantic disk mode ...
    (microsoft.public.windowsxp.basics)