Arokh Posted July 10, 2006 Posted July 10, 2006 After much trail and error I was finally be able to send some keys to a different application with the Postmessage API. But now I want to send key combinations but I don't kno how to do it and I'm out of ideas too. So here are my attempts: Structure Button Dim Part() As String Dim Desc As String Dim Pushed As Int16 End Structure ... Dim mymsg As New MSG ... mymsg.hwnd = MPChWnd mymsg.message = WM_KEYDOWN mymsg.lParam = 0 ' Tried 15 as well mymsg.wParam = Keys.Control TranslateMessage(mymsg) mymsg.wParam = Keys.Right TranslateMessage(mymsg) mymsg.message = WM_KEYUP mymsg.wParam = Keys.Right TranslateMessage(mymsg) mymsg.wParam = Keys.Control TranslateMessage(mymsg) PostMessage(MPChWnd, WM_KEYDOWN, Keys.Control, 0) PostMessage(MPChWnd, WM_KEYDOWN, Keys.Right, 0) PostMessage(MPChWnd, WM_KEYUP, Keys.Right, 0) PostMessage(MPChWnd, WM_KEYUP, Keys.Control, 0) I'm trying to simulate a short cut in a Video Player which lets the video jump forward while pressed (CTRL+Right Arrow), while pressing only the Arrow would only forward the video by one frame. Using TranslateMessage doesn't work at all, Postmessage send the keys not as a combination and forwards the video frame by frame. Sendmessage does't do the job at all, since it just cycles the buttons on the control panel. Quote
Administrators PlausiblyDamp Posted July 10, 2006 Administrators Posted July 10, 2006 http://www.xtremedotnettalk.com/showthread.php?t=93471&highlight=sendkeys might be worth a read as it covers some of the same (similar) issues. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Arokh Posted July 10, 2006 Author Posted July 10, 2006 mhh sorry for posting in the wrong category :rolleyes: I found a solution which is much better. Instead of sending the combination I found the message that is send when the combination is pressed and now I can directly send the forward/backward command. I just discovered another usefull side of Spy++ instead of just finding the windows handles :D, I didn't know it could also show the messages for a specific handle, thanks for the great insight! (Which I got while searching the forum :) ) [EDIT] Thanks PlausiblyDamp I will also have a look at the link. ( I was writing this post while you already posted the link :) ) Quote
Recommended Posts