Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Changing text color in static text control

Changing text color in static text control

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AJarrett
    wrote on last edited by
    #1

    I have a customized Find Dialog (based on CFindReplaceDialog) to which I've added amongst other things a static text box for displaying results of the search in the CListCntl to which the dialog is attached. No problem. Then I thought it would be nice visually to say display "Find failed" in red, success in green. For something that seems like it should be dirt simple, I've plowed through more MSDN doc and CodeProject seemingly related items than I can believe. I must be missing something. Recommendations? Thanks.

    V J 2 Replies Last reply
    0
    • A AJarrett

      I have a customized Find Dialog (based on CFindReplaceDialog) to which I've added amongst other things a static text box for displaying results of the search in the CListCntl to which the dialog is attached. No problem. Then I thought it would be nice visually to say display "Find failed" in red, success in green. For something that seems like it should be dirt simple, I've plowed through more MSDN doc and CodeProject seemingly related items than I can believe. I must be missing something. Recommendations? Thanks.

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      One solution is to add a handler for WM_CTLCOLOR. Update color of the static control inside the handler. Kuphryn

      A 1 Reply Last reply
      0
      • V valikac

        One solution is to add a handler for WM_CTLCOLOR. Update color of the static control inside the handler. Kuphryn

        A Offline
        A Offline
        AJarrett
        wrote on last edited by
        #3

        Yes. That was one avenue that led to a feeling of stupidity. Put a handler in the Find Dialog and SendMesssage to its window. I have yet to find a description of the proper setup of WM_CTLCOLOR wparam, lparam. Do you know a good source for such info? Thanks. Alex.

        1 Reply Last reply
        0
        • A AJarrett

          I have a customized Find Dialog (based on CFindReplaceDialog) to which I've added amongst other things a static text box for displaying results of the search in the CListCntl to which the dialog is attached. No problem. Then I thought it would be nice visually to say display "Find failed" in red, success in green. For something that seems like it should be dirt simple, I've plowed through more MSDN doc and CodeProject seemingly related items than I can believe. I must be missing something. Recommendations? Thanks.

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          Look up WM_CTLCOLORSTATIC in the MSDN Library. Trust in the code Luke. Yea right!

          A 1 Reply Last reply
          0
          • J John R Shaw

            Look up WM_CTLCOLORSTATIC in the MSDN Library. Trust in the code Luke. Yea right!

            A Offline
            A Offline
            AJarrett
            wrote on last edited by
            #5

            Silly me, searching on just WM_CTLCOLOR. :-O I see COLORSTATIC is restricted to a thread, but I can work around that. Many thanks, John. Between you and kuphryn I feel the Force may be with me again.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups