using System;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Drawing;
namespace SetLayeredWindows
{
public class Win32API
{
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct LV_COLUMN
{
public UInt32 mask;
public Int32 fmt;
public Int32 cx;
public String pszText;
public Int32 cchTextMax;
public Int32 iSubItem;
public Int32 iImage;
public Int32 iOrder;
}
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, ref
LV_COLUMN lParam);
[DllImport("user32.dll")]
public static extern int SendMessage (IntPtr hwnd, int wMsg, int wParam,int lParam);
[DllImport("user32.dll")]
public extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public extern static bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public extern static bool SetForegroundWindow(IntPtr hWnd);
public const int LWA_COLORKEY = 0x0001;
public const int LWA_ALPHA = 0x0002;
public const Int32 WS_EX_LAYERED = 0x80000;
public const int GWL_EXSTYLE = -20;
[DllImport("user32.dll")]
public extern static bool SetLayeredWindowAttributes (IntPtr hWnd, Int32 crKey, byte bAlpha, int dwFlags);
[DllImport("user32.dll")]
public extern static long SetWindowLong(IntPtr hWnd, Int32 nIndex, long dwNewLong);
[DllImport("user32.dll")]
public extern static long GetWindowLong(IntPtr hWnd, Int32 nIndex);
[DllImport("user32.dll")]
public extern static long DrawMenuBar(IntPtr hWnd);
[DllImport("user32.dll")]
public extern static bool LockWindowUpdate(IntPtr hWnd);
public const int WM_COPYDATA = 0x004a;
public static int RGB(Color c)
{
return (int)(c.R | c.G << 8 | c.B << 16);
}
public static int RGB(int r, int g, int b)
{
return (int)(r | g << 8 | b << 16);
}
[StructLayout(LayoutKind.Sequential, Pack=2)]
public struct COPYDATASTRUCT
{
public uint dwData;
public uint cbData;
public IntPtr lpData;
};
[StructLayout(LayoutKind.Sequential, Pack=2)]
public struct data
{
public int nMode;
public IntPtr s1;
public uint ID;
public IntPtr address;
public IntPtr Name;
}
}
}