We don't display ads so we rely on your Bitcoin donations to 1KWEk9QaiJb2NwP5YFmR24LyUBa4JyuKqZ
Post date: Mar 9, 2010 11:42:17 AM
This snippet shows you how to modify resource strings at runtime of an application:
uses
Consts;
procedure TForm1.Button1Click(Sender: TObject);
begin
InputBox('Test', 'Enter something', 'Test');
end;
procedure HookResourceString(rs: PResStringRec; newStr: PChar);
var
oldprotect: DWORD;
begin
VirtualProtect(rs, SizeOf(rs^), PAGE_EXECUTE_READWRITE, @oldProtect);
rs^.Identifier := Integer(newStr);
VirtualProtect(rs, SizeOf(rs^), oldProtect, @oldProtect);
end;
const
NewOK: PChar = 'New Ok';
NewCancel: PChar = 'New Cancel';
initialization
HookResourceString(@SMsgDlgOK, NewOK);
HookResourceString(@SMsgDlgCancel, NewCancel);
end.