示例#1
0
 def DisablefsRedirect(self):
     try:
         #load dlls that fail after fs redir is disabled
         win32api.LoadLibrary(os.path.join(win32api.GetSystemDirectory(), "riched32.dll"))
         win32api.LoadLibrary(os.path.join(win32api.GetSystemDirectory(), "shfolder.dll"))
     except Exception, e:
         print "Error disabling redirect on WOW64 %s" % str(e)
示例#2
0
def which_file(fname):
    """prints paths for fname where fname can be found,
	in case of .dll loads it"""
    files = []
    path = win32api.GetEnvironmentVariable('PATH')
    # try paths as described in MSDN
    dirs = [
        os.getcwd(),
        win32api.GetSystemDirectory(),
        win32api.GetWindowsDirectory()
    ] + path.split(';')
    dirs_norm = []
    dirs_l = []
    for d in dirs:
        dn = d.lower()
        if dn not in dirs_l:
            dirs_l.append(dn)
            dirs_norm.append(d)
    for d in dirs_norm:
        fname2 = os.path.join(d, fname)
        if os.path.exists(fname2):
            if fname2 not in files:
                files.append(fname2)
    if files:
        print('\n'.join([get_file_info(f) for f in files]))
    h = 0
    if fname.lower().endswith('.dll'):
        print('\ttrying to load "%s" ...' % (fname))
        try:
            h = win32api.LoadLibrary(fname)
            if h:
                dll_name = win32api.GetModuleFileName(h)
                print('\t%s loaded' % (dll_name))
        except:
            print('\tCannot load "%s" !!!' % (fname))
示例#3
0
def setTransparency(hwnd, amount):
    """
	This is how the method SetTransparent()is implemented
	 on all MS Windows platforms.
	"""
    try:
        import ctypes
        _winlib = ctypes.windll.user32
        style = _winlib.GetWindowLongA(hwnd, 0xffffffecL)
        style |= 0x00080000
        _winlib.SetWindowLongA(hwnd, 0xffffffecL, style)
        _winlib.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
    except ImportError:
        import win32api
        import win32con
        import winxpgui
        _winlib = win32api.LoadLibrary("user32")
        pSetLayeredWindowAttributes = win32api.GetProcAddress(
            _winlib, "SetLayeredWindowAttributes")
        if pSetLayeredWindowAttributes is None:
            return
        exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
        if (exstyle & 0x80000) == 0:
            win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
                                   exstyle | 0x80000)
    winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
示例#4
0
def find_dll(dll_dir, dll_filename):
    """
    Try to find the specified DLL.

    If a DLL directory was given, try to find the DLL there.

    If no DLL directory was given, start looking for the DLL in the following
    order:

    - current working directory
    - global DLL search paths (this also respects the PATH
      environment variable)
    - default Qmix SDK installation directory

    Parameters
    ----------
    dll_dir : string or None
        The directory containing the DLLs. Pass `None` to look in the default locations.
    dll_filename : string
        The name of the DLL to find, including filename extension.

    Returns
    -------
    dll_path : string or None
        The path of the DLL, or `None` if the DLL could not be found.

    """
    if not dll_dir:
        # Check current directory.
        if os.path.exists(dll_filename):
            dll_path = dll_filename
            return dll_path

        # Check DLL search paths.
        import win32api
        try:
            win32api.LoadLibrary(dll_filename)
            dll_path = dll_filename
            return dll_path
        except Exception:
            pass

        # Check default installation directory.
        import appdirs
        dll_dir = appdirs.user_data_dir('QmixSDK', '')
        if os.path.exists(os.path.join(dll_dir, dll_filename)):
            dll_path = os.path.join(dll_dir, dll_filename)
            # Add DLL dir to PATH, otherwise we won't be able to load the DLL.
            os.environ['PATH'] += os.pathsep + dll_dir
            return dll_path

        return None
    else:
        if os.path.exists(os.path.join(dll_dir, dll_filename)):
            dll_path = os.path.join(dll_dir, dll_filename)
            # Add DLL dir to PATH, otherwise we won't be able to load the DLL.
            os.environ['PATH'] += os.pathsep + dll_dir
            return dll_path
        else:
            return None
