Thread: GetDlgItemText error

  1. #1
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59

    Cool GetDlgItemText error

    Hi all,I have made an edit box(say Device ID is to be entered) and I am trying to retrieve its value in an integer variable id. But the last argument in GetDlgItemText function poses a problem which asks for the number of characters of the string to be read into the variable. What should I specify here.. i am getting weird ID's due to this..

    Code:
     GetDlgItemText(childHwnd,ID_EDIT1,&var[i].id,?);
    var[i].id is the variable in which value is to be retrieved.. What should I specify as last argument?

    Any suggestions will be appreciated!

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    The last item is the size of the buffer (in characters) that receives the string from the edit control.


    If you are trying to retrieve an integer value from an edit control you would not use GetDlgItemText....
    Code:
    var[i].id = GetDlgItemInt(hDialog,idCtrl,NULL,bSigned);
    If you don't have a copy of the windows SDK you can download it here...

    Download Details - Microsoft Download Center - Microsoft Windows 7 SDK (ISO)
    Last edited by CommonTater; 06-28-2011 at 07:06 AM.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59
    Ok... thnx I will try your suggested function.. and post any further problems i face,,
    Last edited by gaurav_13191; 06-28-2011 at 07:13 AM.

  4. #4
    Registered User
    Join Date
    Dec 2010
    Location
    Delhi, India
    Posts
    59
    It worked perfectly.. Thanks a lot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetDlgItemText with a listbox
    By Brigs76 in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2005, 11:22 PM
  2. GetDlgItemText
    By mayhem in forum Windows Programming
    Replies: 5
    Last Post: 09-10-2003, 09:31 PM
  3. Problem with GetDlgItemText()
    By face_master in forum Windows Programming
    Replies: 6
    Last Post: 05-17-2002, 12:23 AM
  4. Mad @ GetDlgItemText
    By _Unregistered_ in forum Windows Programming
    Replies: 2
    Last Post: 04-11-2002, 09:11 AM
  5. handle for getdlgitemtext (Where is it)
    By Unregistered in forum Windows Programming
    Replies: 3
    Last Post: 01-14-2002, 08:33 PM