Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Serial communications
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Serial communications
Divers
Thread ID:
00028470
Message ID:
00028470
Vues:
86
I achieved serial communications through VFP.
basically I use the Mscomm32.ocx and OLE.
Like so...

*--Luis Perez - 04/14/97
*--send to a serial port under Win95

PUBLIC ComForm,glError
LOCAL glPort
glPort = 1
glError = .f.

DO CASE
CASE thisform.cCom.Value = 'COM 1'
glPort = 1
CASE thisform.cCom.value = 'COM 2'
glPort = 2
CASE thisform.cCom.value = 'COM 3'
glPort = 3
CASE thisform.cCom.value = 'COM 4'
glPort = 4
ENDCASE
scan for skumast.vendor = vendors.vendor and skumast.flagit = .t.
ComForm = CREATEOBJECT('Form')
ComForm.AddObject("Testcom","Olecontrol","MSCOMMLib.MSComm")
ComForm.Testcom.CommPort = glPort && Use Comm1, The first Serial Port.
ComForm.Testcom.Settings = "9600,N,8,1" && 9.6 Kbaud, No Parity,
&& 8 data Bits, 1 Stop Bit
ComForm.Testcom.PortOpen = .T.
if glError
exit
endif
ComForm.Testcom.Output=chr(2)+"L"+chr(13) && initialize printer
ComForm.Testcom.Output="H15"+chr(13) && set burn time
ComForm.Testcom.Output="PK"+chr(13) && set print speed
ComForm.Testcom.Output="SC"+chr(13) && set slew rate
ComForm.Testcom.Output="1B0103000030070"+upcnum1+chr(13) && send barcode
w/human
readable legend
ComForm.Testcom.Output="100050200600120"+"Id:"+chr(13) && readable Item ID
ComForm.Testcom.Output="100000200600010"+"Vendor:"+chr(13) && readable Vendor
ComForm.Testcom.Output="100000200470010"+"Dpt:"+chr(13) && readable Dpt
ComForm.Testcom.Output="100000200350010"+"Cls:"+chr(13) && readable Cls
ComForm.Testcom.Output="100000200350040"+skumast.class+chr(13) && readable
from
SKUMAST.DBF Class
ComForm.Testcom.Output="100000200470040"+skumast.department+chr(13) &&
readable
from SKUMAST.DBF Dept #
ComForm.Testcom.Output="100000100600140"+skumast.itemnumber+chr(13) &&
readable
from SKUMAST.DBF Item #
ComForm.Testcom.Output="100000200600055"+skumast.vendor+chr(13) &&
readable from
SKUMAST.DBF Vendor
ComForm.Testcom.Output="100000200750010"+skumast.desc1+chr(13) && SKUMAST.DBF
ComForm.Testcom.Output="1X1100000850000L200001"+chr(13) && Top Horizontal
Line
ComForm.Testcom.Output="1X1100000050005L001079"+chr(13) && Left vertical line
ComForm.Testcom.Output="1X1100000000065B130045000000"+chr(13) && Barcode Box
ComForm.Testcom.Output="E"+chr(13) && end print
ComForm.Testcom.PortOpen = .F.
endscan

Don't pay attention to the codes at the Comform.testcom.output = "....
because they are specific to print to a serial label printer.
Now; as you can see, this works flawlessly under Win95, but I need this APP
to run under Win3.11 also....Win3.11 doesn't support Mscomm32.ocx, so I am
looking for alternatives to do this...I''ve tried a few possibilities by
using FOXTOOLS.FLL and the low level functions to no avail...
Using the OS() function I want to detect which OS i'm running under and use
a DO CASE to tell the APP which procedure to use...
I need the Win3.11 desperately...I already called Microsoft and searched
through the MSDN CD's and the TechNet CD's already...

Help!

TIA
____________________________
Luis Perez
Millennium Data Solutions, Corp.
President & CEO
e-mail: luis@mds-corp.com
http://www.mds-corp.com
USA
____________________________
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform