I'm using the following code in an attempt to make a the listbox of a combobox transparent, with no luck tho. Add a combo to a form and try it please. It seems to just 'crash' the list.
Cheers, adehh.VB Code:
Option Explicit Private Declare Function GetComboBoxInfo Lib "user32.dll" _ (ByVal hwndCombo As Long, _ ByRef pcbi As PCOMBOBOXINFO) As Long Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" _ (ByVal hwnd As Long, _ ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" _ (ByVal hwnd As Long, _ ByVal nIndex As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" _ (ByVal hwnd As Long, _ ByVal crKey As Long, _ ByVal bAlpha As Byte, _ ByVal dwFlags As Long) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type PCOMBOBOXINFO cbSize As Long rcItem As RECT rcButton As RECT stateButton As Long hwndCombo As Long hwndItem As Long hwndList As Long End Type Private Const GWL_EXSTYLE As Long = -20 Private Const LWA_ALPHA As Long = &H2 Private Const WS_EX_LAYERED As Long = &H80000 Private Sub Form_Load() Combo1.AddItem "moo" Combo1.AddItem "meep" Combo1.AddItem "baaa" Dim pcbi As PCOMBOBOXINFO, lRet As Long pcbi.cbSize = Len(pcbi) lRet = GetComboBoxInfo(Combo1.hwnd, pcbi) Call SetWindowLong(pcbi.hwndList, GWL_EXSTYLE, GetWindowLong(pcbi.hwndList, GWL_EXSTYLE) Or WS_EX_LAYERED) Call SetLayeredWindowAttributes(pcbi.hwndList, 0, 50, LWA_ALPHA) End Sub




Reply With Quote