首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

能给个asp.net调用dll的Hallo World例子吗,感谢,该怎么处理

2012-02-15 
能给个asp.net调用dll的Hallo World例子吗,感谢想用c#的语法写asp.net的网页,要调用一个dll。在这里搜索了

能给个asp.net调用dll的Hallo World例子吗,感谢
想用c#的语法写asp.net的网页,要调用一个dll。

在这里搜索了很久,没找到能运行的例子。能写个Hallo   World的例子吗?会了后马上结贴

多谢

[解决办法]
要求调用什么样的dll
win32 普通的?
com 的?
托管的?

[解决办法]
自己写个类编译一下就会生成一个dll,

[解决办法]
新建项目-类库HalloWorld 新建一类HalloWorld.cs
namespace HalloWorld
{
public class HalloWorld
{
public string getHalloWorld()
{
return "Hallo World ";
}
}
}
生成dll
新建一网站 添加引用 HalloWorld.dll
新建test.aspx页面调用HalloWorld
HalloWorld.HalloWorld halloWorld = new HalloWorld.HalloWorld();
Response.Write(halloWorld.getHalloWorld());
[解决办法]
添加引用 helloworld.dll

后天使用时候 使用一下语法
hellwprld.hellworld()

或者
using hellworld;

----》
helloworld();
[解决办法]
调用外部 DLL

const string strDLLPath = "FBSDK.dll ";

// 系统函数
[DllImport(strDLLPath, EntryPoint= "Login ")] // 登录系统
public static extern int pLogin(string data, int length, byte[] errorMsg);

[DllImport(strDLLPath, EntryPoint= "Logout ")] // 退出系统
public static extern int pLogout(byte[] errorMsg);

[DllImport(strDLLPath, EntryPoint= "GetAccInfoA ")] // 查询账户详细信息
public static extern int pGetAccInfoA(string query, out IntPtr data, Int32[] length, byte[] errorMsg);

以后使用就直接使用 pLogin(...),和其他函数使用没有什么区别
[解决办法]
照3楼的写法试试,没问题
多动手试试,一个解决方案中的cs文件,编译后就是一个DLL

热点排行