Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using mscomm in _screen.
Message
De
18/03/2005 06:17:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
17/03/2005 17:19:52
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00997071
Message ID:
00997164
Vues:
14
>I'm trying to use MSCOMMLib.MSComm to read serial data from a printer. I have no problem using the control on a form. I would like to create the object before any forms are created so that I can read the status of the printer at all times. (I don't want to keep a form in the background just to contain this object.)
>
>At first I thought it would be as easy as this:
>
>Ocomm=createobject('mycomm')
>define class Mycomm as MSCOMMLib.MSComm
>proc oncomm
> **** code here
>endproc
>enddefine
>
>I get an error message class definition mycomm not found!
>
>I then found some other code that talked about binding events. So I tried this:
>
>PUBLIC lomodemcomm as MSCOMMLIB.MSComm
>loModemComm = Createobject("MSCOMMLib.MSComm")
>loModemComm.Settings='9600,n,8,1'
>lomodemComm.Handshaking=1
>oHandler=Newobject("myhandler")
>loVFPCOM = Newobject("VFPCOM.ComUtil")
>loVFPCOM.BindEvents(loModemComm, oHandler)
>lomodemComm.portOpen=.t.
>
>Define Class myhandler As custom
> Procedure oncomm
> ***code here
> endproc
>Enddefine
>
>When I run this code everything works until the event fires, then it crashes foxpro and want to send the dubug code to microsoft.
>
>Does anyone any infomation that could help me out...
>
>
>thanks
>Tim Boccaleri

Tim,
I can't test this now but should work:
define class myComControl as OleControl
  OleClass = "MSCOMMLIB.MSComm"
  Settings='9600,n,8,1'
  Handshaking=1
  
  Procedure OnComm
*...
endproc
enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform