thisform.Olecontrol3.portOpen=.t. thisform.Olecontrol3.settings='9600,n,8,1' thisform.Olecontrol3.output=CHR(7) thisform.Olecontrol3.portOpen=.f.but now it comes the new USB cash drawer, the model is Posiflex CR4005II/CR2005/CR6005 Series
Public Declare Function DrawerOpen _ Lib "usbcr.dll" _ (ByVal ID As Long) _ As Long Public Declare Function DrawerState _ Lib "usbcr.dll" _ (ByVal ID As Long) _ As Long Public Declare Function OpenUSBcr _ Lib "usbcr.dll" _ () _ As Long Public Declare Function CloseUSBcr _ Lib "usbcr.dll" _ () _ As Long Public Declare Function RetrieveStatistics _ Lib "usbcr.dll" _ (ByVal ID As Long, ByVal idx As Long, _ ByRef buf As Any, ByVal size As Long) _ As Longthe code for C++ is:
#include <stdio.h> #include <time.h> #include "windows.h" int __cdecl main(int argc, char* argv[]) { HMODULE hm; long (*ou)(); long (*cu)(); long (*wp)(long); long (*ps)(long); SetLastError( 0); hm = LoadLibrary( "usbcr.dll"); printf( " hm = %p, %lu \n",hm,GetLastError()); if ( hm==NULL ) return 1; SetLastError( 0); ou = (long(*)()) GetProcAddress( hm,"OpenUSBcr"); printf( " ou = %p, %lu \n",ou,GetLastError()); SetLastError( 0); cu = (long(*)()) GetProcAddress( hm,"CloseUSBcr"); printf( " cu = %p, %lu \n",cu,GetLastError()); SetLastError( 0); wp = (long(*)(long)) GetProcAddress( hm,"DrawerOpen"); printf( " wp = %p, %lu \n",wp,GetLastError()); SetLastError( 0); ps = (long(*)(long)) GetProcAddress( hm,"DrawerState"); printf( " ps = %p, %lu \n",ps,GetLastError()); printf( " OpenUSBcr = %ld \n", ou()); for (long i=0;i<8;++i) // test 8 drawers { printf( " st1(%ld) = %ld \n", i,ps(i)); printf( " ocr(%ld) = %ld \n", i,wp(i)); printf( " st2(%ld) = %ld \n", i,ps(i)); } printf( " CloseUSBcr = %ld \n", cu()); FreeLibrary( hm); return 0; }Thanks for the help