tag:blogger.com,1999:blog-7735977282792144014.post275387926989673135..comments2024-03-27T22:57:22.226-07:00Comments on /egilh: 2614.aspx/egilhhttp://www.blogger.com/profile/07640311410701852519noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7735977282792144014.post-10459561488011229022007-11-09T14:18:00.000-08:002007-11-09T14:18:00.000-08:00Which application are you sending the text to?
I ...Which application are you sending the text to?<br /><br><br /><br>I tried SendKeys("abc{TAB}def") and SendKeys("abc\tdef") and both work OK in my test cases.<br /><br><br /><br>Keep in mind that some applications like Pocket Word will insert a tab in the text instead of moving to the next control.Egil Hogholthttp://www.egilh.com/noreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-14829725914563918322007-08-29T22:28:00.000-07:002007-08-29T22:28:00.000-07:00I'm having problems sendit {TAB}...it doenst m...I'm having problems sendit {TAB}...it doenst move to the next control in the tab index... <br /><br>I'll really apreciate ur help.<br /><br><br /><br>thanks.<br /><br>fco montelongonoreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-10429224035212132062006-10-03T22:59:00.000-07:002006-10-03T22:59:00.000-07:00thanks.
I just need to send "ctrl"+C and...thanks.<br /><br>I just need to send "ctrl"+C and "crtl" +V ...etc now.<br /><br>so here is my solution for now if any one is doing the same thing.<br /><br><br /><br><br /><br><br /><br> const int KEYEVENTF_KEYUP = 2;<br /><br><br /><br><br /><br> /// <summary><br /><br> /// Sends the "control"+ "C" to keyboard.<br /><br> /// </summary><br /><br> public static void SendControlC()<br /><br> { <br /><br> try<br /><br> {<br /><br> keybd_event(0x11, 0, 0, 0);// press ctrl<br /><br> keybd_event(0x43, 0, 0, 0); // press c<br /><br> keybd_event(0x43, 0, KEYEVENTF_KEYUP, 0); //release c<br /><br> keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //release ctrl<br /><br> }<br /><br> catch<br /><br> {<br /><br> throw new ArgumentException("error to copy");<br /><br> }<br /><br> }<br /><br><br /><br> /// <summary><br /><br> /// Sends the "control"+ "V" to keyboard.<br /><br> /// </summary><br /><br> public static void SendControlV()<br /><br> { <br /><br> try<br /><br> {<br /><br> keybd_event(0x11, 0, 0, 0);// press ctrl<br /><br> keybd_event(0x56, 0, 0, 0); // press V<br /><br> keybd_event(0x56, 0, KEYEVENTF_KEYUP, 0); //release V<br /><br> keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //release ctrl<br /><br> }<br /><br> catch<br /><br> {<br /><br> throw new ArgumentException("error to paste");<br /><br> }<br /><br> }<br /><br><br /><br> /// <summary><br /><br> /// Sends the "control"+ "X" to keyboard.<br /><br> /// </summary><br /><br> public static void SendControlX()<br /><br> {<br /><br> try<br /><br> {<br /><br> keybd_event(0x11, 0, 0, 0);// press ctrl<br /><br> keybd_event(0x58, 0, 0, 0); // press X<br /><br> keybd_event(0x58, 0, KEYEVENTF_KEYUP, 0); //release X<br /><br> keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0); //release ctrl<br /><br> }<br /><br> catch<br /><br> {<br /><br> throw new ArgumentException("error to cut");<br /><br> }<br /><br> }<br /><br>bobnoreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-81229255396207822772006-09-22T09:15:00.000-07:002006-09-22T09:15:00.000-07:00I have been to busy at work to spend a lot of time...I have been to busy at work to spend a lot of time on the issue. The problem is that I probably pass KeyShiftAnyCtrlFlag, KeyShiftAnyShiftFlag, KeyShiftAnyAltFlag incorrectly to PostKeybEvents() as it ignores the flags completely. I will have a look again next week but it looks like it will take me some time to find a solution.<br /><br><br /><br>BTW: Shift is not really needed as SendKeys support both upper and lower case characters.Egil Hogholthttp://www.egilh.com/noreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-9546823393076678992006-09-14T12:23:00.000-07:002006-09-14T12:23:00.000-07:00I managed to reproduce the problem on a device. L...I managed to reproduce the problem on a device. Looks like the Shift+Ctr+Alt capabilities got lost when I moved to from keyed_event() to PostKeybdMessage(). I will add support to KeyShiftAnyCtrlFlag, KeyShiftAnyShiftFlag, KeyShiftAnyAltFlag and post a comment here when it's ready. The fixed version should be ready by next week.<br /><br><br /><br>Thanks for the bug report.Egil Hogholthttp://www.egilh.com/noreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-59039140409010669152006-09-14T05:59:00.000-07:002006-09-14T05:59:00.000-07:00thank you!
I have problem to use this.
SendKeys...thank you! <br /><br><br /><br>I have problem to use this.<br /><br><br /><br>SendKeys.Send("+zzz"); // it returns "zzz" not "Zzz"<br /><br>SendKeys.Send("^c"); // it returns "c" instead of "copy"<br /><br><br /><br>so I think it doens't take shift, ctrl, and alt.<br /><br><br /><br>is there anyway to fix it?<br /><br><br /><br><br /><br><br /><br>bobnoreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-38306671530900442492006-07-12T14:38:00.000-07:002006-07-12T14:38:00.000-07:00I managed to reproduce and fix the problem with th...I managed to reproduce and fix the problem with the Windows Mobile 5.0 SDK. Insert the new line below and SendKeys works with Mobile Word as well:<br /><br> PostKeybdMessage(hwnd,0,KeyStateDownFlag,(uint)buf1.Length, DownStates, buf1);<br /><br> buf1[0] = 0; // New line<br /><br> PostKeybdMessage(hwnd,0,KeyShiftDeadFlag,1, DeadStates, buf1);<br /><br><br /><br>The file in the downloads section has been updated.Egil Hogholthttp://www.egilh.com/noreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-31792922963742377182006-07-07T12:50:00.000-07:002006-07-07T12:50:00.000-07:00Which characters do you have problems with?
I tr...Which characters do you have problems with? <br /><br><br /><br>I tried the following characters without problems in Pocket Word on a iPaq h4150 (.NET CF 1.0) using SendKeys.cs from the downloads section:<br /><br>1!2@3#4$5%6^7&0*9()_+/.,<>\|qwertlBMDPOmsnDFkEgil Hogholthttp://www.egilh.com/noreply@blogger.comtag:blogger.com,1999:blog-7735977282792144014.post-7980014959609134712006-07-04T11:34:00.000-07:002006-07-04T11:34:00.000-07:00hi,
thanks.. works fine. but i noticed that it wor...hi,<br /><br>thanks.. works fine. but i noticed that it works fine in address bar of the IE in mobile device and in normal text box but does not work when the cursor is where we edit sms or in word mobile. there some keys works (e.g. q,w) but some does not come or shows different symbols. <br /><br>any idea?<br /><br>rnvrnvnoreply@blogger.com