gpt4 book ai didi

c++ - 访问位图资源失败,错误代码为 0x716

转载 作者:太空宇宙 更新时间:2023-11-04 12:27:44 24 4
gpt4 key购买 nike

所以我不知道为什么我一直收到这个错误。这是相关代码:

//////////////////////// In resource.h ///////////////////////////
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Freestyle.rc
//
#define IDB_BITMAP1 101

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

//////////////////////// In the resource file ////////////////////
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

.
.
.

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_BITMAP1 BITMAP "NOP.bmp"


//////////////////////// In DllMain: /////////////////////////////
// Save the global module we're attached to other files can access it.
g_hLocalModule = hModule;

UnsafePrintToLog(SIMPLE_FORMAT_STRING, "Starting session...");

// Display the splash screen.
CSplash splashScreen(IDB_BITMAP1);


//////////////In CSplash::CSplash(WORD resourceID) //////////////
BitmapSplash = LoadBitmap((HINSTANCE)g_hLocalModule, MAKEINTRESOURCE(resourceID));

if(BitmapSplash == NULL)
{
volatile int temp = GetLastError();
Exit("Could not load the splash screen bitmap.");
}

最佳答案

您尝试加载的位图资源是在 DLL 中还是在加载 DLL 的应用程序中?

在 DLL 中加载资源时,有两种可能的来源,这就是 hInstance 参数至关重要的原因。

使用从 DllMain 获得的 HINSTANCE 参数意味着该资源是您的 DLL 的一部分。

如果资源位于加载您的 DLL 的 应用程序 中,您可以将 NULL 作为 LoadResource() 的第一个参数传入,应用程序的资源将是搜索过。

来自 LoadResource 的文档:

If hModule is NULL, the system loads the resource from the module that was used to create the current process.

希望对您有所帮助。

-斯科特

关于c++ - 访问位图资源失败,错误代码为 0x716,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1183572/

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