March 3, 2021
Hot Topics:

Create a Status Bar using the API

  • By Sam Huggill
  • Send Email »
  • More Articles »

Fed up with distributing the 509KB ComCtl32.ocx with your program just for a single control? In this article, I will take you through creating the common controls using only the Windows API. I will demonstrate how to create a status bar using the CreateStatusWindowA API call. Topics such as adding panels, setting text and a font, getting text and positioning the status bar will be covered.

I first came across this API call in the ComCtrl.h header file. You can't find it in the Windows API viewer (don't know why) but just about all the calls you need can be found in the Windows Header files.

Note: These files are written in C++ syntax and therefore you will need to know the basics of translating this information.

In future articles we will be using the CreateWindowEx call, but for now we can use the CreateStatusWindow call. When we call this function, it returns the the window handle (hWnd) of our new control or 0 if it failed. We can then use this window handle to change the way it looks, and get information about it.

Just a quick note to let you know that all the project files (a form, bas module, project and compiled exe) amount to a mere 4% of the ComCtl32.ocx!

Page 1 of 3

This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date