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. the different between "WM_GETTEXT" and GetWindowText()

the different between "WM_GETTEXT" and GetWindowText()

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 3 Posters 1 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.
  • W Offline
    W Offline
    wanglei1980
    wrote on last edited by
    #1

    Hello :) Recently I have been disturbed by the window message "WM_GETTEXT" and the function GetWindowText(). By sending message "WM_GETTEXT" I can get the content of the edit control in the other process while failed by using "GetWindowText". I can not find any difference between sending "WM_GETTEXT" and using "GetWindowText()". Can you tell me why:doh::doh::doh: wanglei

    C D 2 Replies Last reply
    0
    • W wanglei1980

      Hello :) Recently I have been disturbed by the window message "WM_GETTEXT" and the function GetWindowText(). By sending message "WM_GETTEXT" I can get the content of the edit control in the other process while failed by using "GetWindowText". I can not find any difference between sending "WM_GETTEXT" and using "GetWindowText()". Can you tell me why:doh::doh::doh: wanglei

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      MFC objects (at least CWnd objects) cannot be used across separate threads, that's why it doesn't work.

      1 Reply Last reply
      0
      • W wanglei1980

        Hello :) Recently I have been disturbed by the window message "WM_GETTEXT" and the function GetWindowText(). By sending message "WM_GETTEXT" I can get the content of the edit control in the other process while failed by using "GetWindowText". I can not find any difference between sending "WM_GETTEXT" and using "GetWindowText()". Can you tell me why:doh::doh::doh: wanglei

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        While GetWindowText() does send a WM_GETTEXT message, it does so only if the window belongs to the current process. If the window belongs to a different process and has a caption, GetWindowText() retrieves the window caption text. If the window does not have a caption, the return value is a null string. This is all spelled out in the documentation.


        "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

        "We will be known forever by the tracks we leave." - Native American Proverb

        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