Results 1 to 6 of 6

Thread: Getting Text From An Edit box

  1. #1

    Thread Starter
    Junior Member Forger's Avatar
    Join Date
    Feb 2001
    Posts
    19
    How could I get the text from and edit box? Maybe put it into a string?
    Forger
    As in creator, not copier.

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Posts
    122
    Code:
    GetWindowText(HWND hEdit, char* buff, int Num);
    hEdit- The handle of the edit box.

    buff- text is stored here

    Num- maximum number of characters to write to buff.

  3. #3

    Thread Starter
    Junior Member Forger's Avatar
    Join Date
    Feb 2001
    Posts
    19
    Thanks! Do I have to fill in NUM myself or does it automatically check how big it is?

    BTW Errors:
    Code:
    C:\Windows\Profiles\Steve\Desktop\C c++\Win32 Using Edit Box\attempt.cpp(28) : error C2062: type 'char' unexpected
    C:\Windows\Profiles\Steve\Desktop\C c++\Win32 Using Edit Box\attempt.cpp(29) : error C2065: 'buff' : undeclared identifier
    Last edited by Forger; Feb 28th, 2001 at 08:55 PM.
    Forger
    As in creator, not copier.

  4. #4
    Guest
    Try this...

    Code:
    char buffer[100];
    GetWindowText(hEdit,  buffer, 100);

  5. #5

    Thread Starter
    Junior Member Forger's Avatar
    Join Date
    Feb 2001
    Posts
    19
    Thanks jake...works like a charm
    Forger
    As in creator, not copier.

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    You can't always use 100, if the users has typed more than 100 chars in the box you won't get them...
    so be sure to first use GetWindowTextLength to know how much to grab.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width