How do I use the IFileDialogCustomize::GetEditBoxText() method?
WCHAR wcText[100] = {0};
WCHAR *pText = wcText;
WCHAR **ppText = &pText;
HRESULT hr = pDialogCustomize->GetEditBoxText(dwCtrlID, ppText);
The edit box contains the text "5000" but this text isn't returned by the GetEditBox开发者_开发技巧Text
method.
How can I get the text from the edit box?
According to http://msdn.microsoft.com/en-us/library/bb775908%28VS.85%29.aspx, GetEditBoxText allocates and returns a string for you (that you must later free with CoTaskMemFree). I'm assuming that you're checking the wcText array after the function call, and it is empty? This is because GetEditBoxText is changing the value of pText.
Try:
WCHAR *pText = NULL;
HRESULT hr = pDialogCustomize->GetEditBoxText(dwCtrlID, &pText);
if (S_OK == hr && NULL != pText)
// function succeeded and pText points to a buffer of text that must free when done using
精彩评论