Click here to Skip to main content
15,913,289 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 need to create a status bar with following characteristics:

- It has blue background;
- Instead of text it has two push buttons;
- It has an icon;

So far I was able to learn how to create status bar, set number of its parts, set an icon, and set its text.

I have tried setting background with following code
C#
SendMessage( hsbStatus, SB_SETBKCOLOR, (WPARAM)0, (LPARAM) RGB( 0, 0, 255) );
in WM_CREATE, but had no success.

I have checked MSDN API documentation and couldn't find anything like " WM_CTLCOLOR-like " thing to use, as I would have used if static control or button was the issue.

Also, the reason I think I should use buttons, is because user must go to certain links when certain text in status bar is clicked, and background of that text is an image, so buttons are first thing that came to my idea, but I will accept other suggestions as well.

So my question is:

Should I owner draw the status bar ( if so please provide some guidance in view of code example or straightforward instructions ) or is there another way to achieve all this?

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
Updated 13-May-13 12:41pm
v2

1 solution

You better create a own window with all the needed stuff and set its position where your status bar is located.
 
Share this answer
 
Comments
MyOldAccount 14-May-13 9:13am    
OK, I will try that.
I will report my results as soon as possible.
Thank you for your advice.
KarstenK 14-May-13 9:26am    
make the window a child of the apptobiate status bar window, so it will have always the right position.

Good luck ;-)
MyOldAccount 14-May-13 11:03am    
I have made a static control, and sized it properly to fit. Also, by handling WM_CTLCOLORSTATIC properly, I have managed to set blue background.
Instead of buttons, I will use static controls with styles SS_NOTIFY and SS_ICON set.
That is the problematic part:
How to create those child static controls in my "status bar"?
I have posted the same question in " Quick Answers " section, but got no luck so far.
Perhaps you can help, so I can mark your answer as solution to my question ?
After all, it solves my problem :)

UPDATE:
-----------------------------------------------
I have fixed the issue, everything works fine.
I have used static controls, instead of buttons.
Now all I need to do, is figure out how to process their messages.
Since they are children of a static control, I guess their messages are sent to it ( parent static control ), instead to main window.
So my question is:
How do I change above behavior so that child static controls send their notifications to main window, instead to their parent static control ?
KarstenK 15-May-13 2:21am    
You need to overwrite the message queue and forward the messages. I have used overwriting PreTranslateMessage but this also works:

http://msdn.microsoft.com/en-us/library/ms633570%28v=vs.85%29.aspx#subclassing_window

The knowledge: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632589(v=vs.85).aspx
MyOldAccount 16-May-13 16:27pm    
Thank you, it helped!

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