[comp.windows.ms.programmer] Dialog Editor Blues

stewart@images1.Waterloo.NCR.COM (Stewart Kelland) (01/16/91)

>I am having a great deal of trouble using DLL custom controls in my
>applications.  I create a dialog box using the Dialog Editor and add
>a DLL-defined custom control that I have defined.  Everything works fine in 
>the dialog editor - my custom control performs as expected - it looks fine, 
>everything is great.  But when I try to run my application to use my new dialog
>box with its new custom control I cannot get the dialog box to come up.  What
>am I missing?  The funny thing is that occasionally I have gotten the dialog
>box to appear correctly when I run my application but I don't know what the
>magic incantation was that got it to work.  Does anybody have a sure-fire
>way to make it work all the time?

Ah! There is somebody else out there doing custom controls.  Have you made
sure the DLL for your control is loaded.  I have done this with the
LoadLibrary() call. You should also be able to do it by creating a .lib
file with the implib utility and linking this with your app.  If the 
library happens to be loaded because the Dialog Editor is running and
it knows where the library is your app. will have access to the control
class.  The first thing the library does when it is loaded is register
its window class and then any application can use that class.

By the way I still don't have any suggestions about how to get the
Dialog Editor to recognize changes to my custom control style.  I get
a correct resource file produced with all the styles I specify, but
the Dialog Editor only displays the control as it is described in the
first CTLTYPE entry in the CTLINFO structure. That is I am  able to
modify the dwStyle bits and the resource file created reflects this
faithfully.  What I see on the screen however always has the same style.
When I run my application the control is diplayed with the style I specify.
In fact I don't understand just how the array of CTLTYPE is to be used.
This is not explained in the Guide to Programming or Petzold.  The pre-defined
contr do change their appearance as you modify the style.  Any suggestions?

Cheers,

Stewart