Common control initialization... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Common control initialization...

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
I'm going to be using some common controls in my Windowing library and have a question about initializing the common controls. I know that I must call "InitCommonControlsEx()" prior to using them and I know that calling the function multiple times with different types of common controls stacks, and all of the controls become available, but what if I call it twice and use the same common control type? I have a base class that will initialize the common controls when an instance of said class is created. However, multiple types of control classes are sub-classes of this base class, such as a tab control or a progress bar.

Now assume I have an application that creates two instances of tab controls. This means that "InitCommonControlsEx()" was called to initialize the tab control type (WC_TABCONTROL) twice. Will this cause a problem? Since each class will be its own unique instance, I cannot set a simple boolean flag that says whether or not the common controls have been initialized since the multiple control classes would all have to know about each other and check with themselves every time a class is instantiated.

I did have an idea however, but am not sure it would work. I know that if I have a static method in one class, all instances of said class will share that method. If I declare a boolean variable static in my base class, will every sub-class have access to that one variable, or will each sub-class have its own unique copy?

Sign In or Register to comment.