hi all,

I seems to encountered some problem with creating a MDI.

I have download the MDI zip from icz 's tut site.

what I want to do is want the MDI Child's client area is set to other background color instead of WHITE.

but it seems doesn't work .

I have tried this approaches:

1) in the WM_PAINT msg : get the hdc, get the rect area of the child window, and paint the area with gray.

2)in the WM_CREATE msg : create a new window and size it to totally fit and cover the child window's rect area.

But the 2 approches above doesn't work :(

can someone give me some ideas or help me out please???

p.s.: I also include the source that I have working on

thankx in adv,
Posted on 2002-11-21 04:32:03 by Yanda
subclass and process WM_ERASEBKGND
Changes Background Color of MDI Client
Posted on 2002-11-21 09:43:40 by TBD
Thankx TBD for replying,
I have visited the site, and checked it over.

I tried to apply the idea from that example,

but GCW_HBRBACKGROUND value seem to obsoleted from win32, said ms staffs..

now I am bit confuse how to sub class MDI,

I have attached my source, I duno what I did wrong,, but it just doesn't work. the bak ground still not change.

Please help me out.

thankx in adv,
Posted on 2002-11-22 02:30:26 by Yanda
i used another approach, with filling the MDI window.
the only problem is if you create another child it remains white ...

hope it helps somehow
Posted on 2002-11-22 04:04:36 by TBD

thankx for the idea,
I understand what u mean, from your idea I could make all child same with a filled bkg, but I just want to understand the MS subclassing approach. It seem interesting to me.

but some how I couldn't get that sample to work from MS.

I try to recompile the MDI subclassing source from MS, but I get error, stating GCW_HBRBACKGROUND is undefined symbol, so I gotta find out what that equ to...

and also, Am I did the rite way as the source from MS???

I try to follow them and convert them to asm , but my C knowledge is limited,,,

I wonder if anyone can help me ???

thankx in adv,
Posted on 2002-11-22 04:27:35 by Yanda

i cannot compile MS code because i dont have access to any C compiler, so i cannot say if the source works or not. if you can compile and if the coloring works can you send me the .exe to have a look ?
Posted on 2002-11-22 04:32:21 by TBD
.. till i find what is the problem with SetClassWord here is a working version
of MDI coloring using WM_PAINT
Posted on 2002-11-22 06:51:44 by TBD
Thankx TBD, thankx for the help!

I actually solved the problem coz I forgot to refresh the client area of it...:stupid:

and now I also have your solution :alright:

Posted on 2002-11-24 02:59:37 by Yanda
there is a much simpler solution which you haven't tried. First, use RegisterClassEx to register the new type of window (if you are subclassing a system window then do a GetClassInfoEx to fill a WNDCLASSEX struct). Before registering the window, change the hbrBackground member of the WNDCLASSEX to a brush of the appropriate color. Then, use CreateMDIWindow with the name of the new class you have registered, and your MDI child will be created with the background color you specified. Doing it this way means that you will not have to intercept any messages in the wndproc, and you won't have to do any other work.
Posted on 2002-11-24 04:58:40 by sluggy
hi, Sluggy and TBD

I thank you two for the ideas and helps.

rite now, I try to create some controls or some thing on the MDI CHILD window,, but it seems no good.

I tried to register a class and create a popup window on the child window so I can do stuffs on it..

but the createwindowex functions always failed, I duno y,,, check it some many times....... :stupid:

I also include the source I have working on,,,

can someone help me out ??

Posted on 2002-11-25 14:49:07 by Yanda
I am sorry ,

but I really need to know what I did wrong,,

please someone help me out debug my source what is wrong with it,,

I couldn't get the window display on the child window using registerclassex to create a new class....

but all other controls such as buttons, statics, will work,, but only the new class window doesn't work,,

it won't create,, pleae help me ;(

thankx in adv
Posted on 2002-11-26 01:53:11 by Yanda
what was wrong in your code
1. class name in creating control
2. WS_POPUP not needed

you must add
WM_SIZE handling to show the control inside the MDI client frame

here is a little example based on your code with a small button that does nothing :)

hope it helps ...
... also dont forget, google is your friend, you only need to ask it properly
Posted on 2002-11-26 02:36:39 by TBD
thankx for replying tbd,

I think u missed understand me,,

what I want is :
1)create a custom control within the child window,
2)make the control look similar to a popup window or static control
3)and make it size to fill all the child window area
4) it has its own message handling proc

sorry for the miss present last post

thankx in adv,
Posted on 2002-11-26 03:03:27 by Yanda
hi hi,

thankx for the help,
anyways I found my bug!!!:stupid:

I forgot a RET at the DefwindowProc hahahahahahaha
not wonder my window won't show up :)

arr,, hate bugs!!!!

but I got it now :alright:

Posted on 2002-11-26 04:32:14 by Yanda