示例#5
0
    def MakeTransparent(self, amount):
        """
        This is how the method SetTransparent() is implemented
            on all MS Windows platforms.
        """
        import os
        if os.name == 'nt':  # could substitute: sys.platform == 'win32'

            hwnd = self.GetHandle()
            try:
                import ctypes  # DLL library interface constants' definitions
                _winlib = ctypes.windll.user32  # create object to access DLL file user32.dll
                style = _winlib.GetWindowLongA(hwnd, '0xffff')
                style |= 0x00080000
                _winlib.SetWindowLongA(hwnd, '0xffff', style)
                _winlib.SetLayeredWindowAttributes(hwnd, 0, amount, 2)

            except ImportError:

                import win32api
                import win32con
                import winxpgui
                _winlib = win32api.LoadLibrary("user32")
                pSetLayeredWindowAttributes = win32api.GetProcAddress(
                    _winlib, "SetLayeredWindowAttributes")
                if pSetLayeredWindowAttributes == None:
                    return
                exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
                if 0 == (exstyle & 0x80000):
                    win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
                                           exstyle | 0x80000)
                winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
        else:
            print('OS Platform must be MS Windows')
            self.Destroy()
示例#6
0
def _LoadDll(dll_path):
  """Tries to load, hence initializing, the given DLL.

  Args:
    dll_path: the path to the DLL to test.

  Returns:
    True on success, False on failure.
  """
  mode = (win32con.SEM_FAILCRITICALERRORS |
          win32con.SEM_NOALIGNMENTFAULTEXCEPT |
          win32con.SEM_NOGPFAULTERRORBOX |
          win32con.SEM_NOOPENFILEERRORBOX)
  old_mode = win32api.SetErrorMode(mode)
  try:
    handle = win32api.LoadLibrary(dll_path)
    if not handle:
      return False
    win32api.FreeLibrary(handle)
  except pywintypes.error as e:  # pylint: disable=E1101
    _LOGGER.error('Error: %s', e)
    return False
  finally:
    win32api.SetErrorMode(old_mode)
  return True
示例#7
0
    def MakeTransparent(self, alpha):
        import os, sys

        # input parameter Excel you from 0 to 100 to be consistent with other
        # transparency models.
        # The method below takes a value from 0 to 255.  Need to make the mapping.
        winAlpha = int(alpha * 2.55)

        if sys.platform == 'win32':
            hwnd = self.GetHandle()
            try:
                import ctypes  # DLL library interface constants' definitions
                _winlib = ctypes.windll.user32  # create object to access DLL file user32.dll
                style = _winlib.GetWindowLongA(hwnd, 0xffffffecL)
                style |= 0x00080000
                _winlib.SetWindowLongA(hwnd, 0xffffffecL, style)
                _winlib.SetLayeredWindowAttributes(hwnd, 0, winAlpha, 2)

            except ImportError:
                import win32api, win32con, winxpgui
                _winlib = win32api.LoadLibrary("user32")
                pSetLayeredWindowAttributes = win32api.GetProcAddress(
                    _winlib, "SetLayeredWindowAttributes")
                if pSetLayeredWindowAttributes == None:
                    return
                exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
                if 0 == (exstyle & 0x80000):
                    win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
                                           exstyle | 0x80000)
                winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
        else:
            print '####  OS Platform must be MS Windows'
            self.Destroy()
示例#8
0
    def MakeWindowTransparent(self, amount):
        """
        Makes the :class:`SuperToolTip` window transparent.

        :param `amount`: the alpha channel value.

        :note: This method is available only on Windows and requires Mark Hammond's
         pywin32 package.
        """

        if not _libimported:
            # No way, only Windows XP with Mark Hammond's win32all
            return

        # this API call is not in all SDKs, only the newer ones, so
        # we will runtime bind this
        if wx.Platform != "__WXMSW__":
            return

        hwnd = self.GetHandle()

        if not hasattr(self, "_winlib"):
            self._winlib = win32api.LoadLibrary("user32")

        pSetLayeredWindowAttributes = win32api.GetProcAddress(self._winlib,
                                                              "SetLayeredWindowAttributes")

        if pSetLayeredWindowAttributes == None:
            return

        exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
        if 0 == (exstyle & 0x80000):
            win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, exstyle | 0x80000)

        winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
