SetWindowLongA设置桌面图标排列
今天碰到一个有意思的东西。对于那些懒得打扫电脑桌面,又嫌桌面不够摆放图标的人可以试试。
/* 改变桌面图标排列方式 来自Trojan 2012-09-07 */ #include <Windows.h> #include <stdio.h> int main(int argc, const char **argv, const char **envp) { HWND hWndDesktop; // eax@1 HWND hWndProgman; // eax@1 HWND hWndSHELLDLL_DefView; // eax@1 HWND hWndSysListView32; // eax@1 HWND hWndSysListView32_1; // esi@1 LONG nWindowLong; // eax@1 int result; // eax@2 hWndDesktop = GetDesktopWindow(); hWndProgman = FindWindowExA(hWndDesktop, 0, "Progman", 0); hWndSHELLDLL_DefView = FindWindowExA(hWndProgman, 0, "SHELLDLL_DefView", 0); hWndSysListView32 = FindWindowExA(hWndSHELLDLL_DefView, 0, "SysListView32", 0); hWndSysListView32_1 = hWndSysListView32; nWindowLong = GetWindowLongA(hWndSysListView32, -16);// GWL_STYLE = -16 if ( nWindowLong & 3 ) { LOBYTE(nWindowLong) = nWindowLong & 0xFC; SetWindowLongA(hWndSysListView32_1, -16, nWindowLong);// GWL_STYLE result = 0; } else { LOBYTE(nWindowLong) = nWindowLong & 0xFE | 2; SetWindowLongA(hWndSysListView32_1, -16, nWindowLong);// GWL_STYLE result = 0; } return result; }
运行结果:
1、运行前的桌面。桌面图标文件多了就不好摆放了。

2、运行后

3、再次运行

。。。。。。。。。。。。。
2012-09-07

浙公网安备 33010602011771号