<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic colored buttons in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975505#M24940</link>
    <description>Hi, &lt;BR /&gt;I am trying to get 'colored' buttons according to the  &lt;BR /&gt;code below. &lt;BR /&gt; &lt;BR /&gt;1) I create a 'main' window hWnd &lt;BR /&gt;&lt;BR /&gt;2) I create a number of buttons ButtonWnd(i) to move  &lt;BR /&gt;   around hWnd to different locations depending on  &lt;BR /&gt;   some calculated results &lt;BR /&gt; &lt;BR /&gt;my problem is that I would like to set different colors  &lt;BR /&gt;to the buttons instead of the gray default one. &lt;BR /&gt; &lt;BR /&gt;I have tried to respond to the WM_CTLCOLORBTN message  &lt;BR /&gt;without success. &lt;BR /&gt; &lt;BR /&gt;I do not have any text on the buttons, I just use them  &lt;BR /&gt;as push-button-like check boxes.  &lt;BR /&gt; &lt;BR /&gt;How do I proceed to get colored buttons? &lt;BR /&gt; &lt;BR /&gt;/bjorn &lt;BR /&gt; &lt;BR /&gt; a stripped down code snippet follows: &lt;BR /&gt;&lt;PRE&gt; &lt;BR /&gt;... &lt;BR /&gt;!main windows &lt;BR /&gt;   iflag=IOR(WS_CLIPCHILDREN, &amp;amp; &lt;BR /&gt;         IOR(WS_OVERLAPPEDWINDOW,WS_SIZEBOX)) &lt;BR /&gt;   hWnd = CreateWindowEx(0,           &amp;amp;    &lt;BR /&gt;                 lpszClassName,       &amp;amp; &lt;BR /&gt;                 szCosTitle,          &amp;amp; &lt;BR /&gt;                 int(iflag),          &amp;amp; &lt;BR /&gt;                 0,                   &amp;amp; &lt;BR /&gt;                 0,                   &amp;amp; &lt;BR /&gt;                 cxWnd,               &amp;amp; &lt;BR /&gt;                 cyWnd,               &amp;amp; &lt;BR /&gt;                 NULL,                &amp;amp; &lt;BR /&gt;                 hmenu,               &amp;amp; &lt;BR /&gt;                 hInstance,           &amp;amp; &lt;BR /&gt;                 NULL                 &amp;amp; &lt;BR /&gt;                 ) &lt;BR /&gt;... &lt;BR /&gt;   iflag = IOR(BS_AUTOCHECKBOX, IOR(BS_PUSHLIKE, &amp;amp; &lt;BR /&gt;           IOR(WS_VISIBLE, WS_CHILD))) &lt;BR /&gt;   do i=1,n &lt;BR /&gt;!buttons &lt;BR /&gt;   ButtonhWnd(i) = CreateWindowEx(0,     &amp;amp; &lt;BR /&gt;                        "BUTTON"C,       &amp;amp; &lt;BR /&gt;                        ""C,             &amp;amp; &lt;BR /&gt;                        iflag,           &amp;amp; &lt;BR /&gt;                        100,             &amp;amp; &lt;BR /&gt;                        100,             &amp;amp; &lt;BR /&gt;                        10,              &amp;amp; &lt;BR /&gt;                        10,              &amp;amp; &lt;BR /&gt;                        hWnd,            &amp;amp; &lt;BR /&gt;                        NULL,            &amp;amp; &lt;BR /&gt;                        hInstance,       &amp;amp; &lt;BR /&gt;                        0                &amp;amp; &lt;BR /&gt;                        ) &lt;BR /&gt;    enddo &lt;BR /&gt; &lt;BR /&gt;integer(4) function &amp;amp; &lt;BR /&gt;           MainWndProc( hWnd, mesg, wParam, lParam ) &lt;BR /&gt;... &lt;BR /&gt;  select case ( mesg ) &lt;BR /&gt;      case (WM_CREATE) &lt;BR /&gt;         hBluebrush = CreateSolidBrush( RGB(0,0,255) ) &lt;BR /&gt;      case (WM_CTLCOLORBTN) &lt;BR /&gt;         hdcButton  = wParam; &lt;BR /&gt;         hwndButton = lParam;  &lt;BR /&gt;         i = SelectObject( hdcButton, hBluebrush ) &lt;BR /&gt;         i = SetBkColor(  hdcButton, RGB(0,0,255) ) &lt;BR /&gt;         MainWndProc = hBluebrush !return blue brush &lt;BR /&gt;         return &lt;BR /&gt;      case (WM_DESTROY) &lt;BR /&gt;        bret = DeleteObject( hBluebrush ) &lt;BR /&gt;        call PostQuitMessage( 0 ) &lt;BR /&gt;      case DEFAULT &lt;BR /&gt;        MainWndProc =  &amp;amp; &lt;BR /&gt;        DefWindowProc( hWnd, mesg, wParam, lParam ) &lt;BR /&gt;        return &lt;BR /&gt;   end select &lt;BR /&gt;   MainWndProc = 0 &lt;BR /&gt;   return &lt;BR /&gt;end function MainWndProc &lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 Nov 2001 17:40:41 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2001-11-28T17:40:41Z</dc:date>
    <item>
      <title>colored buttons</title>
      <link>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975505#M24940</link>
      <description>Hi, &lt;BR /&gt;I am trying to get 'colored' buttons according to the  &lt;BR /&gt;code below. &lt;BR /&gt; &lt;BR /&gt;1) I create a 'main' window hWnd &lt;BR /&gt;&lt;BR /&gt;2) I create a number of buttons ButtonWnd(i) to move  &lt;BR /&gt;   around hWnd to different locations depending on  &lt;BR /&gt;   some calculated results &lt;BR /&gt; &lt;BR /&gt;my problem is that I would like to set different colors  &lt;BR /&gt;to the buttons instead of the gray default one. &lt;BR /&gt; &lt;BR /&gt;I have tried to respond to the WM_CTLCOLORBTN message  &lt;BR /&gt;without success. &lt;BR /&gt; &lt;BR /&gt;I do not have any text on the buttons, I just use them  &lt;BR /&gt;as push-button-like check boxes.  &lt;BR /&gt; &lt;BR /&gt;How do I proceed to get colored buttons? &lt;BR /&gt; &lt;BR /&gt;/bjorn &lt;BR /&gt; &lt;BR /&gt; a stripped down code snippet follows: &lt;BR /&gt;&lt;PRE&gt; &lt;BR /&gt;... &lt;BR /&gt;!main windows &lt;BR /&gt;   iflag=IOR(WS_CLIPCHILDREN, &amp;amp; &lt;BR /&gt;         IOR(WS_OVERLAPPEDWINDOW,WS_SIZEBOX)) &lt;BR /&gt;   hWnd = CreateWindowEx(0,           &amp;amp;    &lt;BR /&gt;                 lpszClassName,       &amp;amp; &lt;BR /&gt;                 szCosTitle,          &amp;amp; &lt;BR /&gt;                 int(iflag),          &amp;amp; &lt;BR /&gt;                 0,                   &amp;amp; &lt;BR /&gt;                 0,                   &amp;amp; &lt;BR /&gt;                 cxWnd,               &amp;amp; &lt;BR /&gt;                 cyWnd,               &amp;amp; &lt;BR /&gt;                 NULL,                &amp;amp; &lt;BR /&gt;                 hmenu,               &amp;amp; &lt;BR /&gt;                 hInstance,           &amp;amp; &lt;BR /&gt;                 NULL                 &amp;amp; &lt;BR /&gt;                 ) &lt;BR /&gt;... &lt;BR /&gt;   iflag = IOR(BS_AUTOCHECKBOX, IOR(BS_PUSHLIKE, &amp;amp; &lt;BR /&gt;           IOR(WS_VISIBLE, WS_CHILD))) &lt;BR /&gt;   do i=1,n &lt;BR /&gt;!buttons &lt;BR /&gt;   ButtonhWnd(i) = CreateWindowEx(0,     &amp;amp; &lt;BR /&gt;                        "BUTTON"C,       &amp;amp; &lt;BR /&gt;                        ""C,             &amp;amp; &lt;BR /&gt;                        iflag,           &amp;amp; &lt;BR /&gt;                        100,             &amp;amp; &lt;BR /&gt;                        100,             &amp;amp; &lt;BR /&gt;                        10,              &amp;amp; &lt;BR /&gt;                        10,              &amp;amp; &lt;BR /&gt;                        hWnd,            &amp;amp; &lt;BR /&gt;                        NULL,            &amp;amp; &lt;BR /&gt;                        hInstance,       &amp;amp; &lt;BR /&gt;                        0                &amp;amp; &lt;BR /&gt;                        ) &lt;BR /&gt;    enddo &lt;BR /&gt; &lt;BR /&gt;integer(4) function &amp;amp; &lt;BR /&gt;           MainWndProc( hWnd, mesg, wParam, lParam ) &lt;BR /&gt;... &lt;BR /&gt;  select case ( mesg ) &lt;BR /&gt;      case (WM_CREATE) &lt;BR /&gt;         hBluebrush = CreateSolidBrush( RGB(0,0,255) ) &lt;BR /&gt;      case (WM_CTLCOLORBTN) &lt;BR /&gt;         hdcButton  = wParam; &lt;BR /&gt;         hwndButton = lParam;  &lt;BR /&gt;         i = SelectObject( hdcButton, hBluebrush ) &lt;BR /&gt;         i = SetBkColor(  hdcButton, RGB(0,0,255) ) &lt;BR /&gt;         MainWndProc = hBluebrush !return blue brush &lt;BR /&gt;         return &lt;BR /&gt;      case (WM_DESTROY) &lt;BR /&gt;        bret = DeleteObject( hBluebrush ) &lt;BR /&gt;        call PostQuitMessage( 0 ) &lt;BR /&gt;      case DEFAULT &lt;BR /&gt;        MainWndProc =  &amp;amp; &lt;BR /&gt;        DefWindowProc( hWnd, mesg, wParam, lParam ) &lt;BR /&gt;        return &lt;BR /&gt;   end select &lt;BR /&gt;   MainWndProc = 0 &lt;BR /&gt;   return &lt;BR /&gt;end function MainWndProc &lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Nov 2001 17:40:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975505#M24940</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-11-28T17:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: colored buttons</title>
      <link>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975506#M24941</link>
      <description>The best you can get is a bitmap or icon attached to the button with BS_BITMAP or BS_ICON style (see recent &lt;A href="http://ztxwbcwspro01.ztx.compaq.com/forum?13@@.eeff9c5/1"&gt;thread&lt;/A&gt; ). The feature you discovered is by design. Remarks on WM_CTLCOLORBTN in the help aren't very clear, though. &lt;BR /&gt;A more complicated alternative would be to use owner-draw buttons (BS_OWNERDRAW) but that would require that you do all drawing by yourself &lt;BR /&gt;when processing WM_DRAWITEM; (but DrawFrameControl(DFC_BUTTON, DFC_BUTTONPUSH,...) might be very helpful with that). &lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt;Jugoslav</description>
      <pubDate>Thu, 29 Nov 2001 19:14:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975506#M24941</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-11-29T19:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: colored buttons</title>
      <link>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975507#M24942</link>
      <description>Documentation on WM_CTLCOLORBTN is very spotty, and would lead one to believe that this message works as described.  But it doesn't; a hunt through the various archives and books turns up a comment from Petzold in his Win95 book (still valuable) that WM_CTLCOLORBTN only works with owner-draw buttons, which is of course a nonsensical and totally useless situation.  Go figure.  As Jugoslav has noted, making buttons with bitmaps does work, and is very easy.</description>
      <pubDate>Sun, 02 Dec 2001 05:47:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975507#M24942</guid>
      <dc:creator>pcurtis</dc:creator>
      <dc:date>2001-12-02T05:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: colored buttons</title>
      <link>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975508#M24943</link>
      <description>thanks folks! &lt;BR /&gt;ICONS works OK &lt;BR /&gt; &lt;BR /&gt;regs &lt;BR /&gt;/Bjrn</description>
      <pubDate>Mon, 03 Dec 2001 23:17:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/colored-buttons/m-p/975508#M24943</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-12-03T23:17:30Z</dc:date>
    </item>
  </channel>
</rss>

