hook keyboard and mouse in office com addin

S

Shinya

I am trying to hook keyboard and mouse input event using
SetWindowsHookEx to check word.ActiveDocument.saved flag
to know if word document has been modified in my office com addin

inside of IDTExtensibility2_OnConnection, i am calling the function like the
following
m_hDllmseHook = SetWindowsHookEx WH_MOUSE_LL, AddressOf MouseProc,
App.hInstance, 0&)

however, mouse move gets too slow when checking saved flag


Public Function MouseProc(ByVal uCode As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long

If uCode = HC_ACTION Then
If wParam = WM_LBUTTONDOWN Then
CheckStatus 'check word.activedocument.saved flag here
End If
End If

MouseProc = CallNextHookEx(m_hDllmseHook, uCode, wParam, lParam)

End Function

is there something I can do about this?

Shinya
 
F

Fredrik Wahlgren

Why do you want to check word.ActiveDocument.saved flag on mouse events??
Wouldn't it be better to do so if the user is closing the document or
similar?

/ Fredrik
 
F

Fredrik Wahlgren

Let me see if I understand. You want to check if the document has been
modified whenever the mouse button is pressed. If it is you will
enable/disable something. Can't you use a timer instead and check every x:th
second?
 
S

Shinya

That is perfect solution.
I am a bit upset of not coming up with a simple solution like you do.
Anywas, you save my day.

Thanks again,
Shinya
 
F

Fredrik Wahlgren

You're welcome.
/Fredrik

Shinya said:
That is perfect solution.
I am a bit upset of not coming up with a simple solution like you do.
Anywas, you save my day.

Thanks again,
Shinya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top