GetDlgItemTextW

Whats wrong with this code?

1
2
3
4
5
wchar_t* pszString = L"";
GetDlgItemTextW(m_oTextbox.GetOwner()->m_hWnd,
               IDC_EDIT,
               pszString,
               sizeof(pszString));



It seems not to be passing the text in CEdit Control to pszString..
Can anyone help?


Last edited on
Here's the docs on GetDlgItemText....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
GetDlgItemText
The GetDlgItemText function retrieves the title or text associated with a control in a dialog box. 

UINT GetDlgItemText(
  HWND hDlg,       // handle of dialog box
  int nIDDlgItem,  // identifier of control
  LPTSTR lpString, // address of buffer for text
  int nMaxCount    // maximum size of string
);
 
Parameters
hDlg 
Identifies the dialog box that contains the control. 
nIDDlgItem 
Specifies the identifier of the control whose title or text is to be retrieved. 
lpString 
Pointer to the buffer to receive the title or text. 
nMaxCount 
Specifies the maximum length, in characters, of the string to be copied to the buffer pointed to by lpString. If the length of the string exceeds the limit, the string is truncated. 


Since you are telling the function that the maximum length of string to be copied to pszString is the sizeof(pszString), which is four, you are likely getting close to what you are asking for. As the old saying goes, "Computers do what we tell them to do, not what we want". And by the way, I answered that MSFlexGrid questiion you posed last summer. I posted a C++ SDK example of using the MSFlexGrid for you. Do a search for MSFlexGrid and you'll likely find it.
Last edited on
thanks.. for the information.. actually i am currently doing a unicode build thats why i have a little trouble of this earlier. but again, thanks..
Topic archived. No new replies allowed.