Programming Tips - Win32: Load a resource with a URL

Date: 2023nov2 Platform: win32 Language: C/C++ Q. Win32: Load a resource with a URL A. For win32 functions that take a URL you can provide a regular URL like Or a resource from your program with the Microsoft res protocol! Example function are CListCtrl.SetBkImage() and ListView_GetBkImage() m_ListCtrl.SetBkImage(""); Or use a res: URL of
m_ListCtrl.SetBkImage("res://MYPROGRAM.EXE/#2/#123"); Replace MYPROGRAM.EXE with the full path of your running exe from GetModuleFileName() #2 means bitmap Replace 123 with the resource ID of our bitmap
In addition to http://, https:// and res:// you can use file:// to load a local file! More info