Code :
- ----------------------------------------------------------------
- procedure Test;
- var
- hPort: THandle;
- begin
- try
- // ouverture du port
- hPort:=CreateFile('LPT1',GENERIC_READ or GENERIC_WRITE, 0,nil,OPEN_EXISTING,0,0);
- try
- if hPort = INVALID_HANDLE_VALUE then
- raise exception.Create('Erreur lors de l''ouverture du port');
- // ecriture sur le port parallele
- WriteFile(hPort,...)
- // lecture du port parallele
- ReadFile(hPort,...)
- finally
- CloseHandle(hPort);
- end;
- except
- on e:exception do
- ShowMessage(e.message);
- end;
- end;
- ----------------------------------------------------------------
|