#pragma once // utility for loading sane component ... #include "../sane/s2t_api.h" #include namespace load_sane_util { bool initialize(HMODULE me); bool is_ok(void); bool is_online(SCANNERID guid); ISaneInvoker* open(SCANNERID guid, int* err, bool last_try); void uninitialize(void); void log_info(const wchar_t* info, int level); std::string utf82ansi(const char* utf8); std::string ansi2utf8(const char* ansi); std::wstring ansi2unic(const char* ansi); int move_file(const char* from, const char* to); int move_file(const wchar_t* from, const wchar_t* to); template void to_log(const wchar_t* fmt, Args ... args) { size_t size = swprintf(nullptr, 0, fmt, args ...) + 2; std::unique_ptr buf(new wchar_t[size]); swprintf(buf.get(), size, fmt, args ...); log_info(buf.get(), 0); } };