重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

如何利用VB.NET启动Smartphone

这篇文章给大家分享的是有关如何利用VB.NET启动Smartphone的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

海曙网站建设公司创新互联,海曙网站设计制作,有大型网站制作公司丰富经验。已为海曙上千余家提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的海曙做网站的公司定做!

下面是一个简单示例,启动手机中的计算器程序,步骤如下:

1、启动VS.net2003,选Visual Basic 项目,在右边的列表中选智能设备应用程序,在下一个对话框中针对什么平台选Smartphone,类型选Windows应用程序。

2、将上面介绍的辅助类及API声明的代码做成两个模块。

3、为在form1的代码模块顶部加入如下语句:

Imports System.Runtime.InteropServices

4、在 Form1的 load事件中加入启动计算器的代码如下:

  1. Private Sub Form1_Load(ByVal sender As System.Object, 
    ByVal e As System.EventArgs) Handles MyBase.Load  

  2. Dim tudtShellExecuteInfo As New SHELLEXECUTEINFO  

  3. Dim tstrExecutePath As String  

  4. Dim tudtStartupInfo As STARTUPINFO  

  5. Dim tudtProcessInfo As PROCESS_INFORMATION  

  6. Dim tlngTempa As Int32  

  7.  

  8. With tudtStartupInfo  

  9. .cb = Marshal.SizeOf(GetType(STARTUPINFO))  

  10. End With  

  11.  

  12. With tudtShellExecuteInfo  

  13. .cbSize = Marshal.SizeOf(GetType(SHELLEXECUTEINFO))  

  14. .lpFile = clsDAMSMobileMarshal.fnStringToHLocalUni("/windows/calc.exe")  

  15. .lpParameters = IntPtr.Zero 

  16. '不使用参数,如使用参数可按lpFile的方法申请字符串指针  

  17. End With  

  18. tlngTempa = ShellExecuteEx(tudtShellExecuteInfo) '启动程序  

  19.  

  20. tudtShellExecuteInfo.Dispose()  

  21. If tlngTempa = 0 Then '使用shellexecuteex失败,试图使用createprocess再打开试试  

  22. tlngTempa = CreateProcess("/windows/calc.exe", "/windows/calc.exe", IntPtr.Zero, 
    IntPtr.Zero, _  0, 0, IntPtr.Zero, IntPtr.Zero, tudtStartupInfo, tudtProcessInfo)  

  23. If tlngTempa <> 0 Then  

  24. Call CloseHandle(tudtProcessInfo.hThread)  

  25. Call CloseHandle(tudtProcessInfo.hProcess)  

  26. End If  

  27. End If  

  28. End Sub 

感谢各位的阅读!关于“如何利用VB.NET启动Smartphone”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


网页名称:如何利用VB.NET启动Smartphone
本文路径:http://cqcxhl.cn/article/jcojpc.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP