I am working on a simple localization attempt in D2010. I process all the lines in the forms, because the ETM seems redundant for my needs, like other third-party tools ... (although I'm not sure about that)!
Is the code below for changing Const.pas lines safe for changing labels on standard messages?
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'; Procedure TForm.FormCreate; begin HookResourceString(@SMsgDlgOK, NewOK); HookResourceString(@SMsgDlgCancel, NewCancel); end;
source share