<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[תפיסה של ארוע הדבקה בוינדוס]]></title><description><![CDATA[<p dir="rtl">אני רוצה לתפוס כל פעם שהמתשמש מדביק על ידי המקשים (אופן אחר גם על ידי העכבר יתקבל בברכה).<br />
יש לי את הקוד הבא:</p>
<pre><code>KeysConverter k = new KeysConverter();
          
            int counter = 0;
            while (torun)
            {
                Thread.Sleep(10);
                for (Int32 i = 0; i &lt; 225; i++)
                {
                    int key = GetAsyncKeyState(i);
                  

                    if (key == 1 || key == -32767)
                    {
                        var t = k.ConvertToString(i);
                        if (t =="ControlKey")
                        {
                            counter=1;
                        }
                        if (t == "V" &amp;&amp; counter == 1)
                        {
                           //paste event
                            MessageBox.Show(t);
                        }
</code></pre>
<p dir="rtl">יש עצות יותר טובות מזה?</p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב23/07/2017 17:57 (+03:00)</em></p>
]]></description><link>https://tchumim.com/topic/1298/תפיסה-של-ארוע-הדבקה-בוינדוס</link><generator>RSS for Node</generator><lastBuildDate>Fri, 09 Oct 2026 04:31:26 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/1298.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Jan 2018 11:47:06 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/softs" aria-label="Profile: softs">@<bdi>softs</bdi></a></p>
<blockquote>
<p dir="rtl">מזכיר לי נשכחות... הייתי פעם אלוף בשטויות האלה.<br />
רק אומר שזה לא מורכב בכלל והנה דוגמה : (winform - יש להוסיף פקדי picturebox, textbox ו button)<br />
....</p>
</blockquote>
<p dir="rtl">תודה רבה,<br />
עזרת לי מאוד!</p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב25/08/2017 11:45 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8855</link><guid isPermaLink="true">https://tchumim.com/post/8855</guid><dc:creator><![CDATA[רחמים]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:08 GMT]]></title><description><![CDATA[<p dir="rtl">מזכיר לי נשכחות... הייתי פעם אלוף בשטויות האלה.<br />
רק אומר שזה לא מורכב בכלל והנה דוגמה : (winform - יש להוסיף פקדי picturebox, textbox ו button)</p>
<pre><code>public partial class frmMain : Form
    {
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);

        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);

        [DllImport("user32.dll")]
        static extern short GetAsyncKeyState(Keys vKey);

        private const int WM_DRAWCLIPBOARD = 0x0308;

        private IntPtr m_NextClipbrdViewer;

        public frmMain()
        {
            InitializeComponent();
        }

        bool bAction = false;
        private void btnAction_Click(object sender, EventArgs e)
        {
            if (bAction)
            { //Stop Hook
                ChangeClipboardChain(Handle, m_NextClipbrdViewer);
                btnAction.Text = "Start";
            }
            else
            { //Start Hook (Hook means call WndProc when keyboard is changed)
                m_NextClipbrdViewer = SetClipboardViewer(Handle);
                btnAction.Text = "Stop";
            }
            //Change Flag
            bAction = !bAction;
        }
        
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);
            // Only clipboard events
            if (m.Msg != WM_DRAWCLIPBOARD) return;

            if(GetAsyncKeyState(Keys.Snapshot) != 0)
            {
                textBox1.Text = "Is Snapshot";
            }

            if(Clipboard.ContainsImage())
            {
                pictureBox1.Image = Clipboard.GetImage();
            }

            if (Clipboard.ContainsText())
            {
                textBox1.Text =  Clipboard.GetText();
            }
            if (Clipboard.ContainsFileDropList())
            {
                textBox1.Text = string.Join("\r\n", Clipboard.GetFileDropList().Cast&lt;string&gt;());
            }     
        }
    }
</code></pre>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב24/07/2017 01:48 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8854</link><guid isPermaLink="true">https://tchumim.com/post/8854</guid><dc:creator><![CDATA[softs]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:08 GMT</pubDate></item><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:08 GMT]]></title><description><![CDATA[<p dir="rtl">זה די מסובך. מה שרחמים הביא זה ללכוד את לחיצת המקשים של Ctrl+V, למעשה אתה רוצה את אירוע ההדבקה שיכול להיזרק גם ע"י כפתור או ע"י לחיצת עכבר ותפריט הקשר.<br />
אז זה מאוד מסובך. קוראים לזה hook ותוכל לחפש ע"ז בגוגל C# clipboard global event.</p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב23/07/2017 23:46 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8853</link><guid isPermaLink="true">https://tchumim.com/post/8853</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:08 GMT</pubDate></item><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:07 GMT]]></title><description><![CDATA[<p dir="rtl">בכל רחבי המערכת, וזה WinForms.<br />
מה שהובא לעיל עוזר רק לkey אחד, וא"כ אני אצטרך לחשב בעצמי את הצירוף של שניהם על ידי counter. תקנו אותי אם אני טועה.<br />
ומה שהובא שם מסטאק - אני פשוט לא מבין שם מילה אחת...:(</p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב23/07/2017 21:59 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8852</link><guid isPermaLink="true">https://tchumim.com/post/8852</guid><dc:creator><![CDATA[נתנאל]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:07 GMT</pubDate></item><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:07 GMT]]></title><description><![CDATA[<p dir="rtl">הכונה ברחבי המערכת או רק בתוכנית שלך?<br />
ואם זה בתכונית שלך בלבד איה סוג היא, WPF? WinForms?</p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב23/07/2017 21:04 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8851</link><guid isPermaLink="true">https://tchumim.com/post/8851</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:07 GMT</pubDate></item><item><title><![CDATA[Reply to תפיסה של ארוע הדבקה בוינדוס on Mon, 29 Jan 2018 11:47:06 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://www.codeproject.com/Articles/19004/A-Simple-C-Global-Low-Level-Keyboard-Hook" target="_blank" rel="noopener noreferrer nofollow ugc">https://www.codeproject.com/Articles/19004/A-Simple-C-Global-Low-Level-Keyboard-Hook</a><br />
<a href="https://stackoverflow.com/questions/604410/global-keyboard-capture-in-c-sharp-application" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/604410/global-keyboard-capture-in-c-sharp-application</a></p>
<p dir="rtl"><em>פורסם במקור בפורום CODE613 ב23/07/2017 20:00 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/8850</link><guid isPermaLink="true">https://tchumim.com/post/8850</guid><dc:creator><![CDATA[רחמים]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:47:06 GMT</pubDate></item></channel></rss>