Share via


Most users do not read documentation

This was something our User-Experience folks keep telling us. Frameworks and UI needs to be designed such that they fall into the pattern that'll be assumed by the user.

Recently I got bitten by this. I was writing some verification code which needed to get the pixel color from a location on desktop and match it against a known color. I used the following code

 int hwnd = Native.GetDesktopWindow();
int desktopDC = Native.GetWindowDC(hwnd);
uint pixel = Native.GetPixel(desktopDC, x, y);
Native.ReleaseDC(hwnd, desktopDC);
Color realCol = Color.FromArgb((int)pixel);

Then I was comparing the RGB components of realCol with my expectedColor. Funnily the test was failing each time. Then I dug a bit into the documentation and to my utter disbelief found that the following code was yielding me ABGR and not ARGB.

GetPixel returns COLORREF who's documentation states that the color is stored in 0x00bbggrr. This resulted in this.

Comments

  • Anonymous
    May 11, 2006
    Don't forget that the same COLORREF documentation states that "The maximum value for a single byte is 0xFF."