Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Tutorials > VB Tutorials

VB Tutorials Visual Basic Tutorials and Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-2006, 06:48 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Exclamation VB 6.0: Tutorial, How to Make Glass2K!!

Well I don't know if you people use Glass2k, Well I used it some time ago, but then I decided to make my own! Well in this tutorial I will show you how to make the basics of Glass2k not the whole app.

Requirements:-
  • Visual Basic (prefiribly 6.0)
  • Windows 2000/XP ( because Transparency will not work in other Win 95,98,ME and so! )
So open VB and the following will be shown:-



Select Standard EXE and Press Open.
You will be presented an empty Form.
Ok so now add a module. How? see the pic below:-



The following will be displayed:-



Now Press Open.
and paste the following code into the module:-

Code:
Option Explicit

Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const ULW_ALPHA = &H2
Private Const WS_EX_LAYERED = &H80000

Public Function MakeTransparent(ByVal hwnd As Long, Perc As Integer) As Long
Dim Msg As Long
On Error Resume Next
If Perc < 0 Or Perc > 255 Then
  MakeTransparent = 1
Else
  Msg = GetWindowLong(hwnd, GWL_EXSTYLE)
  Msg = Msg Or WS_EX_LAYERED
  SetWindowLong hwnd, GWL_EXSTYLE, Msg
  SetLayeredWindowAttributes hwnd, 0, Perc, LWA_ALPHA
  MakeTransparent = 0
End If
If Err Then
  MakeTransparent = 2
End If
End Function
This code is a Function to make a window Transparent
Ok so now what?
Now Add a Textbox ( Text1 ) and a Command Button ( Command1 )
and arrange the form the way you like I made it as follows:-



Now all we need to do is adding the following code to our project:-

Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Command1_Click()
    Dim Handle As Long, Ret As Long
    Handle = FindWindow(vbNullString, Text1.Text)
    MakeTransparent Handle, 100
End Sub
Explaining the code:-
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Here we are declaring an API function to Find a Windows from the title bar

Code:
    Dim Handle As Long
Here we are just declaring a Variable

Code:
    Handle = FindWindow(vbNullString, Text1.Text)
Here we are assigning the variable with the API to find the window with the title bar same as the textbox ( text1 ) text that we added on out form.

Code:
    MakeTransparent Handle, 100
Here we are calling the Function of the module to make transparent the Var Handle, that we assigned to it the window, and 100 is the transparency level you want ex.
250 is solid ( normal window colour )
1 is invisible ( makes the wnidow invisible )
and the larger the no ( max 250 ) the more visible will the window be but still transparent until it is 250 ) so from 100 to 200 is the ideal value for a transparent window

Now how does this work?

Well run your app and open for example My Documents and in the Textbox write My Documents and then press the command button and the My Documents window will be transparent. Now to restore the window to its original color just close My Documents and Re-open it!

I want to make Transparent another window instead of My Documents, how?

Simple just type in the title of the window in the Textbox and press the command button!

Complete Source Code:-
Well I included the FULL source code its an attachment, its the complete project just compile and have fun

Ending:-

If you have any questions/problems/feedback pls post here and I will sureley Help you! Well this will make you only the selected window transparent not exactly like Glass2k but if you modify it you surely can make it
So I'm waiting for your feedback
Ow and if you want me to make you some tutorials request what you want and I will see what I can do! I will be happy making some tuts here!

Tcm9669
Attached Files To view attachments in this forum your post count must be 1 or greater. You currently have 0 posts.

Last edited by Jordan; 10-02-2006 at 12:45 PM. Reason: Picture Location Change
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-21-2006, 08:30 AM
Crane's Avatar   
Crane Crane is offline
Programming Expert
 
Join Date: Nov 2005
Posts: 399
Credits: 9
Rep Power: 14
Crane is on a distinguished road
Default

Wow! Nice tutorial! I'd like to see more like this in the future. How did you include the images in your post like that? I'm thinking of creating my own tutorial.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-21-2006, 09:05 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

Ow thanks well its simple to make the pics like that upload the image on imageshack.us and then select the link of Forums copy and paste that link it should have [IMG] link [IMG] ow ant the most imgs you can post here in a post is 4 or 5 ( its a restriction of the Admin ) but then you can post the others as a normal link!

Come on ppl more feedback pls! my 2nd tut is on the way! will be posted shortly !! its nice helping ppl and seeing good feedback!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-22-2006, 09:00 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Credits: 119
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

Nice tutorial! I'd love to see more like this. I wasn't aware there was a limit on the pictures though. hmm.

I think I'm going to create a few, you have inspired me!
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-22-2006, 09:02 AM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default

LOL! What tuts you are going to make? VB, Java? What?
Im curious!
Ow and btw there is another tutorial pls comment on it! and I have another tutorial on the way!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 02-12-2008, 12:50 PM
Gabeli Gabeli is offline
Newbie
 
Join Date: Mar 2007
Posts: 1
Credits: 0
Rep Power: 0
Gabeli is on a distinguished road
Default

Thnx buddy
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-30-2008, 12:54 PM
Dj-York Dj-York is offline
Newbie
 
Join Date: Mar 2008
Posts: 7
Credits: 0
Rep Power: 0
Dj-York is on a distinguished road
Thumbs up Re: VB 6.0: Tutorial, How to Make Glass2K!!

Nice tutorial and THX !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-30-2008, 04:01 PM
JustSimple JustSimple is offline
Newbie
 
Join Date: Mar 2008
Posts: 7
Credits: 0
Rep Power: 0
JustSimple is on a distinguished road
Default Re: VB 6.0: Tutorial, How to Make Glass2K!!

Thanks...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-30-2008, 06:53 PM
TcM's Avatar   
TcM TcM is offline
Code Warrior
 
Join Date: Aug 2006
Location: In a technologic world :p
Posts: 8,332
Credits: 0
Rep Power: 68
TcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of lightTcM is a glorious beacon of light
Default Re: VB 6.0: Tutorial, How to Make Glass2K!!

Welcome. Hope this helps you in learning VB as you said in your intro
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 06-01-2008, 09:14 AM
Bigjohn123 Bigjohn123 is offline
Newbie
 
Join Date: Jun 2008
Posts: 1
Credits: 0
Rep Power: 0
Bigjohn123 is on a distinguished road
Default Re: VB 6.0: Tutorial, How to Make Glass2K!!

Glass2k does work with Vista 32-bit Home Premium, that's what I am using right now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



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

Advanced Search
Display Modes

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 On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB 6.0: Tutorial, Making a Port Scanner TcM VB Tutorials 90 Yesterday 10:18 PM
VB 6.0: Tutorial, Using the MsgBox TcM VB Tutorials 8 09-08-2008 01:48 PM
VB 6.0: Tutorial, How to make a GIF in your application TcM VB Tutorials 17 07-01-2008 04:26 PM
VB 6.0: Tutorial, Explaining the VB 6.0 GUI TcM VB Tutorials 1 05-18-2007 11:25 AM
John's Java Tutorial Index John Java Tutorials 0 01-11-2007 04:05 PM


All times are GMT -5. The time now is 12:50 PM.

Contest Stats

WingedPanther ........ 2672.3
Xav ........ 2597.03
Brandon W ........ 1700.26
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 959.05
dcs ........ 650.52
Steve.L ........ 475.59
orjan ........ 409.29
chili5 ........ 380.6

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads