Re: Help accessing COM .dll from Python

Discussion in 'Python' started by Chris Angelico, Dec 1, 2012.

  1. Quoting his entire text for the benefit of Mr Dietrich, who is
    apparently having trouble reading it. (He's right though, plain text
    is a lot easier to work with.)

    On Sat, Dec 1, 2012 at 8:51 PM, Steve Simmons <> wrote:
    > First time post - be gentle with me :)
    > I am trying to write a Python script to access a scanning device. I havean
    > SDK for the scanner but the documentation is a bit limited and the supplier
    > doesn't support Python (but Python is the best option for me in the current
    > circumstances).
    > The SDK revolves around a .dll file that is described as a 'COM Object' but
    > the text also implies that it can be accessed directly - "If you don’t use
    > the COM interface in your application and use the SDK files directly likein
    > VC++ then you don’t need to install these files on the destination
    > computer". If I look inside the .dll (thanks PE Explorer!), I see
    > DllCanUnload, DllGetClassObject, DllRegisterServer and DllUnregisterServer
    > in the 'Export' view. If I look at the 'Import' view, I can see the names
    > of a bunch of .dll files and the names of the functions/methods I want to
    > call. So I concluded that DllGetClassObject would be my friend.
    > However, I've read various tutorials on using .dll and COM (ctypes,
    > comtypes, and the Python documentation) and I've ended up more confused than
    > when I started. I expected to be using COM but all the examples seem to
    > revolve around automating excel or outlook.
    > I'd be really grateful for some hints on what direction I should be headed
    > and a pointer to a relevant tutorial.
    > Simmo

    Yeah, ctypes isn't all that easy to work with I'm afraid. Ultimately,
    your problem is with your scanner's SDK; if it's poorly documented,
    it's not going to be any easier working from Python than it would be
    from C. I would advise following their non-COM instructions as closely
    as you can, and seeing where that leads you. If their docs are online,
    post us a link; it's possible someone here may be familiar with it, or
    at very least be able to help you with the translation to Python.

    Good luck!

    Chris Angelico, Dec 1, 2012
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
  2. H. Simpson
    H. Simpson
    Aug 3, 2004
  3. Steve Simmons

    Help accessing COM .dll from Python

    Steve Simmons, Dec 1, 2012, in forum: Python
    Günther Dietrich
    Dec 1, 2012
  4. Steve Simmons

    Re: Help accessing COM .dll from Python

    Steve Simmons, Dec 1, 2012, in forum: Python
    Steve Simmons
    Dec 1, 2012
  5. Albert Dengg

    Re: Help accessing COM .dll from Python

    Albert Dengg, Dec 1, 2012, in forum: Python
    Albert Dengg
    Dec 1, 2012

Share This Page