c#中如何使用仅仅有函数的DLL

yilinpang 2003-09-26 04:08:45
如果该DLL中仅仅有函数,不能在工程中添加引用来使用,如何使用该种DLL呢
...全文
56 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
smiletosky 2003-09-26
  • 打赏
  • 举报
回复
给你个播放声音的类,参考一下
public class sndPlay
{
//声音动态连接库声明
[DllImport("winmm.dll", EntryPoint="PlaySound")]
public static extern bool PlaySound(ref Byte snd, IntPtr hmod, uint fdwSound);

[DllImport("winmm.dll", EntryPoint="PlaySound")]
public static extern int PlaySound(string lpszName,int hModule,int dwFlags);

public enum PlayingFlags :uint
{
SND_SYNC = 0x00,
SND_ASYNC = 0x01,
SND_NODEFAULT = 0x02,
SND_MEMORY = 0x04,
SND_ALIAS = 0x010000,
SND_FILENAME = 0x020000,
SND_RESOURCE = 0x040004,
SND_ALIAS_ID = 0x0110000,
SND_ALIAS_START = 0,
SND_LOOP = 0x08,
SND_NOSTOP = 0x010,
SND_VALID = 0x01F,
SND_NOWAIT = 0x02000,
SND_PURGE = 0x40
}
}
ms44 2003-09-26
  • 打赏
  • 举报
回复
只能使用楼上说的了,如果不想找麻烦的话.
-_-中英文数字 2003-09-26
  • 打赏
  • 举报
回复
using System.Runtime.InteropServices;

[DllImport("your.dll")]
static extern /* your function signature here */;

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