Click here to Skip to main content
15,851,915 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I have a main window with a child static control. I have named the variable hsInfo.

This static control is created with styles SS_BITMAP, SS_NOTIFY and SS_REALSIZECONTROL, and displays bitmap. Also it responds when clicked on it.

Now I need to create another static control with styles same as above, to be on top of the above mentioned static control ( hsInfo ). This static control is named hsHelp.

When I pass hsInfo as the parent window in CreateWindow() for hsHelp, hsHelp doesn't appear at all.
If I click on area where hsHelp should approximately appear, parent static control sends its notification, instead of hsHelp's. It seems as if hsHelp doesn't even exist.

However, if main window's handle is passed as parent, child static control ( hsHelp ) is properly drawn, but its notifications again can't be captured,since clicking on it activates again notification of the other one ( hsInfo ).

My question is following:

What should I change in my code to have one static control to be a child of the other static control?

NOTE:
I should be able to catch notification messages from control when user clicks on it.

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using WIN32 API.

If any other information is required ( source code or something similar ), please ask for it, I will more than gladly supply it.
Posted

1 solution

I have solved this!

I am so embarrassed that I had to actually post a question like this!

The problem was in coordinates passed to the child's CreateWindow() function.

I have calculated the positioning of a child static control related to main window's coordinates, so I have passed 300 and 300 as x and y coordinates, hoping that the child static control will be positioned at the top left of the parent static control.

However, all I had to do is pass 0 and 0 as x and y coordinates, and the child static control was placed on top left position of its parent static control.

It was that simple!
 
Share this answer
 
Comments
Richard C Bishop 14-May-13 12:38pm    
Nice job solving it yourself.
MyOldAccount 14-May-13 12:39pm    
Thank you :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900