PDA

Click to See Complete Forum and Search --> : Whats wrong with this code??


heavenhell
Feb 17th, 2001, 09:15 AM
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

Feb 17th, 2001, 11:04 AM
And because of this GetWindowThreadProcessId¥objIE©hwnd. I don't think the declaration has all of those characters in it.

heavenhell
Feb 18th, 2001, 12:05 AM
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¤

alex_read
Feb 19th, 2001, 05:58 AM
Did you copy this code from the net ? :D

Looks as though it didn't copy over properly, these copyright symbols should be dots / full stops / periods :

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) ! :D:)

heavenhell
Feb 19th, 2001, 06:45 AM
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©

saphire_29877
Feb 20th, 2001, 11:53 AM
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.