WIN Python IDE: Difference between revisions
From SecuTech Wiki
Jump to navigationJump to search
Created page with "'''How to Load UniKey.dll in Python''' ==1) Download Python 3.1.2( you can download the lastest version )== ==2) Install Python (run setup)== [[File:WIN Python IDE Pic 1.jpg|c..." |
No edit summary |
||
| Line 21: | Line 21: | ||
[[File:WIN Python IDE Pic 9.jpg|center]] | [[File:WIN Python IDE Pic 9.jpg|center]] | ||
<br> | <br> | ||
[[File:WIN Python IDE Pic 10.jpg| | [[File:WIN Python IDE Pic 10.jpg|750px|center]] | ||
<br> | <br> | ||
==4)Copy the UniKey.dll file into the working directory== | ==4)Copy the UniKey.dll file into the working directory== | ||
Revision as of 14:09, 18 April 2012
How to Load UniKey.dll in Python
1) Download Python 3.1.2( you can download the lastest version )
2) Install Python (run setup)





3)Set the environment path





4)Copy the UniKey.dll file into the working directory

5)Write code in python IDLE


Please write the following code in Python Shell.
>>> import ctypes as C
>>> h=C.c_short()
>>> lp1 = C.c_ulong()
>>> lp2 = C.c_ulong()
>>> dll = C.windll.LoadLibrary('UniKey.dll')
>> dll.UniKey_Find(C.byref (h) , C.byref (lp1) , C.byref(lp2))
>>0
The return 0 indicates that a UniKey dongle is successfully found.