示例#9
0
 def __init__(self, name, index):
     ResourceFile.__init__(self, name, index)
     filename = "%s.dll" % join(s_general['path'], 'EXE', self.name)
     # pylint: disable=E1101
     if not exists(filename):
         raise ResourceError('Resource File Missing: %s' % filename)
     try:
         self._dll = w32.LoadLibrary(filename)
     except pywintypes.error:
         raise ResourceError('Failed to load Resource: %s' % filename)
示例#10
0
def hook(mod):
    import sys
    newname = 'pythoncom%d%d' % sys.version_info[:2]
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        mod = PyInstaller.depend.modules.ExtensionModule(newname, pth)
    return mod
示例#11
0
def __ExtensionFactory__():
    import traceback
    try:
        #return isapi_wsgi.ISAPISimpleHandler(demo_app)
        import win32api
        win32api.LoadLibrary("C:\\Python\\DLLs\\_hashlib.dll")
        return isapi_wsgi.ISAPISimpleHandler(OpenIDApp())
    except:
        f = open(os.path.join(appdir, 'critical error.txt'), 'w')
        f.write(str(os.listdir('c:\\Python\\DLLs')) + '\n')
        f.write(str(sys.path) + '\n')
        traceback.print_exc(file=f)
        f.close()
示例#12
0
def hook(mod):
    import sys
    newname = 'PyWinTypes%d%d' % sys.version_info[:2]
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        import PyInstaller.mf as mf
        mod = mf.ExtensionModule(newname, pth)
    return mod
示例#13
0
    def _loadModuleInternal(module, cwd):
        '''
		Loads a module by calling `LoadLibrary()` directly inside the Python interpreter
		'''
        origCwd = os.getcwd()
        os.chdir(cwd)
        try:
            handle = win32api.LoadLibrary(module)
            win32api.FreeLibrary(handle)
            return 0
        except Exception as e:
            return e.winerror
        finally:
            os.chdir(origCwd)
示例#14
0
    def DropShadow(self, drop=True):
        """
        Adds a shadow under the window.

        :param `drop`: whether to drop a shadow or not.

        :note: This method is available only on Windows and requires Mark Hammond's
         pywin32 package.
        """

        if not _libimported:
            # No Mark Hammond's win32all extension
            return

        if wx.Platform != "__WXMSW__":
            # This works only on Windows XP
            return

        hwnd = self.GetHandle()

        # Create a rounded rectangle region
        size = self.GetSize()
        if drop:
            if hasattr(win32gui, "CreateRoundRectRgn"):
                rgn = win32gui.CreateRoundRectRgn(0, 0, size.x, size.y, 9, 9)
                win32gui.SetWindowRgn(hwnd, rgn, True)

        CS_DROPSHADOW = 0x00020000
        # Load the user32 library
        if not hasattr(self, "_winlib"):
            self._winlib = win32api.LoadLibrary("user32")

        csstyle = win32api.GetWindowLong(hwnd, win32con.GCL_STYLE)
        if drop:
            if csstyle & CS_DROPSHADOW:
                return
            else:
                csstyle |= CS_DROPSHADOW  #Nothing to be done
        else:
            csstyle &= ~CS_DROPSHADOW

        # Drop the shadow underneath the window
        GCL_STYLE = -26
        cstyle = win32gui.GetClassLong(hwnd, GCL_STYLE)
        if drop:
            if cstyle & CS_DROPSHADOW == 0:
                win32api.SetClassLong(hwnd, GCL_STYLE, cstyle | CS_DROPSHADOW)
        else:
            win32api.SetClassLong(hwnd, GCL_STYLE, cstyle & ~CS_DROPSHADOW)
