Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Problem with SendKeys.SendWait("{ESC}") or SendKeys.SendWait("^c"); ?

$
0
0

Hi ,

I have developed an application that uses hotkeys. and the method like registerhotkeys, receivehotkey(), changehotkey(),etc are the functions used in the project in order to handle the project.

In register hotkey, I have used  SendKeys.SendWait("^c"); (application say "SendKeyApplication")

 SendKeys.SendWait("^c");
                if (Clipboard.ContainsText())
                {
                    string clipBoardText = Clipboard.GetText();
                    Clipboard.Clear();                    
                    if (isHTML && html != null)
                    {
                        Clipboard.SetData(DataFormats.Html, html);
                    }
                    else if (isRichText && !String.IsNullOrEmpty(richtext))
                    {
                        Clipboard.SetText(richtext);
                    }
                    else
                    {
                        if (prevDataObject != null)
                            Clipboard.SetDataObject(prevDataObject);                     

                        if (isText && !String.IsNullOrEmpty(prevClipboardValue))
                        {
                            Clipboard.SetText(prevClipboardValue);
                        }
                    }
////some code
}

and 

if (!InProgress)
                    {
                        SendKeys.SendWait("{ESC}");
                        clipBoardText = clipBoardText.Replace("\n", "");
                        clipBoardText = clipBoardText.Replace("\r", "");
                        clipBoardText = clipBoardText.Replace("\t", "");
                        if (HotKeyID == "//something//" && !_entry.DisableVis)
                        {
                            InProgress = true;
                            _entry.myApp1(clipBoardText);
                            InProgress = false;
                        }
                        if (HotKeyID == "//something//" && !_entry.DisableVis)
                        {
                            InProgress = true;
                            _entry.myApp(clipBoardText);
                            InProgress = false;
                        }


                    }

this application is used by other systems who have installed this SendKeyApplication, and they have their one of the application open,

and if they use a hotkey pressed to open the SendKeyApplication, the application proceeds fine but one of the form in

their application goes to the previous page. Is this problem proceeds because of these SendKeys() ??

I am using .net 4.0 C# winforms, and the application is running on Windows 7.




Roopini



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>