001.
002.
003.
004.
005.
006.
007.
008.
009.
010.
011.
012.
013.
014.
015.
016.
017.
018.
019.
020.
021.
022.
023.
024.
025.
026.
027.
028.
029.
030.
031.
032.
033.
034.
035.
036.
037.
unit
CustomMessageDlgDemoUnit;
038.
039.
interface
040.
041.
uses
042.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
043.
Dialogs, StdCtrls, ComCtrls;
044.
045.
type
046.
TfrmCustomMessageDlg =
class
(TForm)
047.
btnStandard: TButton;
048.
btnIndonesian: TButton;
049.
btnContextSave: TButton;
050.
mmoLegend: TMemo;
051.
stbMain: TStatusBar;
052.
btnContextPrint: TButton;
053.
procedure
btnStandardClick(Sender: TObject);
054.
procedure
btnIndonesianClick(Sender: TObject);
055.
procedure
btnContextSaveClick(Sender: TObject);
056.
procedure
btnContextPrintClick(Sender: TObject);
057.
private
058.
059.
procedure
ReplaceResourceString(RStringRec: PResStringRec; AString: PChar);
060.
procedure
SetCustomMessageStandard;
061.
procedure
SetCustomMessageIndonesian;
062.
procedure
SetCustomMessageContextSave;
063.
procedure
SetCustomMessageContextPrint;
064.
public
065.
066.
end
;
067.
068.
var
069.
frmCustomMessageDlg: TfrmCustomMessageDlg;
070.
071.
implementation
072.
073.
{$R *.dfm}
074.
075.
uses
076.
Consts;
077.
078.
const
079.
080.
_SMsgDlgWarning =
'Warning'
;
081.
_SMsgDlgError =
'Error'
;
082.
_SMsgDlgInformation =
'Information'
;
083.
_SMsgDlgConfirm =
'Confirm'
;
084.
_SMsgDlgYes =
'&Yes'
;
085.
_SMsgDlgNo =
'&No'
;
086.
_SMsgDlgOK =
'OK'
;
087.
_SMsgDlgCancel =
'Cancel'
;
088.
_SMsgDlgHelp =
'&Help'
;
089.
_SMsgDlgHelpNone =
'No help available'
;
090.
_SMsgDlgHelpHelp =
'Help'
;
091.
_SMsgDlgAbort =
'&Abort'
;
092.
_SMsgDlgRetry =
'&Retry'
;
093.
_SMsgDlgIgnore =
'&Ignore'
;
094.
_SMsgDlgAll =
'&All'
;
095.
_SMsgDlgNoToAll =
'N&o to All'
;
096.
_SMsgDlgYesToAll =
'Yes to &All'
;
097.
098.
099.
_SMsgDlgWarningIndonesian =
'Peringatan'
;
100.
_SMsgDlgErrorIndonesian =
'Kesalahan'
;
101.
_SMsgDlgInformationIndonesian =
'Informasi'
;
102.
_SMsgDlgConfirmIndonesian =
'Konfirmasi'
;
103.
_SMsgDlgYesIndonesian =
'&Ya'
;
104.
_SMsgDlgNoIndonesian =
'&Tidak'
;
105.
_SMsgDlgOKIndonesian =
'OK'
;
106.
_SMsgDlgCancelIndonesian =
'Batal'
;
107.
_SMsgDlgHelpIndonesian =
'&Panduan'
;
108.
_SMsgDlgHelpNoneIndonesian =
'Panduan tidak tersedia'
;
109.
_SMsgDlgHelpHelpIndonesian =
'Panduan'
;
110.
_SMsgDlgAbortIndonesian =
'&Batal'
;
111.
_SMsgDlgRetryIndonesian =
'&Ulang'
;
112.
_SMsgDlgIgnoreIndonesian =
'A&cuh'
;
113.
_SMsgDlgAllIndonesian =
'&Semua'
;
114.
_SMsgDlgNoToAllIndonesian =
'T&idak untuk Semua'
;
115.
_SMsgDlgYesToAllIndonesian =
'Ya untuk S&emua'
;
116.
117.
118.
119.
_SMsgDlgWarningContextPrint =
'Peringatan'
;
120.
_SMsgDlgErrorContextPrint =
'Kesalahan'
;
121.
_SMsgDlgInformationContextPrint =
'Informasi'
;
122.
_SMsgDlgConfirmContextPrint =
'Konfirmasi Tujuan Pencetakan'
;
123.
_SMsgDlgYesContextPrint =
'&Printer'
;
124.
_SMsgDlgNoContextPrint =
'Dokumen PD&F Lebar Yak'
;
125.
_SMsgDlgOKContextPrint =
'&Layar'
;
126.
_SMsgDlgCancelContextPrint =
'Batal'
;
127.
_SMsgDlgHelpContextPrint =
'&Panduan'
;
128.
_SMsgDlgHelpNoneContextPrint =
'Panduan tidak tersedia'
;
129.
_SMsgDlgHelpHelpContextPrint =
'Panduan'
;
130.
_SMsgDlgAbortContextPrint =
'&Batal'
;
131.
_SMsgDlgRetryContextPrint =
'&Ulang'
;
132.
_SMsgDlgIgnoreContextPrint =
'A&cuh'
;
133.
_SMsgDlgAllContextPrint =
'&Semua'
;
134.
_SMsgDlgNoToAllContextPrint =
'T&idak untuk Semua'
;
135.
_SMsgDlgYesToAllContextPrint =
'Ya untuk S&emua'
;
136.
137.
138.
139.
_SMsgDlgWarningContextSave =
'Peringatan'
;
140.
_SMsgDlgErrorContextSave =
'Kesalahan'
;
141.
_SMsgDlgInformationContextSave =
'Informasi'
;
142.
_SMsgDlgConfirmContextSave =
'Konfirmasi Penyimpanan'
;
143.
_SMsgDlgYesContextSave =
'&Simpan'
;
144.
_SMsgDlgNoContextSave =
'&Lanjut Saja'
;
145.
_SMsgDlgOKContextSave =
'OK'
;
146.
_SMsgDlgCancelContextSave =
'Batal'
;
147.
_SMsgDlgHelpContextSave =
'&Panduan'
;
148.
_SMsgDlgHelpNoneContextSave =
'Panduan tidak tersedia'
;
149.
_SMsgDlgHelpHelpContextSave =
'Panduan'
;
150.
_SMsgDlgAbortContextSave =
'&Batal'
;
151.
_SMsgDlgRetryContextSave =
'&Ulang'
;
152.
_SMsgDlgIgnoreContextSave =
'A&cuh'
;
153.
_SMsgDlgAllContextSave =
'&Semua'
;
154.
_SMsgDlgNoToAllContextSave =
'T&idak untuk Semua'
;
155.
_SMsgDlgYesToAllContextSave =
'Ya untuk S&emua'
;
156.
157.
procedure
TfrmCustomMessageDlg
.
btnContextPrintClick(Sender: TObject);
158.
begin
159.
SetCustomMessageContextPrint;
160.
end
;
161.
162.
procedure
TfrmCustomMessageDlg
.
btnContextSaveClick(Sender: TObject);
163.
begin
164.
SetCustomMessageContextSave;
165.
end
;
166.
167.
procedure
TfrmCustomMessageDlg
.
btnIndonesianClick(Sender: TObject);
168.
begin
169.
SetCustomMessageIndonesian;
170.
end
;
171.
172.
procedure
TfrmCustomMessageDlg
.
btnStandardClick(Sender: TObject);
173.
begin
174.
SetCustomMessageStandard;
175.
end
;
176.
177.
178.
procedure
TfrmCustomMessageDlg
.
ReplaceResourceString(RStringRec: PResStringRec;
179.
AString: PChar);
180.
var
181.
OldProtect: Cardinal;
182.
begin
183.
if
RStringRec =
nil
then
Exit;
184.
if
VirtualProtectEx(GetCurrentProcess, RStringRec, SizeOf(RStringRec^), PAGE_EXECUTE_READWRITE, OldProtect)
then
185.
begin
186.
RStringRec^.Identifier := Integer(AString);
187.
VirtualProtectEx(GetCurrentProcess, RStringRec, SizeOf(RStringRec^), OldProtect, @OldProtect);
188.
end
;
189.
end
;
190.
191.
procedure
TfrmCustomMessageDlg
.
SetCustomMessageContextPrint;
192.
begin
193.
194.
195.
196.
197.
198.
ReplaceResourceString(@SMsgDlgConfirm, _SMsgDlgConfirmContextPrint);
199.
ReplaceResourceString(@SMsgDlgYes, _SMsgDlgYesContextPrint);
200.
ReplaceResourceString(@SMsgDlgNo, _SMsgDlgNoContextPrint);
201.
ReplaceResourceString(@SMsgDlgOK, _SMsgDlgOKContextPrint);
202.
203.
204.
205.
206.
207.
case
MessageDlg(
'Tentukan tujuan pencetakan dokumen ?'
, mtConfirmation, [mbOK, mbYes, mbNo],
0
)
of
208.
mrOK : ShowMessage(
'Dokumen ditayangkan ke layar'
);
209.
mrYes : ShowMessage(
'Dokumen dicetak ke printer'
);
210.
mrNo : ShowMessage(
'Dokumen disimpan dalam format .PDF'
);
211.
end
;
212.
end
;
213.
214.
procedure
TfrmCustomMessageDlg
.
SetCustomMessageContextSave;
215.
begin
216.
217.
218.
ReplaceResourceString(@SMsgDlgConfirm, _SMsgDlgConfirmContextSave);
219.
ReplaceResourceString(@SMsgDlgYes, _SMsgDlgYesContextSave);
220.
ReplaceResourceString(@SMsgDlgNo, _SMsgDlgNoContextSave);
221.
ReplaceResourceString(@SMsgDlgCancel, _SMsgDlgCancelContextSave);
222.
223.
MessageDlg(
'Anda Yakin akan menyimpan dokumen ini ?'
, mtConfirmation, mbYesNoCancel,
0
);
224.
end
;
225.
226.
procedure
TfrmCustomMessageDlg
.
SetCustomMessageIndonesian;
227.
begin
228.
229.
ReplaceResourceString(@SMsgDlgWarning, _SMsgDlgWarningIndonesian);
230.
ReplaceResourceString(@SMsgDlgError, _SMsgDlgErrorIndonesian);
231.
ReplaceResourceString(@SMsgDlgInformation, _SMsgDlgInformationIndonesian);
232.
ReplaceResourceString(@SMsgDlgConfirm, _SMsgDlgConfirmIndonesian);
233.
ReplaceResourceString(@SMsgDlgYes, _SMsgDlgYesIndonesian);
234.
ReplaceResourceString(@SMsgDlgNo, _SMsgDlgNoIndonesian);
235.
ReplaceResourceString(@SMsgDlgOK, _SMsgDlgOKIndonesian);
236.
ReplaceResourceString(@SMsgDlgCancel, _SMsgDlgCancelIndonesian);
237.
ReplaceResourceString(@SMsgDlgHelp, _SMsgDlgHelpIndonesian);
238.
ReplaceResourceString(@SMsgDlgHelpNone, _SMsgDlgHelpNoneIndonesian);
239.
ReplaceResourceString(@SMsgDlgHelpHelp, _SMsgDlgHelpHelpIndonesian);
240.
ReplaceResourceString(@SMsgDlgAbort, _SMsgDlgAbortIndonesian);
241.
ReplaceResourceString(@SMsgDlgRetry, _SMsgDlgRetryIndonesian);
242.
ReplaceResourceString(@SMsgDlgIgnore, _SMsgDlgIgnoreIndonesian);
243.
ReplaceResourceString(@SMsgDlgAll, _SMsgDlgAllIndonesian);
244.
ReplaceResourceString(@SMsgDlgNoToAll, _SMsgDlgNoToAllIndonesian);
245.
ReplaceResourceString(@SMsgDlgYesToAll, _SMsgDlgYesToAllIndonesian);
246.
247.
MessageDlg(
'Anda Yakin akan menyimpan dokumen ini ?'
, mtConfirmation, mbYesNoCancel,
0
);
248.
end
;
249.
250.
procedure
TfrmCustomMessageDlg
.
SetCustomMessageStandard;
251.
begin
252.
253.
ReplaceResourceString(@SMsgDlgWarning, _SMsgDlgWarning);
254.
ReplaceResourceString(@SMsgDlgError, _SMsgDlgError);
255.
ReplaceResourceString(@SMsgDlgInformation, _SMsgDlgInformation);
256.
ReplaceResourceString(@SMsgDlgConfirm, _SMsgDlgConfirm);
257.
ReplaceResourceString(@SMsgDlgYes, _SMsgDlgYes);
258.
ReplaceResourceString(@SMsgDlgNo, _SMsgDlgNo);
259.
ReplaceResourceString(@SMsgDlgOK, _SMsgDlgOK);
260.
ReplaceResourceString(@SMsgDlgCancel, _SMsgDlgCancel);
261.
ReplaceResourceString(@SMsgDlgHelp, _SMsgDlgHelp);
262.
ReplaceResourceString(@SMsgDlgHelpNone, _SMsgDlgHelpNone);
263.
ReplaceResourceString(@SMsgDlgHelpHelp, _SMsgDlgHelpHelp);
264.
ReplaceResourceString(@SMsgDlgAbort, _SMsgDlgAbort);
265.
ReplaceResourceString(@SMsgDlgRetry, _SMsgDlgRetry);
266.
ReplaceResourceString(@SMsgDlgIgnore, _SMsgDlgIgnore);
267.
ReplaceResourceString(@SMsgDlgAll, _SMsgDlgAll);
268.
ReplaceResourceString(@SMsgDlgNoToAll, _SMsgDlgNoToAll);
269.
ReplaceResourceString(@SMsgDlgYesToAll, _SMsgDlgYesToAll);
270.
271.
MessageDlg(
'Anda Yakin akan menyimpan dokumen ini ?'
, mtConfirmation, mbYesNoCancel,
0
);
272.
end
;
273.
274.
end
.