Files
SimpleRemoter/server/2015Remote/WebPage.h

21 lines
683 B
C++

#pragma once
#include <Windows.h>
#include <string>
#include "resource.h"
// Embedded HTML page for web remote control.
// Source of truth: server/web/index.html (shared with future Go server).
// Compiled into the binary as RC BINARY resource IDR_WEB_INDEX_HTML.
inline std::string GetWebPageHTML() {
HRSRC hRes = FindResourceA(NULL, MAKEINTRESOURCEA(IDR_WEB_INDEX_HTML), "BINARY");
if (!hRes) return {};
DWORD size = SizeofResource(NULL, hRes);
if (!size) return {};
HGLOBAL hData = LoadResource(NULL, hRes);
if (!hData) return {};
LPVOID p = LockResource(hData);
if (!p) return {};
return std::string(static_cast<const char*>(p), size);
}