close mdb database from calling mdb

I

iccsi

I have a launch center application to open other mdb files.
I want to close all mdb opened by launch center when user close launch
center.

I would like to know is it possible to get Windows Handle ID number to
identify which applicaitons opened by launch center and close them
using Windows Handle ID number.

I am not sure am I on the right tracke.
If I am, any API function does above tasks like get Windows Handle ID
Number and close the application using Windows Handle ID Number?

If I am not on the right tracker, any better way to do this?

Your help is great appreciated,
 
T

Tom van Stiphout

On Tue, 20 Apr 2010 13:57:43 -0700 (PDT), iccsi <[email protected]>
wrote:

Yes, you are on the right track. Depending on how apps are launched
you can indeed get a "handle" to them and use that later to shut them
down.
But this path has some perils. One of them is that if one of the apps
is displaying a modal dialog or a MsgBox: sending a normal "please
shutdown gracefully" instruction doesn't work. And nuking the app out
of memory seems a little harsh, especially since this can potentially
corrupt a database.
So I would rethink this requirement, and go without it.

In case I did not convince you, use CreateProcess Windows API, and
inspect the hProcess element of the structure pointed to by the
lpProcessInformation argument. You can use this handle to request the
process to be shut down, for example using TerminateProcess. Or use
PostMessage(WM_CLOSE, ...) with a window handle of
application.hWndAccessApp. This all gets a bit complicated to explain
in a newsgroup post.

-Tom.
Microsoft Access MVP
 
I

iccsi

Yes, you are on the right track. Depending on how apps are launched
you can indeed get a "handle" to them and use that later to shut them
down.
But this path has some perils. One of them is that if one of the apps
is displaying a modal dialog or a MsgBox: sending a normal "please
shutdown gracefully" instruction doesn't work. And nuking the app out
of memory seems a little harsh, especially since this can potentially
corrupt a database.
So I would rethink this requirement, and go without it.

In case I did not convince you, use CreateProcess Windows API, and
inspect the hProcess element of the structure pointed to by the
lpProcessInformation argument. You can use this handle to request the
process to be shut down, for example using TerminateProcess. Or use
PostMessage(WM_CLOSE, ...) with a window handle of
application.hWndAccessApp. This all gets a bit complicated to explain
in a newsgroup post.

-Tom.
Microsoft Access MVP








- Show quoted text -

Thanks for the message,
I am glad to know that I am on the right track.
Does apiGetWindow get Windows Handle ID?
Do you have any link to learn all the Winodws API you mentioned in the
message?

Your help is great appreciated,
 
I

iccsi

Yes, GetWindow returns a Window Handle. Seehttp://support.microsoft.com/kb/183009for more details.
I find the Windows APIs using the MSDN Library to which I subscribe,
but any search engine can find them as well.

-Tom.
Microsoft Access MVP






- Show quoted text -

Thanks millions for helping,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top