Ver Mensaje Individual
  #2  
Antiguo 19-07-2007
loxod loxod is offline
Miembro
 
Registrado: feb 2007
Ubicación: Mexico
Posts: 45
Reputación: 0
loxod Va por buen camino
Espero que te sirva
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject); 
var 
  CommPort : string; 
  hCommFile : THandle; 
  ModemStat : DWord; 
begin 
  CommPort := 'COM2'; 

  hCommFile := CreateFile(PChar(CommPort), 
                          GENERIC_READ, 
                          0, 
                          nil, 
                          OPEN_EXISTING, 
                          FILE_ATTRIBUTE_NORMAL, 
                          0); 
  if hCommFile = INVALID_HANDLE_VALUE then 
  begin 
    ShowMessage('No se puede abrir '+ CommPort); 
    exit; 
  end; 

  if GetCommModemStatus(hCommFile, ModemStat) <> false then begin 
    if ModemStat and MS_CTS_ON <> 0 then 
      ShowMessage('El CTS (clear-to-send) esta listo.'); 
    if ModemStat and MS_DSR_ON <> 0 then 
      ShowMessage('El DSR (data-set-ready) esta listo.'); 
    if ModemStat and MS_RING_ON <> 0then 
      ShowMessage('El ring indicator esta listo.'); 
    if ModemStat and MS_RLSD_ON <> 0 then 
      ShowMessage('El RLSD (receive-line-signal-detect) esta listo.'); 
end; 

  CloseHandle(hCommFile); 
end;
Responder Con Cita