順便用VB。將sendkeys用於符號
當我點擊一個按鈕時,我輸入一個符號%^()。當我勾選它(CheckedListBox1)並按開始(按鈕1),它會在記事本上發送垃圾信息,但它不會這樣做。我猜它需要被轉換,或者需要聲明代碼來識別該符號被按下。基本上,我想要的是我放入的任何東西,與OUT相同。
私人小組Timer1_Tick(BYVAL發件人爲System.Object的,BYVALË作爲System.EventArgs)把手Timer1.Tick 上的錯誤繼續下一步
If CheckBox1.Checked = True Then 'Only Checked Items of the CheckedListbox
If IntCount > CheckedListBox1.CheckedItems.Count - 1 Then 'If the index is higher then the max. index of the checkedlistbox
IntCount = 0 ' The index will reset to 0
End If
SendKeys.SendWait(CheckedListBox1.CheckedItems(IntCount).ToString & "{ENTER}") 'Send keys to the active windows
IntCount += 1 'Goto the next line
Else 'All items
If IntCount > CheckedListBox1.Items.Count - 1 Then 'If the index is higher then the max. index of the checkedlistbox
IntCount = 0 ' The index will reset to 0
End If
SendKeys.SendWait(CheckedListBox1.Items(IntCount).ToString & "{ENTER}") 'Send keys to the active windows
IntCount += 1 'Goto the next line
End If
特殊字符,如%^需要圍繞他們'SendKeys.Send'大括號字面上給他們,因爲他們另有其他含義(%ALT鍵,^ CTRL鍵),所以{%}應該可以工作 –
裏面沒有代碼.. –