Hallo,
ich habe da ein kleines Programm welches im Hintergrund minimiert läuft und darauf wartet das es manchmal benutzt wird, nun möcht ich gerne das Programm mit einem Shortcut CTRL-S etc. aus dem Hintergrund nach vorne holen und maximieren, einen Shortcut im Programm zu definieren bringt leider nichts weil das Programm im Hintergrund ja keinen Focus hat,
hat jemand eine Idee ?
Gruss Peter
Hintergrundprogramm per Shortcut aufrufen
Hintergrundprogramm per Shortcut aufrufen
ich weis das ich nix weis
GetAsyncKeyState_() wird auch nicht helfen, da es auch den Focus auf das Fenster benötigt.
Ich würde einen KeyboardHook in Verbindung mit "GetKeyState_(#VK_...) & $F0000000" benutzen, so wie ich es auch bei EasyKill gemacht habe.
Ich würde einen KeyboardHook in Verbindung mit "GetKeyState_(#VK_...) & $F0000000" benutzen, so wie ich es auch bei EasyKill gemacht habe.

[url=irc://irc.freenode.org/##purebasic.de]irc://irc.freenode.org/##purebasic.de[/url]
Jedenfalls funktionierte es, als ich es in EasyKill eingebaut hatte nur als ich das Fenster geöffnet hatte. Kann aber auch sein das es an etwas anderem lag..
In der PSDK steht jedenfalls: "Windows NT/2000/XP: The return value is zero for the following cases: The foreground thread belongs to another process and the desktop does not allow the hook or the journal record."
In der PSDK steht jedenfalls: "Windows NT/2000/XP: The return value is zero for the following cases: The foreground thread belongs to another process and the desktop does not allow the hook or the journal record."

[url=irc://irc.freenode.org/##purebasic.de]irc://irc.freenode.org/##purebasic.de[/url]
Hi,
Problem gelöst !, habe einen Code von Sparkie im englishen Forum gefunden den man einfach auf die eigenen Bedürfnisse anpassen kann.
Gruss Peter
Problem gelöst !, habe einen Code von Sparkie im englishen Forum gefunden den man einfach auf die eigenen Bedürfnisse anpassen kann.
Gruss Peter
Code: Alles auswählen
#VK_O = $4F
#MOD_WIN = $8
; --> We use this as our HotKey ID. It must be between 0 and $BFFF
; --> I'll just add #MOD_WIN + #VK_O for thhis ID
#HOTKEY_WIN_O = #MOD_WIN + #VK_O
quit = #False
Procedure myWindowCallback(hwnd, msg, wparam, lparam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_HOTKEY
; --> Is this our HotKey
If wparam = #HOTKEY_WIN_O
beep_(100,100)
SetForegroundWindow_(WindowID())
MessageRequester("Info", "Hotkey pressed")
EndIf
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "HotKey test") And CreateGadgetList(WindowID())
SetWindowCallback(@myWindowCallback())
; --> Hotkey is WinKey + letter "O"
If RegisterHotKey_(WindowID(), #HOTKEY_WIN_O, #MOD_WIN, #VK_O)
MessageRequester("Info", "HotKey is registered")
TextGadget(0, 0, 90, 300, 20, "Press WinKey+O", #PB_Text_Center)
Else
MessageRequester("Error", "Unable to register HotKey")
quit = #True
EndIf
Repeat
event = WaitWindowEvent()
Select event
Case #PB_Event_CloseWindow
UnregisterHotKey_(WindowID(), #HOTKEY_WIN_O)
quit = #True
EndSelect
Until quit
EndIf
ich weis das ich nix weis
- vonTurnundTaxis
- Beiträge: 2130
- Registriert: 06.10.2004 20:38
- Wohnort: Bayreuth
- Kontaktdaten:
Ich habe ein Programm, das Shortcuts per GetAsyncKeystate_() verwendet, um sich in den Vordergrund zu schieben...Deeem2031 hat geschrieben:Jedenfalls funktionierte es, als ich es in EasyKill eingebaut hatte nur als ich das Fenster geöffnet hatte. Kann aber auch sein das es an etwas anderem lag..
In der PSDK steht jedenfalls: "Windows NT/2000/XP: The return value is zero for the following cases: The foreground thread belongs to another process and the desktop does not allow the hook or the journal record."