zoukankan      html  css  js  c++  java
  • [原]c# 一些 win32 api 声明原型

    [DllImport("user32.dll", CharSet=CharSet.Auto, EntryPoint = "FindWindowA")]
            public static extern IntPtr FindWindowA(string lp1, string lp2);
            
                [DllImport("user32.dll", CharSet=CharSet.Auto, EntryPoint = "FindWindowExA")]
            public static extern IntPtr FindWindowExA(long han1, long han2,string lp1, string lp2);
    
            [DllImport("user32.dll", CharSet=CharSet.Auto, EntryPoint = "ShowWindow")]
            public static extern IntPtr ShowWindow(IntPtr hWnd, int _value);
    
            [DllImport("user32.dll", CharSet=CharSet.Auto)]
            public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
    
            [DllImport("user32.dll", CharSet=CharSet.Auto, EntryPoint = "MoveWindow")]
            public static extern int MoveWindow(int hwnd, int x, int y, int nWidth, int nHeight, int bRepaint);
    
            [DllImport("user32.dll", CharSet=CharSet.Auto)]
            ///第一个参数是指定窗口句柄;第二个参数接收窗口的左上角和右下角的屏幕坐标,它是Rect结构
            private static extern int GetWindowRect(IntPtr hwnd, out  Rect lpRect);
            /// <summary>
            /// 结构体 位置
            /// </summary>
            public struct Rect
            {
                public int Left;
                public int Top;
                public int Right;
                public int Bottom;
            }
       [System.Runtime.InteropServices.DllImport("user32.DLL")]
            private static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
            [System.Runtime.InteropServices.DllImport("user32.DLL")]
            private static extern IntPtr FindWindow(string lpszClass, string lpszWindow);
            [System.Runtime.InteropServices.DllImport("user32.DLL")]
            private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
            [System.Runtime.InteropServices.DllImport("user32.dll")]
            private static extern uint GetWindowThreadProcessId(IntPtr hWnd,
    out uint dwProcessId);
            private const uint PROCESS_VM_OPERATION = 0x0008;
            private const uint PROCESS_VM_READ = 0x0010;
            private const uint PROCESS_VM_WRITE = 0x0020;
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);
            private const uint MEM_COMMIT = 0x1000;
            private const uint MEM_RELEASE = 0x8000;
            private const uint MEM_RESERVE = 0x2000;
            private const uint PAGE_READWRITE = 4;
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, uint dwFreeType);
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern bool CloseHandle(IntPtr handle);
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, IntPtr lpBuffer, int nSize, ref uint vNumberOfBytesRead);
            [System.Runtime.InteropServices.DllImport("kernel32.dll")]
            private static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress,
               IntPtr lpBuffer, int nSize, ref uint vNumberOfBytesRead);
            private struct LVITEM  //结构体
            {
                public int mask;
                public int iItem;
                public int iSubItem;
                public int state;
                public int stateMask;
                public IntPtr pszText; // string
                public int cchTextMax;
                public int iImage;
                public IntPtr lParam;
                public int iIndent;
                public int iGroupId;
                public int cColumns;
                public IntPtr puColumns;
            }
    

    作者:qq283868910 发表于2011-12-2 10:31:29 原文链接
    阅读:336 评论:0 查看评论
  • 相关阅读:
    Linux安装gitlab
    logback日志配置
    spring源码-aop动态代理-5.3
    【转】阿里云免费SSL证书申请与安装使用(IIS7)
    WebApi 全局使用filter
    Mint-UI Picker 三级联动
    P标签莫名有了margin-top值的原因
    Vue为v-html中标签添加CSS样式
    【转】C# string数组转int数组
    【转】SQLServer汉字转全拼音函数
  • 原文地址:https://www.cnblogs.com/SpeakHero/p/2431312.html
Copyright © 2011-2022 走看看