Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2008 Jan : How i can modify Info version on .exe ( at runtime , by code )
| Subject: | How i can modify Info version on .exe ( at runtime , by code ) |
| Posted by: | "Enrico Ghezzi" (enricoghez..@ghezzi.com) |
| Date: | Tue, 29 Jan 2008 16:49:46 |
Hi
i need change InternalName,CompanyName... of my exe at runtime.
i have write this code , but don't work.
Hint ?
procedure TForm1.Button4Click(Sender: TObject);
const
InfoStr : array [1..10] of String = ('CompanyName', 'FileDescription',
'FileVersion',
'InternalName','LegalCopyright', 'LegalTradeMarks',
'OriginalFilename', 'ProductName', 'ProductVersion', 'Comments');
var
pMyFName : Pchar;
hUpdate : hWnd;
hUpdate2 : LongBool;
pNewVers : WideString;
hRes : HRSRC;
hExe : hWnd;
DoneGood : longbool;
hFile : TFileStream;
lpRes : PChar;
batfile : array[0..80] of char;
wLPName : array[0..80] of char;
junk : widestring;
x : integer;
begin
pMyFName := 'C:\program\myprog.exe';
hUpdate := BeginUpdateResource(pMyFName,FALSE);
pNewVers := 'NewName';
StrPCopy(batfile, pNewVers );
x := length(pnewvers);
junk := 'RT_VERSION' ;
StrPCopy( wLPName, junk );
hUpdate2 := UpdateResource(hUpdate,
RT_VERSION,
PChar(InfoStr[1]), //
'\StringFileInfo\041004E4\CompanyName',
LANG_NEUTRAL,
@batfile,
x*2);
DoneGood := EndUpdateResource(hUpdate,FALSE);
end;