惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Vercel News
Vercel News
月光博客
月光博客
S
SegmentFault 最新的问题
A
About on SuperTechFans
Microsoft Security Blog
Microsoft Security Blog
U
Unit 42
Google DeepMind News
Google DeepMind News
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
小众软件
小众软件
WordPress大学
WordPress大学
G
Google Developers Blog
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
博客园 - 【当耐特】
I
InfoQ

博客园 - 半克拉鹅卵石

strong name in gac sql积累 一些有用的bat命令 js获取某年某月天数 计算经纬度距离 正则表达式分割数组 修改系统时间 转贴:Lucene的评分(score)机制 搜索引擎CACHE策略研究 lucene.net 2.0在多线程同步下似乎有问题 Lucene Hack之通过缩小搜索结果集来提升性能 lucene2.0与2.3区别 asp.net常用函数 不走寻常路,设计asp.net应用程序的七大绝招 数据库备份 获取sql server服务器名称 如何用SQLDMO在ASP.NET页面下实现数据库的备份与恢复 C#中下载Excel文件(其实就是将Excel文件从一个路径Copy到另一个路径) Asp.net中操作Excel的权限解决方法
DllImport
半克拉鹅卵石 · 2008-09-23 · via 博客园 - 半克拉鹅卵石

MSDN中对DllImportAttribute的解释是这样的:可将该属性应用于方法。DllImportAttribute 属性提供对从非托管 DLL 导出的函数进行调用所必需的信息。作为最低要求,必须提供包含入口点的 DLL 的名称。

并给了一个示例:

[DllImport("KERNEL32.DLL", EntryPoint="MoveFileW", SetLastError=true,

CharSet=CharSet.Unicode, ExactSpelling=true,

CallingConvention=CallingConvention.StdCall)]

public static extern bool MoveFile(String src, String dst);

上网搜了一下,最常见的就是使用它来调用WIN32的API,例如上面所示。或者调用一下C或C++编写的DLL。

将DLL拷贝到BIN目录后就可使用(DLLImport会从程序启动目录开始查找相应名称的DLL,未找到则转至system32下查找)