|
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 |
|