Re: ctypes-users Digest, Vol 49, Issue 2

David Shi <[email protected]>
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
http://arcscripts.esri.com/scripts.asp?eLang=&eProd=&perPage=10&eQuery=areal&Submit2=Search
 
 
I have been trying to call and execute the ArcView 9.x one.
 
from ctypes import *
import ctypes
import arcgisscripting
gp = arcgisscripting.create()
 
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolBox/Toolboxes/Data Management Tools.tbx")
 
mylib = CDLL("d:\\SHImaps\AS13910\ArealInterpolator.dll")
 
 
from ctypes.wintypes import HWND, LPCSTR, UINT
prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, UINT)
addr = mylib._handle
myfunc = prototype(addr)
 
# Make a layer from the feature class
gp.MakeFeatureLayer("d:/shimaps/lc_2k.shp","lyr1") 
# Make a layer from the feature class
gp.MakeFeatureLayer("d:/shimaps/lc_2k.shp","lyr2") 
 
# Select all cities which overlap the chihuahua polygon
gp.SelectLayerByLocation("lyr2", "intersect", "lyr1")
 
 
hllapiparams = ("lyr1"), ("area"), ("lyr2"), ("lyr2")
 
hllapiproto = ctypes.WINFUNCTYPE(ctypes.c_ulong, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_ulong)
 
hllapi = hllapiproto((1, mylib), hllapiparams)
 
##hllapi = hllapiproto(("1", mylib), hllapiparams)
 
##hllapi = hllapiproto((1, mylib), hllapiparams)
 
The error message says number of parameters not correct.
 
I wonder how to set up prototypes and parameters to call and execute vb .dll.
 
Regards.
 
David




________________________________
From: "[email protected]" <[email protected]>
To: [email protected]
Sent: Tue, 8 June, 2010 13:05:48
Subject: ctypes-users Digest, Vol 49, Issue 2

Send ctypes-users mailing list submissions to
    [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
    https://lists.sourceforge.net/lists/listinfo/ctypes-users
or, via email, send a message with subject or body 'help' to
    [email protected]

You can reach the person managing the list at
    [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ctypes-users digest..."


Today's Topics:

  1. Calling and executing ArcGIS extension .dll in Python (David Shi)
  2. Re: Calling and executing ArcGIS extension .dll in    Python
      [SEC=PERSONAL] (Andrew MacIntyre)


----------------------------------------------------------------------

Message: 1
Date: Mon, 7 Jun 2010 12:54:10 +0000 (GMT)
From: David Shi <[email protected]>
Subject: [ctypes-users] Calling and executing ArcGIS extension .dll in
    Python
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

Has anyone come across working examples of calling extension dll in a Python script?

I should be grateful if you could send me working examples and instructions to make it work.

Regards.

David


      
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Tue, 8 Jun 2010 14:59:08 +1000
From: "Andrew MacIntyre" <[email protected]>
Subject: Re: [ctypes-users] Calling and executing ArcGIS extension
    .dll in    Python [SEC=PERSONAL]
To: [email protected]
Message-ID:
    <[email protected]>
Content-Type: text/plain; charset="utf-8"

It would help if you can give a bit more detail about what exactly you?re trying to do, and what components you?re trying to use.



If you mean using COM interfaces particular to various ArcGIS extensions, particularly those that require a licence, you should read the section in ?ArcGIS Desktop Help for VBA developers? for the ExtensionManager co-class.  You will also need build the comtypes interface files for all the ArcGIS dlls and type libraries required.



-------------------------> "These thoughts are mine alone!" <---------

Andrew MacIntyre          Operations Branch

tel:  +61 2 6219 5356    Communications Infrastructure Division

fax:  +61 2 6253 3277    Australian Communications & Media Authority

email: [email protected]            http://www.acma.gov.au/



From: David Shi [mailto:[email protected]] 
Sent: Monday, 7 June 2010 10:54 PM
To: [email protected]
Subject: [ctypes-users] Calling and executing ArcGIS extension .dll in Python



Has anyone come across working examples of calling extension dll in a Python script?



I should be grateful if you could send me working examples and instructions to make it work.



Regards.



David




If you have received this email in error, please notify the sender immediately and erase all copies of the email and any attachments to it. The information contained in this email and any attachments may be private, confidential and legally privileged or the subject of copyright. If you are not the addressee it may be illegal to review, disclose, use, forward, or distribute this email and/or its contents.

Unless otherwise specified, the information in the email and any attachments is intended as a guide only and should not be relied upon as legal or technical advice or regarded as a substitute for legal or technical advice in individual cases. Opinions contained in this email or any of its attachments do not necessarily reflect the opinions of ACMA.
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

------------------------------

_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users


End of ctypes-users Digest, Vol 49, Issue 2
*******************************************

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo

_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.