首先,需要找到该对话框控制的标识:
一个打开/保存对话框的例子,你看是否对你有用?
const
// LB_FOLDERS_ID = 65535;
LB_FILETYPES_ID = 1089;
// "File types:" label
LB_FILENAME_ID = 1090;
// "File name:" label
LB_DRIVES_ID = 1091;
// "Look in:" label
其次,需要对那些待改变的控制发送消息,打开/保存对话框的例子:
procedure TForm1.OpenDialog1Show(Sender: TObject);
const
CDM_SETCONTROLTEXT = 1128;
// LB_FOLDERS_ID = 65535;
LB_FILETYPES_ID = 1089;
LB_FILENAME_ID = 1090;
LB_DRIVES_ID = 1091;
Str1 = 'Four';
Str2 = 'Five';
Str3 = 'One';
Str4 = 'Two';
Str5 = 'Three';
begin
SendMessage( GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, IDOK,LongInt(Pchar(Str1)));
SendMessage( GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, IDCANCEL, LongInt(Pchar(Str2)));
SendMessage( GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, LB_FILETYPES_ID, LongInt(Pchar(Str3)));
SendMessage( GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, LB_FILENAME_ID, LongInt(Pchar(Str4)));
SendMessage( GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, LB_DRIVES_ID, LongInt(Pchar(Str5)));
end;