[comp.os.os2.programmer] Minimize a dialog box, get an icon?

BR.JWF@forsythe.stanford.edu (Jay Field) (10/31/90)

Does anyone know how to associate an icon with a dialog box?
The dialog box was created with the DLGBOX editor and I included
a MINIMIZE button.  I have tried all combinations of FS_ICON
and FCF_ICON and POINTER statements, but I still can't get
the icon associated with the minimized dialog box.  Any ideas
would be greatly appreciated.

I am running IBM 1.2 EE on a PS/2, using MS C 6.0 and the
MS toolkit.

(I am able to associate an icon with the Frame Window created
with WinCreateStdWindow.  After that is created, a dialog box
appears in response to a pull-down menu choice.  When that dialog
box is minimized, the name from the dialog box title and some
'garbage' appear at the bottom of the client window created
with WinCreateStdWindow.  What I want is to get my icon for the
dialog box to appear instead of the garbage (default icon?)
that appears now.)

Many thanks in advance,

Jay Field
Research Libraries Group
(415) 691-2215

lsalomo@hubcap.clemson.edu (lsalomo) (11/01/90)

From article <1990Oct30.223224.27196@morrow.stanford.edu>, by BR.JWF@forsythe.stanford.edu (Jay Field):
> Does anyone know how to associate an icon with a dialog box?
> The dialog box was created with the DLGBOX editor and I included
> a MINIMIZE button.  I have tried all combinations of FS_ICON
> and FCF_ICON and POINTER statements, but I still can't get
> the icon associated with the minimized dialog box.  Any ideas
> would be greatly appreciated.

Note that this has been fought over and over again by OS/2 users.  This was
answered by saying that a dialog box is NOT a frame and should NOT have support
for such items as a sizing border, an icon, etc.  If you want this, you have to
do it manually:

MRESULT EXPENTRY myDlgProc(HWND hwnd,USHORT msg,MPARAM mp1,MPARAM mp2)
{
   switch (msg) {
   case WM_INITDLG:
      {
         HPOINTER hIcon;
 
         /******************************
          Note that we don't have to check for NULL,
          because WinDefDlgProc processing for WM_SETICON
          will take care of it.
         ******************************/
         hIcon=WinLoadPointer(...);
         WinSendMsg(hwnd,WM_SETICON,MPFROMP(hIcon),0L);
      }
      break;
      :
   default:
      return WinDefDlgProc(hwnd,msg,mp1,mp2);
   } /* endswitch */

   return (MRESULT)FALSE;
}

I haven't tried doing this in a while (I have since gotten on the CUA kick in
a BIG way) so I'm not POSITIVE that the above code will work, but I think it
is correct (or extremely close to being correct).

Cheers,
Q - the "Q"uestor for knowledge (, a degree, etc.)

lsalomo@hubcap.clemson.edu
ibmman@clemson.clemson.edu
=============================================================================
"Gee Wally, I think there's something wrong with the Beaver."
=============================================================================