Windows 2000非対応アプリを動かすとウインドウが透明になることがある理由が判明
今まで、Windows 2000で非対応アプリを起動した時よく発生する『ウィンドウの中が透明で描画されない現象』原因が不明だったのですがようやく理由が判明しました。
同じプログラムを Windows 10とかで起動すると
こうなります。
FillRect などの古いAPIで描画すると半透明に対応していないので、指定した色がそのまま出てくるのですが、Gdiplus::SolidBrush などで定義したブラシは最上位が α プレーンになります。
0 を指定すると透明なので、何も描画されないわけですが、Windows XP以降の場合、なぜかいったん白で初期化するので、描画されなくても気づかないという訳です。
つまり、Windows 2000で透明になっちゃうのはプログラム側のバグなんですね ・ω・
例えば、吉里吉里のゲームアプリなんかがそうですね ・ω・
The reason why the window becomes transparent when running an application that is not compatible with Windows 2000 is related to how the operating system handles transparency and rendering of graphical elements.
In older versions of Windows like Windows 2000, the APIs (Application Programming Interfaces) used for graphic drawing, such as FillRect, did not support transparency. This means that when you draw using these APIs, the specified color appears as is, without any transparency.
However, newer APIs like Gdiplus::SolidBrush support transparency. These brushes use an alpha (α) channel to control transparency. When you specify an alpha value of 0, the brush becomes transparent, and nothing is drawn.
The problem occurs when incompatible applications with Windows 2000 use these transparent brushes. In Windows 2000, the operating system does not handle these transparent brushes correctly and initializes them to white by default. This means that even if nothing is drawn, the window appears to be filled with white, creating the illusion of a transparent window.
However, in later versions of Windows like Windows XP, this issue was fixed, and transparent brushes are initialized correctly. Therefore, even if an incompatible application uses these transparent brushes, the window does not appear transparent because it is not filled with white. you are capable to fix it ?
>>1
no it’s the other way around
In Windows 2000, handle these transparent brushes correctly and initializes them to transparent.
However, in later versions of Windows like Windows XP, this issue was ocuured, transparent brushes are initialized white brush not correctly.