views:

20

answers:

1

Hi everyone,

My VB6 project requires keyboard short-cuts for toolbar control in its MDI Form. For this, I used vbAccelerator Keyboard Hook with vbalHook6.dll found at vbAccelerator Hooks (thanks to Alex K for this suggestion), I'm getting Runtime Error '429', i.e. ActiveX Object Can't be created. I've referenced the required DLL with the project and also tried to register the dll with Windows using Registry Server utility (regsvr32) but it fails to register with error code 0x80004005. I looked at ActiveX Can't Create Object - vbAccelerator which specifically explains reasons for this type of error & its solution, but it didn't worked for me. The project supplied with Keyboard Hook DLL runs fine in my computer, but not with my project. Please help me out............... :-| Thanks..........

[Update]

Again with help of Alex K, I've successfully registered all required DLLs....

But, something has again gone wrong....

Here's code of my IWindowsHook_HookProc method to get key combinations that I want as short-cuts in my application. What's wrong with the code below that crashes VB along with my app if any key is pressed..?

I also want to include short-cuts for Save (Ctrl+s) and Open (Ctrl+O), how I can form chained condition to identify particular key combination...?

Private Function IWindowsHook_HookProc(ByVal eType As EHTHookTypeConstants, ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long, bConsume As Boolean) As Long
If KeyboardlParam(lParam).KeyDown Then
    Select Case True
        Case Me.ActiveControl = Me
            If wParam = vbKeyControl + vbKeyN Then
                frmNewReport.show
                bConsume = True
            End If
    End Select
End If

End Function

+1  A: 

Its a UAC/Permissions error; If your on vista/win7 right click the command prompt icon, choose "run as administrator" then regsvr32 c:\whatever\xxxx.dll.

Alex K.
Thanks, I've successfully registered it. But, the hook is still unable to identify my key combinations, I guess my code is incorrect and crashes VB6 when I press any key during execution. My IWindowsHook_HookProc function is included in my original question. I'm novice to high-level VB programming so help me out.... :-| Thanks.....
Kush