Functions.cs
上传用户:nnpulika
上传日期:2013-02-15
资源大小:597k
文件大小:21k
- using System;
- using System.Drawing;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Diagnostics;
- namespace UtilityLibrary.Win32
- {
- /// <summary>
- /// Windows API Functions
- /// </summary>
- public class WindowsAPI
- {
- #region Constructors
- // No need to construct this object
- private WindowsAPI()
- {
- }
- #endregion
-
- #region Constans values
- public const string TOOLBARCLASSNAME = "ToolbarWindow32";
- public const string REBARCLASSNAME = "ReBarWindow32";
- public const string PROGRESSBARCLASSNAME = "msctls_progress32";
- public const string SCROLLBAR = "SCROLLBAR";
- #endregion
- #region CallBacks
- public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
- public delegate int CompareFunc(IntPtr param1, IntPtr param2, IntPtr sortParam);
- public delegate int WinProc(IntPtr hWnd, uint message, int wParam, int lParam);
- #endregion
- #region Kernel32.dll functions
- [DllImport("kernel32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
- public static extern int GetCurrentThreadId();
- [DllImport("kernel32.dll")]
- public static extern uint GetDriveType(string rootPathName);
- [DllImport("kernel32.dll")]
- public static extern int GetVolumeInformation(string drivePath,
- StringBuilder volumeNameBuffer,
- uint driveNameBufferSize,
- out uint serialNumber,
- out uint maxFileNameLength,
- out uint fileSystemFlags,
- StringBuilder systemNameBuffer,
- uint systemNameBufferSize);
- #endregion
-
- #region Gdi32.dll functions
- [DllImport("gdi32.dll")]
- static public extern bool StretchBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
- IntPtr hDCSrc, int XOriginScr, int YOriginSrc, int WidthScr, int HeightScr, PatBltTypes Rop);
- [DllImport("gdi32.dll")]
- static public extern IntPtr CreateCompatibleDC(IntPtr hDC);
- [DllImport("gdi32.dll")]
- static public extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int Width, int Heigth);
- [DllImport("gdi32.dll")]
- static public extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
- [DllImport("gdi32.dll")]
- static public extern bool BitBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest,
- IntPtr hDCSrc, int XOriginScr, int YOriginSrc, PatBltTypes flags);
- [DllImport("gdi32.dll")]
- static public extern IntPtr DeleteDC(IntPtr hDC);
- [DllImport("gdi32.dll")]
- static public extern bool PatBlt(IntPtr hDC, int XLeft, int YLeft, int Width, int Height, uint Rop);
- [DllImport("gdi32.dll")]
- static public extern bool DeleteObject(IntPtr hObject);
- [DllImport("gdi32.dll")]
- static public extern uint GetPixel(IntPtr hDC, int XPos, int YPos);
- [DllImport("gdi32.dll")]
- static public extern int SetMapMode(IntPtr hDC, int fnMapMode);
- [DllImport("gdi32.dll")]
- static public extern int GetObjectType(IntPtr handle);
- [DllImport("gdi32")]
- public static extern IntPtr CreateDIBSection(IntPtr hdc, ref BITMAPINFO_FLAT bmi,
- int iUsage, ref int ppvBits, IntPtr hSection, int dwOffset);
- [DllImport("gdi32")]
- public static extern int GetDIBits(IntPtr hDC, IntPtr hbm, int StartScan, int ScanLines, int lpBits, BITMAPINFOHEADER bmi, int usage);
- [DllImport("gdi32")]
- public static extern int GetDIBits(IntPtr hdc, IntPtr hbm, int StartScan, int ScanLines, int lpBits, ref BITMAPINFO_FLAT bmi, int usage);
- [DllImport("gdi32")]
- public static extern IntPtr GetPaletteEntries(IntPtr hpal, int iStartIndex, int nEntries, byte[] lppe);
- [DllImport("gdi32")]
- public static extern IntPtr GetSystemPaletteEntries(IntPtr hdc, int iStartIndex, int nEntries, byte[] lppe);
- [DllImport("gdi32")]
- public static extern uint SetDCBrushColor(IntPtr hdc, uint crColor);
- [DllImport("gdi32")]
- public static extern IntPtr CreateSolidBrush(uint crColor);
- [DllImport("gdi32")]
- public static extern int SetBkMode(IntPtr hDC, BackgroundMode mode);
- [DllImport("gdi32")]
- public static extern int SetViewportOrgEx(IntPtr hdc, int x, int y, int param);
- [DllImport("gdi32")]
- public static extern uint SetTextColor(IntPtr hDC, uint colorRef);
- [DllImport("gdi32")]
- public static extern int SetStretchBltMode(IntPtr hDC, StrechModeFlags StrechMode);
- [DllImport("gdi32")]
- public static extern uint SetPixel(IntPtr hDC, int x, int y, uint color);
- #endregion
- #region Uxtheme.dll functions
- [DllImport("uxtheme.dll")]
- static public extern int SetWindowTheme(IntPtr hWnd, StringBuilder AppID, StringBuilder ClassID);
- static public void DisableWindowsXPTheme(IntPtr hWnd)
- {
- // Disable using the Window XP Theme for the Window handle
- // passed as a parameter
- StringBuilder applicationName = new StringBuilder(" ", 1);
- StringBuilder classIDs = new StringBuilder(" " , 1);
- WindowsAPI.SetWindowTheme(hWnd, applicationName, classIDs);
- }
- #endregion
-
- #region User32.dll functions
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern IntPtr GetDC(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern IntPtr GetDesktopWindow();
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool ShowWindow(IntPtr hWnd, ShowWindowStyles State);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool UpdateWindow(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool SetForegroundWindow(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, uint flags);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool OpenClipboard(IntPtr hWndNewOwner);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool CloseClipboard();
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool EmptyClipboard();
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern IntPtr SetClipboardData( uint Format, IntPtr hData);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, uint Item, ref RECT rc);
- [DllImport("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)]
- public static extern IntPtr GetParent(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, Msg msg, int wParam, int lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref POINT lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, ToolBarMessages msg, int wParam, ref TBBUTTON lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, ToolBarMessages msg, int wParam, ref TBBUTTONINFO lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, RebarMessages msg, int wParam, ref REBARBANDINFO lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVITEM lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVINSERTSTRUCT lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVSORTCB lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, TreeViewMessages msg, int wParam, ref TVHITTESTINFO hti);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, ListViewMessages msg, int wParam, ref LVITEM lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, ref HDITEM lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern void SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, ref HD_HITTESTINFO hti);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern int SendMessage(IntPtr hWnd, HeaderControlMessages msg, int wParam, int lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr PostMessage(IntPtr hWnd, Msg msg, int wParam, int lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SetWindowsHookEx(WindowsHookCodes hookid, HookProc pfnhook, IntPtr hinst, int threadid);
- [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
- public static extern bool UnhookWindowsHookEx(IntPtr hhook);
- [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
- public static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wparam, IntPtr lparam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SetFocus(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static int DrawText(IntPtr hdc, string lpString, int nCount, ref RECT lpRect, DrawTextFormatFlags flags);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static int GetClientRect(IntPtr hWnd, ref RECT rc);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static int InvalidateRect(IntPtr hWnd, ref RECT rc, int bErase);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- public extern static int InvalidateRect(IntPtr hWnd, IntPtr rc, int bErase);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool WaitMessage();
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax, PeekMessageFlags flags);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool GetMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool TranslateMessage(ref MSG msg);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool DispatchMessage(ref MSG msg);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr LoadCursor(IntPtr hInstance, CursorType cursor);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SetCursor(IntPtr hCursor);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr GetFocus();
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool ReleaseCapture();
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref POINT pptDst, ref SIZE psize,
- IntPtr hdcSrc, ref POINT pprSrc, Int32 crKey, ref BLENDFUNCTION pblend, UpdateLayeredWindowFlags dwFlags);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool GetWindowRect(IntPtr hWnd, ref RECT rect);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool ClientToScreen(IntPtr hWnd, ref POINT pt);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool TrackMouseEvent(ref TRACKMOUSEEVENTS tme);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern ushort GetKeyState(int virtKey);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int GetClassName(IntPtr hWnd, StringBuilder ClassName, int nMaxCount);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int SetWindowLong(IntPtr hWnd, int nIndex, WinProc winProc);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, uint flags);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr GetWindowDC(IntPtr hWnd);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int FillRect(IntPtr hDC, ref RECT rect, IntPtr hBrush);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int GetWindowPlacement(IntPtr hWnd, ref WINDOWPLACEMENT wp);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int SetWindowText(IntPtr hWnd, string text);
- [DllImport("User32.dll", CharSet=CharSet.Auto)]
- public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int maxCount);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int GetSystemMetrics(SystemMetricsCodes code);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int SetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si, int fRedraw);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int ShowScrollBar(IntPtr hWnd, int bar, int show);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int EnableScrollBar(IntPtr hWnd, uint flags, uint arrows);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int BringWindowToTop(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int GetScrollInfo(IntPtr hwnd, int bar, ref SCROLLINFO si);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy,
- ref RECT rcScroll, ref RECT rcClip, IntPtr UpdateRegion, ref RECT rcInvalidated, uint flags);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool IsWindow(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int LockWindowUpdate(IntPtr hWnd);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool ValidateRect(IntPtr hWnd, ref RECT rcInvalidated);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern bool ValidateRect(IntPtr hWnd, IntPtr rc);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int GetScrollBarInfo(IntPtr hWnd, SystemObject id, ref SCROLLBARINFO sbi);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern IntPtr GetWindowLong(IntPtr hWnd, GetWindowLongFlag flag);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int SetProp(IntPtr hWnd, IntPtr atom, IntPtr hData);
- [DllImport("user32.dll", CharSet=CharSet.Auto)]
- static public extern int CallWindowProc(IntPtr hOldProc, IntPtr hWnd, uint message, int wParam, int lParam);
- #endregion
- #region Shell32.dll functions
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SHGetFileInfo(string drivePath, uint fileAttributes,
- out SHFILEINFO fileInfo, uint countBytesFileInfo, ShellFileInfoFlags flags);
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern IntPtr SHGetFileInfo(IntPtr idl, uint fileAttributes,
- out SHFILEINFO fileInfo, uint countBytesFileInfo, ShellFileInfoFlags flags);
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern int SHGetSpecialFolderLocation(IntPtr hwndOwner, ShellSpecialFolder folder, out IntPtr idl);
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern int SHGetMalloc(out IMalloc alloc);
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern int SHGetDesktopFolder(out IShellFolder folder);
-
- [DllImport("Shell32.dll", CharSet=CharSet.Auto)]
- public static extern int SHGetPathFromIDList(IntPtr idl, StringBuilder path);
- public static void SHFreeMalloc(IntPtr handle)
- {
- IMalloc alloc = null;
- try
- {
- WindowsAPI.SHGetMalloc(out alloc);
- Debug.Assert(alloc != null);
- alloc.Free(handle);
- // Free allocator itself
- IUnknown iUnknown = (IUnknown)alloc;
- iUnknown.Release();
- }
- catch (Exception e)
- {
- // In case the Garbage collector is trying to free
- // this memory from its own thread
- Debug.WriteLine(e.Message);
- }
- }
-
- #endregion
- #region Common Controls functions
- [DllImport("comctl32.dll")]
- public static extern bool InitCommonControlsEx(INITCOMMONCONTROLSEX icc);
- [DllImport("comctl32.dll")]
- public static extern bool InitCommonControls();
- [DllImport("comctl32.dll", EntryPoint="DllGetVersion")]
- public extern static int GetCommonControlDLLVersion(ref DLLVERSIONINFO dvi);
- [DllImport("comctl32.dll")]
- public static extern IntPtr ImageList_Create(int width, int height, uint flags, int count, int grow);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_Destroy(IntPtr handle);
- [DllImport("comctl32.dll")]
- public static extern int ImageList_Add(IntPtr imageHandle, IntPtr hBitmap, IntPtr hMask);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_Remove(IntPtr imageHandle, int index);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_BeginDrag(IntPtr imageHandle, int imageIndex, int xHotSpot, int yHotSpot);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_DragEnter(IntPtr hWndLock, int x, int y);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_DragMove(int x, int y);
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_DragLeave(IntPtr hWndLock);
- [DllImport("comctl32.dll")]
- public static extern void ImageList_EndDrag();
- [DllImport("comctl32.dll")]
- public static extern bool ImageList_Draw(IntPtr hImageList, int imageIndex,
- IntPtr hDCDest, int x, int y, ImageListDrawFlags flags);
- [DllImport("comctl32.dll")]
- public static extern int ImageList_DrawEx(IntPtr hImageList, int imageIndex,
- IntPtr hDCDest, int x, int y, int dx, int dy,
- ImageListDrawColors backColor, ImageListDrawColors foregColor, ImageListDrawFlags flags);
- static public bool IsCommonCtrl6()
- {
- DLLVERSIONINFO dllVersion = new DLLVERSIONINFO();
- // We are assummng here that anything greater or equal than 6
- // will have the new XP theme drawing enable
- dllVersion.cbSize = Marshal.SizeOf(typeof(DLLVERSIONINFO));
- WindowsAPI.GetCommonControlDLLVersion(ref dllVersion);
- return (dllVersion.dwMajorVersion >= 6);
- }
- #endregion
- #region Win32 Macro-Like helpers
- public static int X_LPARAM(int lParam)
- {
- return (lParam & 0xffff);
- }
-
- public static int Y_LPARAM(int lParam)
- {
- return (lParam >> 16);
- }
- public static Point GetPointFromLPARAM(int lParam)
- {
- return new Point(X_LPARAM(lParam), Y_LPARAM(lParam));
- }
- public static int LOW_ORDER(int param)
- {
- return (param & 0xffff);
- }
- public static int HIGH_ORDER(int param)
- {
- return (param >> 16);
- }
- public static uint INDEXTOOVERLAYMASK(uint index)
- {
- return (index << 8);
- }
- public static short HRESULT_CODE(int hr)
- {
- return (short)(hr & 0xFFFF);
- }
- public static bool SUCCEEDED(int status)
- {
- return (status >= 0);
- }
- public static bool FAILED(int status)
- {
- return (status < 0);
- }
- public static int MAKEINTRESOURCE(int res)
- {
- return 0x0000FFFF & res;
- }
- #endregion
- }
- }