C#:使用Window自带函数(如:user32.dll)

?





1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

[DllImport("user32.dll", EntryPoint = "GetScrollInfo", CallingConvention = CallingConvention.StdCall)]

public
static extern bool GetScrollInfo(IntPtr hwnd, int
fnBar, ref
SCROLLINFO lpsi);

[DllImport("user32.dll", EntryPoint = "SetScrollInfo", CallingConvention = CallingConvention.StdCall)]

public
static extern int SetScrollInfo(IntPtr hwnd, int
fnBar, [In] ref
SCROLLINFO lpsi, bool
fRedraw);

[DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage", CallingConvention =CallingConvention.Cdecl)]

static
extern IntPtr SendMessage(IntPtr hWnd, uint
Msg, IntPtr wParam, IntPtr lParam);

[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "PostMessage")] 

public
static extern bool PostMessage(IntPtr hWnd, uint
Msg, int
wParam, int
lParam);

[DllImport("gdi32.dll")]

public
static extern int CreateRoundRectRgn(int
x1, int
y1, int
x2, int
y2, int
x3, int
y3);

[DllImport("user32.dll")]

public
static extern int SetWindowRgn(IntPtr hwnd, int
hRgn, Boolean bRedraw);

[DllImport("user32.dll")]

[return: MarshalAs(UnmanagedType.Bool)]

public
static extern bool ShowScrollBar(IntPtr hWnd, int
wBar, bool
bShow);

[DllImport("user32.dll")]

public
static extern IntPtr GetWindowDC(IntPtr hWnd);

[DllImport("user32.dll")]

public
static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

C#:使用Window自带函数(如:user32.dll),布布扣,bubuko.com

时间: 2024-12-10 15:20:57

C#:使用Window自带函数(如:user32.dll)的相关文章

【整理】c# 调用windows API(user32.dll)

User32.dll提供了很多可供调用的接口,大致如下(转自http://blog.csdn.net/zhang399401/article/details/6978803) using System;    using System.Collections.Generic;    using System.Linq;    using System.Text;    using System.Runtime.InteropServices;       namespace WindowsAPI

转整理分享C#通过user32.dll模拟物理按键操作的代码

对系统模拟按键方面的知识和按键映射代码做了一下梳理,在这里分享出来,适用于开发自动操作工具和游戏外挂. 主代码: public const int KEYEVENTF_EXTENDEDKEY = 0x0001; //Key click flag public const int KEYEVENTF_KEYUP = 0x0002; //Key up flag [DllImport("user32.dll")] private static extern void keybd_event(

Python 调用 user32.dll

import ctypes h = ctypes.windll.LoadLibrary("C:\\Windows\\System32\\user32.dll") h.MessageBoxW(0, u'内容', u'标题', 0)

整理分享C#通过user32.dll模拟物理按键操作的代码

对系统模拟按键方面的知识和按键映射代码做了一下梳理,在这里分享出来,适用于开发自动操作工具和游戏外挂. 主代码: public const int KEYEVENTF_EXTENDEDKEY = 0x0001; //Key click flag public const int KEYEVENTF_KEYUP = 0x0002; //Key up flag [DllImport("user32.dll")] private static extern void keybd_event(

user32.dll

1 user32.dll中的所有函数 2 3 4 5 6 using System; 7 using System.Collections.Generic; 8 using System.Linq; 9 using System.Text; 10 using System.Runtime.InteropServices; 11 12 namespace WindowsAPI 13 { 14 class CSharp_Win32Api 15 { 16 #region User32.dll 函数 1

准确看看 user32.dll 里有哪些导出函数(win7-32)

看看 user32.dll里有哪些导出函数,大家都会,但准确性???以MS dumpbin为标准,要做出来结果一模一样,才表示代码完全正确. 直接上代码: 1 // ListExport.cpp : Defines the entry point for the console application. 2 // 3 #include "stdafx.h" 4 #include <windows.h> 5 #include <winnt.h> 6 7 exter

【转】c# 调用windows API(user32.dll)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace WindowsAPI { class CSharp_Win32Api { #region User32.dll 函数 /// <summary> /// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,以后可以

Winform API &quot;user32.dll&quot;中的函数

命名空间:System.Runtime.InteropServices 1 /// <summary> 2 /// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄,以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图.hWnd:设备上下文环境被检索的窗口的句柄 3 /// </summary> 4 [DllImport("user32.dll", CharSet = CharSet.Auto)] 5 public static exter

Win32 API中的user32.dll中的ShowWindow方法参数整理

在使用ShowWindow方法来设置窗体的状态时,由于不知道参数值,用起来非常容易混乱,所以整理了以下其参数的枚举值,方便以后的的使用.   public class User32API { #region ShowWindow 方法窗体状态的参数枚举 /// <summary> /// 隐藏窗口并激活其他窗口 /// </summary> public const int SW_HIDE = 0; /// <summary> /// 激活并显示一个窗口.如果窗口被最小