简体   繁体   English

覆盖MFC应用程序的LoadString

[英]Override LoadString for MFC app

I have a static-linked MFC app I'm trying to localise. 我有一个试图本地化的静态链接的MFC应用程序。 For convenience I would prefer to have all strings sourced from XML files. 为了方便起见,我希望所有字符串都来自XML文件。 I've already set this up for the rest of my app. 我已经为其余的应用程序进行了设置。 However, MFC retrieves some strings from string resources internally, presumably via LoadString . 但是,MFC大概是通过LoadString内部从字符串资源中检索一些字符串。 Is it possible to override this so I can reimplement it to source strings from XML files? 是否有可能重写它,以便我可以重新实现它以从XML文件获取字符串?

I've already tried creating a DLL which implements LoadString, but it only is called for calls to LoadString from my own code (which I've already replaced), and is not called from the MFC library code. 我已经尝试过创建一个实现LoadString的DLL,但是它只能从我自己的代码(已经替换掉)中调用LoadString,而不能从MFC库代码中调用。 I could try updating the resources, but it seems kind of hackish. 我可以尝试更新资源,但这似乎有点黑。 Is it possible to redirect where LoadString finds its strings? 是否可以在LoadString找到其字符串的地方重定向?

I am not sure how to override LoadString but the most commonly used approach for localization is to create Resource DLL's and use it. 我不确定如何覆盖LoadString,但是最常用的本地化方法是创建Resource DLL并使用它。 Refer this . 请参考

For the merits of using Resource DLL's read this 对于使用资源DLL的优点,请阅读以下内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM