微软.net精简框架常见问题及回答(中文版)(66)

王朝c#·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

' Get/Set the short

Public Property sDummy() As Short

Get

Return BitConverter.ToInt16(m_data, 4)

End Get

Set(ByVal Value As Short)

Buffer.BlockCopy(BitConverter.GetBytes(Value),0,m_data,4,BitConverter.GetBytes(Value).Length)

End Set

End Property

End Class 'ByteClass

Dim fromFile As Byte() = {1, 1, 1, 1, 2, 2}

Dim testClass As New ByteClass(fromFile)

Dim test1 As System.UInt32 = testClass.uiDummy ' 0x1010101

Dim test2 As Short = testClass.sDummy ' 0x202

testClass.sDummy = &H505 ' Test short

Dim test4 As System.UInt32 = testClass.uiDummy ' 0x1010101

Dim test5 As Short = testClass.sDummy ' 0x505

7.10. 我可以建立一个委托(delegate)交给Invoke吗?

不可以。在.net精简框架中,只有EventHandler方法可以被调用。以下代码说明啊如何正确使用此方法:

//C#

public void HandleMe(object o, EventArgs e) {...}

form.Invoke(new EventHandler(form.HandleMe));

'VB

Public Sub HandleMe(o As Object, e As EventArgs)

End Sub 'HandleMe

form.Invoke(New EventHandler(AddressOf form.HandleMe))

Although the following will compile, it will not work properly:

//C#

public delegate void MyHandler();

public void HandleMeBadly() {...}

form.Invoke(new MyHandler(form.HandleMeBadly));

'VB

Delegate Sub MyHandler()

Public Sub HandleMeBadly()

End Sub 'HandleMeBadly

form.Invoke(New MyHandler(form.HandleMeBadly))

7.11. 如何在微软.net精简框架上使用电话API?

查看这篇文章,学习如何在基于.net精简框架的应用程序中访问电话API:

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfphoneapi.asp

7.12. 如何在Pocket Pc上生成GUID?

Guid.NewGuid方法可以生成新的GUID,但在.net精简框架中没有此方法。阅读这篇文章,学习如何根据GUID规范在PocketPC应用程序中建立GUID对象:

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/PPCGuidGen.asp

7.13. 如何让我的.net精简框架程序和Pocket Outlook的数据结合?

这篇文章讨论了如何使用InTheHand公司的Pocket Outlook .NET组件:

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/inthehandpoom.asp

7.14. 我可以判断.net精简框架中一个文件的版本吗?

Visual Studio .NET 2003帮助中的C# Programmer's Reference提供了在.net精简框架下使用不安全代码调用GetFileVersionInfo函数。 这个例子带来的问题是,这个函数是由OEM厂商决定的,并且不保证能返回正确结果。

使用Reflection可以获得程序集(Assembly)的版本:

//C#

using System.Reflection;

String ver = Assembly.GetExecutingAssembly().GetName().Version.ToString();

'VB

Imports System.Reflection;

Dim ver As String = [Assembly].GetExecutingAssembly().GetName().Version.ToString()

7.15. 微软.net精简框架的后台处理有什么相关技术?

使用后台处理,需要注意相关细节并小心设计。这篇文章提供一些关于后台处理最有用的建议,文中介绍的很多观点是必须说明的:

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/BackgroundProcess.asp

7.16. 在微软.net精简框架上使用多线程有什么技巧?

学习如何在基于.net精简框架的Windows窗体应用程序中使用多线程。

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfmultithreadedapp.asp

7.17. 如何在 智能设备应用 中使用混淆器?

学习如何使用PreEmptive Dotfuscator混淆器保护你的代码。

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfobfuscation.asp

7.18. 如何使用密码服务对数据进行加密或解密?

请参考本问答的 "10.5. 写一个捕捉Pocket PC签名的程序n ." 部分。

7.19. 如何在微软.net精简框架上获得Windows CE设备的唯一号码?

学习如何使用.net精简框架获得Windows CE设备的设备号。

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/retrievedeviceid.asp

你可以调用本地代码的函数来获得PocketPC的设备号,也就是序列号。这篇快速入门教程,演示了用MessageBox来显示设备号。

http://samples.gotdotnet.com/quickstart/CompactFramework/doc/deviceid.aspx

7.20. 如何在微软.net精简框架的应用程序上发送短消息?

这篇文章演示了如何从基于.net精简框架的应用程序中发送短消息:

http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfsendsms.asp

第一頁    上一頁    第66頁/共78頁    下一頁    最後頁
第01頁 第02頁 第03頁 第04頁 第05頁 第06頁 第07頁 第08頁 第09頁 第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頁 
第51頁 第52頁 第53頁 第54頁 第55頁 第56頁 第57頁 第58頁 第59頁 第60頁 
第61頁 第62頁 第63頁 第64頁 第65頁 第66頁 第67頁 第68頁 第69頁 第70頁 
第71頁 第72頁 第73頁 第74頁 第75頁 第76頁 第77頁 第78頁 
 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航