C
ccdarkness
Unregistered / Unconfirmed
GUEST, unregistred user!
我想做个系列号输入工具,不知道怎么模拟键盘输入,代码:<br>procedure TForm1.hotkey(var msg: tmessage);<br>var<br> i: integer;<br> myclip: TClipboard; //剪贴板类<br> mykey: string;<br> temp: string;<br>begin<br> myclip := TClipboard.Create; //创建剪贴板类实例<br> if myclip.HasFormat(cf_text) then //如果剪贴板中内容是文本<br> begin<br> mykey := myclip.AsText; //把文本内容付给mykey<br> if mykey <> '' then //当剪贴板内容不为空,循环<br> begin<br> for i := 1 to length(mykey) do<br> begin<br> temp := copy(mykey, i, 1); //获得第i个字符给temp<br> if temp = '-' then<br> begin<br> keybd_event(9,0,0,0);<br> keybd_event(9,0,KEYEVENTF_KEYUP,0); //当是'-'时按下TAB键<br> end<br> else<br> begin<br> keybd_event(****, 0, 0, 0);<br> keybd_event(****, 0,keyeventf_keyup, 0);<br> end;<br> end;<br> end;<br> myclip.Free;<br> end;<br>end;<br>星号那个地方不知道怎么输入?temp怎么转成虚拟键码?<br>50分,帮帮忙!!