Help accessing COM .dll from Python

Discussion in 'Python' started by Steve Simmons, Dec 1, 2012.

  1. First time post - be gentle with me :)

    I am trying to write a Python script to access a scanning device.  I have an 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 like in 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
     
    Steve Simmons, Dec 1, 2012
    #1
    1. Advertising

  2. Steve Simmons <> wrote:

    ><html>
    > <head>
    >
    > <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    > </head>
    > <body text="#000000" bgcolor="#FFFFFF">
    > <font size="-1"><font face="Bitstream Vera Sans">First time post -
    > be gentle wi<font size="-1">th me :)<br>
    > <br>
    > </font>I am trying to write a Python <font size="-1">script to
    > access a scanning d<font size="-1">evice.&nbsp; <font size="-1">I
    > have an SDK for t<font size="-1">he</font> <font
    > size="-1">scanner but the documentation is a <font
    > size="-1">bit limited and the supplier doesn't support
    > Python (but <font size="-1"><font size="-1">Python is
    > the best option for me <font size="-1">in the
    > current
    > circumstances).</font></font>&nbsp;</font></font></font
    > ></font></font>

    > <br>
    > <br>
    > The SDK revolves around a .dll fi<font size="-1">le that <font
    > size="-1">is described as a 'COM Ob<font size="-1">ject'
    > but the text also implies that it can be ac<font
    > size="-1">cessed directly - "If you don’t use the COM
    > interface in your application and use the SDK files
    > directly like in VC++ then you don’t need to install
    > these files on the destination computer".&nbsp; If I look
    > inside the .d<font size="-1">ll (thanks PE<font
    > size="-1"> Explorer!), I see DllCanUnload,
    > DllGetClassObject, DllRegisterServer and
    > DllUnregisterServer in the 'Export' view.&nbsp; If I
    > look at <font size="-1">the 'Import' view, I can
    > see the names of a bunc<font size="-1">h of <font
    > size="-1">.dll files and </font></font>the
    > names of the <font size="-1">functions</font>/methods
    > I want to call.&nbsp; So I concluded that&nbsp;
    > </font></font></font></font></font></font></font></font
    > ></font></font><font

    > size="-1"><font face="Bitstream Vera Sans"><font size="-1"><font
    > size="-1"><font size="-1"><font size="-1"><font size="-1"><font
    > size="-1"><font size="-1"><font size="-1"><font
    > size="-1"><font face="Bitstream Vera Sans"><font
    > size="-1"><font size="-1"><font size="-1"><font
    > size="-1"><font size="-1"><font
    > size="-1"><font
    > size="-1">DllGetClassObject
    > <font size="-1">would be my
    >
    > friend.</font></font></font></font></font></fon
    > t></font></font></font></font></font>
    > </font></font><br>
    > <br>
    > <font size="-1">However, I've <font size="-1">read
    > various tutorials on using .dll and COM (ctypes,
    > comtypes, and the Python documentation) and I've
    > ended up <font size="-1">more confused than when
    > I started.&nbsp; <font size="-1">I expected to be
    > using COM but all the examples seem to revolve
    > around automating excel or out<font
    > size="-1">look.<br>
    > <br>
    > <font size="-1">I'd be really grateful for
    > some hints on what direction I<font
    > size="-1"> should be head<font size="-1">ed
    > and a pointer to a relevant
    > tutorial.</font></font></font></font>
    > </font></font></font></font><br>
    > <br>
    > <font size="-1">Simmo</font><br>
    > </font></font></font></font></font></font></font>
    > </body>
    ></html>


    A newsreader is not an HTML reader (aka web browser). Please post your
    question in plain text.



    Best regards,

    Günther
     
    Günther Dietrich, Dec 1, 2012
    #2
    1. Advertising

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
    Replies:
    5
    Views:
    8,788
  2. H. Simpson
    Replies:
    4
    Views:
    289
    H. Simpson
    Aug 3, 2004
  3. Chris Angelico

    Re: Help accessing COM .dll from Python

    Chris Angelico, Dec 1, 2012, in forum: Python
    Replies:
    0
    Views:
    141
    Chris Angelico
    Dec 1, 2012
  4. Steve Simmons

    Re: Help accessing COM .dll from Python

    Steve Simmons, Dec 1, 2012, in forum: Python
    Replies:
    0
    Views:
    153
    Steve Simmons
    Dec 1, 2012
  5. Albert Dengg

    Re: Help accessing COM .dll from Python

    Albert Dengg, Dec 1, 2012, in forum: Python
    Replies:
    0
    Views:
    143
    Albert Dengg
    Dec 1, 2012
Loading...

Share This Page