兄弟你好!欢迎交流!偶的qq为71892967.经过我的实验发现:<br>1.似乎是可以实现模拟Ctrl+a的,如下程序证明<br>procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;<br> Shift: TShiftState);<br>begin<br>if (key=97)and(ssCtrl in shift) then showmessage('yes');<br>end;<br><br>procedure TForm1.Memo1MouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br> keybd_event(VK_CONTROL,mapvirtualkey(VK_CONTROL,0),0,0);<br> keybd_event(97,mapvirtualkey(97,0),0,0);<br> keybd_event(97,mapvirtualkey(97,0),keyeventf_keyup,0);<br> keybd_event(VK_CONTROL,mapvirtualkey(VK_CONTROL,0),keyeventf_keyup,0);<br>end;<br>但是有一个奇怪的问题,程序实际运行时,真正按下Ctrl+a是无效的<br><br>2.如果设置菜单等快捷键为Ctrl+A,则上述模拟按键无效,好象只认'A',不认'a'.<br><br>综上所述,可能(仅仅是'可能',有待查证)当我们按下Ctrl+A时,传入字符的ASCII<br>码都是'A'(65),也就是说要用‘A', 但是:<br>procedure TForm1.Memo1MouseUp(Sender: TObject; Button: TMouseButton;<br> Shift: TShiftState; X, Y: Integer);<br>begin<br>//keybd_event(VK_SHIFT,mapvirtualkey(VK_SHIFT,0),0,0);<br>keybd_event(97,mapvirtualkey(97,0),0,0);<br>keybd_event(97,mapvirtualkey(97,0),keyeventf_keyup,0);<br>//keybd_event(VK_SHIFT,mapvirtualkey(VK_SHIFT,0),keyeventf_keyup,0);<br>end;<br>当我点击memo时,自动加入的竟然是‘1’,晕倒!为什么?<br>对这个问题很感兴趣,有结果一定会告诉你的. 希望和你一起探讨!