我沒間鍋 不過你可以看看UtilityLibrary的員代碼 裡面有許多例子,我給你貼一部分,希望有所啟發 #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 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 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);
不過你可以看看UtilityLibrary的員代碼
裡面有許多例子,我給你貼一部分,希望有所啟發
#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
[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 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
[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);
[email protected]
发给我一封,阿
谢谢
这里有比较全的, 刚上传上去
[email protected]
谢谢:![email protected]