-1

我是win32的新手。我将位图图像“logo2.bmp”放入 .vcxproj 所在的目录中。但是,当我使用 LoadImage() 函数时,似乎没有加载任何内容。

我在网上查了我的问题,但修改后图像仍然无法加载。

void AddControls(HWND hwnd)
{
//some code
    hLogo = CreateWindowW(L"Static", NULL, WS_VISIBLE | WS_CHILD | SS_BITMAP,
                                 350, 60, 100, 100, hwnd, NULL, NULL, NULL);
    if (hLogoImage != NULL)
    {
        SendMessage(hLogo, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hLogoImage);
    }
    else
    {
        MessageBox(0, L"Could not load image", L"Error", MB_OK);
    }
}

void loadImages()
{
    hLogoImage = (HBITMAP)LoadImage(NULL, L"logo2.bmp", IMAGE_BITMAP,
                                      0,0,LR_LOADFROMFILE | LR_DEFAULTSIZE);
}

我希望输出是在 Windows 上成功显示的位图图像,但是显示了“错误”文本框,但没有显示图片。

4

1 回答 1

-1

编辑:好的,我知道这是文件格式的问题。我最好多学习。

于 2019-06-26T10:02:41.480 回答