I'm trying to upgrade some vb 6 code that I found to vb.net. It uses API calls to cancle button presses (supposed to be for ctrl Alt Delete, which I hope to change once getting it working). I can't figure out how to fix on issue.

I had to create a delegate function to fix an error saying AddressoOf expression cannot be converted to Long because Long is not a Delegate type. But now I get an error saying ...myfunction... cannot be converted to long. The code below is what I have without the guts.

VB Code:
  1. Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
  2.  
  3. Public Delegate Function LowLevelKeyboardProcDel(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  4.  
  5. Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  6. 'yadda yadda yadda
  7. End Function
  8.  
  9. Private m_hDllKbdHook As Long  'private variable holding
  10.  
  11. Public Sub Main
  12. m_hDllKbdHook = SetWindowsHookEx(WH_KEYBOARD_LL, New LowLevelKeyboardProcDel(AddressOf LowLevelKeyboardProc), hIcon, 0&)
  13. 'error is here.  Starting at New Low...
  14. End Sub