There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
using Clipboard in VB6


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
lamstaldy's Avatar
Senior Member with 113 posts.
 
Join Date: Dec 2001
Location: Plymouth, Mass.
13-Mar-2003, 07:14 AM #1
using Clipboard in VB6
Is there an easy way to check and see if there is anything in the Clipboard? Right now I'm setting the contents of Clipboard to an invisible text box and then checking the length of the text box. If the length of the text box is 0 then the Clipboard was empty. This works, but it seems like there should be a more straight forward way to do this.

P.S. any chance we could get a smilie with a gun to its head, for those times when we are really stressed.
Mosaic1's Avatar
Distinguished Member with 7,498 posts.
 
Join Date: Aug 2001
13-Mar-2003, 01:19 PM #2
What kind of data are you checking for on the Clipboard? Here's a quick example of checking for text.

PHP Code:
Dim A As Integer
   
If Clipboard.GetFormat(vbCFTextThen A 1
      
If 1 Then MsgBox "Clipboard contains text" 

or
PHP Code:
Dim B as String
Dim A 
As Integer
Clipboard.GetText
        
If "" Then
         
Else: 1

 End 
If

 If 
1 then Whatever action you wanted to take 

Last edited by Mosaic1 : 13-Mar-2003 01:31 PM.
lamstaldy's Avatar
Senior Member with 113 posts.
 
Join Date: Dec 2001
Location: Plymouth, Mass.
13-Mar-2003, 04:07 PM #3
I'm looking for any text to be in the clipboard. I have a Paste command in the Edit menu. When some one clicks on the Edit I want the Paste command to be disabled if the clipboard is empty. In your first example what is (vbCFText)? Does that return True if the clipboard text is in a certain format? Or True for any text?
I know this is a diferent subject, but have you ever used Outlook in a VB app? That's my next step in this project so I'm sure I'll some questions.
Mosaic1 thanks again for helping me out.
Mosaic1's Avatar
Distinguished Member with 7,498 posts.
 
Join Date: Aug 2001
13-Mar-2003, 04:13 PM #4
When checking for Text. The data type is text only. For example, I copy a bitmap to the clipboard and open Notepad. Paste is unavailable. But if I open wordpad, paste is available. It is checking for the particular types of data. I think that wouod be the same in your program.

If you go to help and search for ClipBoard, you'll see all the various data types you can have the program look for .

If you don't have help, post back and I'll get you a list.

It really depends on what your program does and what type of data you want it to paste.
lamstaldy's Avatar
Senior Member with 113 posts.
 
Join Date: Dec 2001
Location: Plymouth, Mass.
13-Mar-2003, 04:34 PM #5
I am just looking for text so that should work great. I'll check out the help CD tomorrow just to see what else is available. Thanks again Mosaic1.
Mosaic1's Avatar
Distinguished Member with 7,498 posts.
 
Join Date: Aug 2001
13-Mar-2003, 04:38 PM #6
I read my last answer again and it sounds confusing. The return is true is text exists and false if not. It is perfect for what you want to do. If true enable paste. If false, disable paste.

Actually, I didn't need to assign to a variable A. The default is true. I am still learning. That was overkill. Sorry.

The truth is I am dabbling in this. I am not advanced in the least. I am learning bit by bit in my spare time. I have not used any Office VBA.
lamstaldy's Avatar
Senior Member with 113 posts.
 
Join Date: Dec 2001
Location: Plymouth, Mass.
13-Mar-2003, 09:05 PM #7
I understood your answer, and your suggestion worked fine. This is what I ended up with:


If (Clipboard.GetFormat(vbCFText)) Then
mnuPaste.Enabled = True
Else
mnuPaste.Enabled = False
End If

I too have been trying to learn on my own. I think I really need to install the help files, but they take up so much room on the hard drive. You've been able to help me with all my problems so you're an expert in my book! Thanks again, and I hope I can return the favor someday.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:34 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.