|
/* |
|
* MIT License |
|
* |
|
* Copyright (c) 2021 krlvm |
|
* |
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
* of this software and associated documentation files (the "Software"), to deal |
|
* in the Software without restriction, including without limitation the rights |
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
* copies of the Software, and to permit persons to whom the Software is |
|
* furnished to do so, subject to the following conditions: |
|
* |
|
* The above copyright notice and this permission notice shall be included in all |
|
* copies or substantial portions of the Software. |
|
* |
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
* SOFTWARE. |
|
*/ |
|
|
|
#include <Windows.h> |
|
#include <Uxtheme.h> |
|
|
|
#pragma comment(lib, "user32.lib") |
|
#pragma comment(lib, "uxtheme.lib") |
|
|
|
#define SEPARATOR 2 |
|
|
|
int UpdateBitmap(HBITMAP hbm) |
|
{ |
|
BITMAP bm; |
|
GetObject(hbm, sizeof(bm), &bm); |
|
|
|
if (!hbm || bm.bmBitsPixel != 32 || bm.bmWidth > 64) |
|
{ |
|
return FALSE; |
|
} |
|
|
|
int side = bm.bmWidth / 2; |
|
|
|
BYTE* pBits = new BYTE[bm.bmWidth * bm.bmHeight * 4]; |
|
GetBitmapBits(hbm, bm.bmWidth * bm.bmHeight * 4, pBits); |
|
|
|
for (int y = 0; y < bm.bmHeight; y++) { |
|
BYTE* pPixel = (BYTE*)pBits + bm.bmWidth * 4 * y; |
|
|
|
for (int x = 0; x < bm.bmWidth; x++) { |
|
|
|
if ( ((x + 1) >= side && (x + 1) < (side + SEPARATOR)) || ((y + 1) >= side && (y + 1) < (side + SEPARATOR))) |
|
{ |
|
pPixel[3] = 0; |
|
} |
|
else |
|
{ |
|
// Windows 11 Logo Color |
|
//pPixel[2] = 0; |
|
//pPixel[1] = 120; |
|
//pPixel[0] = 212; |
|
|
|
pPixel[2] = 255; |
|
pPixel[1] = 255; |
|
pPixel[0] = 255; |
|
|
|
pPixel[3] = 255; |
|
} |
|
|
|
pPixel += 4; |
|
} |
|
} |
|
|
|
SetBitmapBits(hbm, bm.bmWidth * bm.bmHeight * 4, pBits); |
|
|
|
delete[] pBits; |
|
return TRUE; |
|
} |
|
|
|
int ModifyStyle(LPCWSTR pszClassList, int iPartId, int iStateId, int iPropId) |
|
{ |
|
HBITMAP hBitmap; |
|
|
|
HTHEME hTheme = OpenThemeDataForDpi(HWND_DESKTOP, pszClassList, GetDpiForWindow(HWND_DESKTOP)); |
|
|
|
GetThemeBitmap(hTheme, iPartId, iStateId, iPropId, GBF_DIRECT, &hBitmap); |
|
CloseThemeData(hTheme); |
|
|
|
if (!hBitmap) return 0; |
|
|
|
return UpdateBitmap(hBitmap); |
|
} |
|
|
|
int main() |
|
{ |
|
for (int i = 1; i <= 7; i++) |
|
{ |
|
ModifyStyle(L"TaskbarPearl", i, 0, 0); |
|
} |
|
} |
how do i remove this