P/Invoke能够在asp.net 中使用哦
P/Invoke能够在asp.net 中使用哦,是的,今天have some try le.

1
2
3
using System;
4
using System.Collections;
5
using System.ComponentModel;
6
using System.Data;
7
using System.Drawing;
8
using System.Web;
9
using System.Web.SessionState;
10
using System.Web.UI;
11
using System.Web.UI.WebControls;
12
using System.Web.UI.HtmlControls;
13
14
using System.Runtime.InteropServices;
15
using System.Windows.Forms;
16
17
namespace Test_MyService
18
{
19
/// <summary>
20
/// WebForm1 的摘要说明。
21
/// </summary>
22
public class WebForm1 : System.Web.UI.Page
23
{
24
protected System.Web.UI.WebControls.TextBox TextBox1;
25
protected System.Web.UI.WebControls.Label Label1;
26
protected System.Web.UI.WebControls.Button Button1;
27
protected System.Web.UI.WebControls.TextBox TextBox2;
28
protected System.Web.UI.WebControls.TextBox txtQ;
29
protected System.Web.UI.WebControls.TextBox txtD;
30
31
localhost.ServiceTest myservice = new Test_MyService.localhost.ServiceTest();
32
33
private void Page_Load(object sender, System.EventArgs e)
34
{
35
// 在此处放置用户代码以初始化页面
36
37
}
38
39
[DllImport("user32.dll", CharSet=CharSet.Ansi)]
40
public static extern int MessageBox(int h, string m,
41
string c, int type);
42
43
[DllImport("user32.dll", CharSet=CharSet.Ansi)]
44
public static extern Boolean MessageBeep(UInt32 beepType);
45
46
[DllImport("Kernel32.dll", SetLastError=true)]
47
static extern Boolean Beep(UInt32 frequency, UInt32 duration);
48
49
50
Web 窗体设计器生成的代码
71
72
private void Button1_Click(object sender, System.EventArgs e)
73
{
74
this.TextBox2.Text = myservice.Who(this.TextBox1.Text);
75
76
// string pText = "Hello World!";
77
// string pCaption = "PInvoke Test";
78
// MessageBox(0, pText, pCaption, 0);
79
80
//MessageBeep(0x00000010);
81
Beep(Convert.ToUInt32(txtQ.Text),Convert.ToUInt32(txtD.Text));
82
83
}
84
}
85
}
86
其中MessageBox.Show(...)执行时就不动了,内部机理也不名所以,若是能够SHOW的话,那岂不是不用ACTIVEX了吗,一己之见而已了。根据理论是不行的,在。NET3.0(WinFX)可以将Win&Web集成到一起,那时将不分什么了,太恐怖了。。。。。
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

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

__EOF__

本文作者:pccai
本文链接:https://www.cnblogs.com/pccai/archive/2006/08/01/464935.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
本文链接:https://www.cnblogs.com/pccai/archive/2006/08/01/464935.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!
msn: pccai1983@hotmail.com
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现