
Signature
Julian I-Do-Stuff
Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
Hi Julian
At the top of the module, add the following:
Private Declare Function FindWindowByClass Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName
As Long) As Long
When you want the handle, use
Dim lngHWnd as long
lngHWnd = FindWindowByClass("opusapp", 0&)
FWIW, "Opus" was the code name for the first version of Word for
Windows.
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
>I have some useful code (incl declarations into user32) for checking
>keyboard events but it needs Word's Window Handle (Word 2002) - Excel
[quoted text clipped - 5 lines]
>
> Julian
Julian - 22 Jan 2008 08:43 GMT
Thanks Shauna - just what I was looking for!
I'd found something similar elsewhere but was missing the lpClassName,
which, as you demonstrated, was somewhat arbitrary (not like "XLMAIN")
Haven't tried it yet but it looks like it will do the trick perfectly - then
I will be able to do the auto-saving I want *only* when Word is idle...
VMT! Julian

Signature
Julian I-Do-Stuff
Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
> Hi Julian
>
[quoted text clipped - 25 lines]
>>
>> Julian
Julian - 22 Jan 2008 12:52 GMT
Hi Shauna
That works nicely, but I've just realised I may have been asking the wrong
question (it's certainly harder to debug with this approach!)
What I want to do is to trap keyboard events so that I can note the time of
the last keypress...
any suggestions?

Signature
Julian I-Do-Stuff
Some Vista stuff, but mostly just Stuff at http://berossus,blogspot.com
> Hi Julian
>
[quoted text clipped - 25 lines]
>>
>> Julian
Jonathan West - 22 Jan 2008 14:23 GMT
> Hi Shauna
>
[quoted text clipped - 5 lines]
>
> any suggestions?
It sounds like you are trying to write a keylogger. Many such have already
been written, many of them open-source. Just do a web search for
"keylogger".

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup