I am using the RegisterHotKey Win32 API to listen to the Ctrl_V key combination and using the WndProc method to handle this hot key notification. Now, even if I don't perform any operations in this method apart from calling base.WndProc(ref mesg), the Paste operation doesnt seem to be getting passed onto Windows and hence, paste is not working. I managed to get paste of text working by explicitly calling SendKeys("^V") but it is not working for non-text data. I also tried SendMessage Win32 API as below
SendMessage(foregroundWindowHandle, 0x302, 0, 0);
but even this is not working.
I am unable to figure out how to execute my code and then let Windows perform the paste for images, files etc. Any help in resolving this will be very timely and highly appreciated.
UPDATE: I figured out the problem was that the window where the Paste command was being generated wasnt getting the focus back. After correcting this, Paste is working fine for Notepad. Also, I am using Alt_Shift_V as the hot key now to avoid clashing with the default paste command. So pasting non-text data works fine. However, pasting text into Visual studio and Office applications is not working. SendKeys("^V") seems to be interpreted in a different way in these applications. Any idea on how to get this working?