Machsupport Forum
Third party software and hardware support forums. => PoKeys => Topic started by: RadiantHeat on January 19, 2009, 11:46:21 AM
-
I am an 'amateur' VB6 Programmer. I quess many Mach3 VB guys are amateur's also. What I want to do is control POKEYS55 from VB6. This is because the MACH/Cypress VB system truly sucks. ( I am not a diplomat ). I downloaded and opened file http://www.poscope.com/uploads/files/VisualBasicDemoScript.zip. I have copied the code to the bottom of this transmission appendix a. I entered the code into Visual Basic 6 and it ran ! ! ! ! . it could tell if there was a device connected , at least. I was so happy ( for a minute )
I looked everywhere for a list off all the other ' magic chants ' ( or keywords or methods/properties ) , I even read all the manuals ! But could not find them anywhere. I tried spying on the dll. and extracting the keywords from the .dll TLB file , with a text editor , there are about 30 of them. but they do not work. a sample of the code taken from 'notepad' is in appendix b. there are little runes at the end of the keywords. I tried many variations of calling conventions and varible types , but could only get one to work "getbuilddate" .
If there is anyone who knows how to fully harness the pokeys dll in VB6 It would be most helpfull. I tried to find a program to read the dll/tlb file , no results. i tried to 'read' the pokeys specifications PDF , but its all in 'Greek' (usa humor).
appendix a , code from pokeys file these work !
' Example on using PoKeys communication DLL via VB scripting
set device = CreateObject("PoKeysDevice_DLL.PoKeysDevice")
if device.EnumerateDevices() = 0 then ' Enumerate devices
msgbox "No PoKeys55 devices found!"
else
device.ConnectToDevice 0 ' Connect to PoKeys55
device.SetPinData 0, 4, 0, 0 ' Set pin 1 as output
device.SetOutput 0, false ' Set pin 1 output OFF
end if
appendix B
Appendix B is the dll / tlb file from the pokeys55 folder , opened with notepad and cleaned up a little. (formatting)
GetDeviceIDWÿÿÿÿÿÿÿÿ Ô¿
serialNumberÿÿÿÿÿÿÿÿ }-
firmwareVersionWÿÿÿÿÿÿÿÿ AŒ
pinNumWW ÿÿÿÿ ´'
GetDeviceIDExWWWÿÿÿÿÿÿÿÿ ®—
firmwareVersionMajorÿÿÿÿ4 €Ú
firmwareVersionMinor ÿÿÿÿ -I
GetBuildDateÿÿÿÿÿÿÿÿ µà
buildDateWWW ÿÿÿÿ äe
GetUserIDWWWÿÿÿÿÿÿÿÿ jÑuserIDWW ÿÿÿÿ ”À
SetUserIDWWWÿÿÿÿÿÿÿÿ !ínewUserIDWWW ÿÿÿÿ
–K
SetPinDataWWÿÿÿÿÿÿÿÿ ¶pinIDWWWÿÿÿÿÿÿÿÿ ‚J
pinFunctionWÿÿÿÿÿÿÿÿ Üpull
UpDownResistorWWÿÿÿÿÿÿÿÿ Ü
invertPinWWW ÿÿÿÿ ªL
SetPinData_2 ÿÿÿÿ
¨
GetPinDataWWÿÿÿÿÿÿÿÿ ²A
pinPossibleFunctions X ¡—
GetPinData_2 ˆ ´
SetPinKeyMappingÿÿÿÿÿÿÿÿ
-
The solution is quite simple.
In your Visual Basic 6.0 environment, go to Project > References..., find 'PoKeys device communication DLL' in the list (if you cannot find the entry, click Browse and locate .tlb file in PoKeys installation folder). Then press magic F2 key (it opens Object browser) and select PoKeysDevice_DLL in upper combo box. Now you can see all the functions and their parameters that PoKeys communication DLL supports.
To use the objects in DLL, proceed in this way (this is possible after you add Reference to PoKeys DLL):
Dim device As New PoKeysDevice
device.EnumerateDevices
device.ConnectToDevice 0
device.DisconnectDevice
Set device = Nothing
-
Neoto is developer by PoLabs :)
regards
Boris