S
snovi28
My code should make a window 50% transparrent:
const int GWL_EXSTYLE = -20;
const int WS_EX_LAYERED = 0x00080000;
const int LWA_ALPHA = 0x00000002;
SetWindowLong( hMyWnd,
GWL_EXSTYLE,
GetWindowLong(hMyWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
if (!SetLayeredWindowAttributes(hMyWnd,
Color.FromArgb(0,0,0),
Convert.ToByte(255 * 0.50),
LWA_ALPHA))
{
// Error
}
This is in Microsoft Visual C# 2005 project. The methods are imported
from user32.dll.
The code compiles/links fine but during run-time I'm getting exception
for the call to SetLayeredWindowAttributes:
System.Runtime.InteropServices.MarshalDirectiveException was unhandled
Message="Cannot marshal 'parameter #2': Invalid managed/unmanaged
type combination."
Tried to play with Color.FromArgb(0,0,0) but could make it work. Any
ideas/suggestions?
const int GWL_EXSTYLE = -20;
const int WS_EX_LAYERED = 0x00080000;
const int LWA_ALPHA = 0x00000002;
SetWindowLong( hMyWnd,
GWL_EXSTYLE,
GetWindowLong(hMyWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
if (!SetLayeredWindowAttributes(hMyWnd,
Color.FromArgb(0,0,0),
Convert.ToByte(255 * 0.50),
LWA_ALPHA))
{
// Error
}
This is in Microsoft Visual C# 2005 project. The methods are imported
from user32.dll.
The code compiles/links fine but during run-time I'm getting exception
for the call to SetLayeredWindowAttributes:
System.Runtime.InteropServices.MarshalDirectiveException was unhandled
Message="Cannot marshal 'parameter #2': Invalid managed/unmanaged
type combination."
Tried to play with Color.FromArgb(0,0,0) but could make it work. Any
ideas/suggestions?