Hi,
I did a program which is dialog based application,in that i add listbox dynamically by deriving a class form CListBox class.and the list box is created in OnInitDialog() method.but when i add the listbox to the dialog using DDX_Control function it is failed to assert the listbox,because 3rd parameter is not initialized which is null.so, i need to initialize the list box before dialog gets intialized.
so, this is is done in precreatewindow() . but i am not able to call this function.it never execute.
can any one help me , can we call precreatewindow() function from the CDialog class?
if, No what is the exact reason?
thanks in advance..

Recommended Answers

All 4 Replies

You are probably trying to create the list box before the dialog box is created. Move the code to just before the return statement in OnInitDialog() as shown here.

thnaks u but what happen when i write that code into oncreate() method?

thanks in advance

From Microsoft about PreCreateWindow():

Never call this function directly.

See the comments in this link

You have to override that function in your CListBox-derived class.

yes, now i cam able to build that one.
Thanks....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.