This example first queries the count of colors used by a push button. Then it queries all the colors used by 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 */