How to use the comtypes.client.GetModule function in comtypes

To help you get started, we’ve selected a few comtypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github InsightSoftwareConsortium / ITK / Wrapping / Generators / SwigInterface / pygccxml-1.0.0 / pygccxml / msvc / pdb / __init__.py View on Github external
import os
import sys
import ctypes
import logging
import comtypes
import comtypes.client

from . import impl_details

from ... import utils
from ... import declarations
from .. import config as msvc_cfg

msdia = comtypes.client.GetModule( msvc_cfg.msdia_path )

#~ comtypes_client_gen_dir = comtypes.client.gen_dir
#~ try:
    #~ comtypes.client.gen_dir = None
    #~ msdia = comtypes.client.GetModule( msvc_cfg.msdia_path )
#~ finally:
    #~ comtypes.client.gen_dir = comtypes_client_gen_dir

from loader import decl_loader_t
github compas-dev / compas / src / compas / com / rhino / client.py View on Github external
def start(self):
        Rhino_tlb = GetModule("C:/Program Files/Rhinoceros 5/System/Rhino5.tlb")
        RhinoScript_tlb = GetModule("C:/Program Files/Rhinoceros 5/Plug-ins/RhinoScript.tlb")
        self.Rhino = CreateObject('Rhino5x64.Application').QueryInterface(Rhino_tlb.IRhino5x64Application)
        while not self.Rhino.IsInitialized():
            print('Initialising Rhino...')
            time.sleep(0.5)
        print('Rhino initialised!')
        self.rs = self.Rhino.GetScriptObject().QueryInterface(RhinoScript_tlb.IRhinoScript)
github envygeo / arcplus / arcplus / ao / ao.py View on Github external
def InitStandalone():
    """Init standalone ArcGIS license"""
    # Set ArcObjects version
    import comtypes
    from comtypes.client import GetModule
    g = comtypes.GUID("{6FCCEDE0-179D-4D12-B586-58C88D26CA78}")
    GetModule((g, 1, 0))
    import comtypes.gen.ArcGISVersionLib as esriVersion
    import comtypes.gen.esriSystem as esriSystem
    pVM = NewObj(esriVersion.VersionManager, esriVersion.IArcGISVersion)
    if not pVM.LoadVersion(esriVersion.esriArcGISDesktop, "10.3"):
        return False
    # Get license
    pInit = NewObj(esriSystem.AoInitialize, esriSystem.IAoInitialize)
    ProductList = [esriSystem.esriLicenseProductCodeAdvanced, \
                   esriSystem.esriLicenseProductCodeStandard, \
                   esriSystem.esriLicenseProductCodeBasic]
    for eProduct in ProductList:
        licenseStatus = pInit.IsProductCodeAvailable(eProduct)
        if licenseStatus != esriSystem.esriLicenseAvailable:
            continue
        licenseStatus = pInit.Initialize(eProduct)
        return (licenseStatus == esriSystem.esriLicenseCheckedOut)
github andreaschiavinato / python_grabber / pygrabber / dshow_core.py View on Github external
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

# see https://github.com/tpn/winsdk-10/blob/master/Include/10.0.16299.0/um/axextend.idl for interface spec.

from pygrabber.moniker import *
from pygrabber.win_common_types import *
from comtypes import *
from comtypes import client
from ctypes.wintypes import RECT, SIZE, ULONG, LPOLESTR, DWORD, LONG
from comtypes.automation import IDispatch
from ctypes import c_int, c_long, c_longlong

qedit = client.GetModule("qedit.dll")
quartz = client.GetModule("quartz.dll")


PIN_IN = 0
PIN_OUT = 1


