HughLerwill
Programmer
Dear All,
In beta versions of Vista VB6 apps failed with an error 70 when the code encountered a Sendkeys Statement. This was fixed in the final release of Vista for VB6 exe files; however the VB6 IDE still falls over.
For those that must have Sendkeys working in the IDE too the following wrapper appears to work; it just appears too simple after the API solutions I have seen...
Private Sub Command1_Click()
Text1.SetFocus
Sendkey "Hello"
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Sendkey "%{F4}"
End Sub
Private Sub Command3_Click()
'fails with error 70 in IDE under Vista
Text1.SetFocus
SendKeys "Goodbye"
End Sub
Sub Sendkey(text$, Optional wait As Boolean = False)
'wrapper for Sendkeys which does not crash in the IDE under Windows Vista
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys text, wait
Set WshShell = Nothing
End Sub
Any comments?
I am not prompting a discussion on hate for SendKeys.
regards Hugh
In beta versions of Vista VB6 apps failed with an error 70 when the code encountered a Sendkeys Statement. This was fixed in the final release of Vista for VB6 exe files; however the VB6 IDE still falls over.
For those that must have Sendkeys working in the IDE too the following wrapper appears to work; it just appears too simple after the API solutions I have seen...
Private Sub Command1_Click()
Text1.SetFocus
Sendkey "Hello"
End Sub
Private Sub Command2_Click()
Text1.SetFocus
Sendkey "%{F4}"
End Sub
Private Sub Command3_Click()
'fails with error 70 in IDE under Vista
Text1.SetFocus
SendKeys "Goodbye"
End Sub
Sub Sendkey(text$, Optional wait As Boolean = False)
'wrapper for Sendkeys which does not crash in the IDE under Windows Vista
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys text, wait
Set WshShell = Nothing
End Sub
Any comments?
I am not prompting a discussion on hate for SendKeys.
regards Hugh