WELCOME TO INFOCHEATS.NET

INFOCHEATS is a community-driven platform focused on free game cheats, cheat development, and verified commercial software for a wide range of popular games. We provide a large collection of free cheats shared by the community. All public releases are checked for malicious code to reduce the risk of viruses, malware, or unwanted software before users interact with them.

Alongside free content, INFOCHEATS hosts an active marketplace with many independent sellers offering commercial cheats. Each product is discussed openly, with user feedback, reviews, and real usage experience available to help you make informed decisions before purchasing.

Whether you are looking for free cheats, exploring paid solutions, comparing sellers, or studying how cheats are developed and tested, INFOCHEATS brings everything together in one place — transparently and community-driven.

Guide DX11 Image Loader — Web-to-Memory Textures for ImGui

byte_corvus

Expert
Expert
Expert
Expert
Status
Offline
Joined
Mar 3, 2026
Messages
765
Reaction score
457
Sick of bloating your build with local assets or base64 strings? If you're building a menu and want to pull icons dynamically from a web server—or even just grab a Steam icon—this snippet handles the heavy lifting of fetching a byte stream and turning it into a DX11 resource.

The Logic
This implementation uses WinInet to establish the connection and D3DX11 to create the ShaderResourceView. It's wrapped in a clean class that handles C++17 string_view if your toolchain is up to date, fallbacking to const std::string& otherwise.

Technical Implementation
Code:
#ifndef IMAGE_LOADER_HPP
#define IMAGE_LOADER_HPP

#if _HAS_CXX17
#include <string_view>
#else
#include <string>
#endif

#include <d3d11.h>

class ImageLoader {
public:
#if _HAS_CXX17
 using string_t = std::string_view;
#else
 using string_t = const std::string&;
#endif

 ImageLoader() = default;
 ImageLoader(ID3D11Device* dx_device, string_t image_url);
 ~ImageLoader();

 void initialize(ID3D11Device* dx_device, string_t image_url);
 ID3D11ShaderResourceView* image() const noexcept;

private:;
 ID3D11ShaderResourceView* m_image;
};

#endif

Code:
#include "ImageLoader.h"
#include <Windows.h>
#include <wininet.h>
#include <vector>
#include <stdexcept>
#include <memory>
#include <d3dx11.h>

#pragma comment(lib, "d3dx11.lib")
#pragma comment(lib, "wininet.lib")

#define MAX_FILESIZE_TO_READ 4096

ImageLoader::ImageLoader(ID3D11Device* dx_device, string_t image_url) : m_image(nullptr)
{
 if (m_image != nullptr) return;
 initialize(dx_device, image_url);
}

ImageLoader::~ImageLoader() {}

void ImageLoader::initialize(ID3D11Device* dx_device, string_t image_url)
{
 if (m_image != nullptr) return;

 std::unique_ptr<std::remove_pointer_t<HINTERNET>, decltype(&InternetCloseHandle)>
  hInternet(InternetOpenA("ImGui ImageLoader", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0), InternetCloseHandle);

 if (!hInternet) throw std::runtime_error("InternetOpenA failed");

 std::unique_ptr<std::remove_pointer_t<HINTERNET>, decltype(&InternetCloseHandle)>
  hURL(InternetOpenUrlA(hInternet.get(), image_url.data(), NULL, 0, INTERNET_FLAG_RELOAD, 0), InternetCloseHandle);

 if (!hURL) throw std::runtime_error("InternetOpenUrl failed");

 std::vector<BYTE> image_data;
 std::vector<BYTE> buffer(MAX_FILESIZE_TO_READ); 
 DWORD bytes_read = 0;
 while (InternetReadFile(hURL.get(), buffer.data(), MAX_FILESIZE_TO_READ, &bytes_read) && bytes_read > 0) {
  image_data.insert(image_data.end(), buffer.data(), buffer.data() + bytes_read);
 }

 D3DX11_IMAGE_LOAD_INFO image_load_info;
 ID3DX11ThreadPump* thread_pump{ nullptr };
 HRESULT hr = D3DX11CreateShaderResourceViewFromMemory(dx_device, image_data.data(), image_data.size(), &image_load_info, thread_pump, &m_image, 0);
 if (FAILED(hr)) throw std::runtime_error("D3DX11CreateShaderResourceViewFromMemory failed");
}

ID3D11ShaderResourceView* ImageLoader::image() const noexcept
{
 return m_image;
}

ImGui Integration
Once decoded, you just cast the SRV to a PVOID and let ImGui handle the quad rendering. Perfect for dynamic module icons or user avatars in your internal.

Code:
static ImageLoader custom_icon(pDevice, "https://example.com/asset.png");
ImGui::Image((PVOID)custom_icon.image(), ImVec2(32, 32));

A few technical warnings:
  1. WinInet is synchronous here—if you call initialize on the main thread, your menu will hang until the request finishes. Better to spin this off into a worker thread.
  2. The D3DX11 library is technically legacy. Ensure you have the DirectX SDK headers or the appropriate NuGet packages linked, otherwise you'll get unresolved externals.
  3. Memory management: The original author used heap allocation for the read buffer "because they wanted to"—standard stack allocation would be fine for a 4KB chunk, but leave it if you're lazy.

While others are hard-coding 5MB arrays of image bytes into their headers and wondering why their DLL is massive, Infocheats users are loading dynamic assets like pros.

Anyone moved this over to a purely asynchronous lib already?
 
Top