|
-
Jan 26th, 2006, 09:50 PM
#1
Thread Starter
Frenzied Member
VB6 code to VB.net
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:
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
Public Delegate Function LowLevelKeyboardProcDel(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'yadda yadda yadda
End Function
Private m_hDllKbdHook As Long 'private variable holding
Public Sub Main
m_hDllKbdHook = SetWindowsHookEx(WH_KEYBOARD_LL, New LowLevelKeyboardProcDel(AddressOf LowLevelKeyboardProc), hIcon, 0&)
'error is here. Starting at New Low...
End Sub
-
Jan 26th, 2006, 10:03 PM
#2
Re: VB6 code to VB.net
What is it that you are trying to achieve? It may be easier to use RegisterHotKey and UnregisterHotKey. I have to admit that I have no real experience with either so I'm not sure what the relative merits of each are.
http://www.thecodeproject.com/vb/net/mclhotkeynet.asp
-
Jan 26th, 2006, 10:09 PM
#3
Thread Starter
Frenzied Member
Re: VB6 code to VB.net
I have the MS Windows MEdia Center keyboard, which I am attempt to use for a product that I am developing. This keyboard has a bunch of hotkeys on it, channel up, channel down, record.... I've been able to capture the keys being pressed (It wasn't as easy as using the forms key preview event. Not all the keys raised the event). But anyways, some of the keys load applications no matter where you are, like MCE interfase or MSN messanger. I want to stop these programs from loading. But no software comes with the keyboard for customization.
-
Jan 26th, 2006, 10:27 PM
#4
Re: VB6 code to VB.net
 Originally Posted by mpdeglau
no software comes with the keyboard for customization.
Far be it from Microsoft to allow you easy access to something that didn't come from them.
-
Jan 26th, 2006, 11:41 PM
#5
Thread Starter
Frenzied Member
Re: VB6 code to VB.net
It did come from them. It's their keyboard. I'm gonna try that link you gave me tomorrow at work.
Thanks
-
Jan 26th, 2006, 11:44 PM
#6
Re: VB6 code to VB.net
I meant far be it for them to provide you any easy way to access software other than their own using their hardware.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|