Prev: Making an exe file
Next: Timer Class
From: Bee on 12 May 2010 21:33 I am playing with some web cam calls in VB6 and ran into an interesting situation. The API calls use the clipboard to place an image on. So I was running this code and decided to respond to an eMail and edit another VB6 app in the IDE. Well, Ctrl-V was non-functional everywhere for text. Or so it seemed. In reality the text data as being cleared. Also it was really screwing up my eMail program draft save. That must use the clipboard too. I see that I have a Clipboard.Clear call in the cam acquisition loop and that is probably what is doing it since the help says it clears all data. Stopping the cam "enabled" the Ctrl-V. So, is there a way to clear only image data from the clipboard and leave text data alone? I do not see that in the MSDN. What do I look for?
From: Karl E. Peterson on 12 May 2010 21:56 Bee wrote: > So, is there a way to clear only image data from the clipboard and leave > text data alone? I do not see that in the MSDN. What do I look for? Read the text, empty the clipboard, restore the text. -- ..NET: It's About Trust! http://vfred.mvps.org
From: MikeD on 12 May 2010 23:18 "Bee" <Bee(a)discussions.microsoft.com> wrote in message news:E7B927D4-0153-455F-BF55-F7E870C174E0(a)microsoft.com... > > So, is there a way to clear only image data from the clipboard and leave > text data alone? I do not see that in the MSDN. What do I look for? > Is it possible to do? Yeah, it is. You simply clear ONLY that specific format from the clipboard. But IIRC, you can't use VB's Clipboard.Clear because I'm pretty sure that clears everything in the clipboard. Essentially, you don't clear it at all. You only copy to it your specific format, replacing anything of that same format already in the clipboard, but not touching data in any other format. You may need to utilize some of the clipboard API functions. See here: http://msdn.microsoft.com/en-us/library/ms648709(v=VS.85).aspx But that's not a good idea IMO. The clipboard SHOULD contain the same "data" but in different formats so apps can use the "best" format for pasting. IOW, it will contain the same text (for example) but might have formats for that text as plain text or RichText. For a graphic, it might contain the same picture, but perhaps contain formats for both BMP and JPG. But the "data" is the same. It's just the format of that data that's different. It's NOT good if there's both "text" data and "image" data in the clipboard. Other programs aren't going to know what should be pasted. Should it be the text? Should it be the image? There are plenty of programs that could handle either text or images (most any word processor for example or even a program like Publisher). It's gonna depend on the app in some cases as to which gets pasted. For other apps, you may be able to specify via a "Paste Special" option. But it's still not a good idea for the clipboard to contain completely different data. -- Mike
From: Dee Earley on 13 May 2010 12:40 On 13/05/2010 02:33, Bee wrote: > I am playing with some web cam calls in VB6 and ran into an interesting > situation. > The API calls use the clipboard to place an image on. > So I was running this code and decided to respond to an eMail and edit > another VB6 app in the IDE. > Well, Ctrl-V was non-functional everywhere for text. Or so it seemed. In > reality the text data as being cleared. > Also it was really screwing up my eMail program draft save. That must use > the clipboard too. The other posts have answered about the clipboard, but I'll address the video capture part. Do not use VfW video capture anymore. While it will work OK for some hobby code, it is not suitable for anything proffessional. You should really be looking at WDM, but there are difficulties using this from VB6. If you must use VfW/exVidCap, use the save method and read off disk. It's been so long since I scrapped VfW, but I think it also provides a callback method to get the raw DIB data. -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
From: Karl E. Peterson on 13 May 2010 12:45
MikeD wrote: > > "Bee" <Bee(a)discussions.microsoft.com> wrote in message > news:E7B927D4-0153-455F-BF55-F7E870C174E0(a)microsoft.com... >> >> So, is there a way to clear only image data from the clipboard and leave >> text data alone? I do not see that in the MSDN. What do I look for? > > Is it possible to do? Yeah, it is. You simply clear ONLY that specific > format from the clipboard. But IIRC, you can't use VB's Clipboard.Clear > because I'm pretty sure that clears everything in the clipboard. Because it's a direct call to EmptyClipboard which, any guesses?, clears everything on the clipboard. > Essentially, > you don't clear it at all. You only copy to it your specific format, > replacing anything of that same format already in the clipboard, but not > touching data in any other format. You may need to utilize some of the > clipboard API functions. See here: > http://msdn.microsoft.com/en-us/library/ms648709(v=VS.85).aspx Huh? > But that's not a good idea IMO. The clipboard SHOULD contain the same "data" > but in different formats so apps can use the "best" format for pasting. IOW, > it will contain the same text (for example) but might have formats for that > text as plain text or RichText. There are very good reasons for clearing all but text. In fact, I wrote a program to do just that, and keep an icon on my desktop because I need to use it dozens of times a day. http://vb.mvps.org/tools/ConClip -- ..NET: It's About Trust! http://vfred.mvps.org |