Kylix
Tips

NEW TIPS
Database (94)
Files (902)
Forms (120)
Graphic (121)
IDE (28)
Indy (13)
Internet / LAN (142)
IntraWeb (9)
Kylix (19)
Math (84)
Misc (137)
Multimedia (56)
Objects/
ActiveX (63)

OpenTools API (11)
Printing (45)
Strings (94)
System (274)
VCL (246)

Search Tip
Top15
Add new Tip

Forum

...change resource strings at run-time?
Author: P. Below
Homepage: http://www.teamb.com
[ Print tip ]    

Tip Rating (9):  
     





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.

Rate this tip:

poor
very good


Copyright © Torry's Delphi Pages Torry's Delphi Pages Maintained by Simon Grossenbacher Notes? Comments? Feel free to send... Copyright © 1996-2001