+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: VB 6.0: Tutorial, How to Make Glass2K!!

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    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 Attached Files
    Last edited by Jordan; 10-02-2006 at 09:45 AM. Reason: Picture Location Change

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Crane's Avatar
    Crane is offline Programming Expert
    Join Date
    Nov 2005
    Posts
    398
    Rep Power
    25
    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.

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    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!!

  5. #4
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    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!

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    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!!

  7. #6
    Gabeli is offline Newbie
    Join Date
    Mar 2007
    Posts
    1
    Rep Power
    0
    Thnx buddy

  8. #7
    Dj-York is offline Newbie
    Join Date
    Mar 2008
    Posts
    7
    Rep Power
    0

    Thumbs up Re: VB 6.0: Tutorial, How to Make Glass2K!!

    Nice tutorial and THX !

  9. #8
    JustSimple is offline Newbie
    Join Date
    Mar 2008
    Posts
    7
    Rep Power
    0

    Re: VB 6.0: Tutorial, How to Make Glass2K!!

    Thanks...

  10. #9
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Re: VB 6.0: Tutorial, How to Make Glass2K!!

    Welcome. Hope this helps you in learning VB as you said in your intro

  11. #10
    Bigjohn123 is offline Newbie
    Join Date
    Jun 2008
    Posts
    1
    Rep Power
    0

    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.

+ Reply to Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Visual C# video tutorial: How to make a simple calculator
    By James.H in forum Video Tutorials
    Replies: 7
    Last Post: 05-31-2010, 12:22 AM
  2. MAKE YOUR VOTE - Tutorial Contest
    By James.H in forum Announcements
    Replies: 10
    Last Post: 05-20-2010, 11:00 AM
  3. VB 6.0: Tutorial, How to make a GIF in your application
    By TcM in forum Visual Basic Tutorials
    Replies: 18
    Last Post: 07-08-2009, 01:55 PM
  4. Java:Tutorial - Make Your Button Work
    By John in forum Java Tutorials
    Replies: 0
    Last Post: 01-11-2007, 12:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts