几何尺寸与公差论坛

 找回密码
 注册
查看: 834|回复: 0

【转帖】ctrl key

[复制链接]
发表于 2009-4-13 10:07:26 | 显示全部楼层 |阅读模式
ctrl key
i want to develop c# code to implement "ctrl key is pressed" so that i can continue selecting solidworks entities without physically pressing the "ctrl" key. then "release the ctrl key" after selection. i am using visual studio 2005 and solidworks 2008. does anyone have any idea?
many thanks
newform
i am using mouse selection event so that i cannot set the "append" property when selecting a solidworks entity.
there is a class named keyeventargs in c# .net. however, keyeventargs.control (the ctrl key) is read only. i cannot set it true indicating that the "ctrl" key is pressed.
no idea right now.
try this
that will just determine if a key is pressed or not. the only way to do what you are after is to use a low level system key hook and send a keydown windows message to the system queue. then send the keyup event once done.
bare in mind that if the user actually presses and releases the ctrl key during this things will get messy so you may want to dismiss any user posted system messages in your key hook.
dear luke and william,
thank you very much for your help.
i checked msdn and found that there are three keyboard messages, namely, keydown, keypress and keyup. i am using keybd_event to imitate that "ctrl" key is kept pressed. it works perfectly.
thanks a lot.
newform
edited: 09/02/2008 at 12:17 pm by newform newform
though it works now, it causes another problem. since the "ctrl" key is "kept pressed", you cannot use hot keys such as ctrl + c if you switch from solidworks to other applications such as microsoft word. if you do, you cannot select multiple objects in solidworks if you switch back to solidworks.
i cannot find any property setting for selectionmanager to append selected object so i want to know how "ctrl" key is kept pressed in solidwork and released if you switch to other applications.
thanks
edited: 09/09/2008 at 10:42 am by newform newform
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-24 10:03 , Processed in 0.035448 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表