社区
C#
帖子详情
DllImport("User32.dll")
ainiyanjiao
2008-08-28 04:59:01
大侠们!调用这个函数的作用是?该怎么调用?
.NET 里面经常调用的外部系统函数还有哪些?举例说明吧
...全文
8035
49
打赏
收藏
DllImport("User32.dll")
大侠们!调用这个函数的作用是?该怎么调用? .NET 里面经常调用的外部系统函数还有哪些?举例说明吧
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
49 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
wzm12349
2012-07-30
打赏
举报
回复
在这里看了很久。。。。。
horsemeng
2012-05-23
打赏
举报
回复
刚好遇到这个问题,也是不知道DllImport是干嘛的,学习了,谢谢诶。
akuaiyuan
2011-11-17
打赏
举报
回复
[Quote=引用 18 楼 freshairyz25 的回复:]
引用 12 楼 yangglemu 的回复:
常用的三大模块:
user32.dll
是Windows用户界面相关应用程序接口,用于包括Windows处理,基本用户界面等特性,如创建窗口和发送消息
gdi32.dll
gdi32.dll是Windows GDI图形用户界面相关程序,包含的函数用来绘制图像和显示文字
kernel32.dll
控制着系统的内存管理、数据的输……
[/Quote]
好啊
jinmingyc
2011-08-04
打赏
举报
回复
xuexizhong
vavas0
2011-08-04
打赏
举报
回复
不错,真的学习了
gen251819258
2011-06-01
打赏
举报
回复
学习了,高手
ccsldya
2011-04-02
打赏
举报
回复
[Quote=引用 12 楼 yangglemu 的回复:]
常用的三大模块:
user32.dll
是Windows用户界面相关应用程序接口,用于包括Windows处理,基本用户界面等特性,如创建窗口和发送消息
gdi32.dll
gdi32.dll是Windows GDI图形用户界面相关程序,包含的函数用来绘制图像和显示文字
kernel32.dll
控制着系统的内存管理、数据的输入输出操作和中断处理
微软就是靠这三个模块起……
[/Quote]
学习,谢谢大神~
yuzhoufeng888
2011-04-02
打赏
举报
回复
学习中……
瑾安
2011-02-13
打赏
举报
回复
学习下
doubleu2005
2011-02-13
打赏
举报
回复
常用的基本就是这三个
user32.dll
gdi32.dll
kernel32.dll
cycwind
2011-02-13
打赏
举报
回复
ding
dreaminglove
2011-01-18
打赏
举报
回复
说个实例看看啊,我也搞不懂啊
卧_槽
2010-12-20
打赏
举报
回复
.net framework的核心就是DllImport.
lvchun012
2010-12-20
打赏
举报
回复
呵呵,接口问题,
crazyweed0907
2010-12-20
打赏
举报
回复
[Quote=引用 1 楼 ericzhangbo1982111 的回复:]
DllImport 属性的常见用法。第一节讨论使用 DllImport 从托管应用程序调用本机代码的优点。第二节集中讨论封送处理和 DllImport 属性的各个方面。
从托管应用程序调用非托管代码
当在托管应用程序中重用现有的非托管代码时,DllImport 属性非常有用。例如,托管应用程序可能需要调用非托管 WIN32 API。
下面的代码示例说明此通用方案,此示例将调用 Mes……
[/Quote]
!!!
flyerwing
2010-12-20
打赏
举报
回复
[Quote=引用 21 楼 computerfox 的回复:]
C#的平台调用,请参考:
创建Win32 DLL,并在C#里面调用
另外,遇到这样的问题,可以先google搜索后,再问具体的。例如怎么调用某个函数等。
[/Quote]
平台调用吧.
Alexander_QQ
2010-12-20
打赏
举报
回复
[Quote=引用 12 楼 yangglemu 的回复:]
常用的三大模块:
user32.dll
是Windows用户界面相关应用程序接口,用于包括Windows处理,基本用户界面等特性,如创建窗口和发送消息
gdi32.dll
gdi32.dll是Windows GDI图形用户界面相关程序,包含的函数用来绘制图像和显示文字
kernel32.dll
控制着系统的内存管理、数据的输入输出操作和中断处理
微软就是靠这三个模块……
[/Quote]
长见识
popchinale
2010-11-09
打赏
举报
回复
学习了··好多高YIN啊
安静写代码
2010-11-05
打赏
举报
回复
学习了
salecn
2010-10-04
打赏
举报
回复
来学习一下,顺便帮顶!
加载更多回复(28)
通过avicap32.
dll
操作视频的类(C#)
#region 导入API函数 [
Dll
Import
("avicap32.
dll
")]//包含了执行视频捕获的函数,它给AVI文件I/O和视频、音频设备驱动程序提供一个高级接口 public static extern IntPtr capCreateCaptureWindow(string lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hwndParent, int nID); /************参数说明************* * * 函数:capCreateCaptureWindow * * lpszWindowName:标识窗口的名称 * dwStyle:标识窗口风格 * x、y:标识窗口的左上角坐标 * nWidth、nHeight:标识窗口的宽度和高度 * hWnd:标识父窗口句柄 * nID:标识窗口ID * * 返回值:视频捕捉窗口句柄。 * ********************************/ [
Dll
Import
("AVICAP32.
dll
", CharSet = CharSet.Unicode)] public static extern bool capGetDriverDescription(int wDriverIndex, StringBuilder lpszName, int cbName, StringBuilder lpszVer, int cbVer); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, bool wParam, int lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, int lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, short wParam, FrameEventHandler lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref BITMAPINFO lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref CAPDRIVERCAPS lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref CAPTUREPARMS lParam); [
Dll
Import
("
User32
.
dll
")] public static extern bool SendMessage(IntPtr hWnd, int wMsg, int wParam, ref CAPSTATUS lParam); [
Dll
Import
("
User32
.
dll
")] public static extern int SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags); [
Dll
Import
("avicap32.
dll
")] public static extern int capGetVideoFormat(IntPtr hWnd, IntPtr psVideoFormat, int wSize); #endregion
无标题窗体的拖动程序[
Dll
Import
("
user32
.
dll
")]
无标题窗体的拖动程序[
Dll
Import
("
user32
.
dll
")] public static extern bool ReleaseCapture(); [
Dll
Import
("
user32
.
dll
")] public static extern bool SendMessage(IntPtr hwnd,int wMsg,int wParam,int lParam); public const int WM_SYSCOMMAND=0x0112; public const int SC_MOVE=0xF010; private Button button1; public const int HTCAPTION=0x0002;(C#源代码编写)
C# 游动小金鱼 动态屏保
C#游动屏保小金鱼, [
Dll
Import
("gdi32.
dll
", ExactSpelling = true, SetLastError = true)] public static extern IntPtr CreateCompatibleDC(IntPtr hDC); [
Dll
Import
("
user32
.
dll
", ExactSpelling = true, SetLastError = true)] public static extern IntPtr GetDC(IntPtr hWnd); [
Dll
Import
("gdi32.
dll
", ExactSpelling = true)] public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObj); [
Dll
Import
("
user32
.
dll
", ExactSpelling = true)] public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); [
Dll
Import
("gdi32.
dll
", ExactSpelling = true, SetLastError = true)] public static extern int DeleteDC(IntPtr hDC); [
Dll
Import
("gdi32.
dll
", ExactSpelling = true, SetLastError = true)] public static extern int DeleteObject(IntPtr hObj); [
Dll
Import
("
user32
.
dll
", ExactSpelling = true, SetLastError = true)] public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pptSrc, Int32 crKey, ref BLENDFUNCTION pblend, Int32 dwFlags);
窗体.隐藏.练习内容
窗体.隐藏.练习 [
Dll
Import
("
user32
.
dll
")] public static extern IntPtr FindWindow(string ClassN, string WindN); [
Dll
Import
("
user32
.
dll
", EntryPoint = "ShowWindow", SetLastError = true)] static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
C# 中操作API,清晰PDF
接着添加下面的代码来声明一个 API : [
Dll
Import
("
User32
.
dll
")] public static extern int MessageBox(int h, string m, string c, int type); 此处
Dll
Import
属性被用来从不可控代码中调用一方法。”
User32
.
dll
库名。
C#
110,534
社区成员
642,576
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章