Browse Subversion Repository
Contents of /TransparentizeWindow/Win32API.cs
Parent Directory
| Revision Log
Revision 2 -
( show annotations)
( download)
Sat Jan 14 05:02:38 2012 UTC
(12 years, 2 months ago)
by yuuan
File size: 2522 byte(s)
- 新規に起動したPuTTYに対しても透過処理を行うようにした
- NGリストを実装
- 設定値を保存するようにした
- メニューで透過済みの項目がチェック状態になるようにした
| 1 |
using System; |
| 2 |
using System.Collections.Generic; |
| 3 |
using System.Linq; |
| 4 |
using System.Text; |
| 5 |
using System.Runtime.InteropServices; |
| 6 |
|
| 7 |
namespace TransparentizePutty |
| 8 |
{ |
| 9 |
class Win32API |
| 10 |
{ |
| 11 |
public const int GWL_ID = -12; |
| 12 |
public const int GWL_STYLE = -16; |
| 13 |
public const int GWL_EXSTYLE = -20; |
| 14 |
public const int WS_EX_LAYERED = 0x80000; |
| 15 |
public const int LWA_ALPHA = 0x2; |
| 16 |
public const int LWA_COLORKEY = 0x1; |
| 17 |
|
| 18 |
// Window Styles |
| 19 |
public enum WS : uint { |
| 20 |
OVERLAPPED = 0, |
| 21 |
POPUP = 0x80000000, |
| 22 |
CHILD = 0x40000000, |
| 23 |
MINIMIZE = 0x20000000, |
| 24 |
VISIBLE = 0x10000000, |
| 25 |
DISABLED = 0x8000000, |
| 26 |
CLIPSIBLINGS = 0x4000000, |
| 27 |
CLIPCHILDREN = 0x2000000, |
| 28 |
MAXIMIZE = 0x1000000, |
| 29 |
CAPTION = 0xC00000, // WS_BORDER or WS_DLGFRAME |
| 30 |
BORDER = 0x800000, |
| 31 |
DLGFRAME = 0x400000, |
| 32 |
VSCROLL = 0x200000, |
| 33 |
HSCROLL = 0x100000, |
| 34 |
SYSMENU = 0x80000, |
| 35 |
THICKFRAME = 0x40000, |
| 36 |
GROUP = 0x20000, |
| 37 |
TABSTOP = 0x10000, |
| 38 |
MINIMIZEBOX = 0x20000, |
| 39 |
MAXIMIZEBOX = 0x10000, |
| 40 |
TILED = WS.OVERLAPPED, |
| 41 |
ICONIC = WS.MINIMIZE, |
| 42 |
SIZEBOX = WS.THICKFRAME, |
| 43 |
} |
| 44 |
|
| 45 |
// Extended Window Styles |
| 46 |
public enum WS_EX : uint { |
| 47 |
DLGMODALFRAME = 0x0001, |
| 48 |
NOPARENTNOTIFY = 0x0004, |
| 49 |
TOPMOST = 0x0008, |
| 50 |
ACCEPTFILES = 0x0010, |
| 51 |
TRANSPARENT = 0x0020, |
| 52 |
MDICHILD = 0x0040, |
| 53 |
TOOLWINDOW = 0x0080, |
| 54 |
WINDOWEDGE = 0x0100, |
| 55 |
CLIENTEDGE = 0x0200, |
| 56 |
CONTEXTHELP = 0x0400, |
| 57 |
RIGHT = 0x1000, |
| 58 |
LEFT = 0x0000, |
| 59 |
RTLREADING = 0x2000, |
| 60 |
LTRREADING = 0x0000, |
| 61 |
LEFTSCROLLBAR = 0x4000, |
| 62 |
RIGHTSCROLLBAR = 0x0000, |
| 63 |
CONTROLPARENT = 0x10000, |
| 64 |
STATICEDGE = 0x20000, |
| 65 |
APPWINDOW = 0x40000, |
| 66 |
OVERLAPPEDWINDOW = (WS_EX.WINDOWEDGE | WS_EX.CLIENTEDGE), |
| 67 |
PALETTEWINDOW = (WS_EX.WINDOWEDGE | WS_EX.TOOLWINDOW | WS_EX.TOPMOST), |
| 68 |
LAYERED = 0x00080000, |
| 69 |
NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children |
| 70 |
LAYOUTRTL = 0x00400000, // Right to left mirroring |
| 71 |
COMPOSITED = 0x02000000, |
| 72 |
NOACTIVATE = 0x08000000, |
| 73 |
} |
| 74 |
|
| 75 |
[DllImport("user32.dll")] |
| 76 |
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); |
| 77 |
|
| 78 |
[DllImport("user32.dll")] |
| 79 |
public static extern bool SetLayeredWindowAttributes(IntPtr hwnd, uint crKey, byte bAlpha, uint dwFlags); |
| 80 |
|
| 81 |
[DllImport("user32.dll")] |
| 82 |
public static extern bool GetLayeredWindowAttributes(IntPtr hwnd, uint crKey, out byte bAlpha, uint dwFlags); |
| 83 |
|
| 84 |
[DllImport("user32.dll", SetLastError = true)] |
| 85 |
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); |
| 86 |
} |
| 87 |
} |
| |