简体   繁体   中英

How to use Resource.RC file in Visual Studio

For context, I have been trying to include 2 PNG files with my C++ code, but I have not been able to figure out how to do so in Visual Studio 2019. I have searched through the docs and have not found anything helpful. How could I accomplish the three items listed below?

  1. Correctly include files in a Resource.RC file (and correctly create a Resource.RC file)
  2. Access these files in a filesystem-independent manner in C++ (no absolute paths)
  3. Include these files when distributing an executable

My solution is laid out in the default manner: a References folder, External Dependencies folder, Header Files folder, Resource Files folder, and a Source Files folder.

添加 .rc 文件参考微软文档,你可以使用或加载这个 rc 资源参考这个链接,windows api findresource 和 loadresource 可以通过定义资源 ID 来使用这个 rc 文件资源

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