Ok, here I go again... I built an application that runs on top of a game that I play. I use a keyboard hook to intercept certain keys and pass them through my app. The problem I am haveing is that the commands are getting passed through my application, but is there a way to stop the keys from then being sent to the game as well.

For example I want to intercept Ctrl + T which in my application does something, but in the game, it opens a window. What I want to happen is it to fire the event in my app and then not send that combination to the game and open the window.

I hope I was clear with my question and I thank you in advance for any help

This is the function I am currently using, which works, but the keys still get sent to the game

VB Code:
  1. Public Function IsHooked(ByRef Hookstruct As KBDLLHOOKSTRUCT) As Boolean
  2.  
  3.         '  CTL Keys
  4.  
  5.         Dim key As Integer
  6.         Dim mcr As Integer
  7.         Dim VK_KEY As Integer
  8.  
  9.         For i As Integer = 0 To setKeys.GetUpperBound(0)
  10.             key = setKeys(i).subKey 'The subkey (1=Ctrl,2=Alt,0=none)
  11.             mcr = setKeys(i).mcr 'The macro index to be fired
  12.             VK_KEY = setKeys(i).key 'The key value
  13.  
  14.             If key = 1 Then 'Subkey is Control
  15.                 If (Hookstruct.vkCode = VK_KEY) And CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) _
  16.                         And CBool(Hookstruct.flags And LLKHF_UP) Then
  17.                     Call mcrFire(mcr)
  18.                     Return True
  19.                 ElseIf (Hookstruct.vkCode = VK_KEY) And CBool(GetAsyncKeyState(VK_CONTROL) And &H8000) Then
  20.                     'Do nothing
  21.                 End If
  22.             ElseIf key = 2 Then 'Subkey is Alt
  23.                 If (Hookstruct.vkCode = VK_KEY) And CBool(Hookstruct.flags And LLKHF_ALTDOWN) _
  24.                     And CBool(Hookstruct.flags And LLKHF_UP) Then
  25.                     Call mcrFire(mcr)
  26.                     Return True
  27.                 ElseIf (Hookstruct.vkCode = VK_KEY) And CBool(Hookstruct.flags And LLKHF_ALTDOWN) Then
  28.                     'Do nothing
  29.                 End If
  30.             Else 'No Subkey
  31.                 If (Hookstruct.vkCode = VK_KEY) And CBool(Hookstruct.flags And LLKHF_UP) Then
  32.                     Call mcrFire(mcr)
  33.                     Return True
  34.                 ElseIf (Hookstruct.vkCode = VK_KEY) Then
  35.                     'Do nothing
  36.                 End If
  37.             End If
  38.         Next i
  39.  
  40.         'Page up and down for switching macro sets
  41.  
  42.         If (Hookstruct.vkCode = VK_NEXT) And CBool(Hookstruct.flags And LLKHF_UP) Then
  43.             MacroSets(1)
  44.             Return True
  45.         ElseIf (Hookstruct.vkCode = VK_NEXT) Then
  46.             Return True
  47.         End If
  48.  
  49.         If (Hookstruct.vkCode = VK_PRIOR) And CBool(Hookstruct.flags And LLKHF_UP) Then
  50.             MacroSets(-1)
  51.             Return True
  52.         ElseIf (Hookstruct.vkCode = VK_PRIOR) Then
  53.             Return True
  54.         End If
  55.  
  56.         Return False
  57.     End Function