Hi Michael,
Based on my understanding, there is some logic in your winform application
that intercepts the Ctrl+F12 key combination shortcut. Now, you want to
activate this shortcut code logic in various places, such as Button.Click
event and Label.MouseEnter event etc... If I have misunderstood you, please
feel free to tell me, thanks.
Normally, in this situation, the recommended solution is placing all the
code that is processing the Ctrl+F12 shortcut in a subroutine function, so
we can call this subroutine function in various places to achieve/activate
the same Ctrl+F12 code logic.
If your application has the limitation that the code that processes Ctrl+F12
spreads in many places and is hard to maintain in a single subroutine
function, you may really need to simulate the Ctrl+F12 key combination
programmatically. .Net provided System.Windows.Forms.SendKeys class for this
function. You may use SendKeys.Send() method to simulate the shortcut. More
specificly, you may use SendKeys.Send("^{F12}"). The detailed keystroke
parameter table is listed in the MSDN link below:
http://msdn2.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
SendKeys.Send() is also useful to trigger keyboard shortcut of other
applications, since other application's code is not callable from our code.
Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support Engineer
within 1 business day is acceptable. Please note that each follow up
response may take approximately 2 business days as the support professional
working with you may need further investigation to reach the most efficient
resolution. The offering is not appropriate for situations that require
urgent, real-time or phone-based interactions or complex project analysis
and dump analysis issues. Issues of this nature are best handled working
with a dedicated Microsoft Support Engineer by contacting Microsoft Customer
Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.