MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / LoadString

Method LoadString

source/KuString.h:1123–1153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121
1122#ifdef _WIN32
1123inline bool CKuStringUtilW::LoadString(CKuStringW &str, HINSTANCE hInstance, UINT nID, WORD wLanguage)
1124{
1125 HRSRC hResource = ::FindResourceEx(hInstance, RT_STRING, MAKEINTRESOURCE(((nID >> 4) + 1)), wLanguage);
1126 if( hResource == NULL )
1127 return false;
1128 HGLOBAL hGlobal = ::LoadResource(hInstance, hResource);
1129 if (hGlobal) {
1130 const WORD *pImage;
1131 const WORD *pImageEnd;
1132 pImage = (const WORD *) ::LockResource(hGlobal);
1133 if (pImage) {
1134 pImageEnd = (const WORD *)(((UINT_PTR) pImage) + ::SizeofResource(hInstance, hResource));
1135 UINT iIndex = nID & 0xF;
1136
1137 while(iIndex > 0 && pImage < pImageEnd)
1138 {
1139 pImage = (const WORD *)(((UINT_PTR) pImage) + (sizeof(WORD) + (*pImage * sizeof(wchar_t))));
1140 iIndex--;
1141 }
1142 if (pImage < pImageEnd && *pImage > 0) {
1143 memcpy(str.GetBufferSetLength(*pImage), pImage + 1, *pImage * sizeof(wchar_t));
1144 str.ReleaseBufferSetLength(*pImage);
1145 FreeResource(hGlobal);
1146 return true;
1147 }
1148 }
1149 FreeResource(hGlobal);
1150 }
1151
1152 return false;
1153}
1154
1155inline bool CKuStringUtilA::LoadString(CKuStringA &str, HINSTANCE hInstance, UINT nID, WORD wLanguage)
1156{

Callers

nothing calls this directly

Calls 2

StringWCharToCharFunction · 0.85
GetBufferSetLengthMethod · 0.80

Tested by

no test coverage detected