Bildchen auf Fensterleiste möglich?
Re: Bildchen auf Fensterleiste möglich?
PB_Key_PadEnter wußte ich nicht, aber werde ich mal testen, Danke.
Re: Bildchen auf Fensterleiste möglich?
ich habe mal kleine Beispiele gebaut:
Die Konstanten #PB_Key_PadEnter und #PB_Key_Return gibts bei InitKeyboard(), InitSprite() und Co.
In Windows Applicationen kann man (scheinbar) zwischen Return und Enter nicht wirklich unterscheiden.
Auf ein Beispiel mit Console und RawKey() habe ich hier verzichtet, das Beispiel aus der Hilfe läuft!
Die Konstanten #PB_Key_PadEnter und #PB_Key_Return gibts bei InitKeyboard(), InitSprite() und Co.
Code: Alles auswählen
If InitSprite() And InitKeyboard() And OpenScreen(800,600,32,"Test")
Paused = #False
Debug " enter loop "
Repeat
FlipBuffers()
If StartDrawing(ScreenOutput())
ExamineKeyboard()
DrawingMode(0)
DrawText(20, 20, "Program is running... (ESC to exit.)")
If KeyboardPushed(#PB_Key_PadEnter)
DrawText(20, 40, "Key PadEnter ...") :Debug #PB_Key_PadEnter ;== 156
EndIf
If KeyboardPushed(#PB_Key_Return)
DrawText(20, 60, "Key Return ...") :Debug #PB_Key_Return ;== 28
EndIf
StopDrawing()
EndIf
Until KeyboardPushed(#PB_Key_Escape)
EndIf
Code: Alles auswählen
EnableExplicit
Procedure Trace(Pre$, Key = 0)
Protected t$, k
If key <> 0
t$ = ": " + RSet(Str(key), 3) + ", 0x" + RSet(Hex(key), 2, "0") + ", '" + Chr(key) + "'"
If key = #VK_RETURN : t$ + ", (Return or Enter)" : EndIf
EndIf
AddGadgetItem (0, -1, LSet(Pre$, 15) + t$)
SetGadgetState(0, CountGadgetItems(0) - 1)
EndProcedure
; MSDN - HELP WM_KEYDOWN
;
; wParam
; The virtual-key code of the nonsystem key. See Virtual-Key Codes.
;
; lParam
; The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.
;
; Bits Meaning
; 0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
; 16-23 The scan code. The value depends on the OEM.
; 24 Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
; 25-28 Reserved; do not use.
; 29 The context code. The value is always 0 for a WM_KEYDOWN message.
; 30 The previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
; 31 The transition state. The value is always 0 for a WM_KEYDOWN message.
;
; Return value
; An application should return zero if it processes this message.
;
Procedure callback(hwnd, umsg, wparam, lparam)
Protected result = #PB_ProcessPureBasicEvents
Select umsg
Case #WM_SYSKEYDOWN : Trace("WM_SYSKEYDOWN", wparam)
Case #WM_SYSKEYUP : Trace("WM_SYSKEYUP", wparam)
Case #WM_KEYDOWN : Trace("WM_KEYDOWN", wparam)
Case #WM_KEYUP : Trace("WM_KEYUP", wparam)
EndSelect
ProcedureReturn result
EndProcedure
Procedure main()
If OpenWindow(0, 0, 0, 640, 480, "Teste Keyboard ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListViewGadget(0, 10, 10, 620, 460, $4000) ;' #LBS_NOSEL == $4000
SetGadgetFont(0, LoadFont(0, "consolas", 8))
AddGadgetItem (0, -1, "Einfach mal eine Taste drücken und schauen was passiert! ")
SetWindowCallback(@callback(), 0)
;AddKeyboardShortcut(0, #PB_Shortcut_Return, 1) ;' remove ; to capture the Key down event ???
Repeat ;' Main Loop
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
; Case #WM_KEYDOWN
; Trace("MainLoop DOWN", EventwParam())
; Case #WM_KEYUP
; Trace("MainLoop UP", EventwParam())
Case #PB_Event_Menu
AddGadgetItem (0, -1, "Event Menu Key : Return by Keyboardshortcut ")
SetGadgetState(0, CountGadgetItems(0) - 1)
EndSelect
ForEver
EndIf
EndProcedure
End main()
;' BoF
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home
- HeX0R
- Beiträge: 2959
- Registriert: 10.09.2004 09:59
- Computerausstattung: AMD Ryzen 7 5800X
96Gig Ram
NVIDIA GEFORCE RTX 3060TI/8Gig
Win10 64Bit
G19 Tastatur
2x 24" + 1x27" Monitore
Glorious O Wireless Maus
PB 3.x-PB 6.x
Oculus Quest 2 - Kontaktdaten:
Re: Bildchen auf Fensterleiste möglich?
Doch klar:Axolotl hat geschrieben: In Windows Applicationen kann man (scheinbar) zwischen Return und Enter nicht wirklich unterscheiden.
Code: Alles auswählen
EnableExplicit
Procedure Trace(Pre$, Key, lparam)
Protected t$, extkey
If key <> 0
If lparam & $1000000
extkey = #True
EndIf
If key = #VK_RETURN
If extkey
t$ = "Enter"
Else
t$ = "Return"
EndIf
EndIf
EndIf
If t$
AddGadgetItem (0, -1, LSet(Pre$, 15) + t$)
SetGadgetState(0, CountGadgetItems(0) - 1)
EndIf
EndProcedure
; MSDN - HELP WM_KEYDOWN
;
; wParam
; The virtual-key code of the nonsystem key. See Virtual-Key Codes.
;
; lParam
; The repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following.
;
; Bits Meaning
; 0-15 The repeat count for the current message. The value is the number of times the keystroke is autorepeated as a result of the user holding down the key. If the keystroke is held long enough, multiple messages are sent. However, the repeat count is not cumulative.
; 16-23 The scan code. The value depends on the OEM.
; 24 Indicates whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
; 25-28 Reserved; do not use.
; 29 The context code. The value is always 0 for a WM_KEYDOWN message.
; 30 The previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up.
; 31 The transition state. The value is always 0 for a WM_KEYDOWN message.
;
; Return value
; An application should return zero if it processes this message.
;
Procedure main()
If OpenWindow(0, 0, 0, 640, 480, "Teste Keyboard ", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListViewGadget(0, 10, 10, 620, 460, $4000) ;' #LBS_NOSEL == $4000
SetGadgetFont(0, LoadFont(0, "consolas", 8))
AddGadgetItem (0, -1, "Einfach mal eine Taste drücken und schauen was passiert! ")
Repeat ;' Main Loop
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #WM_KEYDOWN
Trace("MainLoop DOWN", EventwParam(), EventlParam())
Case #PB_Event_Menu
AddGadgetItem (0, -1, "Event Menu Key : Return by Keyboardshortcut ")
SetGadgetState(0, CountGadgetItems(0) - 1)
EndSelect
ForEver
EndIf
EndProcedure
End main()
{Home}.:|:.{Codes}.:|:.{Downloads}.:|:.{History Viewer Online}
Re: Bildchen auf Fensterleiste möglich?
hallo,
Bildchen auf Fensterleiste möglich? Ja
https://www.purebasic.fr/english/viewto ... 54#p339154
Auf Wiedersehen
Bildchen auf Fensterleiste möglich? Ja
https://www.purebasic.fr/english/viewto ... 54#p339154
Auf Wiedersehen