If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Finding out control IDs

Can anyone tell me how to find the control IDs for the "Name","size","type", and "Modified" buttons that come up in an Open/Save dialog box when the Details button is pressed? Or does anyone know these control IDs?

I don't know what they are called. they are the buttons that appear when you press the Details button in any Open/Save dialog. They are the ones that allow you to sort the files by name, type, size, or modified. What I want to do is have the list of files sorted by one of these before the open/save dialog opens to the user. I already know how to simulate a button being pressed but i need the control id.

Use FindWindow/EnumChildWindow to find a widow with class "SysListView32".

Send message LVM_GETHEADER or use macro ListView_GetHeader to get the handle of headerctrl of the ListView.

Now you need to know against which HeaderItem i.e. size, date, name etc you want to sort. Either hardcode the index (i think it is always the same) or move on the HeaderControl to get the correct index with messages like HDM_GETITEMCOUNT or HDM_GETITEMCOUNT.

Thanks for the post. I know, my rep is now green but for a while there is was showing red.
I think I am following you on your explanation but where does the list get sorted by the specified header? Is there a function call or do I put the header items in a specific order with the item that i want to sort by first? thanks again!

Well to sort a ListView you click on the ListView HeaderItem and that Item tells its PARENTWINDOW that a click has happened and do whatever needs to be done. What i told you to is the get HeaderCtrl handle (with handle you can get the info about the HeaderItem, that you can use to fillin the struct NMHEADER, and after filling that struct you do the same (by sending the WM_NOTIFY to parentwnd) that a click even has happened. The ListView should then sort itself. Hope its clear enough.
Regards,
Usman.
Btw I wouldn't mind if you would like to add something to my repo .

I think that is going to work. I am going to go ahead and try it now but if I have any problems I will add another reply. thanks to both of you. You both should now have a reputation point added to your names!

The first three members of the struct should be pretty straight forward, for the last one use HDM_GETITEM that message will give the HDITEM for the item you are interested in then u can assing the address of the returned HDITEM to the last member of the struct and send the WM_NOTIFY. So you have all the four params filled in.
Hope this helps,
Regards,
Usman.