I am trying to call the GetLayeredWindowAttributes(hwnd, crKey, bAlpha, dwFlags) function but it does not work.
I use Visual Basic 6 on Windows Vista Home Premium.
I declared it using:
Private Declare Function GetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean
I called it using:
Dim byteAlpha As Byte, hwnd As Long
byteAlpha = 1 'Make it 1 for debugging purposes
hwnd = Me.hwnd
Call GetLayeredWindowAttributes(hwnd, vbNull, byteAlpha, vbNull) 'use vbNull for variables you don't need
Debug.Print = GetLastError() & " " & byteAlpha
Debug.Print shows that GetLastError() returns 998, which the MSDN says is ERROR_NOACCESS (Invalid access to memory location.)
byteAlpha is still the same value as before (1).
I can call the GetLayeredWindowAttributes in Dev-C++ on the same computer and it works fine.
Does anyone have any idea on how to call it from VB6 in Vista?