Formular immer im Vordergrund halten, Tastenbelegung anzeigen

SetWindowPos, KeyAscii, KeyCode
Private Declare Function SetWindowPos Lib "user32" _
 (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, _
 ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
 ByVal cy As Long, ByVal wFlags As Long) As Long
Private Sub mnuAnsItem_Click() Button in Menüleiste.
Dim Switch As Long
  mnuAnsItem.Checked = Not mnuAnsItem.Checked
  If mnuAnsItem.Checked Then
     Switch = -1     'auch: Switch = HWND_TOPMOST Formular immer im Vordergrund.
  Else
     Switch = -2     'auch: Switch = HWND_NOTOPMOST Form nicht im Vordergrund.
  End If
  Call SetWindowPos(Me.hwnd, Switch, 0, 0, 0, 0, &H53) Aufruf der API-Funktion (Keep Application on Top).
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim I As Integer
  lblTT(0).Caption = ""
  lblTT(1).Caption = ""
  lblASC.Caption = ""
  lblTT(0).Caption = KeyCode Tastenbelegung im Label anzeigen.
  KeyCode = 0
  For I = 0 To 2
    If (2 ^ I) And Shift Then
      lblShift(I).ForeColor = vbRed
    Else
      lblShift(I).ForeColor = &H80000011
    End If
  Next I
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
  lblTT(1).Caption = KeyAscii
  lblASC.Caption = Chr$(KeyAscii)
End Sub



 Ranking-Hits zurück Sitemap
Designed by www.wbrnet.info