genuinemails.com

Rabu, 10 Februari 2010

Microsoft Visual Basic 6.0: Create Invisible Window

Clear and translucent that a dictionary defines the word transparent. Yes, something that makes transparent clear what is behind him. That's what happens when the application window that is made transparent. Usually the active application window appearance will not overwrite the current window. But now we will try to make a window application with Visual Basic 6.0 so that the transparent inactive windows visible clearly.

How to manufacture the following:

1. Open the Visual Basic 6.0 application via [Start]> [All Programs]> [Microsoft Visual Studio 6.0]> [Microsoft Visual Studio 6.0].

2. In the New Project window, select the New tab.

3. On the New tab, choose Standard EXE and click [Open] to open the window Project1 - Form1 (Form).

4. klik [View] >


The CODE:
  1. untuk membuka jendela Project1 – Form1 (Code)

  2. 5. Ketikkan kode program berikut ini :

  3. [code]Option Explicit
  4. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  5. (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  6. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  7. (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  8. Private Declare Function SetLayeredWindowAttributes Lib "user32" _
  9. (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Long, ByVal _
  10. dwFlags As Long) As Long
  11. Private Const WS_EX_LAYERED As Long = &H80000
  12. Private Const LWA_ALPHA As Long = &H2
  13. Private Const GWL_EXSTYLE = (-20)
  14. Sub TembusPandang(lhWnd As Long, level As Integer)
  15. On Error GoTo keluar

  16. Call SetWindowLong(lhWnd, GWL_EXSTYLE, GetWindowLong(lhWnd _
  17. , GWL_EXSTYLE) Or WS_EX_LAYERED)
  18. Call SetLayeredWindowAttributes(lhWnd, 0, (level * 255) / 100, LWA_ALPHA)

  19. keluar:
  20. End Sub

  21. Private Sub Form_Load()
  22. TembusPandang Me.hWnd, 50
  23. End Sub
6. To see the results stored and run by pressing [F5].

In TembusPandang Me.hWnd program code, 50 means the window is made with a transparent level of 50%. Now try changing the numbers 50 to 100. Thus, the effect of invisibility on the window disappeared and returned to normal. Then if we change them to 0, then all the windows are not visible. Please note, translucent effect like this can only be done on the OS Windows 2000 / XP or higher. Good luck!

Related Posts by Categories



Widget by Hoctro | Jack Book

Your cOmment"s Here! Hover Your cUrsOr to leave a cOmment.

BlogCatalog

My Sponsor