@aloneguid ... aurait dû voir cela il y a longtemps .. merci monsieur! @ver (concernant la solution de solution de 2008 par rapport à;) - une approche de type B52, un bombardement de tapis sur tout ce qui est SysTreeView32 dans un devenv.exe. Possible supplémentaire pour param couleur désirée, sinon RVB (220220220) - qui fonctionne le mieux pour moi
#include <windows.h>
#include "psapi.h"
#include "shlwapi.h"
#include "commctrl.h"
COLORREF clr = RGB(220,220,220);
BOOL CALLBACK wenum(HWND hwnd, LPARAM lParam)
{
const UINT cb = 261;
static wchar_t name[] = L"SysTreeView32",
tmp[cb] = {0};
if(::GetClassNameW(hwnd, tmp, 260) && 0 == _wcsicmp(name, tmp))
{
::SendMessageW(hwnd, TVM_SETBKCOLOR, 0, (LPARAM)clr);
}
return TRUE;
}
BOOL CALLBACK EnumTops(HWND hwnd, LPARAM lParam)
{
DWORD dwThreadId = 0,
dwProcessId = 0;
HINSTANCE hInstance;
static wchar_t derVS[] = L"devenv.exe";
wchar_t name[_MAX_PATH] = {0},
*exe = 0;
HANDLE hProcess;
if (!hwnd) return TRUE; // Not a window
if (!::IsWindowVisible(hwnd)) return TRUE; // Not visible
if (!SendMessage(hwnd, WM_GETTEXT, sizeof(name), (LPARAM)name))
return TRUE; // No window title
dwThreadId = GetWindowThreadProcessId(hwnd, &dwProcessId);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);
if(!GetModuleFileNameEx(hProcess, 0, name, sizeof(name))) goto exit;
exe = ::PathFindFileNameW(name);
if((void*)exe == (void*)name) goto exit; // mhm? maybe not exit?
if(_wcsicmp(derVS, exe)) goto exit;
EnumChildWindows(hwnd, wenum, (LPARAM)hProcess);
exit:
CloseHandle(hProcess);
int res = GetLastError();
return res;
}
int wmain(int argc, wchar_t * argv[])
{
if(argc >= 2)
{
wchar_t *end = 0;
long l = wcstol(argv[1], &end, 16);
clr = (DWORD)l;
}
::EnumWindows(EnumTops, NULL);
return 0;
}
Salut beau travail! Comment avez-vous fait? – zadam
trivial, trouver la fenêtre de l'explorateur de solution qui est un contrôle treeview , et en envoyant le message de Windows pour changer des couleurs :) –
@aloneguid puis-je obtenir une version VS2008 quelque part? (Ou obtenir le code source pour cela?) – ver