David Youngblood
3/1/2012 5:11:00 PM
Anyone know how to draw a transparent Static class window (created by
CreateWindowEx)? I thought I had everything required, but can't get it to
work. I'm using the vbaccelerator subclassing control while testing. I would
appreciate it if someone could tell me what I'm doing wrong...
Private Sub Form_Load()
Const dwStyle As Long = WS_CHILD Or WS_GROUP Or WS_VISIBLE
Const dwExStyle As Long = WS_EX_TRANSPARENT
Call CreateWindowEx(dwExStyle, "Static", "My window", dwStyle, 0, 0, 100,
20, hwnd, 0, 0, ByVal 0)
AttachMessage Me, hwnd, WM_CTLCOLORSTATIC
End Sub
Private Sub Form_Unload(Cancel As Integer)
DetachMessage Me, hwnd, WM_CTLCOLORSTATIC
End Sub
Private Property Let ISubclass_MsgResponse(ByVal RHS As
SSubTimer6.EMsgResponse)
m_emr = RHS
End Property
Private Property Get ISubclass_MsgResponse() As SSubTimer6.EMsgResponse
m_emr = emrConsume
ISubclass_MsgResponse = m_emr
End Property
Private Function ISubclass_WindowProc(ByVal hwnd As Long, ByVal iMsg As
Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim hBr As Long
Select Case iMsg
Case WM_CTLCOLORSTATIC
'* lParam = hwndStatic
'* wParam = hdcStatic
Debug.Print "Mode: "; SetBkMode(wParam, TRANSPARENT)
hBr = GetStockObject(HOLLOW_BRUSH)
Debug.Print "hBrush: "; hBr
Debug.Print "SelectObject: "; SelectObject(wParam, hBr)
ISubclass_WindowProc = CallOldWindowProc(hwnd, iMsg, wParam, lParam)
End Select
End Function