示例#15
0
    def CreateViewWindow(self, prev, settings, browser, rect):
        print("ScintillaShellView.CreateViewWindow", prev, settings, browser,
              rect)
        # Make sure scintilla.dll is loaded.  If not, find it on sys.path
        # (which it generally is for Pythonwin)
        try:
            win32api.GetModuleHandle("Scintilla.dll")
        except win32api.error:
            for p in sys.path:
                fname = os.path.join(p, "Scintilla.dll")
                if not os.path.isfile(fname):
                    fname = os.path.join(p, "Build", "Scintilla.dll")
                if os.path.isfile(fname):
                    win32api.LoadLibrary(fname)
                    break
            else:
                raise RuntimeError("Can't find scintilla!")

        style = (win32con.WS_CHILD
                 | win32con.WS_VSCROLL
                 | win32con.WS_HSCROLL
                 | win32con.WS_CLIPCHILDREN
                 | win32con.WS_VISIBLE)
        self.hwnd = win32gui.CreateWindow(
            "Scintilla",
            "Scintilla",
            style,
            rect[0],
            rect[1],
            rect[2] - rect[0],
            rect[3] - rect[1],
            self.hwnd_parent,
            1000,
            0,
            None,
        )

        message_map = {
            win32con.WM_SIZE: self.OnSize,
        }
        #        win32gui.SetWindowLong(self.hwnd, win32con.GWL_WNDPROC, message_map)

        file_data = file(self.filename, "U").read()

        self._SetupLexer()
        self._SendSci(scintillacon.SCI_ADDTEXT, len(file_data), file_data)
        if self.lineno != None:
            self._SendSci(scintillacon.SCI_GOTOLINE, self.lineno)
        print("Scintilla's hwnd is", self.hwnd)
示例#16
0
def __import(modname):
    import win32api, imp, sys
    suffix = ""
    if win32api.__file__.find("_d") > 0:
        suffix = "_d"
    filename = "%s%d%d%s.dll" % (modname, sys.version_info[0],
                                 sys.version_info[1], suffix)
    # win32 can find the DLL name.
    h = win32api.LoadLibrary(filename)
    found = win32api.GetModuleFileName(h)
    # Python can load the module
    mod = imp.load_module(modname, None, found,
                          ('.dll', 'rb', imp.C_EXTENSION))
    # and fill our namespace with it.
    globals().update(mod.__dict__)
    win32api.FreeLibrary(h)
示例#17
0
文件: overlay.py 项目: russelg/grid
 def MakeTransparent(self, amount):
     if os.name == 'nt':  # could substitute: sys.platform == 'win32'
         hwnd = self.GetHandle()
         _winlib = win32api.LoadLibrary("user32")
         pSetLayeredWindowAttributes = win32api.GetProcAddress(
             _winlib, "SetLayeredWindowAttributes")
         if pSetLayeredWindowAttributes is None:
             return
         exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
         if 0 == (exstyle & 0x80000):
             exstyle |= win32con.WS_EX_LAYERED | win32con.WS_EX_TOOLWINDOW | win32con.WS_EX_TRANSPARENT
             win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE, exstyle)
         win32gui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
     else:
         print('####  OS Platform must be MS Windows')
         self.Destroy()
示例#18
0
def hook(mod):
    import sys
    if hasattr(sys, 'version_info'):
        vers = '%d%d' % (sys.version_info[0], sys.version_info[1])
    else:
        toks = sys.version[:3].split('.')
        vers = '%s%s' % (toks[0], toks[1])
    newname = 'PyWinTypes%s' % vers
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname+'.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        import PyInstaller.mf as mf
        mod = mf.ExtensionModule(newname, pth)
    return mod
示例#19
0
def hook(mod):
    import sys
    if hasattr(sys, 'version_info'):
        vers = '%d%d' % (sys.version_info[0], sys.version_info[1])
    else:
        import string
        toks = string.split(sys.version[:3], '.')
        vers = '%s%s' % (toks[0], toks[1])
    newname = 'pythoncom%s' % vers
    if mod.typ == 'EXTENSION':
        mod.__name__ = newname
    else:
        import win32api
        h = win32api.LoadLibrary(newname + '.dll')
        pth = win32api.GetModuleFileName(h)
        #win32api.FreeLibrary(h)
        import mf
        mod = mf.ExtensionModule(newname, pth)
    return mod
示例#20
0
    def MakeTransparent(self, amount):
        hwnd = self.GetHandle()
        try:
            import ctypes
            _winlib = ctypes.windll.user32
            style = _winlib.GetWindowLongA(hwnd, 0xffffffecL)
            style |= 0x00080000
            _winlib.SetWindowLongA(hwnd, 0xffffffecL, style)
            _winlib.SetLayeredWindowAttributes(hwnd, 0, amount, 2)

        except ImportError:
            import win32api, win32con, winxpgui
            _winlib = win32api.LoadLibrary("user32")
            pSetLayeredWindowAttributes = win32api.GetProcAddress(
                _winlib, "SetLayeredWindowAttributes")
            if pSetLayeredWindowAttributes == None:
                return
            exstyle = win32api.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
            if 0 == (exstyle & 0x80000):
                win32api.SetWindowLong(hwnd, win32con.GWL_EXSTYLE,
                                       exstyle | 0x80000)
            winxpgui.SetLayeredWindowAttributes(hwnd, 0, amount, 2)
示例#21
0
 def __enter__(self):
     self._handle = win32api.LoadLibrary(self._path)
     return self._handle
示例#22
0
    # Load the R dll using the explicit path
    # First try the bin dir:
    Rlib = os.path.join(RHOME, 'bin', 'R.dll')
    if not os.path.isfile(Rlib):
        Rlib = os.path.join(RHOME, 'lib', 'R.dll')
    if not os.path.isfile(Rlib):
        Rlib = os.path.join(RHOME, 'bin', 'i386', 'R.dll')
    # Otherwise fail out!
    if not os.path.exists(Rlib):
        raise RuntimeError("Unable to locate R.dll within %s" % RHOME)

    if VERBOSE:
        print "Loading the R DLL %s .." % Rlib,
        sys.stdout.flush()
    win32api.LoadLibrary(Rlib)
    if VERBOSE:
        print "Done."
        sys.stdout.flush()

# load the version of rpy that matches the verison of R we're using
if VERBOSE:
    print "Loading Rpy version %s .." % RVER,
    sys.stdout.flush()

try:
    command = "import _rpy%s as _rpy" % RVER
    exec(command)
