Actually, I don't know exactly why. However, you could use Upper$ and Lower$ to change the cast of the characters:
Const VK_CAPITAL = $14 Const VK_NUMLOCK = $90 Const VK_SCROLL = $91 Const VK_SHIFT = $10 Dim key(3) key(0) = VK_CAPITAL key(1) = VK_NUMLOCK key(2) = VK_SCROLL key(3) = VK_SHIFT i = 3 Repeat api_keybd_event(key(i),0,0,0) ;key down api_keybd_event(key(i),0,2,0) ;key up a = 0 : While a = 0 : a = GetKey() : Wend ;If a > 0 Then Write Chr$(a) If a > 0 Then If (api_GetKeyState(key(i)) And $FFFF) Then Write Upper$(Chr$(a)) Else Write Lower$(Chr$(a)) Until KeyHit(1)