Results 1 to 6 of 6

Thread: VB6 code to VB.net

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    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:
    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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    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.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: VB6 code to VB.net

    Quote 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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    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

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width