Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Gestire handles
Forum - C# / VB.NET - Gestire handles

Avatar
gzorzi (Normal User)
Newbie


Messaggi: 1
Iscritto: 15/05/2012

Segnala al moderatore
Postato alle 16:29
Martedė, 15/05/2012
Buongiorno, ho una routine che gestisce l'evento keypress. Questa routine aggiunge in una arraylist (keyBuffer) ogni singolo carattere selezionato e chiama
la sub KeyPressManager, la quale manda un carattere su seriale, carattere che dovrebbe scatenare un altro handles della seriale. Il problema č che l'handle scatenato dalla pressione del tasto inibisce lo scatenarsi del secondo handle dovuto alla scrittura su seriale, fintanto che la sub keypressManager non finisce.
In pratica fino a quando io sono nella sub keypreemanager, nessun altro handle viene gestito. Come posso risolvere? Grazie

Codice sorgente - presumibilmente VB.NET

  1. Private Sub KeyPress(ByVal sender As Object, _
  2.                    ByVal e As Windows.Forms.KeyPressEventArgs) Handles txtTerminal.KeyPress
  3.  
  4.  
  5.         KeysBuffer.Add(e)
  6.         KeyPressManager()
  7.  End Sub
  8.  
  9. Private Sub KeyPressManager()
  10.  
  11.         Dim e As Windows.Forms.KeyPressEventArgs
  12.  
  13.         PressManager = True
  14.  
  15.         While KeysBuffer.Count > 0
  16.               e = CType(KeysBuffer.Item(0), KeyPressEventArgs)
  17.            
  18.  
  19.                 terminal.writeChar(e.KeyChar)
  20.                 e.Handled = True
  21. end while


PM Quote