class BITMAPINFOHEADER(Structure):
    _fields_ = [
        ('biSize', c_uint32),
        ('biWidth', c_int),
        ('biHeight', c_int),
        ('biPlanes', c_short),
        ('biBitCount', c_short),
        ('biCompression', c_uint32),
        ('biSizeImage', c_uint32),
github grugq / Buggery / buggery / utils.py View on Github external
def module_from_tlb(tlb_file):
    comtypes.client.GetModule(tlb_file)
github wxWidgets / Phoenix / wx / lib / iewin.py View on Github external
def GetStringSelection(self, asHTML=True):
        """
        Returns the contents of the selected portion of the document as
        either html or plain text.
        """
        if self.ctrl.Document is None:
            return ""
        if not hasattr(sys, 'frozen'): cc.GetModule('mshtml.tlb')
        from comtypes.gen import MSHTML
        doc = self.ctrl.Document.QueryInterface(MSHTML.IHTMLDocument2)
        sel = doc.selection
        range = sel.createRange()
        if asHTML:
            return range.htmlText
        else:
            return range.text
github DavidWhittingham / arcpyext / arcpyext / arcobjects / _arcobjects.py View on Github external
def InitStandalone():
    global pInit
    """Init standalone ArcGIS license"""
    # Set ArcObjects version
    import comtypes
    from comtypes.client import GetModule
    g = comtypes.GUID("{6FCCEDE0-179D-4D12-B586-58C88D26CA78}")
    GetModule((g, 1, 0))
    import comtypes.gen.ArcGISVersionLib as esriVersion
    import comtypes.gen.esriSystem as esriSystem
    pVM = NewObj(esriVersion.VersionManager, esriVersion.IArcGISVersion)
    if not pVM.LoadVersion(esriVersion.esriArcGISDesktop, str(_esriVersion)):
        return False
    # Get license
    pInit = NewObj(esriSystem.AoInitialize, esriSystem.IAoInitialize)
    ProductList = [esriSystem.esriLicenseProductCodeAdvanced, \
                   esriSystem.esriLicenseProductCodeStandard, \
                   esriSystem.esriLicenseProductCodeBasic]
    for eProduct in ProductList:
        licenseStatus = pInit.IsProductCodeAvailable(eProduct)
        if licenseStatus != esriSystem.esriLicenseAvailable:
            continue
        licenseStatus = pInit.Initialize(eProduct)
        return (licenseStatus == esriSystem.esriLicenseCheckedOut)
github ksteinfe / decodes / src / decodes / io / pyautocad / api.py View on Github external
~~~~~~~~~~~~~~~

    Main AutoCAD automation object.

    :copyright: (c) 2012 by Roman Haritonov.
    :license: BSD, see LICENSE.txt for more details.
"""

__all__ = ['Autocad', 'ACAD']

import logging
import comtypes
try:
    import comtypes.client
    # generate modules for work with ACAD constants
    comtypes.client.GetModule(['{851A4561-F4EC-4631-9B0C-E7DC407512C9}', 1, 0])
    import comtypes.gen.AutoCAD as ACAD
except Exception:
    # we are under readthedocs.org and need to mock this
    ACAD = None

from . import types

logger = logging.getLogger(__name__)


class Autocad(object):
    """Main AutoCAD Automation object
    """

    def __init__(self, create_if_not_exists=False, visible=True):
        """
github gccxml / pygccxml / pygccxml / msvc / mspdb / loader.py View on Github external
import ctypes
import pprint
import logging
import comtypes
import itertools
import comtypes.client

from . import enums
from . import impl_details

from ... import utils
from ... import declarations
from .. import config as msvc_cfg
from .. import common_utils as msvc_utils

msdia = comtypes.client.GetModule( msvc_cfg.msdia_path )

SymTagEnum = 12
msdia.SymTagEnum = 12

def iif( condition, true_value, false_value ):
    if condition:
        return true_value
    else:
        return false_value

def as_symbol( x ):
    return ctypes.cast( x, ctypes.POINTER( msdia.IDiaSymbol ) )

def as_table( x ):
    return ctypes.cast( x, ctypes.POINTER( msdia.IDiaTable ) )