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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can't find the win32 C/C++ equivalents of the VB functions SelStart, SelLength, and SelText

Can't find the win32 C/C++ equivalents of the VB functions SelStart, SelLength, and SelText

Scheduled Pinned Locked Moved C / C++ / MFC
c++jsontutorialquestion
6 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.
  • G Offline
    G Offline
    glyfyx
    wrote on last edited by
    #1

    I'd like to search the active window's client area for a given string and highlight it. I've done this in VB using SelStart and SelLength. I'm sure I've seen the same functionality available from a conventional Windows program, but can't remember what the win32 API calls are. Does anyone know, or have tips on how to find out? Thanks for the assist. glyfyx

    CPalliniC J 2 Replies Last reply
    0
    • G glyfyx

      I'd like to search the active window's client area for a given string and highlight it. I've done this in VB using SelStart and SelLength. I'm sure I've seen the same functionality available from a conventional Windows program, but can't remember what the win32 API calls are. Does anyone know, or have tips on how to find out? Thanks for the assist. glyfyx

      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      There is EM_SETSEL message though it works with edit boxes (or EM_EXSETSEL, with Rich Edit controls). AFAIK VB6 itself allows SelStart and SelLength only inside controls (i.e. they are TextBox methods). :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

      In testa che avete, signor di Ceprano?

      G 1 Reply Last reply
      0
      • G glyfyx

        I'd like to search the active window's client area for a given string and highlight it. I've done this in VB using SelStart and SelLength. I'm sure I've seen the same functionality available from a conventional Windows program, but can't remember what the win32 API calls are. Does anyone know, or have tips on how to find out? Thanks for the assist. glyfyx

        J Offline
        J Offline
        JohnCz
        wrote on last edited by
        #3

        If this is a Win32 application without using MFC, create window as a child of the main window; use "edit" window class. You may want to subclass edit window but it is not necessary. Use EM_* messages to tell edit window what to do. See MSDN for more information. EM_ messages are defined in WINUSER.H. Handle notification messages from control in a parent window, to see what control is doing. Notification code are also defined in WINUSER.H and are delivered as parameter of WM_COMMAND message. For MFC application use CEdit class and call SetSel member function. Again, see MSDN for members reference. You can add notification handlers in a parent of edit control using Wizard.

        JohnCz MS C++ MVP

        G 1 Reply Last reply
        0
        • J JohnCz

          If this is a Win32 application without using MFC, create window as a child of the main window; use "edit" window class. You may want to subclass edit window but it is not necessary. Use EM_* messages to tell edit window what to do. See MSDN for more information. EM_ messages are defined in WINUSER.H. Handle notification messages from control in a parent window, to see what control is doing. Notification code are also defined in WINUSER.H and are delivered as parameter of WM_COMMAND message. For MFC application use CEdit class and call SetSel member function. Again, see MSDN for members reference. You can add notification handlers in a parent of edit control using Wizard.

          JohnCz MS C++ MVP

          G Offline
          G Offline
          glyfyx
          wrote on last edited by
          #4

          Thanks for taking time to provide such a complete answer - much appreciated! glyfyx

          J 1 Reply Last reply
          0
          • CPalliniC CPallini

            There is EM_SETSEL message though it works with edit boxes (or EM_EXSETSEL, with Rich Edit controls). AFAIK VB6 itself allows SelStart and SelLength only inside controls (i.e. they are TextBox methods). :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke

            G Offline
            G Offline
            glyfyx
            wrote on last edited by
            #5

            Just a word of thanks - appreciated! glyfyx

            1 Reply Last reply
            0
            • G glyfyx

              Thanks for taking time to provide such a complete answer - much appreciated! glyfyx

              J Offline
              J Offline
              JohnCz
              wrote on last edited by
              #6

              You are very welcome. Glad to be of help.

              JohnCz MS C++ MVP

              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