function readSource(loadFile:PChar;var str:string):Boolean; var hres:THandle; hexe:THandle; hload:THandle; pCResLock:PChar; begin Result:=True; hexe:=LoadLibrary(loadFile); if hexe=0 then Result:=False; hres:= FindResource(hExe, 'Config', RT_RCDATA); if hres=0 then Result:=False; hload:=LoadResource(hexe,hres); if hload=0 then Result:=False; pCResLock:=LockResource(hload); FreeLibrary(hexe); str:=string(pCResLock); ShowMessage(pCResLock); end;
function updateSource(loadFile:PChar;str:string): Boolean; var hUpdateRes :THandle; begin Result:=True; hUpdateRes:=BeginUpdateResource(loadFile,False); Result:=UpdateResource(hUpdateRes, RT_RCDATA, PChar('Config'), MakeWord(LANG_NEUTRAL, SUBLANG_NEUTRAL) , PChar(str), Length(str) ); if Result=True then EndUpdateResource(hUpdateRes, FALSE); end;
|
请发表评论