-
July 26th, 2004, 09:33 AM
#1
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?
Thanks!
-
July 26th, 2004, 09:51 AM
#2
Do you mean the header control titles of a ListCtrl?
I think there is no Control ID for a column header.
-
July 26th, 2004, 10:03 AM
#3
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.
-
July 26th, 2004, 10:25 AM
#4
See the post #2.
These "buttons" are not the Buttons. They are the part (parts) of the Header control, not the controls themselves!
-
July 26th, 2004, 10:32 AM
#5
So does that mean there is no way to access or control them?
-
July 26th, 2004, 11:05 AM
#6
I dont know. I am a beginner at this stuff. Why did you get mad at me and give me a bad reputation. I am learning. Thanks a lot.
-
July 26th, 2004, 11:15 AM
#7
What? now my reputation is green. Before it was red. What happened? Who controls the reputations?
-
July 26th, 2004, 11:29 AM
#8
Well I have never tried it myself but you can something like
- 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.
- Now send a notify-message to HeaderCtrl's Parent like...
Code:
SendMessage(GetParent(hHeaderCtrl), WM_NOTIFY, NULL, (LPARAM)&NMHeader);
Look into MSDN for how you should fillout the NMHeader struct.
May be there is anyother easier way to do the same, but sorry i am not aware of it.
Hope this helps,
Regards,
Usman.
Btw, your repo is still green
-
July 26th, 2004, 11:39 AM
#9
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!
-
July 26th, 2004, 11:45 AM
#10
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 .
-
July 26th, 2004, 11:48 AM
#11
Originally Posted by senkyoshi
So does that mean there is no way to access or control them?
Take a look at these (and, perhaps, you will find some more) usefull Paul DiLascia's articles:
http://msdn.microsoft.com/msdnmag/issues/0800/c/
http://msdn.microsoft.com/msdnmag/issues/02/01/c/
-
July 26th, 2004, 12:24 PM
#12
Hey Usman,
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!
thanks again
-
July 26th, 2004, 01:03 PM
#13
usman,
After I get the handle to the HeaderCtrl, how do I get the information that I need for the NMHEADER struct?
-
July 26th, 2004, 02:20 PM
#14
Hi!
Please don't create new threads for the same problem. Now you want to fill in the NMHEADER struct. Its defined in MSDN like...
Code:
typedef struct tagNMHEADER {
NMHDR hdr;
int iItem;
int iButton;
HDITEM *pitem;
} NMHEADER, *LPNMHEADER
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.
-
July 26th, 2004, 03:55 PM
#15
Problem: i am trying to use FindWindow with class "SysListView32" but it isnt returning anything. any other way to get a reference to CListCtrl in the CFileDialog?
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|