代码如下:资源是英文的
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
  HINSTANCE hInstLib = NULL; DWORD dwLan = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
hInstLib = LoadLibraryEx(
"DetectorRes.dll",
NULL,
DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE 
 ); HRSRC hFindRes;
HGLOBAL hLoadRes;
LPVOID pRes; char szBuffer[MAX_PATH] = "";
LoadString(hInstLib, 129,szBuffer, MAX_PATH); 
hFindRes = FindResourceEx(hInstLib,RT_STRING, MAKEINTRESOURCE(129),SUBLANG_NEUTRAL);
int nError = GetLastError();
。LoadString 都是能成功的,但FindResourceEx就是找不到, hInstLib 也是对的
如果寻找类型为RT_DIALOG的资源却是能找到的为什么呢?

解决方案 »

  1.   

    试一下
    HINSTANCE hInstLibEx= AfxGetResourceHandle();
    hFindRes = FindResourceEx(hInstLibEx,RT_STRING, MAKEINTRESOURCE(129),SUBLANG_NEUTRAL);
    或者第一个参数为NULL
      

  2.   

    hFindRes = FindResourceEx(hInstLib,RT_STRING, MAKEINTRESOURCE(129),SUBLANG_NEUTRAL);试试
    hFindRes = FindResourceEx(hInstLib,RT_STRING, MAKEINTRESOURCE(129),MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
    wLanguage
    [in] Specifies the language of the resource. If this parameter is MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), the current language associated with the calling thread is used. 
    To specify a language other than the current language, use the MAKELANGID macro to create this parameter. For more information, see MAKELANGID.
      

  3.   

    我也碰到过类似的问题:我当时是去找BITMAP,好象查找成功了,但是载入就失败了。可能资源对它进行了压缩等处理。
      

  4.   

    注意引用时的符号!比如资源文件夹名称(类型)用"LO", 资源名为"IDR_LO",注意,都有双引号,调用时:FindResourceEx(hInstLibEx,"lo", "IDR_LO",SUBLANG_NEUTRAL);
      

  5.   

    FindResourceEx(hInstLib,RT_STRING, MAKEINTRESOURCE(129),SUBLANG_NEUTRAL);
    这样也没错吧,to ZHUCDE :
    "比如资源文件夹名称(类型)用"LO""是什么意思啊?