



Code: Alles auswählen
Global hWindow,msg,hook
#VK_OEM_PERIOD = $BE
Structure KBDLLHOOKSTRUCT
vkCode.l
scanCode.l
flags.l
time.l
dwExtraInfo.l
EndStructure
Procedure.b FindWindowProcessName (exename.s, title.s)
Protected snap.l, hwnd.l, wndname.s
hwnd = GetForegroundWindow_()
wndname = ""
GetWindowText_(hwnd,@wndname,255)
GetWindowThreadProcessId_ (hwnd, @pid)
NewList Process32.PROCESSENTRY32()
ClearList (Process32 ())
snap = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS,0)
If snap
Define.PROCESSENTRY32 Proc32
Proc32\dwSize = SizeOf (PROCESSENTRY32)
If Process32First_ (snap, @Proc32)
If pid = Proc32\th32ProcessID And GetFilePart(PeekS(@Proc32\szExeFile)) = exename And wndname = title
ProcedureReturn #True
LastElement (Process32 ())
EndIf
While Process32Next_ (snap, @Proc32)
If pid = Proc32\th32ProcessID And GetFilePart(PeekS(@Proc32\szExeFile)) = exename And wndname = title
ProcedureReturn #True
LastElement (Process32 ())
EndIf
Wend
EndIf
CloseHandle_ (snap)
EndIf
ProcedureReturn #False
EndProcedure
Procedure.l myKeyboardHook(nCode, wParam, *p.KBDLLHOOKSTRUCT)
If nCode = #HC_ACTION
If *p\vkCode = #VK_DECIMAL And FindWindowProcessName("notepad.exe","test.txt - Editor")
If wParam = #WM_KEYDOWN Or wParam = #WM_SYSKEYDOWN
keybd_event_(#VK_OEM_PERIOD, MapVirtualKey_(#VK_OEM_PERIOD,0), 0, 0)
ProcedureReturn 1
EndIf
EndIf
EndIf
ProcedureReturn CallNextHookEx_(0, nCode, wParam, *p)
EndProcedure
Procedure AskForExit()
If MessageRequester("EXIT", "End the KeyboardHook ??",#MB_YESNO) = #IDYES
UnhookWindowsHookEx_(hook) : End
EndIf
EndProcedure
hook = SetWindowsHookEx_(#WH_KEYBOARD_LL,@myKeyboardHook(),GetModuleHandle_(0),0)
If hook = 0: End: EndIf
hWindow = OpenWindow(1,0,0,10,10,"k8D h00K",#PB_Window_Invisible)
; by daniel, 21. Nov 2002 (german Tips&Tricks)
SystemPath$ = Space(1024) : GetSystemDirectory_(SystemPath$,1024)
hIcon = ExtractIcon_(0,SystemPath$+"\user32.dll",1)
;-----
AddSysTrayIcon(1,WindowID(1),hIcon)
SysTrayIconToolTip(1,"k8D h00K")
msg = RegisterWindowMessage_("DKs_k8D_h00K")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow : End
Case #PB_Event_Menu
If EventMenu() = 20 : AskForExit() : EndIf
Case #PB_Event_SysTray
If EventType() = #PB_EventType_LeftDoubleClick
AskForExit()
EndIf
EndSelect
ForEver
Code: Alles auswählen
7 8 9 0
U I O P
J K L Ö
M : _
Code: Alles auswählen
OpenWindow(0,0,0,300,200,"test.txt - Editor") : CreateGadgetList(WindowID(0)) : EditorGadget(0,0,0,300,200) : LoadFont (0, "Courier", 15) : SetGadgetFont(0, FontID(0)) : Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow