API声明类
来源:互联网 发布:护士资格考试题库软件 编辑:程序博客网 时间:2024/06/06 21:47
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
namespace ZU14.CN.GetWindowHandleFromCursor
{
/// <summary>
/// API声明类
/// </summary>
internal static class NativeMethods
{
#region Windows API Import Section
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", EntryPoint = "GetTopWindow", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr GetTopWindow(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass,
string lpszWindow);
[DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll", EntryPoint = "GetWindowTextLength", SetLastError = true,
CharSet = CharSet.Unicode)]
internal static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32.dll", EntryPoint = "GetWindowText", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", EntryPoint = "GetClassName", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern int GetClassName(IntPtr hWnd, StringBuilder buf, int nMaxCount);
[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CharSet = CharSet.Unicode)]
internal static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, string lParam);
[DllImport("user32.dll", EntryPoint = "SendMessage", SetLastError = true, CharSet = CharSet.Auto)]
internal static extern IntPtr SendMessage(IntPtr hWnd, uint wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "GetWindow", SetLastError = true)]
internal static extern IntPtr GetWindow(IntPtr hWnd, uint wCmd);
[DllImport("user32.dll", EntryPoint = "IsWindow", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool IsWindow(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)]
internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool DrawMenuBar(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true)]
internal static extern uint GetMenuItemCount(IntPtr hMenu);
[DllImport("user32.dll", SetLastError = true)]
internal static extern bool DeleteMenu(IntPtr hMenu, uint uPosition, uint uFlags);
[DllImport("user32.dll")]
internal static extern bool GetCursorPos(out Point lpPoint);
[DllImport("user32.dll")]
internal static extern IntPtr WindowFromPoint(Point Point);
#endregion
#region Windows Message Declaration Section
internal const uint SWP_NOACTIVATE = 0x10;
internal const uint SWP_SHOWWINDOW = 0x40;
#endregion
}
}
- API声明类
- api声明
- API函数声明
- API的函数声明
- 怎样手工声明API
- Vb.net声明API
- ODBC API的声明语句
- WinInet API 声明 for VB
- Retrofit——API声明
- VB Api简单入门(3)-Api声明
- VB调用系统API的声明
- c# 一些 win32 api 声明原型
- mysql api的函数声明简介
- Retrofit的API接口声明准则
- Retrofit——API声明 2
- 疯狂代码VB段声明API和使用API
- vb怎么声明api函数:VB中声明和使用API函数
- C++ 类声明 类前置声明范例
- 常见的视频、音频、图片文件的格式
- 软件开发的效率
- 我要在CSDN开辟自己的一片小天地~
- SPI、I2C、UART三种串行总线协议的区别
- Java事务处理总结
- API声明类
- 转载(只用于学习)
- ajax最简单的一个实例
- java中的Proxy模式(一)
- Learning note(1) for Windows PowerShell Tips
- STOS/STOSB/STOSW/STOSD/STOSQ---存储字符串
- Symbian:3版到2版移植
- XSL概述(一)
- 正式开博了~