Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Customizing CFileDialog

Posted on 1997-04-30
6
Medium Priority
?
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

721 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