如何得到动态库中资源 我想在我的工程中得到一个动态库中资源,比如位图,图标,我加在动态库后,通过ID 去取位图,编译没有问题,但是好象没有取到,请高手指点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 hehe,你在exe里是exe的资源句柄,当然取不到动态库的了,先把资源句柄切换到动态库,取得资源后再切换回来 HRSRC hResLoad; // handle to loaded resource HANDLE hExe; // handle to existing .EXE file HRSRC hRes; // handle/ptr. to res. info. in hExe HANDLE hUpdateRes; // update resource handle char *lpResLock; // pointer to resource data BOOL result; // Load the .EXE file that contains the dialog box you want to copy. hExe = LoadLibrary("hand.exe"); if (hExe == NULL) { ErrorHandler("Could not load exe."); } // Locate the dialog box resource in the .EXE file. hRes = FindResource(hExe, "AboutBox", RT_DIALOG); if (hRes == NULL) { ErrorHandler("Could not locate dialog box."); } // Load the dialog box into global memory. hResLoad = LoadResource(hExe, hRes); if (hResLoad == NULL) { ErrorHandler("Could not load dialog box."); } // Lock the dialog box into global memory. lpResLock = LockResource(hResLoad); if (lpResLock == NULL) { ErrorHandler("Could not lock dialog box."); } HINSTANCE hLibrary ;HBITMAP hBitmap ;int iCurrent = 1 ;hLibrary = LoadLibrary ("xxx.DLL")hBitmap = LoadBitmap (hLibrary, MAKEINTRESOURCE (iCurrent)) ; 图片link的a标签,在程序代码中不能打开文件,但放在单独的html中则可以 !!寻求图像处理高手合作!! 还是我原来的窗体类名问题. [讨论] 如何使用API实现RICHEDIT语法着色 调用excel时如何设置栏宽度 关于系统回调函数LRESULT CALLBACK WndProc返回值问题 编译问题? 怎样将一个variant的数据放到流对象中? 请问一下面象对向设计中的两个问题. 网卡问题 CString 和 String 怎么互换啊? 请问dialog如何设置style 为 WS_TABSTOP,谢谢
HANDLE hExe; // handle to existing .EXE file
HRSRC hRes; // handle/ptr. to res. info. in hExe
HANDLE hUpdateRes; // update resource handle
char *lpResLock; // pointer to resource data
BOOL result;
// Load the .EXE file that contains the dialog box you want to copy.
hExe = LoadLibrary("hand.exe");
if (hExe == NULL)
{
ErrorHandler("Could not load exe.");
}
// Locate the dialog box resource in the .EXE file.
hRes = FindResource(hExe, "AboutBox", RT_DIALOG);
if (hRes == NULL)
{
ErrorHandler("Could not locate dialog box.");
}
// Load the dialog box into global memory.
hResLoad = LoadResource(hExe, hRes);
if (hResLoad == NULL)
{
ErrorHandler("Could not load dialog box.");
}
// Lock the dialog box into global memory.
lpResLock = LockResource(hResLoad);
if (lpResLock == NULL)
{
ErrorHandler("Could not lock dialog box.");
}
HBITMAP hBitmap ;
int iCurrent = 1 ;
hLibrary = LoadLibrary ("xxx.DLL")
hBitmap = LoadBitmap (hLibrary, MAKEINTRESOURCE (iCurrent)) ;