Editing Content Clipboard Before Pasting (Ctrl-V) In VB6 - VbCity

The .NET Developer Community
Sign in | Join | Help
  • Home
  • Blogs
  • Forums
  • FAQ
  • Wikis
  • Members
  • Search
  • Services
Forums » VB6 / VBA / ASP » Visual Basic 6 » Editing content Clipboard before pasting (Ctrl-V) in VB6 Editing content Clipboard before pasting (Ctrl-V) in VB6

rated by 0 users This post has 2 Replies | 1 Follower

djeek Not Ranked Since 3/4/2004 Posts 5 Reputation 70 Reply djeek djeek (djeek) Posted: 3/25/2004 4:22 PM rated by 0 users I want to catch Ctrl-v with the KeyDown (and/or KeyPress) event so I can edit de keyboard before the paste. The editing proces is simple: with Clipboard.Gettext to a string variable and then clearing the clipboard followed by Clipboard.Settext the string. All Word- or HTML-**** is gone then! I tried the KeyDown event but running the program pasted the clipboardtext in my code!!!!! The KeyPreview of the form is true.Please help!?Code:Private Sub Form_KeyDown(keycode As Integer, Shift As Integer) Dim CB As String Exit Sub If keycode = 68 And Shift = 2 Then 'Ctrl-V (does not work in a input field in the Webbrowser Control) CB = Clipboard.GetText 'strip codes (Word/html) from clipboardtext via stringvariabele Clipboard.Clear Clipboard.SetText CB 'Put the stripped text back on the clipboard DoEvents SendKeys "^(v)", True 'Continue the paste proces keycode = 0 Shift = 0 End If End Sub
  • | Post Points: 20
Boma Not Ranked Germany Since 1/19/2004 Posts 25 Reputation 230 Reply Boris Matzner (Boma) replied on 3/26/2004 1:07 AM rated by 0 users Hi,instead of using Key events you could just set a timer in your form and then clear the Clipboard all the time, no matter what key is pressed.Code:Private Sub Timer1_Timer() CB = Clipboard.GetText Clipboard.Clear Clipboard.SetText CB End SubregardsBoma
  • | Post Points: 5
djeek Not Ranked Since 3/4/2004 Posts 5 Reputation 70 Reply djeek djeek (djeek) replied on 3/26/2004 11:25 PM rated by 0 users Thanks for replying Boma! Low response on this subject... Difficult?!Your solution is not possible because other applications that are running has to use the clipboard too: with those applications I was copying before the paste action with my VB-app!
  • | Post Points: 5
< Previous Topic | Next Topic > Page 1 of 1 (3 items) | RSS Copyright 1998-2017 vbCity.com LLC

Từ khóa » Visual Basic Sendkeys Ctrl+v