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.

the first line set hWnd to 0x00000000. the second line I use to get a pointer to the object and that isnt working because the hWnd handle is bad. anything else you can think of? thanks so much for your time and help

............
Many of the common dialogs have controls with documented IDs like stc1 for a static text control and lst1 for a listbox; these symbols are #defined in <dlgs.h>. You might think the list control would be lst1, but spelunking with Spy (see Figure 1) reveals that the list control is actually contained in another window of class, SHELLDLL_DefView. The SHELLDLL_DefView window has ID lst2; the list control inside it has child ID 1. So to get the list control, you can write:

Remember, when you customize the open file dialog, your CFileDialog is actually a child of the real dialog, which explains why you must use GetParent. (For details see my article "Give Your Applications the Hot New Interface Look with Cool Menu Buttons" in the January 1998 issue of MSJ.) The cast to CListCtrl* works as per the usual MFC trick, because CListControl has neither data members nor virtual functions; it's a pure wrapper class. (Since GetDlgItem returns a pointer to a temporary CWnd, not a CListCtrl, downcasting would normally be a major booboo.)
Once you have a pointer to the list control, you can do whatever you likeŚwithin reason.........

Yes, I actually saw that and it works fine now.
But now, compiling works fine but when I run it and when it gets to that line I get an Unhandled Exception (MFC42D) 0x00000005 Access Violation. Here is my code:

The problem seems to be the List Control is yet not created while OnInitDialog is being called...
Post user defined Message to your dialog and try to retrieve list control pointer in the handler of this message:

OK, it isn't crashing anymore but nothing is happening. The following line:

NMHeader->iItem = 3;

should be telling it to click the Modified area correct (since it is zero based and we have Name, size, type, Modified) Well, nothing is being clicked. Am I missing something in the code I last posted?