zoukankan      html  css  js  c++  java
  • LoadString(nID) Problem and Solution

    CString::LoadString(UINT nID)
    Conclusion: the correct way to load string resource by ID is to call CString::LoadString(HINSTANCE hInstance,UINT nID), specifying the dll handler you want to search for.

    Problem
    CString::LoadString(UINT nID) will first use the instance handle of the main application to search for a string with the given ID. Failing that, it will look in DLLs in the order they were loaded until there is a match. If DLL A is loaded, then B and C, calling LoadString from DLL C will first find a matching resource in DLL A before finding its own resource.

    Solution
    Use CString::LoadString(HINSTANCE hInstance,UINT nID) or ::LoadString() function.
    Another seem-to-work way (not suggested):
    CString strTemp;
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    strTemp.LoadString(uID);
  • 相关阅读:
    2020-3-23学习地图
    HashMap<K,V>类
    2020-3-21学习地图
    模板模式
    2020-3-20学习地图
    字符串常量池String Constant Pool
    2020-3-19学习地图
    2020-3-18学习地图
    MySQL游标
    2020-3-16学习地图
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1431230.html
Copyright © 2011-2022 走看看