⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogs.vb

📁 Microsoft Mobile Development Handbook的代码,有C#,VB,C++的
💻 VB
字号:
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports CodeForChapter4vb_DLL.CodeForChapter4cs_DLL

Namespace CodeForChapter4cs
  Public Partial Class frmLogs
	  Inherits Form
	Public Sub New()
	  InitializeComponent()
	  Me.Text = System.Net.Dns.GetHostName()
	End Sub

	<DllImport("ws22.dll", SetLastError := True)> _
	Public Shared Function sethostname(ByVal pName As Byte(), ByVal cName As Int32) As Int32
	End Function

	<DllImport("ws2.dll", SetLastError := True)> _
	Public Shared Function sethostnamee(ByVal pName As Byte(), ByVal cName As Int32) As Int32
	End Function


	Private Sub menuItem1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles menuItem1.Click
	  Dim b As Byte() = ASCIIEncoding.ASCII.GetBytes("my dev name" & Constants.vbNullChar)
	  Try
	  sethostnamee(b, b.GetLength(0))

	  Catch ex As Exception

		MessageBox.Show(ex.Message)
	  End Try
	 ' sethostname(b, b.GetLength(0));

	  If sethostname(b, b.GetLength(0)) = 0 Then
		Me.Text = System.Net.Dns.GetHostName()
	  Else
		Me.Text = Marshal.GetLastWin32Error().ToString()
	  End If

	End Sub

	Private Sub menuItem2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles menuItem2.Click
	  Marshal.PrelinkAll(Me.GetType())
	  Dim s As SomeClass = New SomeClass()
	End Sub
  End Class
End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -