Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use VB.NET to start Smartphone

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how to use VB.NET to start Smartphone. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Here is a simple example to start the calculator program on your phone. The steps are as follows:

1. Start VS.net2003, select Visual Basic project, select smart device application in the list on the right, select Smartphone for which platform and type Windows application in the next dialog box.

2. Make the helper class and the code declared by API into two modules.

3. Add the following statement to the top of the code module of form1:

Imports System.Runtime.InteropServices

4. The code to start the calculator in the load event of Form1 is as follows:

Private Sub Form1_Load (ByVal sender As System.Object

ByVal e As System.EventArgs) Handles MyBase.Load

Dim tudtShellExecuteInfo As New SHELLEXECUTEINFO

Dim tstrExecutePath As String

Dim tudtStartupInfo As STARTUPINFO

Dim tudtProcessInfo As PROCESS_INFORMATION

Dim tlngTempa As Int32

With tudtStartupInfo

.CB = Marshal.SizeOf (GetType (STARTUPINFO))

End With

With tudtShellExecuteInfo

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

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

.lpParameters = IntPtr.Zero

'do not use parameters. If you use parameters, you can apply for string pointers according to the lpFile method.

End With

TlngTempa = ShellExecuteEx (tudtShellExecuteInfo) 'launcher

TudtShellExecuteInfo.Dispose ()

If tlngTempa = 0 Then 'failed to use shellexecuteex, try to use createprocess to open it again

TlngTempa = CreateProcess ("/ windows/calc.exe", "/ windows/calc.exe", IntPtr.Zero

IntPtr.Zero, _ 0,0, IntPtr.Zero, IntPtr.Zero, tudtStartupInfo, tudtProcessInfo)

If tlngTempa 0 Then

Call CloseHandle (tudtProcessInfo.hThread)

Call CloseHandle (tudtProcessInfo.hProcess)

End If

End If

End Sub

Thank you for reading! This is the end of the article on "how to use VB.NET to start Smartphone". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report