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. i dont understand why i cant...

i dont understand why i cant...

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
11 Posts 4 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.
  • T Tim Zorn

    i dont understand why i cant get the text from an editbox of a window its a window that was created durring runtime i tryed GetWindowText on a handle to the edit box but it outputs a bank char array is it somehow different for getting text from editboxes that are created during runtime? im pretty sure that the dialog window is created during runtime but i may be mistaken because its not my program that creates it help would be very appreciated thx:)

    G Offline
    G Offline
    Gurra_Koo
    wrote on last edited by
    #2

    Have you tried sending the control an EM_GETTEXTEX message? Here's the link to the the msdn library entry on EM_GETTEXTEX[^] "There is an empty room full of people who think you are creative"

    T 1 Reply Last reply
    0
    • T Tim Zorn

      i dont understand why i cant get the text from an editbox of a window its a window that was created durring runtime i tryed GetWindowText on a handle to the edit box but it outputs a bank char array is it somehow different for getting text from editboxes that are created during runtime? im pretty sure that the dialog window is created during runtime but i may be mistaken because its not my program that creates it help would be very appreciated thx:)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #3

      Sample code please :) Here is a piece of my code : CEdit searchedit; CString srchstrl; searchedit.GetWindowText(srchstrl); // The string to search for Remember the text is not returned, it is placed in the CString refrence. Elaine :rose: The tigress is here :-D

      1 Reply Last reply
      0
      • G Gurra_Koo

        Have you tried sending the control an EM_GETTEXTEX message? Here's the link to the the msdn library entry on EM_GETTEXTEX[^] "There is an empty room full of people who think you are creative"

        T Offline
        T Offline
        Tim Zorn
        wrote on last edited by
        #4

        no. ive only tried WM_GETTEXT. ill go see if it works. thanks for the help

        T 1 Reply Last reply
        0
        • T Tim Zorn

          no. ive only tried WM_GETTEXT. ill go see if it works. thanks for the help

          T Offline
          T Offline
          Tim Zorn
          wrote on last edited by
          #5

          can u fix this code for me? i dont understand how to use GETTEXTEX GETTEXTEX gte; ZeroMemory(>e,sizeof(gte)); gte.cb = 512; gte.codepage = CP_ACP; SendMessage(hwnd,EM_GETTEXTEX,(WPARAM)>e,(LPARAM)temp);

          J 1 Reply Last reply
          0
          • T Tim Zorn

            i dont understand why i cant get the text from an editbox of a window its a window that was created durring runtime i tryed GetWindowText on a handle to the edit box but it outputs a bank char array is it somehow different for getting text from editboxes that are created during runtime? im pretty sure that the dialog window is created during runtime but i may be mistaken because its not my program that creates it help would be very appreciated thx:)

            J Offline
            J Offline
            Jose Lamas Rios
            wrote on last edited by
            #6

            GetWindowText should work. Post some code to see how you are doing it, and someone may be able to spot the problem. -- jlr http://jlamas.blogspot.com/[^]

            T 1 Reply Last reply
            0
            • T Tim Zorn

              can u fix this code for me? i dont understand how to use GETTEXTEX GETTEXTEX gte; ZeroMemory(>e,sizeof(gte)); gte.cb = 512; gte.codepage = CP_ACP; SendMessage(hwnd,EM_GETTEXTEX,(WPARAM)>e,(LPARAM)temp);

              J Offline
              J Offline
              Jose Lamas Rios
              wrote on last edited by
              #7

              From MSDN's documentation for the GETTEXTEX Structure[^]:

              "The GETTEXTEX structure contains information about an operation to get text from a rich edit control"

              Are you trying this with a rich edit control? Otherwise, I don't think it will work. Try this instead:

              const int nBufLen = 512; // or whatever size you want
                TCHAR buffer[nBufLen];
                SendMessage(0, WM_GETTEXT, nBufLen, (LPARAM) buffer);
                // Text should be in buffer now

              -- jlr http://jlamas.blogspot.com/[^]

              T 1 Reply Last reply
              0
              • J Jose Lamas Rios

                From MSDN's documentation for the GETTEXTEX Structure[^]:

                "The GETTEXTEX structure contains information about an operation to get text from a rich edit control"

                Are you trying this with a rich edit control? Otherwise, I don't think it will work. Try this instead:

                const int nBufLen = 512; // or whatever size you want
                  TCHAR buffer[nBufLen];
                  SendMessage(0, WM_GETTEXT, nBufLen, (LPARAM) buffer);
                  // Text should be in buffer now

                -- jlr http://jlamas.blogspot.com/[^]

                T Offline
                T Offline
                Tim Zorn
                wrote on last edited by
                #8

                no, i already tried that. the classes of the edit controls im trying to read are UsTextEditPane and Ate32Class if that helps at all

                J 1 Reply Last reply
                0
                • J Jose Lamas Rios

                  GetWindowText should work. Post some code to see how you are doing it, and someone may be able to spot the problem. -- jlr http://jlamas.blogspot.com/[^]

                  T Offline
                  T Offline
                  Tim Zorn
                  wrote on last edited by
                  #9

                  i know im doing it right because it works for titlebars and stuff read the post i made about the classes they are and maybe that will help u help me

                  J 1 Reply Last reply
                  0
                  • T Tim Zorn

                    no, i already tried that. the classes of the edit controls im trying to read are UsTextEditPane and Ate32Class if that helps at all

                    J Offline
                    J Offline
                    Jose Lamas Rios
                    wrote on last edited by
                    #10

                    Tim Zorn wrote: no, i already tried that. And...? What was the result? Post some code to see how you are doing it and what specific error you get. -- jlr http://jlamas.blogspot.com/[^]

                    1 Reply Last reply
                    0
                    • T Tim Zorn

                      i know im doing it right because it works for titlebars and stuff read the post i made about the classes they are and maybe that will help u help me

                      J Offline
                      J Offline
                      Jose Lamas Rios
                      wrote on last edited by
                      #11

                      Using GetWindowText may not work for windows created in another process, but sending WM_GETTEXT directly should work anyway. -- jlr http://jlamas.blogspot.com/[^]

                      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