This example sets new border colors for all the push buttons in the application.
/******************************************************************/ /* Query the number of colors used by a push button. */ /******************************************************************/ cCount = WinQueryControlColors( HWND_DESKTOP, /* Desktop window handle */ CCT_PUSHBUTTON, /* Select push button */ CCF_COUNTCOLORS, /* Count number of colors */ 0, 0); pactlColor = (PCTLCOLOR)malloc(sizeof(CTLCOLOR) * cCount); /******************************************************************/ /* Query all the colors used by push buttons in application. */ /******************************************************************/ WinQueryControlColors(HWND_DESKTOP, /* Desktop window handle */ CCT_PUSHBUTTON, /* Select push button */ CCF_ALLCOLORS | /* Return all colors ... */ CCF_APPLICATION, /* ... for application */ cCount, /* Size of array */ pactlColor); /* Buffer for color data */ /******************************************************************/ /* Give the global push button borders a red color. */ /******************************************************************/ for (i = 0; i < cCount; i++) { switch (pactlColor[i].clrIndex) { case CCI_BORDERLIGHT: pactlColor[i].clrValue = 0x00FFC0C0; /* Light red */ break; case CCI_BORDERDARK: pactlColor[i].clrValue = 0x00C00000; /* Dark red */ break; default: pactlColor[i].clrValue = CCV_DEFAULT; /* Default color */ break; } } /******************************************************************/ /* Set the new border colors for all push buttons in application. */ /******************************************************************/ WinSetControlColors(HWND_DESKTOP, /* Desktop window handle */ CCT_PUSHBUTTON, /* Select push button */ CCF_APPLICATION, /* Application colors */ cCount, /* Number of colors */ pactlColor); /* Buffer for color data */