From e3f724c9fd36995c207a6ed173849c20aaa2e3d7 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期二, 17 十二月 2024 13:06:22 +0800 Subject: [PATCH] update --- jrj/xframe/wobject/xutil.hpp | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 41 insertions(+), 3 deletions(-) diff --git a/jrj/xframe/wobject/xutil.hpp b/jrj/xframe/wobject/xutil.hpp index b7a6e4d..7d2a7ad 100644 --- a/jrj/xframe/wobject/xutil.hpp +++ b/jrj/xframe/wobject/xutil.hpp @@ -6,6 +6,9 @@ #include "win32/win.hpp" using kutil = Hxsoft::XFrame::IXFUtil; +extern "C" { + void* WINAPI GetProcAddressW(HMODULE hModule, const char* lpText); +} class xutil { public: @@ -34,9 +37,9 @@ return kutil::CacheUrlData((LPWSTR)url,(LPWSTR)data); } - static int SaveToFile(const LPTSTR pFile,const LPTSTR pData,const LPTSTR ext, const LPTSTR pFilter, const LPTSTR pFileName=NULL) + static int SaveToFile(xstring pFile,xstring pData,xstring ext, xstring pFilter, const LPTSTR pFileName=NULL) { - return kutil::SaveToFile((LPWSTR)pFile,(LPWSTR)pData,(LPWSTR)ext,(LPWSTR)pFileName); + return kutil::SaveToFile((LPWSTR)pFile.c_str(), (LPWSTR)pData.c_str(), (LPWSTR)ext.c_str(), (LPWSTR)pFileName); } static LPWSTR MD5(const wchar_t* pStr) { @@ -55,11 +58,39 @@ return Hxsoft::XUtil::FormatDecimalString(str, format, bfree); } + static xstring ToXmlTextAndStartSpace(xstring str) + { + wchar_t* xmlStr = Hxsoft::XUtil::ToXmlTextAndStartSpace(str.c_str()); + return xmlStr ? xmlStr : str; + } + + static xstring ToHtmlTextAndStartSpace(xstring str) + { + wchar_t* htmlStr = Hxsoft::XUtil::ToHtmlTextAndStartSpace(str.c_str()); + return htmlStr ? htmlStr : str; + } + + static xstring ToXmlText(xstring str) + { + wchar_t* xmlStr = Hxsoft::XUtil::ToXmlText(str.c_str()); + return xmlStr? xmlStr : str; + } + static xstring ToHtmlText(xstring str) + { + wchar_t* htmlStr = Hxsoft::XUtil::ToHtmlText(str.c_str()); + return htmlStr? htmlStr : str; + } + static xstring UnXMLText(xstring str) + { + wchar_t* xmlStr = Hxsoft::XUtil::UnXMLText(str.c_str()); + return xmlStr? xmlStr:str; + } + public: static xstring GetModulePath() { wchar_t buf[255]; - GetModuleFileName(0, buf, 255); + ::GetModuleFileNameW(nullptr, buf, 255); PathRemoveFileSpec(buf); return xstring(buf); } @@ -71,4 +102,11 @@ return tmp; } + static void* GetFuncPtr(const wchar_t* dll, const char* name) + { + void* fnAttachEvent = nullptr; + HMODULE hModule = LoadLibraryW(dll); + if (hModule)fnAttachEvent = ::GetProcAddressW(hModule, name); + return fnAttachEvent; + } }; \ No newline at end of file -- Gitblit v1.9.3