var<br> hRes : THandle;<br> pRes : pointer;<br> ResSize : longint;<br> i : integer;<br> s : shortstring;<br>begin<br> hRes := FindResource(Hinstance,<br> 'strs',<br> 'MYDATATYPE');<br> if hRes = 0 then begin<br> ShowMessage('找不到资源。');<br> exit;<br> end;<br> ResSize := SizeOfResource(hinstance, hRes);<br> if ResSize = 0 then begin<br> ShowMessage('没有资源载入 - 尺寸 = 0');<br> Exit;<br> end;<br> hRes := LoadResource(hInstance, hRes);<br> if hRes = 0 then begin<br> ShowMessage('资源载入失败!');<br> Exit;<br> end;<br> pRes := LockResource(hRes);<br> if pRes = nil then begin<br> ShowMessage('资源锁定失败!');<br> FreeResource(hRes);<br> Exit;<br> end;<br><br> {转换资源为字符串}<br> s:='';<br> i := 0;<br> while pChar(pRes) <> '!' do begin<br> s := s + pChar(pRes);<br> inc(i);<br> end;<br><br> ShowMessage(s);<br><br> UnLockResource(hRes);<br> FreeResource(hRes);<br>end;