VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Animated Glass Cube Effect using StretchBlt

Riaan Aspeling  (14 Submissions)   Custom Controls/Forms/Menus   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

This code animates a glass cube moving on a picture in real-time. Almost the same as that Windows 95 screen saver (the moving glass boll). I though this code can help make a screen-saver like that. (You have to e-mail me a copy of that screen-saver please)

Inputs
Create a new form. Place to picture boxes on it (Picture1 and Picture2). Set the following attributes on them (Appearance=0 - Flat; AutoRedraw=False ;AutoSize=True). Load a nice fair sized BMP graphic into Picture1 and load that same graphic into Picture2. Set Picture2 Visible property to false. Create a command button (Command1) and change it's caption to "Do Effect". Now copy and paste the code and off you go... PLEASE SEND ME A COPY IF YOU MAKE ANY NICE CHANGES OR SCREEN-SAVER FROM THIS CODE. If I get the time I'll make one any post it on this site ;)

Assumes
I only checked this code on Windows 98... I don't know if it will work on any of the other platforms... Please let me know if it work's on any of the other.

Returns
A smile on your face ;)

API Declarations
'***************************************
'This code must be copied into a module.
'***************************************
'
Option Explicit
Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Global Const SRCCOPY = &HCC0020

Rate Animated Glass Cube Effect using StretchBlt (9(9 Vote))
Animated Glass Cube Effect using StretchBlt.bas

Animated Glass Cube Effect using StretchBlt Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters