David can you provide a link to your code.
Here is a simple Toggle that will Turn the Caps Lock key on when you are in Mtext
and turn it of when finished.
Code Modified from http://forums.devx.com/showthread.php?t=38468
{code}
' Declare Type for API call:
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage
End Type
' API declarations:
Private Declare Function GetVersionEx Lib "kernel32" _
Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Declare Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetKeyboardState Lib "user32" _
(pbKeyState As Byte) As Long
Private Declare Function SetKeyboardState Lib "user32" _
(lppbKeyState As Byte) As Long
' Constant declarations:
Const VK_CAPITAL = &H14
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Const VER_PLATFORM_WIN32_NT = 2
Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If CommandName = "MTEXT" Then
CapLock False
End If
End Sub
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
If CommandName = "MTEXT" Then
CapLock True
End If
End Sub
Sub CapLock(CapOn As Boolean)
Dim o As OSVERSIONINFO
Dim CapsLockState As Boolean
o.dwOSVersionInfoSize = Len(o)
GetVersionEx o
Dim keys(0 To 255) As Byte
GetKeyboardState keys(0)
' CapsLock handling:
CapsLockState = keys(VK_CAPITAL)
If CapOn Then
If CapsLockState <> True Then 'Turn capslock on
GoSub Runit:
End If
Else
If CapsLockState <> False Then 'Turn capslock off
GoSub Runit:
End If
End If
Exit Sub
Runit:
If o.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS Then '=== Win95/98
keys(VK_CAPITAL) = 1
SetKeyboardState keys(0)
ElseIf o.dwPlatformId = VER_PLATFORM_WIN32_NT Then '=== WinNT
'Simulate Key Press
keybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or 0, 0
'Simulate Key Release
keybd_event VK_CAPITAL, &H45, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0
End If
End Sub
Sub isCapsLockON()
Dim o As OSVERSIONINFO
Dim CapsLockState As Boolean
o.dwOSVersionInfoSize = Len(o)
GetVersionEx o
Dim keys(0 To 255) As Byte
GetKeyboardState keys(0)
' CapsLock handling:
CapsLockState = keys(VK_CAPITAL)
If CapsLockState Then
MsgBox "Caps Lock is On"
Else
MsgBox "Caps Lock is Off"
End If
End Sub
{code}
---------------------------

(defun botsbuildbots() (botsbuildbots))