I have some problems when working with Win32 api.

  1. Changing the text and background color of a button doesn't take effect. My code:

    case WM_CTLCOLORBTN:
            COLORREF colorref;
            colorref = RGB(0,0,255);
            HBRUSH hBrushBtn;
            hBrushBtn = CreateSolidBrush(colorref);
            return ((LRESULT)hBrushBtn);
        break;
  2. How do I create selectable text. My code:

    text = CreateWindow("STATIC","text",WS_VISIBLE | WS_CHILD , 0,0,100,60, hwnd , NULL, NULL, NULL);

  3. How do I create a filled rectangle?

This looks correct on the surface but from what I read is not reliable. That is, may not have the desired effect in all situations. I'd leave it alone and complete your app. The background color of a button doesn't add much value IMO. Also if you want, just make the button a graphic and take full control.

Sets the colors for the specified display elements. Display elements are the various parts of a window and the display that appear on the system display screen.

My suggestion, if you're going to use c++ to program a Windows GUI, use Visual Studio. It will interface c++ with the .net library and make your programming much easier.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.