Admin | Write | GuestBook
[공지] 해당 블로그에 용건이 있으신 분께서는 http://blog.fore.kr/ 의 방명록(Guestbook)으로 부탁드립니다.
[Python] 동적 라이브러리(DLL) 사용 처리.
Category : Programming/Programming Talk | URL : | Written by 포레 ( 2014. 12. 3. 03:18 ) | 신고

 

 """
Load Dynamic-Linked Library(DLL) in Python 2.7
Present by FORE
http://foreblog.tistory.com/
"""

from ctypes import *

 

# define win32-api function
LoadLibraryW = windll.kernel32.LoadLibraryW
GetProcAddress = windll.kernel32.GetProcAddress

 

# Start script
user32 = LoadLibraryW(u'USER32.DLL')
MessageBoxA = GetProcAddress(user32,'MessageBoxA')
if MessageBoxA == 0:
 print 'out!'
 exit()

 

# if __cdeal type -> use CFUNCTYPE
pMessageBoxA = WINFUNCTYPE(c_uint,c_void_p,c_char_p,c_char_p,c_uint)
MessageBoxA = pMessageBoxA(MessageBoxA)
MessageBoxA(0,'XD','Caption',0)

 

 

 

 

Category
분류 전체보기 (605)
Notice (6)
Programming (79)
DISKER (1)
FSCH (7)
Caption (0)
Rest Time ! (443)
Hobby (64)
Tour (5)
Blind Post (0)
Recent Post
Recent Comment
Link
Calender
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Total :
Today :
Yesterday :