Change the title of the Open button in the Open dialog box

Source: Internet
Author: User
Tags resource first row

The VCL control on the Dialogs page on the C++builder Control Panel includes Windows common dialog boxes. In other words, VCL does not provide dialog boxes, which are part of Windows. VCL just makes it easier to use these dialog boxes. In some applications, you may want to change the title of the Open button in the Open dialog box, for example, to indicate that your program allows the user to add files to the document, in which case you might want to open the title on the button instead of "open". You can simply change the title of any button on a generic dialog, and the OnShow event that opens the dialog box can be used to do this.

The following code shows how to change:

void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
HWND
hwndDialog = GetParent(OpenDialog1->Handle);
HWND hwndButton =GetDlgItem(hwndDialog, 1);
SetWindowText(hwndButton, "&Add Files");
}

The first line is to get the handle to open the dialog box, note: Call GetParent () and pass the handle of the topendialog.

The next line uses the GetDlgItem () function to get the handle to the Open button in the dialog box.

Note: The passed handle is the handle of the first row of the dialog box and the dialog resource identified as one.

Remember, opening a dialog box is not a VCL Form, but a real Windows dialog box. Each control on the dialog box has a resource ID. The resource ID for the Open button is 1.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.