Adding keypress event handler to the visio document

X

xargon

Hi everyone,

I am trying to handle the keypress event in the Visio document. But it
somehow does not match the procedure declaration. Always comes up with the
error:
"Procedure declaration does not match description of event or procedure
having the same name."

The code I have used is as follows:

Private Sub m_vsoWindow_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = KeyCodeConstants.vbKeyControl Then
KeyAscii = 0
End If
End Sub

The m_vsoWindow variable is initialized to ActiveWindow.

I have used something similar for the MouseDown event and that works
fine!

Thanks!

Cheers!
Pankaj
 
J

junethesecond

It seems that the keys used to control Visio at now is catched by the Visio
system, so the user's events handler cannot catch the events.
I'm not sure is there any effective counter measur. I'm also looking for
the solution.
 
X

xargon

Damn! Please share if you find something!! MS is working really hard to now
allow users to change the keyboard accelerators programatically!
 
X

xargon

Found this. It catches the keyboard event but refuses to eat it and not
process it further. Maybe it comes after top level processing it done. The
documentation however states that setting CancelDefault to true should
help.

Private Sub m_vsoWindow_KeyDown(ByVal KeyCode As Long, ByVal
KeyButtonState As Long, CancelDefault As Boolean)
CancelDefault = True
'MsgBox "KeyDown fired"
End Sub

Private Sub m_vsoWindow_KeyPress(ByVal KeyAscii As Long, CancelDefault As
Boolean)
CancelDefault = True
'MsgBox "Keypress"
End Sub

Private Sub m_vsoWindow_KeyUp(ByVal KeyCode As Long, ByVal KeyButtonState
As Long, CancelDefault As Boolean)
CancelDefault = True
'MsgBox "Key up"
End Sub

However, still no gain!
 

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