更改 ShowMessage 的 OK 鈕的 Caption |
|
hagar
版主 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
在網路上找到的一篇
也可以用相同的方式 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 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |