全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1353
推到 Plurk!
推到 Facebook!

更改 ShowMessage 的 OK 鈕的 Caption

 
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-13 14:53:27 IP:202.39.xxx.xxx 未訂閱
在網路上找到的一篇 也可以用相同的方式 runtime 更改 InputBox 的按鈕 Caption 或其它 resourcestring
unit Unit1;
   
interface
   
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;
   
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
   
var
  Form1: TForm1;
   
implementation
   
uses Consts; // 大部份的 resourcestring 所在 unit
   
{$R *.DFM}
   
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'; // 新的 Caption 值
   
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage('TEST');
end;
  
initialization
  HookResourceString(@SMsgDlgOK, NewOK); // SMsgDlgOK 為 consts unit 中一個變數    end.
--- 每個人都是一本書 發表人 - hagar 於 2003/05/13 14:58:47
系統時間:2024-04-30 12:23:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!