Sumber Kode

Change resource strings at runtime.

  • delphibasics
  • Nov 19' 14
  • Delphi
  • 96
  • 283
  • United States
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.


Powered by
Pasar Kode Partner

Share

  • Tags :
comments powered by Disqus

Kode Terkait

Alternative Sleep Methods

Create a form with Windows API.

Drag and Drop

Retreive default browser path

Create a functioning form with Windows API.

HHUtils 1.0 - A collection of useful delphi functions.

Screen Capture with Pure Windows API

Programmatically talk using Microsoft Sam

Modify TEdit to include text alignment

Delphi RC4 Encryption Source Code



Kategori