Computing.Net > Forums > Programming > translucent userform

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

translucent userform

Reply to Message Icon

Name: Adrian
Date: June 15, 2003 at 19:34:21 Pacific
OS: xp
CPU/Ram: celeron 600
Comment:

How can i make this code work in VBA for Excel to make a translucent form ?

it works fine in vb,
---------------
Option Explicit

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

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 Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Public Function TranslucentForm(frm As UserForm, TranslucenceLevel As Byte) As Boolean

SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED

SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA

TranslucentForm = Err.LastDllError = 0

End Function

Private Sub UserForm_show()
TranslucentForm Me, 180 ' 0 - 255
End Sub

Private Sub UserForm_click()

End Sub



Sponsored Link
Ads by Google

Response Number 1
Name: Sord
Date: June 24, 2003 at 09:32:57 Pacific
Reply:

Try looking up Alphabending. Also, many translucent
functions only work with Windows 2000 and
Windows XP.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: translucent userform

Excel VBE www.computing.net/answers/programming/excel-vbe/6297.html

Javascript www.computing.net/answers/programming/javascript/1469.html

Populating a combo box vba www.computing.net/answers/programming/populating-a-combo-box-vba/15098.html