技术文章 > 让桌面上图标的文字背景变成透明(C)

让桌面上图标的文字背景变成透明(C)

2018-09-20 03:15

文档管理软件,文档管理系统,知识管理系统,档案管理系统的技术资料:
实际上很简单,找到桌面窗口,改变图标文字的属性。
#include
#include
HWND GetDeskWnd()
{
HWND hWnd;
hWnd = GetDesktopWindow();
if ((hWnd = FindWindowEx(hWnd, 0, "Progman", "Program Manager")) == 0)
return NULL;
if ((hWnd = FindWindowEx(hWnd, 0, "SHELLDLL_DefView", NULL)) == 0)
return NULL;
if ((hWnd = FindWindowEx(hWnd, 0, "SysListView32", NULL)) == 0)
return NULL;
return hWnd;
}
int main(void)
{
HWND hWnd;
hWnd = GetDeskWnd();
if(hWnd)
{// Change icon text attributes
SendMessage(hWnd, 0x1026, 0, 0xffffffff); // Turn background to transparent
SendMessage(hWnd, 0x1024, 0, 0x000000ff); // Turn foregound to white
InvalidateRect(hWnd, NULL, TRUE); // Repaint
}
return 0;
} // main()