How to Select Text Messages in MFC

When programming in the Microsoft Foundation Class Library or MFC -- the Windows API for C++ library -- text boxes can be used for user input to record messages. These messages, typically plain text, remain in the input boxes. If you want to use this input code, you must use the SetSel code. SetSel can select the text messages inputted into various field types. This is useful for dynamic user content.

Instructions

    • 1

      Open the project you are working on in Visual Studio.

    • 2

      Browse through to the section of code where you want to select your text message.

    • 3

      Just after the input field, type the following code:

      void SetSel(
      DWORD dwSelection,
      BOOL bNoScroll = FALSE
      );
      void SetSel(
      int nStartChar,
      int nEndChar,
      BOOL bNoScroll = FALSE
      );

      This highlights and selects the message.

Related Searches:

References

Comments

Related Ads

Featured