Common control initialization...

SephirothSephiroth Fayetteville, NC, USA
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.

Howdy, Stranger!

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