简体   繁体   中英

Override LoadString for MFC app

I have a static-linked MFC app I'm trying to localise. For convenience I would prefer to have all strings sourced from XML files. I've already set this up for the rest of my app. However, MFC retrieves some strings from string resources internally, presumably via LoadString . Is it possible to override this so I can reimplement it to source strings from XML files?

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. I could try updating the resources, but it seems kind of hackish. Is it possible to redirect where LoadString finds its strings?

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. Refer this .

For the merits of using Resource DLL's read this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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