Solved

Customizing CFileDialog

Posted on 1997-04-30
6
270 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 100 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
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sum13 challenge 24 107
Unix Command -- Challenging  question 7 90
Updating statistics with error notification email in SQL server 4 95
x-bar in Google Sheets 2 54
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: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

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