Important alert: (current site time 7/16/2013 3:28:28 AM EDT)
 

winzip icon

Transparent Bitmap/GIF/JPG with one line of code!

Email
Submitted on: 10/16/2000 8:27:09 PM
By: Andrew Heinlein (Mouse)  
Level: Beginner
User Rating: By 33 Users
Compatibility: VB 5.0, VB 6.0
Views: 36006
author picture
(About the author)
 
     While surfing the web i found the API for a function named TransparentBlt in C++ and i changed it over to VB. If you like BitBlt, your going to love this. 2 examples on how to use this API, one deals with a transparent animation, and the other is just a basic example using GetPixel API. Enjoy, cause this is a god-sent for me.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 9 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

10/16/2000 8:35:05 PMMouse

"one line of code" is a little presumptuous, so all the smart asses out there ready to comment on that, go away.
(If this comment was disrespectful, please report it.)

 
10/16/2000 9:14:31 PMDemian Net

THIS AINT ONE LINE, heh j/k.
awesome code. 5 globes
(If this comment was disrespectful, please report it.)

 
10/17/2000 12:18:50 AMnedyrB

and i was fooled that you could do all that in one line.. oh well, 1 globe for trying (j/k 5)
thanks
(If this comment was disrespectful, please report it.)

 
10/17/2000 2:10:57 AMRad-X

One line eh? well, I.....I....Diddn't think it could be done....2 globes.
(If this comment was disrespectful, please report it.)

 
10/17/2000 2:14:48 AMRad-X

better make that 5
(If this comment was disrespectful, please report it.)

 
10/17/2000 4:26:04 AMSmart

well it seems to that a required .dll file is missing, where is it?
(If this comment was disrespectful, please report it.)

 
10/17/2000 8:57:48 AMElad Rosenheim

It's just too bad that TransparentBlt works only under win98+, so it's quite useless until everyone gets rid of win95
(If this comment was disrespectful, please report it.)

 
10/17/2000 10:51:07 AMKenneth Gilbert Jr.

If they don't like your one line of code for doing transparent stuff, hit them with your 2 or 3 line of BitBlt code to do it. Works under all windows : )
(If this comment was disrespectful, please report it.)

 
10/17/2000 11:43:01 AMNicholas

How many times have I voted "Excellent" for this person? I need to set up an auto-voter for his submissions ;-)
(If this comment was disrespectful, please report it.)

 
10/17/2000 1:21:57 PMBrian Bender

Not bad. He kind of looks like a mouse. Hehehe, Just kidding. Good job.
(If this comment was disrespectful, please report it.)

 
10/17/2000 2:04:37 PMMouse

Thank you for all the comments and votes =) I'm sorry, but i didnt realize that the "Msimg32.dll" is a win98/NT/2000 thing... (darn 95 users... UPGRADE ALLREADY!!! =) it is a DLL that is only 52k in size, so if you use this function, just include the "Msimg32.dll" in your install. Don't have it? I uploaded it for you:

http://www.mouse-industries.com/msimg32.zip

have fun
(If this comment was disrespectful, please report it.)

 
11/26/2000 9:12:16 AMDa' Booda

Good Code, One Line and all...But one problem...sapz the memory real bad and doesn't give it back...so if you use this function repeatedly...vb will shut down on you...any idea's on how to fix this because I like the speed and the unlimited capture size.
(If this comment was disrespectful, please report it.)

 
1/16/2001 1:52:55 PMderrick

Nice code. How could we function without all those cry baby critics whining about your one line. Mouse I'd hate to see what they'd say if you code didn't work. Mouse your link to http://www.mouse-industries.com/msimg32.zip doesn't work as of 3pm Atlantic Time. I look forward to seeing the whole thing in action. Thanks,
derrick



(If this comment was disrespectful, please report it.)

 
1/19/2001 3:41:34 AMMouse

http://www.theblackhand.net/mouse/MSIMG32.zip

there is the DLL
sorry i havent checked this thread in a while
(If this comment was disrespectful, please report it.)

 
1/30/2001 11:59:08 AMStingRaY

I'm using VB6 SP4 on Win2K.
and I'm trying to use transparentblt() function. It works fine in VB IDE but after I compiled it and run it as an EXE file. The image wasn't shown...how come?
(If this comment was disrespectful, please report it.)

 
3/19/2002 3:41:04 PMMartin

I thought I'd found something really useful until having worked on my project to hunt down a memory leak I found it that it was caused by the .dll
(If this comment was disrespectful, please report it.)

 
8/24/2012 8:13:35 AMriksha

Works perfectly when under construction, but fails when compiled, (vb6 under windows 7 64 bit)
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.