Is there a way to load an icon from a memory file handler?
- by Jon Trauntvein
I am writing wxWidgets application where I am importing the .ICO file as a header. I am attempting to use a wxMemoryFSHandler to make this icon (and others as well) accessible as files. I am using the following code to do this:
wxFileSystem::AddHandler(new wxMemoryFSHandler);
wxMemoryFSHandler::AddFileWithMimeType(
"app_inactive.ico",
CsiWebAdmin_ico,
sizeof(CsiWebAdmin_ico),
"image/vnd.microsoft.icon");
Unfortunately, if I try to load an icon from this "file" as shown below, it does not work. As I stepped through the MSW source (wx 2.8.10), I can see that the loader never attempted to resolve the virtual file name.
wxIcon icon("memory:app_inactive.ico");
I have also tried the following:
wxIcon icon(wxIconLocation("memory:app_inactive.ico"));
and have encountered the same results.
I realise that I can use resources to load these files but I would still face the same dilemma when the time came to port my application to GTK. Is there something obvious that I am missing?