CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: Newbe question

Threaded View

  1. #5
    Join Date
    Mar 2004
    Location
    (Upper-) Austria
    Posts
    2,899

    Re: Newbe question

    Now I will explain you the following code:

    Code:
    TCHAR szStr[100] = "";
    GetDlgItemText(hDlg, IDC_BUTTON, szStr, 100);
    SetDlgItemText(hDlg, IDC_EDITBOX, szStr);
    TCHAR is just a type that can either handle Ansi strings or - if you want to use Unicode - unicode strings. If you define a _UNICODE macro before you include the windows header you will use unicode strings.

    The first function 'GetDlgItemText' retrieves the text of a specified control. The control is recognized by the HWND-handle of the parent (hDlg) and it's ID. szStr will now contain the string of how you labeld your button.

    SetDlgItemText is the opposite of GetDlgItemText it lets you set the text of a specified control. The control is also recognized - as mentioned above - by the HWND handle of the parent and the controls ID.

    You can set IDs in the resource editor. And you need to include the automatically created header file "resource.h".
    Last edited by NoHero; December 18th, 2004 at 10:48 AM.
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

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

Featured