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

Discussion in 'Access Security' started by Stewart Berman, Apr 29, 2010.

  1. 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?
     
    Stewart Berman, Apr 29, 2010
    #1
    1. Advertisements

  2. 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
     
    Charles Wang [MSFT], May 4, 2010
    #2
    1. Advertisements

  3. I've already tried that and it isn't.
    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.
     
    Stewart Berman, May 4, 2010
    #3
  4. Stewart Berman

    kalyan Guest

    Stewart Berman wrote on 04/29/2010 17:17 ET
    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 ?
     
    kalyan, Jan 5, 2011
    #4
  5. Stewart Berman

    Tony Toews Guest

    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/
     
    Tony Toews, Jan 6, 2011
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.