Click to See Complete Forum and Search --> : WM_CREATE returns -1?


Zappo
January 23rd, 2006, 12:56 PM
Hi all. I have a problem with a control that I can't create. Specifically, creation fails because the default window procedure returns -1 for WM_CREATE, and I can't figure out why. GetLastError() is zero. All the handles in CREATESTRUCT are correct, as is the window class, positioning numbers and style.

I'd post the relevant code, but it's very large and it involves a third-party library. Since I can't give details, I won't ask for a solution to this particular problem. So the question is, generically:

In what cases does the default window proc return -1 for WM_CREATE?

kirants
January 23rd, 2006, 01:03 PM
I don't know.

Anything like this is happening.
Some essential styles are not set ? For.e.g. some controls ( as an example edit, combo ) can be created as WS_CHILD contol only.
Also, things like, when you specify WS_CHILD style, the hWndParent has to be right.. such things could cause window creation to fail.

Zappo
January 23rd, 2006, 01:07 PM
hWndParent is correct, and the styles are identical to those I used in another application that is basically the same (except that it works -.- ).

I'd need a detailed documentation for the default window procedure, but for now I have no idea where to get it...

kirants
January 23rd, 2006, 01:09 PM
What kind of window are you trying to create ?

Zappo
January 23rd, 2006, 01:14 PM
It's a third-party tree control. I am using it inside a frame, in a non-doc/view MDI application. It is created when the frame is created, and occupies the entire client area (much like the view in a docview app).

kirants
January 23rd, 2006, 01:15 PM
Hm.. does the control come with some documentation ?

Zappo
January 23rd, 2006, 03:47 PM
Yes, but nothing about its response to WM_CREATE. As far as I can tell, it calls the default proc.

kirants
January 23rd, 2006, 03:53 PM
hWndParent is correct, and the styles are identical to those I used in another application that is basically the same (except that it works -.- ).


I would start here. I would start by looking at the differences between the two. However small it may be.. and rule them out as I analyze.
It's difficult to say what the problem could be..

Does your third party library need to be initialized in any way before you start doing anuthing ?
Does your third party library depend on any other component that has to be installed ?
Does the same library work on 2 different apps, but on same machine ?

NoHero
January 23rd, 2006, 03:57 PM
Maybe your thirdparty control needs InitCommonControls() or CoInitialize()...

Zappo
January 23rd, 2006, 04:14 PM
Does your third party library need to be initialized in any way before you start doing anuthing ?AUGH! :blush:

...yes, that was it. Got to call a registration thing first. Thanks.

Now forgive me while I find a place to hide and die. :blush:

Is there a name for when you waste the better part of a day on something that turns out to be utterly trivial?

kirants
January 23rd, 2006, 04:21 PM
Is there a name for when you waste the better part of a day on something that turns out to be utterly trivial?

It's called EXPERIENCE !!
Good luck :wave: