Python C:ctypes Library

Source: Internet
Author: User

>>> Import ctypes>>> from ctypes import *>>> dir (ctypes) [' array ', ' argumenterror ', ' array ', ' Bigendianstructure ', ' cdll ', ' cfunctype ', ' default_mode ', ' DllCanUnloadNow ', ' DllGetClassObject ', ' FormatError ', ' GetLastError ', ' HRESULT ', ' libraryloader ', ' littleendianstructure ', ' oledll ', ' POINTER ', ' pyfunctype ', ' pydll ', ' rtld_ ' GLOBAL ', ' rtld_local ', ' setpointertype ', ' Structure ', ' Union ', ' winfunctype ', ' windll ', ' winerror ', ' _cfuncptr ', ' _ Funcflag_cdecl ', ' _funcflag_pythonapi ', ' _funcflag_stdcall ', ' _funcflag_use_errno ', ' _funcflag_use_lasterror ', ' _ Pointer ', ' _simplecdata ', ' __builtins__ ', ' __doc__ ', ' __file__ ', ' __name__ ', ' __package__ ', ' __path__ ', ' __version__ ', ' _c_functype_cache ', ' _calcsize ', ' _cast ', ' _cast_addr ', ' _check_hresult ', ' _check_size ', ' _ctypes_version ', ' _dlopen ', ' _endian ', ' _memmove_addr ', ' _memset_addr ', ' _os ', ' _pointer_type_cache ', ' _string_at ', ' _string_at_addr ', ' _sys ', ' _win_functype_cache ', ' _wstring_at ', ' _wstring_at_addr ', ' AddressoF ', ' alignment ', ' ByRef ', ' c_bool ', ' c_buffer ', ' c_byte ', ' C_char ', ' c_char_p ', ' c_double ', ' c_float ', ' c_int ', ' c_int16 ' , ' C_int32 ', ' c_int64 ', ' c_int8 ', ' c_long ', ' c_longdouble ', ' c_longlong ', ' c_short ', ' c_size_t ', ' c_ubyte ', ' c_uint ', ' c_ ' UInt16 ', ' c_uint32 ', ' c_uint64 ', ' c_uint8 ', ' c_ulong ', ' c_ulonglong ', ' c_ushort ', ' c_void_p ', ' C_VOIDP ', ' C_wchar ', ' c_ ' Wchar_p ', ' cast ', ' Cdll ', ' create_string_buffer ', ' create_unicode_buffer ', ' Get_errno ', ' get_last_error ', ' memmove ', ' Memset ', ' oledll ', ' pointer ', ' py_object ', ' pydll ', ' pythonapi ', ' resize ', ' set_conversion_mode ', ' Set_errno ', ' set_ Last_error ', ' sizeof ', ' string_at ', ' windll ', ' wstring_at '] a little something like this is really a lot of stuff. You can see the type definitions that mainly include some C languages. When you import ctypes, some dynamic libraries are already loaded with:>>> print (WINDLL.KERNEL32) >>> print (WINDLL.USER32) >>> Print (WINDLL.MSVCRT) Just try it out, our favorite natural is Hello world. The MessageBox is called directly here. Check Msdn,messagebox in User32, we call it. >>> MessageBox = windll.user32.messageboxw>>> MessageBox (0, "great", "Hello World", 0) Then, the MessageBox was called .... 

  

Python C:ctypes Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.