Why isn't PreCreateWindow called 
Author Message
 Why isn't PreCreateWindow called

I have a CListCtrl derived class function:

BOOL CMyListCtrl::PreCreateWindow(CREATESTRUCT& cs)
{
        ...
        return CListCtrl::PreCreateWindow(cs);

Quote:
}

I use the CMyListCtrl control in a dialog, but the PreCreateWindow
function is never called.

What do I need to do in order to ensure that PreCreateWindow is called.

I tried to handle the ON_WM_CREATE() message as well, but the OnCreate
function wasn't called either.

Torben



Fri, 14 Jul 2000 03:00:00 GMT  
 Why isn't PreCreateWindow called

Try PreSubclassWindow (). That function is called not PreCreateWindow or
Create () since it is created first and then subclassed to behave like
your CMyListCtrl..

Quote:

> I have a CListCtrl derived class function:

> BOOL CMyListCtrl::PreCreateWindow(CREATESTRUCT& cs)
> {
>         ...
>         return CListCtrl::PreCreateWindow(cs);
> }

> I use the CMyListCtrl control in a dialog, but the PreCreateWindow
> function is never called.

> What do I need to do in order to ensure that PreCreateWindow is called.

> I tried to handle the ON_WM_CREATE() message as well, but the OnCreate
> function wasn't called either.

> Torben

--
Girish Bharadwaj [VC++/MVP]
http://members.tripod.com/~GBharadwaj/index.html



Fri, 14 Jul 2000 03:00:00 GMT  
 Why isn't PreCreateWindow called


Quote:
>I have a CListCtrl derived class function:

>BOOL CMyListCtrl::PreCreateWindow(CREATESTRUCT& cs)
>{
>        ...
>        return CListCtrl::PreCreateWindow(cs);
>}

>I use the CMyListCtrl control in a dialog, but the PreCreateWindow
>function is never called.

>What do I need to do in order to ensure that PreCreateWindow is called.

>I tried to handle the ON_WM_CREATE() message as well, but the OnCreate
>function wasn't called either.

You need to subclass the list control.  You can either do it in
DoDataExchange() using DDX_Control(), or CWnd::SubclassWindow in
OnInitDialog().

--------------------------------------------------------------------------------

Principal Software Engineer       Corporate Web Page:     http://www.xiotech.com

Eden Prairie, MN                  Personal Home Page:   http://www.visi.com/~nde

"Question authority...and the authorities will end up questioning YOU!"
--------------------------------------------------------------------------------



Sat, 15 Jul 2000 03:00:00 GMT  
 Why isn't PreCreateWindow called

On Tue, 27 Jan 1998 01:04:24 GMT,

Quote:


>>I have a CListCtrl derived class function:

>>BOOL CMyListCtrl::PreCreateWindow(CREATESTRUCT& cs)
>>{
>>        ...
>>        return CListCtrl::PreCreateWindow(cs);
>>}

>>I use the CMyListCtrl control in a dialog, but the PreCreateWindow
>>function is never called.

>>What do I need to do in order to ensure that PreCreateWindow is called.

>>I tried to handle the ON_WM_CREATE() message as well, but the OnCreate
>>function wasn't called either.

>You need to subclass the list control.  You can either do it in
>DoDataExchange() using DDX_Control(), or CWnd::SubclassWindow in
>OnInitDialog().

If you subclass the window, its already created, isn't it?  

I think to be able to handle WM_CREATE, you need to register a new
window class and call CWnd::Create with the class name as the first
param.  PreCreateWindow() seems to be called from CXXXXWnd::Create, so
it won't be called if the system is creating the window, e.g. if
CMyListCtrl is being created from a dialog template.

Don Grasberger
(remove --- from address to e-mail)



Sat, 15 Jul 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Qestion: why isn't PreCreateWindow() called here

2. Why isn't OnDraw/OnPaint called?

3. CPropertySheet OnOK-method isn't called, why?

4. PreCreateWindow - Why is it called twice for CMDIFrameWnd

5. NULL isn't 0/0 isn't NULL

6. Should CMainFrame's PreCreateWindow() get called twice ?

7. why isn't stdio full-duplex?

8. Top Left Icon - Why Isn't it Showing Up Correctly

9. Why isn't malloc necessary here?

10. HELP - why isn't ld working

11. why isn't there a strcasestr ?

12. Why isn't there a ->= operator?

 

 
Powered by phpBB® Forum Software