-
Aug 29th, 2007, 03:06 PM
#1
Thread Starter
Fanatic Member
VB6 clears the clipboard when starting..
Hello,
Is there a fix or patch of some sort that will STOP VB6 from clearing the clipboard when it starts?
Thanks!
-
Aug 29th, 2007, 03:14 PM
#2
Thread Starter
Fanatic Member
Re: VB6 clears the clipboard when starting..
Found this in a Google group. I guess there is always a way...but still open to suggestions...
On Mon, 21 Oct 2002 14:02:15 -0500, "Norm Cook"
<normc...@cableone.net> wrote:
>Sigh, just something we have to live with. It's burned me so many times
>that I've learned to start VB before doing any copying.
Well, maybe not. If this thing works for you guys too then i guess a
couple of problems are solved. It's a quick and dirty hack, i'm sure
there are some more elegant ways, but i coldn't be arsed.
So it may need some tender loving play with extending or reducing the
timeout in the for next loop but you guys are programmers right ? :-)
All in a standard module, formless code.
I called this vb66.exe and changed the path in the file associations
"open" to point at this exe instead.
So far so good, it keeps my clipboard intact and i'm starting up in my
project directory too. Double whammy and so far so good. :-)
Nb: Not tested on NT/2k/XP let me know how you went.
Option Explicit
'CHANGE THIS TO YOUR VB EXE's PATH
Code:
Private Const VBPath = "c:\mvs\vb98\vb6.exe"
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds _
As Long)
Sub Main()
Dim saveBuffer As String
Dim startPath As String
Dim i As Long, ct As Long, ret As Long
'check for and grab any text
If Clipboard.GetFormat(vbCFText) = True Then
saveBuffer = Clipboard.GetText
End If
'eval the commandline and grab the project path.
If Command$ <> "" Then
i = InStrRev(Command$, "\")
If i Then
startPath = Left$(Command$, i)
Else
startPath = ""
End If
End If
'ask the user to use project path or not.
' if it bugs you get rid of this.
Select Case MsgBox("Set path to : " & vbCrLf & _
startPath, vbYesNoCancel Or vbDefaultButton1, _
"About to launch VB")
Case vbYes: ' just break
Case vbNo: startPath = "" 'don't care
Case vbCancel: End ' I'm already denying this.
End Select
'launch VB
ret = ShellExecute(0, "open", VBPath, Command$, startPath, 1)
If ret <= 32 Then
MsgBox ("Failed to launch VB")
saveBuffer = "" 'force a drop through below
End If
ct = 0
DONE:
If saveBuffer <> "" Then
Do While Clipboard.GetFormat(vbCFText) = True 'catch the
clearing
Call Sleep(300) 'hang about until the cb is cleared by VB.
DoEvents
ct = ct + 1
If ct > 100 Then Exit Do ' but have to give up at some
time.
Loop
On Error Resume Next
Clipboard.SetText saveBuffer, vbCFText
' make sure it stuck and VB doesn't clear it again..which it
' does at times :-/
For ct = 1 To 5
Call Sleep(300)
If (Clipboard.GetFormat(vbCFText) <> True) Then
Clipboard.SetText saveBuffer, vbCFText
End If
Next
End If
' if we're lucky we should still have a clipboard full of goodies
End Sub
--
Regards, Frank
Last edited by birthjay; Aug 29th, 2007 at 03:16 PM.
Reason: Can't ever copy code with this dumb thing.
-
Aug 29th, 2007, 03:16 PM
#3
Re: VB6 clears the clipboard when starting..
Are you using SP6?
I had the same problem a while ago, but after installing SP6 everything remained in the clipboard when starting VB6.
http://www.microsoft.com/downloads/d...displaylang=en
-
Aug 29th, 2007, 03:18 PM
#4
Thread Starter
Fanatic Member
Re: VB6 clears the clipboard when starting..
Thanks...but I can't install it because we develop with SP5. Good to know they must have fixed it though.
-
Aug 29th, 2007, 03:38 PM
#5
Re: VB6 clears the clipboard when starting..
SP6 has no effect on this and did try creating a "memory" files before as well...
So, in short - just live with it.
-
Aug 29th, 2007, 04:14 PM
#6
Re: VB6 clears the clipboard when starting..
I am running VB6 SP6 and I have not had any problems - until recently when I installed the VBCodeHelper addin. Now when ever I start VB the clipboard is erased. Disabling VBCodeHelper instantly restores normal behaviour.
Hope this helps.
-
Aug 29th, 2007, 04:25 PM
#7
Re: VB6 clears the clipboard when starting..
But "normal" behaviour for VB6 is to clear the clipboard. Do you have anything else installed - something like MZ Tools?
-
Aug 29th, 2007, 04:31 PM
#8
Re: VB6 clears the clipboard when starting..
Nope! and I just tried it again to prove the point. I copied all of the code in post #2 and then started VB. Tried to paste into the form - nothing!
Same as above but I disabled VBCodeHelper before quitting the programme, copied the code, started VB and viola!! Are you certaikn that the normal behaviour of VB is to clear the clipboard?
I have come up from VB3 - VB5 - VB6 and cannot recall this ever happening before, until last week when I installed VBCodeHelper (great addin though).
-
Aug 29th, 2007, 04:33 PM
#9
Re: VB6 clears the clipboard when starting..
I don't buy it - the entire VB community in the world is suffering since VB5 and you are not?
You must have something else installed (or missing) that directly affects (in a good way) behaviour.
btw, what version of VB6 do you have? I've never used anything but Enterprise.
-
Aug 29th, 2007, 04:46 PM
#10
Re: VB6 clears the clipboard when starting..
Well you've actually made me doubt myself, so I've just tried the same things as in my last post. No VBCodeHelper and I can copy your post, start VB and paste it into a form. With VBCodeHelper - nothing.
VB6 Professional with SP6 and the MS updates to overcome the SP6 bugs.
I think I've attached an image of my addin manager.
-
Aug 29th, 2007, 05:00 PM
#11
Re: VB6 clears the clipboard when starting..
OK - Here's an update for you. At the weekend I reloaded XP SP2 onto my notebook and, although I had installed VB, I hadn't used it.
Just tried it out on there and it does exactly what everyone else in the world is getting - Spooky.
Notebook = HP AMD 2400XP+ - 512MB - XP/SP2
Main Machine HP AMD X2 3800+ 64bit - 1GB - 32bit XP/SP2
Wow, look at the time and I have to up at 5.
-
Aug 29th, 2007, 06:48 PM
#12
Re: VB6 clears the clipboard when starting..
This has been discussed before. See RobDog888's post #8 in this thread.
-
Aug 29th, 2007, 07:41 PM
#13
Re: VB6 clears the clipboard when starting..
Hmmm, interesting observation btw.
I tried it and if you unload ALL add-ins and also make sure NONE is selected to be loaded at startup then "problem" goes away.
But that beats the purpose of using add-ins !!!
And since some of them are loaded by default and ARE quite useful practically nobody bothers to unload them.
That explains. Thanks Marty for pointing out to that thread.
ps, after all I'd rather have say Component Services loaded and have VB to clear clipboard then visa versa...
Last edited by RhinoBull; Aug 29th, 2007 at 08:26 PM.
-
Aug 30th, 2007, 03:15 AM
#14
Re: VB6 clears the clipboard when starting..
It's become pretty much a habit for me to highlight the code, open VB, go back to the window, copy, back to VB, and paste. Kind of a pain...but come on...it takes only a few extra seconds. Surely if you're a programmer that can't be too bad...
I think it would take more time for me to try and break that habit and get used to it not clearing the clipboard at this point.
-
Nov 2nd, 2008, 07:47 AM
#15
Re: VB6 clears the clipboard when starting..
I know this is an old thread, but an easy solution is a 3rd party clipboard tool.
I use Yanky Clipper, it's free and good!
http://www.intelexual.com/products/YC3/
-
Apr 18th, 2009, 05:57 PM
#16
Member
Re: VB6 clears the clipboard when starting..
Hmm, why not use the savesetting/getsettings?
When form loads, savesetting clipboard data, then getsettings clipboard data?
Home of Nuova Cartella (Mass Folder Creator)
-
Apr 18th, 2009, 06:02 PM
#17
Re: VB6 clears the clipboard when starting..
We're not talking about saving app data here but rather that some add-ins cause VB the clear the clipboard when VB is started.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|