To all you interested BCW hackers out there that
might want to minimize a TDialog descendant main window
to an icon of their own making, read on.
Here’s what happened:
From: e…@tgm.CAM.ORG (Eric Trepanier)
To: pl…@cs.ucsd.edu (Mark Plutowksi)
Subject: "Re: Where’s my icon? Or, have you seen your’s missing?"
Mark Plutowksi once wrote….
>Having attached an icon to my windows application,
>it minimizes to the default blank white square.
>However, clicking and dragging on it shows the
>skeletonized version of the icon.
>[whereas it appears normally everywhere else.]
>I’m using Borland’s OWL interface, creating the gui with
>the Resource Compiler, then generating code via Protogen.
>My main window is a descendant of TDialog.
>I attach the icon to it by redefining GetWindowClass(), setting
>the default registration attribute via
> hIcon = LoadIcon(hWindow, "IconName");
This may or may not be of help, but I remember having a similar problem.
It turned out I had forgotten to provide the correct class name of the
dialog box. All I had to do was to derive the GetClassName member function
and return the ClassName of the Dialog box.
And if this doesn’t help, it might be that you are using a BorDlg
dialog. If so, you _must_ provide a unique dialog class name
(eg: BorDlg_MyClass), and you _must_ set the lpfnWndProc member of
the WNDCLASS structure to BWCCDefDialogProc (BWCCDefDlgProc?).
The above are only required if, as is your case, the TDialog is used
as the main window. If this doesn’t help you, let me know, and I’ll
try to think of something that will…
Eric
—-
POSTSCRIPT: It turns out that an extra step, in addition to the
(very important) aforementioned steps, is required to make the icon
display correctly..
============================================================================
First a comment for PROTOGEN USERS:
It turns out that ProtoGen did not use the same
name when creating the mainwindow as it did when it redefined
GetClassName(). In GetClassName, it did
return "MainWindow";
whereas in the constructor it did
MainWindow = TMainWindow(NULL,"DIALOG_1");
where DIALOG_1 is the name given to the main window dialog’s resource.
SO: MAKE SURE YOU VERIFY THAT YOU USE THE SAME NAME
IN BOTH PLACES AS PROTOGEN FAILED TO DO SO HERE.
============================================================================
NEXT: The Extra Step:
============================================================================
Edit the dialog box resource as text, (i.e., in the *.dlg file)
and just below the CAPTION line, put the following line:
CLASS "DIALOG_1"
where again, "DIALOG_1" is the resource name.
RESOURCE WORKSHOP USERS NOTE:
Resource Workshop failed to put this line into the *.dlg file.
So did Protogen when I attached this dialog to the
application to serve as the main window dialog.
=== Thanks Again To All Repliers Out There!!!
I never would have put all the pieces together
alone, and certainly would never have figured it
out solely from the docs, examples, & tech support.
= Mark

