Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Customizing CFileDialog

Posted on 1997-04-30
6
Medium Priority
?
299 Views
Last Modified: 2013-11-20
I would like to rename the "Open" button, but I don't know its control ID. How to get its control ID?
0
Comment
Question by:gulmi
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1301246
There is a way of doing it.

Make a tool like spy++ which will automatically monitor the active window . If the active window title/class matches that of the CFileDialog (using FindWindow /EnumWindows). Now, iterate thru all the child windows of your file open dialog and catch the handle of your Ok button ( using EnumChildWindows). Using SetWindowText() you can set the title text.

But beware this isn't as easy as it looks. Mainly because , if your dialog box is modal you will have to execute this process either from another thread or another application.

0
 
LVL 2

Accepted Solution

by:
rajesh032097 earned 200 total points
ID: 1301247
Hi,
Use IDOK as it's control ID. It should work.
0
 
LVL 4

Expert Comment

by:mbhakta
ID: 1301248
Hang on, can you please give me one good reason why my answer was rejected. Yes, you can do it by using IDOK as the control ID. But you still need to go thru the technique I have explained to get there. How will you change the button text just by knowing the control ID ? If you have a better technique PLEASE tell me...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:rajesh032097
ID: 1301249
Hi Mbhakta,
I used following code to change text in my application in the OnInitDialog() function of my CFileDialog derived class.
CWnd* pParent = GetParent();
CWnd* pWnd = pParent->GetDlgItem(IDOK);
pWnd->SetWindowText("NewName");
It's working fine here.
Please advise me if there are any potential errors in it.

0
 
LVL 4

Expert Comment

by:mbhakta
ID: 1301250
That looks fine to me. But our man Gulmi never mentioned this is what he wanted. His question is one line. I hope in future people come up with more self explainatory questions. Experts are not psychics.

Well done mate. If I were Gulmi I would give you 500 points.
0
 

Author Comment

by:gulmi
ID: 1301251

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question