except Exception, e:
    raise RuntimeError(
        str(e) + """
示例#23
0
 def library(self):
     return win32api.LoadLibrary(self.file_path)
示例#24
0
 def __getitem__(self, filename):
     key = filename.lower()
     return self.__cache.setdefault(key, win32api.LoadLibrary(key))
示例#25
0
        print(
            '\nError: could not read the version string from the DLL file "{}".'
            .format(dllName),
            file=sys.stderr)
        print(
            'Please ensure the DLLs copied from the host are valid DLL files.',
            file=sys.stderr)
        sys.exit(1)

    # Print the DLL details
    print('Found host DLL file "{}" with version string "{}".'.format(
        dllName, dllVersion))
    sys.stdout.flush()

    # Determine if the container OS will load the DLL
    try:
        handle = win32api.LoadLibrary(dll)
        win32api.FreeLibrary(handle)
    except:
        print(
            '\nError: the container OS cannot load the DLL file "{}".'.format(
                dllName),
            file=sys.stderr)
        print(
            'This typically indicates that the DLL is from a newer version of Windows.',
            file=sys.stderr)
        print(
            'Please ensure the DLLs copied from the host match the container OS version.',
            file=sys.stderr)
        sys.exit(1)
示例#26
0
import win32con
import win32ui
import win32api
import array
import struct
import string
import os
from . import scintillacon

# Load Scintilla.dll to get access to the control.
# We expect to find this in the same directory as win32ui.pyd
dllid = None
if win32ui.debug:  # If running _d version of Pythonwin...
    try:
        dllid = win32api.LoadLibrary(
            os.path.join(
                os.path.split(win32ui.__file__)[0], "Scintilla_d.DLL"))
    except win32api.error:  # Not there - we dont _need_ a debug ver, so ignore this error.
        pass
if dllid is None:
    try:
        dllid = win32api.LoadLibrary(
            os.path.join(os.path.split(win32ui.__file__)[0], "Scintilla.DLL"))
    except win32api.error:
        pass
if dllid is None:
    # Still not there - lets see if Windows can find it by searching?
    dllid = win32api.LoadLibrary("Scintilla.DLL")

# null_byte is str in py2k, bytes on py3k
null_byte = "\0".encode('ascii')
示例#27
0
    def OnClose(self, hwnd, msg, wparam, lparam):
        win32gui.EndDialog(hwnd, 0)

    def OnDestroy(self, hwnd, msg, wparam, lparam):
        pass


def DemoModal():
    # Load the .rc file.
    resources = win32rcparser.Parse(g_rcname)
    for id, ddef in resources.dialogs.items():
        print("Displaying dialog", id)
        w = DemoWindow(ddef)
        w.DoModal()


if __name__ == "__main__":
    flags = 0
    for flag in """ICC_DATE_CLASSES ICC_ANIMATE_CLASS ICC_ANIMATE_CLASS 
                   ICC_BAR_CLASSES ICC_COOL_CLASSES ICC_DATE_CLASSES
                   ICC_HOTKEY_CLASS ICC_INTERNET_CLASSES ICC_LISTVIEW_CLASSES
                   ICC_PAGESCROLLER_CLASS ICC_PROGRESS_CLASS ICC_TAB_CLASSES
                   ICC_TREEVIEW_CLASSES ICC_UPDOWN_CLASS ICC_USEREX_CLASSES
                   ICC_WIN95_CLASSES  """.split():
        flags |= getattr(commctrl, flag)
    win32gui.InitCommonControlsEx(flags)
    # Need to do this go get rich-edit working.
    win32api.LoadLibrary("riched20.dll")
    DemoModal()
示例#28
0
###
### A wrapper for the libusb wrapper of the libusb library :-)
###
### This code is in the Public Domain.  (libusb and the wrapper
### are LGPL)
###

from __future__ import generators

import sys

if sys.platform == 'win32':
    try:
        import win32api
        handle = win32api.LoadLibrary("libusb0.dll")
        win32api.FreeLibrary(handle)
    except:
        raise ImportError(
            "libusb needs to be installed for this module to work")

import libusb as usb

# grab some constants and put them in our namespace

for sym in dir(usb):
    if sym.startswith("USB_CLASS_") or sym.startswith("USB_DT"):
        exec "%s=usb.%s" % (sym, sym)
del sym

TRACE = False
示例#29
0
"""A useful wrapper around the "_winxptheme" module.
Unlike _winxptheme, this module will load on any version of Windows.

If _winxptheme is not available, then this module will have only 2 functions -
IsAppThemed() and IsThemeActive, which will both always return False.

If _winxptheme is available, this module will have all methods in that module,
including real implementations of IsAppThemed() and IsThemeActive().
"""

import win32api
try:
    win32api.FreeLibrary(win32api.LoadLibrary("Uxtheme.dll"))
    # Life is good, everything is available.
    from _winxptheme import *
except win32api.error:
    # Probably not running XP.
    def IsAppThemed():
        return False

    def IsThemeActive():
        return False

del win32api
示例#30
0
	
global li
li=[]
cmd=[]

if(len(list1)!=0):
	for n in list1:
		cmd.append((n.strip('\r\n')))   
		addlaunch(n.strip('\r\n'))
		
	
root.resizable(0,0)
root.wm_attributes("-topmost", 1,"-alpha",TRANSPARENT)
myH= int(eval(root.wm_frame()))
root.title('nul')
dock.pack(side=TOP, fill=X)
dock.update()
root.update()
mainloop()


#=============================================================
#eg2:

import win32api
lib_hnd = win32api.LoadLibrary( "user32.dll" )
if lib_hnd:
fn_addr = win32api.GetProcAddress( lib_hnd, "MessageBeep" ) # returns int(2010532466)
if fn_addr:
# Here I'd like to call fn_addr. In C it would be plain fn_addr()
win32api.FreeLibrary( lib_hnd )