We have used OPOS for our POS system for quite some time.
Our currently commercial product was written in VFP and I am now working on making it work in our new product written in VB.
Working with OPOS is quite the same in VB as in VFP (besides the syntax differences).
To control/open a device, you only need to call three methods of the OPOS object:
OpenDevice &&This is where you need the device name from the registry
ClaimDevice &&Claim the device for exlusive use
Enabled &&property to enable the device
You need not concern yourself about what port the device is attached to, this is all handled by OPOS.
Of course, your user, dealer or you need to define the device in OPOS, give it a logical device name (LDN) and assign it to a comm port. But once this is done, opos will handle port communication for you.
You only need to read the registry to know what device to start (The device name).
Actually you only need these functions to do this:
DECLARE Integer RegOpenKeyEx IN Win32API ;
Integer nKey, String @cSubKey, Integer nReserved,;
Integer nAccessMask, Integer @nKeyHandle
DECLARE Integer RegQueryValueEx IN Win32API ;
Integer nKey, String cValueName, Integer nReserved,;
Integer @nType, String @cBuffer, Integer @nBufferSize
and if there are more say f.i. line displays:
DECLARE Integer RegEnumKeyEx IN Win32API ;
Integer nKey, Integer nIndex, String @cName, Integer @nNameSize, Integer nReserved,;
String @cBufferClass, Integer @nBufferSize, Integer @dLastWrittenTo
These are just the declarations in VFP syntax. You can find more info in the MSDN on line about these functions.
For UPOS (Unified OPOS):
The documentation is quite clear about how to talk to the opos object and once you got the hang of it, it is very easy.
HTH,
Weedz (Edward W.F. Veld)
My private project:
Download the CrownBase source code !!