Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Clipboard Application - Pasting to IE

Reply
 
Old 06-15-2008   #1 (permalink)
monty0018


 
 

Clipboard Application - Pasting to IE

Hi,

I'm writing a custom clipboard application in VB .NET 2008 similar to
Ditto (http://ditto-cp.sourceforge.net/).
I have tried targeting .NET Frameworks 2.0, 3.0, and 3.5 with the same
results.
I have also tried targeting x86 and x64 CPUs. I am developing on
Windows Vista SP 1 x64.

My problem is that when pasting to IE forms, nothing is pasted! It
pastes to all other tested applications as expected.

Basically, I set the text to the clipboard and use SendKeys.Send("^V")
to send Control-V to foreground window. I am using Interop with
user32.dll's SetForegroundWindow (ByVal hwnd As IntPtr) As Long
function.

When I use SendKeys.Send() and pass the actual text as oppoesed to
Control-V, IE accepts the input as received BUT all CR's in text are
sent as {ENTER} and Posts the form. This causes undesirable results
in the form of a comment with the entire paste building at each CR. I
have been testing with a Comment field.
-------------------------------------------------
ie, trying to paste "Hello,
World"
results in two comments;
1st comment: Hello,
2nd comment: Hello,
World

Suggestions for resolving either of these issues is greatly
appreciated. Code below;

'Dim wsh As New WshShell
' Set last active window to foreground
Form1.SetForegroundWindow(awh)
' send clipped item to application in foreground
Clipboard.SetData(DataFormats.StringFormat,
lvClipped.SelectedItems(0).Text)

'Sleeping as a workaround does not fix IE paste to form
'Threading.Thread.CurrentThread.Sleep(4000)
' Using Windows Shell doesn't help IE paste to form
'wsh.SendKeys("^V")
' dispose of my COM object
'wsh = Nothing

SendKeys.SendWait("^V")
' Flushing doesn't help IE send to form
'SendKeys.Flush()

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista randomly pasting clipboard contents Vista General
pasting document into e-mail Vista mail
clipboard application recommendation? Vista General
Copy/Pasting Vista General
Pasting Photos.. Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46