From: marcusj@apricot.co.uk (Marcus Jenkins)
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: Borland C++ OWL and MDI - summary
Date: 7 Oct 92 07:57:32 GMT
Organization: Apricot Computers Limited

I have had a good response to my question of 'how do I set the icon
for MDI child windows'.  Here's a summary


=============== First off the Man From Borland says: ==============

It's not too easy, but not too hard.....

MDI children can all share an icon if they're the same class.
Change that in the REGISTERCLASS structure.

You need to do three things.  First, handle the WM_QUERYDRAGICON
message as documented.  This allows the window's icon to move around
when you pick it up with the mouse.

Then, you need to test for IsIcon(hWnd) in the paint procedure and
paint using DrawIcon if it is an icon.  Just paint the icon at 0,0.

Finally, you need to handle the WM_ICONERASEBKGND or some such message.
This is documented, but basically what it does is draw the 
backplane in a rectangle so you can see the icon on top of it.
Here's where you can change the background color to be different from the
MDI client window.  

There may be more, but just look for messages called *ICON*.

============== another answer # 1 ==========================

As you already stated it's very simple.
You must register a new Window-Class to Windows (not a subclass of
Borlands Window-Class) with a call to RegisterWindowClass(wndclass struct).
The name_field forinstance "MyApp:MDI_Child"
in the Icon field you can define the Icon you want with a call to
LoadIcon("<icon_name>").
If you create a child-class in Borland, you can make a new MDI-child by using
this new MS-Window-Class "MyApp:MDI_Child" in the constructor of your
Borland-class.

I hope this is enough information to implement the MDI-Icon.

============== another answer # 2 ========================

To change the icon you have to derive your on class.   You will have to use the two functions derived for the TWindow object,  GetClassName, and GetWindowClass;  Since I can't remember right of hand the structures that are passed I will do the best that I can.

void TChildClass::GetWindowClass(//a window class is passed here)
{
  TWindow.GetWindowClass(AWndClass);
  AWndClass.icon=LoadIcon(hInstance,"Your Icon");
}

since you changed the default class you have to give it another name therfore you use the following procedure

LPSTR TCHildClass::GetClassName()
{
  return("New Class Name");

=============== another answer # 4 =======================

All that you need to do is set the ICON in the childs GetWindowClass 
function. As an example....

void TChild :: GetWindowClass( WNDCLASS& AWndClass )
{
   TWindow::GetWindowClass( AWndClass );
   AWndClass.hIcon = hChildIcon;
}

=============== end of other answers ====================

There were one or two more 'other' answers, but they said pretty 
much the same thing.  If it's so simple as the 'other' answers
imply, why did the relpy from a chap in Borland go on about me
having to trap all the *ICON* messages for the child window?
Who's right (I have my suspicions)?


 _ _ _
' ) ) )                         Internet: marcusj@apricot.co.uk
 / / / __.  __  _. . . _        UUCP: marcusj@apricot.uucp
/ ' (_(_/|_/ (_(__(_/_/_)_      If all else fails from US, try:  
Marcus Jenkins                  apricot!marcusj@relay.EU.net
Tel: +44 21 472 3002  Fax: +44 21 471 2935
Disclaimer:  Anything I wrote above is, of course, my own view and
             does not in any way represent my employer.