From: Vaibhav Sanghavi on
Hi All,

I am launching many applications from my application in background. Say I
launched MS Word. Now, I want the handle of the launched application. I have
the handle to the mainframe window of newly launched application. I am able
to get the menu pointer using CWnd::GetMenu() from the mainframe pointer. But
this works only with the applications like Notepad and Adobe Reader where
menu is the intigral part of the mainframe. Applications like MS Word and MS
Excel have seperate docking windows for menu. At this time I am not able to
get the menu from mainframe.

For such applications what I do is I enumerate all child windows of the
mainframe and call GetMenu function on all child windows but still none of
them returns me the menu pointer.
I get the handle of the docking menu bar window (This handle is the same I
can see using spy++). I call CWnd::FromHandle() funtion to get the CWnd
pointer to that window and then call GetMenu() of using that CWnd pointer but
it returns me NULL;

Any clues?
From: David Lowndes on
>I am launching many applications from my application in background. Say I
>launched MS Word. Now, I want the handle of the launched application. I have
>the handle to the mainframe window of newly launched application. I am able
>to get the menu pointer using CWnd::GetMenu() from the mainframe pointer. But
>this works only with the applications like Notepad and Adobe Reader where
>menu is the intigral part of the mainframe. Applications like MS Word and MS
>Excel have seperate docking windows for menu. At this time I am not able to
>get the menu from mainframe.

Since Word & Excel don't use Windows menus, you're not going to
succeed that way.

What are you trying to achieve - perhaps there's an alternative
approach?

Dave
From: Vaibhav Sanghavi on
Hi David,

Basically I am showing the list of applications installed on the PC. User
will select the multiple applications from that list and will start the
process. Now for all those selected applications I want to capture the
registry keys and files in which application specific data is stored. For
example If I set that after every 5 minutes Outlook Express should check for
the new emails, this woudl be stored somewhere in the registry or in some
file. I want to capture that registry item or the file. But my application
does not know that what are the registry keys it needs to capture for a
particular application.

So what I am doing is I am launching all user selected applications in the
background (i.e. actually afterwards I will create a new desktop and luach
the application in that new desktop) and then getting the handle of its main
window and the menu. I am hitting all the menu items which will access or
modify registry and file system. I am monitoring these registry and file
system changes using Regmon and Filemon utilities and capturing all such
access and modified items.

So to do this I require the handle of the menu from which I will get the
CMenu* using which I will hit the menu.

I hope I have given a clear picture to you.
Will wait for your reply.

Thanks,
Vaibhav
From: Ajay Kalra on
An application can and will touch registry from commands/methods that
do not appear in the menu. This assumption of registry being touched
only by commands thru menu items(or even toolbars) is flawed. Only a
handful of commands appear on the menu in Office applications. You can
customize the menus to have whatever commands a user wants. Regardless,
you will still be open to any internal method of the app that may
write to registry under different context.

--------
Ajay Kalra
ajaykalra(a)yahoo.com

From: David Lowndes on
>Basically I am showing the list of applications installed on the PC. User
>will select the multiple applications from that list and will start the
>process. Now for all those selected applications I want to capture the
>registry keys and files in which application specific data is stored.

It sounds to me as though you have an overly ambitious, almost
impossible task.

Why are you trying to do this?

Dave