[comp.windows.ms.programmer] Help: custom controls in a dialog box

saba@tellabs.com (Bruce Sabalaskey) (05/05/91)

I've been having trouble trying to display a custom control in a
modeless dialog box. Can anyone tell me what I am doing wrong?

Here's the background:

First, I'm using BC++.

I've created a custom control and placed it into a DLL. It seems to
initialize properly since the dialog editor of the SDK displays it
correctly (I've noticed that the Whitewater toolkit doesn't show
anything but an outline -- is this a clue or a limit of the Whitewater
toolkit ??)  My reference material for doing custom controls has been
"Programming Windows 3" from Microsoft.

In my main program, I've included the custom control header file (for
the messages it needs). When I link the main program, I also include
the custom control .LIB file which was created as part of my DLL. The
program compiles and links OK. My .DLL itself is in the win3 directory
so I know it's in the path.

Now here's the specific problem. When I try to create the modeless
dialog box with CreateDialog(), it always returns a NULL (0) window
handle when the custom control is in the dialog box. If I take the
custom control out of the dialog box, the dialog box gets created
properly. (Turbo debugger sure made this easy!)
 (PS: yes, i've thunked the dialog proc)

Any help would be appreciated.

Bruce Sabalaskey
saba@tellabs.com
..!uunet!tellab1!saba

kensy@microsoft.UUCP (Ken SYKES) (05/12/91)

In article <5992@tellab5.tellabs.com> saba@tellabs.com (Bruce Sabalaskey) writes:
>I've been having trouble trying to display a custom control in a
>modeless dialog box. Can anyone tell me what I am doing wrong?
>
>Here's the background:
>dialog box with CreateDialog(), it always returns a NULL (0) window
>handle when the custom control is in the dialog box. If I take the
>custom control out of the dialog box, the dialog box gets created
>properly. (Turbo debugger sure made this easy!)
> (PS: yes, i've thunked the dialog proc)

I had this happen once because I forgot to do a RegisterClass on the name
of the custom control.  Maybe that's your problem.

--Ken
Disclaimer: The above opinions are solely my own.