[fpc-pascal]New for Windows programming

Anton Tichawa anton.tichawa at chello.at
Fri Oct 18 18:07:43 CEST 2002


On Thursday 17 October 2002 20:45, you wrote:
> > From: "Klaus Hartnegg" <klaus at mailserv.brain.uni-freiburg.de>
> > Date: 2002/10/17 Thu AM 10:11:35 EDT
> > To: fpc-pascal at deadlock.et.tudelft.nl
> > Subject: Re: [fpc-pascal]New for Windows programming
> >
> > > Another question is about accessing com port under windows.
> > > I have some turbo pascal DOS based programms that communicate with
> > > microcontrollers through PC serial port. What is the easyest way to get
> > > them working under Windows?
> >
> > I have the same problem.
> >
> > I found some demos on the web page (click in left row on "units"),
> > download elecom12, read file win32com.pas (Com_Open, Com_SendChar, ...)
> > Seems one must use an API call for initializing (SetCommState)
> > and provide callback functions for sending and receiving.
> > I think the Win32 API doc is also available somewhere on Free Pascal Web
> > page. Google Search for "SetCommState" also finds some info on e
> > Microsoft web page.
> >
> > Does somebody have a minimal demo source?
> >
> > Klaus
> > --
>
> When I was doing programming (sometime ago) I was using Martin Bekers
> elecom unit, somewhat modified. Do a Google search on the net for elebbs
> and I am sure it's on his site.
>
> It contains the source and some demo programs for Win32 stuff as well as
> OS/2 and DOS. Nothing for Linux unfortunately.
>
> Frank
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


I don't have the time to look at my backupped sources, but as far as I 
remember, there is a windows-help file for the windows API, available at 
microsoft (some 20 or 30 MB). Also, when I worked with Delphi 4 and 6, this 
very help file was included in the Delphi distribution.

AFAIK, SetCommState is a way to setup the communication parameters (baudrate, 
parity, handshaking, ..), and OpenComm (or was it CreateComm?) opened the 
serial port and returned a file handle.

I did -not- use callback functions (windows 2000, delphi 6). After 
SetCommState/OpenComm(?) I used standard file I/O functions on the file 
handle returned by the API. At termination, or re-initialization, I had to 
use CloseHandle (or CloseFile or CloseComm?) to close the so-called file.

hth

Anton Tichawa.




More information about the fpc-pascal mailing list