How To Remove An Instance of Access From the Running Objects Table


S

Stewart Berman

We want to prevent another application from using GetObject to connect to
the instance of Access that our application is running it.

It is my understanding that it should be possible to do that by calling
RevokeActiveObject. The problem that I have is that RevokeActiveObject
requires the handle that was returned by the original call to
RegisterActiveObject.

Now the documentation for GetCurrentProcess says it will return a psuedo
handle for the current process that can be used anywhere a real handle is
needed. However, using the value returned by GetCurrentProcess as input to
RevokeActiveObject does not work.

How do I get the correct handle to call RevokeActiveObject with?

Or is there some other way to remove an instance of Access from the Running
Objects Table?
 
C

Charles Wang [MSFT]

You can call DuplicateHandle to create a real handle. But I am afraid that
it may not be same as the handle required in RevokeActiveObject. As far as
I know, this handle can be only retrieved from the
RegisterActiveObject.However since Office Excel, Word and Access are single
use (multiple instances) servers and that they automatically register their
instances in ROT, you could not retrieve the object handle in your
application. Though you can iterate ROT
(http://support.microsoft.com/kb/190985/EN-US/), there is no interface that
can help retrieve the handle.

If you do not want other process to read/write your Access file, I think
that you can use OPENFILE function to open your file execlusively. More
infomration can be found here,
http://msdn.microsoft.com/en-us/library/aa365430(VS.85).aspx.

Best regards,
Charles Wang
 
Ad

Advertisements

S

Stewart Berman

You can call DuplicateHandle to create a real handle. But I am afraid that
it may not be same as the handle required in RevokeActiveObject. As far as
I know, this handle can be only retrieved from the
RegisterActiveObject.However since Office Excel, Word and Access are single
use (multiple instances) servers and that they automatically register their
instances in ROT, you could not retrieve the object handle in your
application. Though you can iterate ROT
(http://support.microsoft.com/kb/190985/EN-US/), there is no interface that
can help retrieve the handle.

If you do not want other process to read/write your Access file, I think
that you can use OPENFILE function to open your file execlusively. More
infomration can be found here,
http://msdn.microsoft.com/en-us/library/aa365430(VS.85).aspx.

Best regards,
Charles Wang


You can call DuplicateHandle to create a real handle. But I am afraid that
it may not be same as the handle required in RevokeActiveObject.
I've already tried that and it isn't.
If you do not want other process to read/write your Access file, I think
that you can use OPENFILE function to open your file execlusively.
The problem is not another process opening the Access file. The problem is
another process using the instance of Access that has the database open.
 
K

kalyan

Stewart Berman wrote on 04/29/2010 17:17 ET
We want to prevent another application from using GetObject to connect t
the instance of Access that our application is running it

It is my understanding that it should be possible to do that by callin
RevokeActiveObject. The problem that I have is that RevokeActiveObjec
requires the handle that was returned by the original call t
RegisterActiveObject

Now the documentation for GetCurrentProcess says it will return a psued
handle for the current process that can be used anywhere a real handle i
needed. However, using the value returned by GetCurrentProcess as input t
RevokeActiveObject does not work

How do I get the correct handle to call RevokeActiveObject with

Or is there some other way to remove an instance of Access from the Runnin
Objects Table
Hey--I am facing the same issue.I would like to remove an existing entry fo
excel from the ROT but cannot get dwRegister value to revoke
Did you find any solution for that ?
 
Ad

Advertisements

T

Tony Toews

Hey--I am facing the same issue.I would like to remove an existing entry for
excel from the ROT but cannot get dwRegister value to revoke.
Did you find any solution for that ?
There was just some discussion on the ROT in the
m.p.vb.general.discussion newsgroup. Those folks had a reasonable
clue about the ROT. Whereas I'd never heard about it before. So I'd
suggest asking in there for some assistance.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 

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