gpt4 book ai didi

visual-c++ - 如何使用 IFileDialogCustomize::GetEditBoxText() 方法?

转载 作者:行者123 更新时间:2023-12-04 06:45:03 27 4
gpt4 key购买 nike

WCHAR wcText[100] = {0};
WCHAR *pText = wcText;
WCHAR **ppText = &pText;

HRESULT hr = pDialogCustomize->GetEditBoxText(dwCtrlID, ppText);

编辑框包含文本“5000”,但 GetEditBoxText 方法未返回此文本。

如何从编辑框中获取文本?

最佳答案

根据 http://msdn.microsoft.com/en-us/library/bb775908%28VS.85%29.aspx , GetEditBoxText 为您分配并返回一个字符串(您稍后必须使用 CoTaskMemFree 释放该字符串)。我假设您在函数调用后检查 wcText 数组,它是空的?这是因为 GetEditBoxText 正在更改 pText 的值。

尝试:

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

关于visual-c++ - 如何使用 IFileDialogCustomize::GetEditBoxText() 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5732694/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com