0

嗨,我使用 C++ 代码块。我尝试使用 ListView_GetHeade() 获取列表视图的标题:

BOOL CALLBACK enumWindowsProc(HWND hwnd,LPARAM lParam)
{
    int length = ::GetWindowTextLength( hwnd ); //get the length of handler title.
    if( 0 == length ) return true;

    TCHAR* buffer;
    buffer = new TCHAR[ length + 1 ];
    memset( buffer, 0, ( length + 1 ) * sizeof( TCHAR ) );

    GetWindowText( hwnd, buffer, length + 1 ); //get the name of the handler.
    std::wstring str1 (buffer);
    std::wstring str2 (L"יומן חשבוניות"); //set the value to search.
    std::string::size_type found = str1.find(str2); //searching for name.
    if (found!=std::string::npos)
    {
        LPCWSTR rrr = str1.c_str();
        MessageBoxW(hwnd, rrr , L"the file is:", MB_OK);
        HWND w = ListView_GetHeader(hwnd);
        MessageBoxW(hwnd, (LPCWSTR)w , L"text 1:", MB_OK);

hwnd 是窗口“יומן חשבוניות”的句柄: 在此处输入图像描述

但它给了我错误:

error: 'ListView_GetHeader' was not declared in this scope|

我在代码的头部包括:

#include <Commctrl.h>

正如我在 msdn 页面上看到的那样:https ://msdn.microsoft.com/en-us/library/windows/desktop/bb761290(v=vs.85).aspx

我如何解决它?

4

0 回答 0