Solved

Customizing CFileDialog

Posted on 1997-04-30
6
290 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 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

630 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