?
Solved

Controlling folder combo in an Open Dialog in Win32

Posted on 1997-06-03
7
Medium Priority
?
547 Views
Last Modified: 2013-12-03
Is there a way to control folder combo box ('Look in:')
from a hook function of an Open Dialog under Win32?
I need to select folder depending on a value in a
file-filter combo.
0
Comment
Question by:magnezko
[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
  • 3
7 Comments
 
LVL 4

Expert Comment

by:AVaulin
ID: 1397821
You must handle WM_NOTIFY CDN_TYPECHANGE message, detect which folder selected, change it how you want and send WM_NOTIFY CDN_FOLDERCHANGE.
0
 

Author Comment

by:magnezko
ID: 1397822
I do handle CDN_TYPECHANGE and when handling this notification
message I want to change folder (directory) in folder combo
from my code, not from user interface.
This cannot be done by sending notification CDN_FOLDERCHANGE
which is used to notify me about change in that combo.
0
 
LVL 4

Expert Comment

by:AVaulin
ID: 1397823
Try change m_pofnTemp->lpstrInitialDir and call Update function.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 

Author Comment

by:magnezko
ID: 1397824
Which "Update function" ???

I'm working solely with WIN32 API, no class libraries,
such as MFC or OWL ...


0
 
LVL 4

Expert Comment

by:AVaulin
ID: 1397825
I didn't say that you don't use any library. So can you show how do you create dialog and handle CDN_TYPECHANGE message.
0
 
LVL 15

Accepted Solution

by:
NickRepin earned 200 total points
ID: 1397826
1. You should obtain the dialog item id for the 'folder' combobox.
This can be done by opening COMDLG32.DLL with any resource editor. You can also refer to DLGS.H .
cmb2 == 0x471 == 'Look in' combobox
edt1 == 0x480 =='File name' combobox
1 == 'Open' pushbutton

2. In response to CDN_TYPECHANGE, select appropriate
folder. I am not sure you can do this by changing lpstrInitialDir.
But you can simulate user input in 'File name' field and pressing 'Open'. Eg, we need to change current dir to 'c:\temp'.

// Prevent redrawing
SendDlgItemMessage(hdlg,edt1,WM_SETREDRAW,FALSE);
SendDlgItemMessage(hdlg,1,WM_SETREDRAW,FALSE);
// Changing text in 'File name'. Here you can save previous text
SendDlgItemMessage(hdlg,edt1,WM_SETTEXT,0,"c:\\temp"
// Emulating pressing 'Open'
SendDlgItemMessage(hdlg,1,BM_CLICK);
// Now dialog should change current folder to 'c:\temp'
// Here you can restore previous text in 'File name'

// Allow redrawing
SendDlgItemMessage(hdlg,edt1,WM_SETREDRAW,TRUE);
SendDlgItemMessage(hdlg,1,WM_SETREDRAW,TRUE);

// Also here you can update edt1 or/and 'Open' pushbutton
// (although it is not necessary in this case) by using InvalidateRect() and UpdateWindow().

0
 

Author Comment

by:magnezko
ID: 1397827
EXCELENT! THANK YOU!

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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