龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > VC开发 >

用VC实现桌面文字背景透明摆脱黑白

时间:2009-12-30 15:42来源:未知 作者:admin 点击:
分享到:
Module name : Transparent.cpp * * Module description : * To make desktop icon text background transparent. * * Project : * * Target platform : Win32 * * Compiler Library : Visual C++ 6.0 * * Author : Richard Shen * * Creation date : 19 June

Module name : Transparent.cpp
*
* Module description :
* To make desktop icon text background transparent.
*
* Project :
*
* Target platform : Win32
*
* Compiler & Library : Visual C++ 6.0
*
* Author : Richard Shen
*
* Creation date : 19 June, 1999
*
#include <windows.h>

int main(void)
{
HWND hWnd;

hWnd = GetDesktopWindow();
if ((hWnd = FindWindowEx(hWnd, 0, "Progman", "Program Manager")) == 0)
return 1;

if ((hWnd = FindWindowEx(hWnd, 0, "SHELLDLL_DefView", NULL)) == 0)
return 1;

if ((hWnd = FindWindowEx(hWnd, 0, "SysListView32", NULL)) == 0)
return 1;

// Change icon text attributes
SendMessage(hWnd, 0x1026, 0, 0xffffffff); // Turn background to transparent
SendMessage(hWnd, 0x1024, 0, 0x00ffffff); // Turn foregound to white

InvalidateRect(hWnd, NULL, TRUE); // Repaint

return 0;
} // main()

精彩图集

赞助商链接