Results 1 to 6 of 6

Thread: Whats wrong with this code??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    24
    Set objIE = New InternetExplorer
    objIE©navigate "mail©yahoo©com"
    objIE©Visible = True

    lthreadID = GetWindowThreadProcessId¥objIE©hwnd, 0&¤

    hHook = SetWindowsHookEx¥WH_KEYBOARD, AddressOf KeyboardProc, 0&, lthreadID¤


    This works for a form but it doesnt work for internetExplorer© Whats wrong with this??
    Thanks

  2. #2
    Guest
    And because of this GetWindowThreadProcessId¥objIE©hwnd. I don't think the declaration has all of those characters in it.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    24
    I try removing the copyright signs nut it still diesnt work© About GetWindowThreadProcessID, it second arugment is lpdwProcessId
    Points to a 32-bit value that receives the process identifier© If this parameter is not NULL, GetWindowThreadProcessId copies the identifier of the process to the 32-bit value; otherwise, it does not©

    I tried this but still doesnt work, Any ideas???

    lret=GetWindowThreadProcessId ¥hwnd,lthreadID¤
    hHook = SetWindowsHookEx¥WH_KEYBOARD, AddressOf KeyboardProc, 0&, lthreadID¤

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    Did you copy this code from the net ?

    Looks as though it didn't copy over properly, these copyright symbols should be dots / full stops / periods :
    Code:
    Set objIE = New InternetExplorer
    objIE.navigate "www.twistedhumour.com"
    'Very good joke site - the last one _
    is a test that I don't think is an actual site !
    objIE.Visible = True
    
    lthreadID = GetWindowThreadProcessId (objIE.hwnd, 0&)
    
    hHook = SetWindowsHookEx (WH_KEYBOARD, AddressOf KeyboardProc, 0&, lthreadID)
    This will work for you (the brackets were also shown as weird shapes) !

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Feb 2001
    Location
    Singapore
    Posts
    24
    What do are you saying? i dont understand© My problem is that i cant hook to the the IE object even though i got the threadID of it©

  6. #6
    New Member
    Join Date
    Feb 2001
    Location
    USA
    Posts
    1

    Smile HOOK to IE Thread

    hi,

    i dont think it is possible to hook to an internet explorer window or any window that does not belong to YOUR application. Visual Basic restricts that because of the apartment threading model that it follows. This however can be done by a C++ DLL file that subclasses the keyboard events and messages. Please correct me if i am wrong.

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