In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how VB.NET calls Window API, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
The way VB.NET calls Window API is similar to that in VB6, where you must use the declare statement to declare a reference to an external program in the dynamic link library (DLL). Let's make an example of the call and call the GetUserName function in advapi32.dll to get the user name of the system login.
Imports System
Imports System.Text
Imports Microsoft.VisualBasic
Public Class Form3Class Form3
Declare Function GetUsername () Function GetUsername Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpbuffer As String, ByRef nSize As Integer) _
As Integer
Private Sub Button3_Click () Sub Button3_Click (ByVal sender As System.Object
ByVal e As System.EventArgs) Handles Button3.Click
Dim RV As Integer
Dim UserName As String
Dim Buffer As String
Buffer = New String (CChar ("), 25)
RV = GetUsername (Buffer, 25)
UserName = Microsoft.VisualBasic.Left (Buffer, InStr (Buffer, Chr (0))-1)
MsgBox (UserName)
End Sub
End Class
Of course, DotNet FrameWork 2.0 already provides a rich set of class libraries. We can get almost all the functions without having to call Window API with VB.NET, especially after Microsoft's operating system is already set up on. Net FrameWork.
Thank you for reading this article carefully. I hope the article "how to call Window API with VB.NET" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.