How to change system colors for scrollbar?

  • Thread starter Thread starter alikim
  • Start date Start date
A

alikim

Guest
I have a window with a button and an edit component, created like this:

...

LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

switch (msg)
{
case WM_CREATE:

hBtn[0] = CreateWindow(_T("BUTTON"), "Thread", WS_CHILD | WS_VISIBLE, 900, 755, 100, 21, hWnd, (HMENU)(BTN::Thread), hInst, NULL);
SendMessage(hBtn[0], WM_SETFONT, (WPARAM)fontOut, MAKELPARAM(true, 0));

hOut = CreateWindow(_T("EDIT"), _T(""), WS_CHILD | WS_BORDER | WS_VSCROLL | ES_MULTILINE | WS_VISIBLE, 20, 755, 860, 220, hWnd, NULL, hInst, NULL);
SendMessage(hOut, WM_SETFONT, (WPARAM)fontOut, MAKELPARAM(true, 0));

break;

...



I wrote this test function to see how my window (as well as other programs windows) UI will be affected:



void changeSysColors()
{
int nm[32];
DWORD clrOld[32], clrNew[32];
for (int i = 0; i < 31; i++) {
nm = i;
clrOld = GetSysColor(i);
clrNew = RGB(250, 2*i, 0);
prnt("%d. %08X", PV, i, clrOld);
}
if (!SetSysColors(31, nm, clrNew)) prnt("Err #%d", PV, GetLastError()); else prnt("Set");
Sleep(60000);
if (!SetSysColors(31, nm, clrOld)) prnt("Err #%d", PV, GetLastError()); else prnt("Restored");
}




The button in my window is colored red as I expected, but the scrollbar of the edit element is not affected at all. The same is true for other programs I have open, if they have a scrollbar it didn't change.

What is the reason for that?

How do I change sys colors of scrollbars?

Continue reading...
 
Back
Top