DLL From VB To Delphi

I have the Following DLL IN VB (ShlHook.dll)
Can anyone help me change it to Delphi?
thx
All the project is here:
http://www.coderheaven.com/forum/download.php?id=226

VB Class Module (cShellHook)
'[CODE]
Private Declare Function RegisterWindowMessage Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpString As String) As Long
Private Declare Function RegisterShellHook Lib "Shell32" Alias "#181" (ByVal hwnd As Long, ByVal nAction As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function GetKeyboardLayout Lib "user32" (ByVal dwLayout As Long) As Long
Private Declare Function GetWindowThreadProcessId& Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long)

Const GWL_WNDPROC = (-4)
Const RSH_DEREGISTER = 0

Public Enum SheelHookTypes
       RSH_REGISTER = 1
       RSH_REGISTER_PROGMAN = 2
       RSH_REGISTER_TASKMAN = 3
End Enum

Private Enum ShellEvents
      HSHELL_WINDOWCREATED = 1
      HSHELL_WINDOWDESTROYED = 2
      HSHELL_ACTIVATESHELLWINDOW = 3
      HSHELL_WINDOWACTIVATED = 4
      HSHELL_GETMINRECT = 5
      HSHELL_REDRAW = 6
      HSHELL_TASKMAN = 7
      HSHELL_LANGUAGE = 8
      HSHELL_ACCESSIBILITYSTATE = 11
End Enum

Public Event WindowCreated(ByVal hwnd As Long)
Public Event WindowDestroyed(ByVal hwnd As Long)
Public Event WindowActivated(ByVal hwnd As Long)
Public Event LocaleChanged(ByVal LocaleID As Long)
Public Event TaskBarButtonRedraw(ByVal hwnd As Long)
Public Event TaskManActivated(ByVal hwnd As Long)
Public Event ShellWindowActivated()
Public Event AccesibilityStateChanged()

Dim m_var_hwnd As Long, bHookSet As Boolean

Public Function RemoveShellHook() As Boolean
   If Not bHookSet Then Exit Function
   Call RegisterShellHook(hwnd, RSH_DEREGISTER)
   SetWindowLong hwnd, GWL_WNDPROC, OldProc
   bHookSet = False
End Function

Public Function SetShellHook(ByVal hwnd As Long, ByVal HookType As SheelHookTypes) As Boolean
   uRegMsg = RegisterWindowMessage(ByVal "SHELLHOOK")
   Call RegisterShellHook(hwnd, HookType)
   OldProc = GetWindowLong(hwnd, GWL_WNDPROC)
   SetWindowLong hwnd, GWL_WNDPROC, AddressOf WndProc
   bHookSet = True
   SetShellHook = bHookSet
End Function

Private Sub Class_Initialize()
  SHptr = ObjPtr(Me)
End Sub

Friend Function FireEvent(nEvent As ShellEvents, lExtraInfo As Long)
   Dim pId As Long, tId As Long
   Select Case nEvent
      Case HSHELL_WINDOWCREATED
           RaiseEvent WindowCreated(lExtraInfo)
      Case HSHELL_WINDOWDESTROYED
           RaiseEvent WindowDestroyed(lExtraInfo)
      Case HSHELL_ACTIVATESHELLWINDOW
           RaiseEvent ShellWindowActivated
      Case HSHELL_WINDOWACTIVATED
           RaiseEvent WindowActivated(lExtraInfo)
      Case HSHELL_GETMINRECT
           RaiseEvent TaskBarButtonRedraw(lExtraInfo)
      Case HSHELL_REDRAW
           RaiseEvent TaskBarButtonRedraw(lExtraInfo)
      Case HSHELL_TASKMAN
           RaiseEvent TaskManActivated(lExtraInfo)
      Case HSHELL_LANGUAGE
           tId = GetWindowThreadProcessId(lExtraInfo, pId)
           RaiseEvent LocaleChanged(LoWord(GetKeyboardLayout(tId)))
      Case HSHELL_ACCESSIBILITYSTATE
           RaiseEvent AccesibilityStateChanged
      Case Else
   End Select
End Function

Private Function LoWord(DWORD As Long) As Integer
   If DWORD And &H8000& Then
      LoWord = &H8000 Or (DWORD And &H7FFF&)
   Else
      LoWord = DWORD And &HFFFF&
   End If
End Function

Private Sub Class_Terminate()
  RemoveShellHook
End Sub
'[/CODE]

VB Module
'[CODE]
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes&)

Public OldProc As Long
Public uRegMsg As Long
Public SHptr As Long

Public Function WndProc(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
  If wMsg = uRegMsg Then
     ResolvePointer(SHptr).FireEvent wParam, lParam
  Else
     WndProc = CallWindowProc(OldProc, hwnd, wMsg, wParam, lParam)
  End If
End Function

Private Function ResolvePointer(ByVal lpObj&) As cShellHook
  Dim oSH As cShellHook
  CopyMemory oSH, lpObj, 4&
  Set ResolvePointer = oSH
  CopyMemory oSH, 0&, 4&
End Function
'[/CODE]
instant_newAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eddie ShipmanAll-around developerCommented:
I'm not even going to try that one. There are many ShellHook examples out there try searchng them first.
0
deathman5Commented:
mmmm
all in VB
searched google, didnt find Delphi
I'll try searching other things
0
Eddie ShipmanAll-around developerCommented:
Delphi-Jedi has the JvShellHook example.

http://www.delphi-jedi.org

See Jedi-VCL
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.