Getting filenames of all windows opened in the Main window

Hi,
  I hav created a dialog box with a combo control on it in my VC++(6.0) application. I need to get the list of all the "active" open document file names of the Main Window in the Combo box( In the same manner by which, it shows under the "Windows" option in the application menu bar). I tried finding help in MSDN, but all in vain.
Can anyone please help me find a solution to this...and if possible provide the necessary source code.
Waiting eagerly for reply..
Thanx
Shilpa
ShilpaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

inprasCommented:
Can U pl be more clear what U want I?
Whats the document name any way? and main window?
0
shaigCommented:
If you mean the window text, displayed in the window caption, then you need to use the function GetWindow. Then use GetWindowText on each window you get.
0
ShilpaAuthor Commented:
Hi,
 Okay..Let me be a little more specific..Wht I mean is, suppose in my application(which can open image files, like jpg,bmp,gif etc.) I open 5 different files consecutively. ie. now I hav 5 windows open in my Application. The combo box should now display all the 5 filenames(which r active in my application)on the dialog box.
Till then I will try shaiq's advice. But I would always appreciate more suggestions from u'll....
Thanx once again..
Shilpa    
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Vinayak KumbarSr Program ManagerCommented:
Hi,

U will be opening the files. Then what is the problem?. Just remember the file names into some CStringArray or such things. And fill the combo box with that list. Whenever u close a window, U again will get which window, right?. Then delete that file name from Ur list and update the combo list once again.

Try it out.
VinExpert
0
ShilpaAuthor Commented:
Hi VinExpert,
  ur suggestion is quite understandable. I hav never used CStringArray. Can u pls give me the code tht u hav in ur mind.
Thanx once again..
Waiting eagerly for ur reply
Shilpa
0
Vinayak KumbarSr Program ManagerCommented:
Hi,

In app class .h file declare a variable of CStringArray as public member
CStringArray m_saOpenFileNames;

Then whenever U are going to open a new file at that time use
CString filename;
filename = "OpenFile1";
m_saOpenFileNames.Add(filename );

similarly go on adding
And when u close a file at that time u will know the file name say "Open2"
then do
for(int Index = 0; Index < m_saOpenFileNames.GetSize(); Index++)
{
if(m_saOpenFileNames[Index] ==  "Open2")
{
m_saOpenFileNames.RemoveAt[Index];
}
}

Thats it. If U want to access that CStringArray variable outside the app's cpp file, then if ur app class is CMyApp, then use
CMyApp *pApp = (CMyApp *)AfxGetApp();
pApp->m_saOpenFileNames will give u the access.

Hope this helps.

Cheers,
VinExpert

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.