网站建设资讯

NEWS

网站建设资讯

vb.net蓝牙编程 vbnet web编程

零基础学习vb. net怎样学?

你得先补基础。

网站的建设成都创新互联专注网站定制,经验丰富,不做模板,主营网站定制开发.小程序定制开发,H5页面制作!给你焕然一新的设计体验!已为成都门窗定制等企业提供专业服务。

最好去学校,找计算机系的学生,抄下专业专业课程和对应的课本(说不定顺便能讨些旧课本),卖齐这些课本(一般学校里面就有书店)慢慢学。

(以下课程不全)

至少需要读一遍的:计算机导论、程序设计基础、软件工程、编译原理

重点学习的:算法与数据结构、面向对象程序设计

还有VB.Net需要一定的基础,建议先从 C++ 或 VB(版本6.0)入门

vb.net和vb编程的区别

vb.net是完全面向对象的语言,支持面向对象的四个基本属性:抽象,继承,多态,封装,但vb是面向过程的语言,它只支持部分面向对象的内容像多态,接口等。从 VB 7.0 之后的版本俗称 VB.NET,来源于微软的.NET战略,到现在为止有三个版本

VB 7.0 即VB 2002,对应.NET Framework 1.0的版本

VB 7.1 即VB 2003,对应.NET Framework 1.1的版本

VB 8.0 即VB 2005,对应.NET Framework 2.0的版本

除了语法和使用习惯的继承,VB 6.0之前的版本和VB 7.0之后的版本完全没有联系,几乎没有相同之处,两种不同体系的语言

VB.net多线程编程问题

你可以在timer前用if判断网络状态,

如断开,可用

threading.Thread.Sleep(10000) ‘当前线程挂起10秒

’可以开一个新线程去读取脱机数据。

如连接,则继续执行。

补充:

dim i as integer

'超过100次退出,避免死循环

for i=0 to 100

try

'ping你的端口

if ‘ok

exit for

else

threading.Thread.Sleep(10000) ‘当前线程挂起10秒

end

Catch ex As Exception

End Try

next

怎样用VB.NET进行网络编程?

都可以,可以用winsock,也可以自己重写SOCKET套接字.建议你如果工期紧,可以先用WINSOCK.当然最好是自己学用SOCKET套接字.这对未来开发网络通讯是很有帮助的.因为用WINSOCK有个毛病就是杀毒软件总会阻止

如何用VB或C++实现对某服务启动和停止//如BlueTooth Support

前几天搞的

在listview里 双击要改变状态的服务就行

Dim strComputer As String, strNameSpace As String, strClass As String

Dim x

Private Type RECT

Left As Long

Top As Long

Right As Long

Bottom As Long

End Type

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Const LB_SETHORIZONTALEXTENT = H194

Const DT_CALCRECT = H400

Dim tmpLp As Long

Dim SRVDsc(1 To 300) As String

Private Sub Command1_Click()

ShellExecute 0, "Open", "c:\SERVERS_LOG.log", "", "", 1

End Sub

Private Sub Form_Load()

With ListView1.ColumnHeaders '添加新的列标题

.Add , , "", 10

.Add , , "服务", 2500 '第一列标题,标题内容为“第一列”,列宽为2500

.Add , , "状态", 1000 '第二列标题,标题内容为“第二列”,列宽为1000

End With

Call ss2

End Sub

Sub closeSS(ByVal SSname As String)

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

"{impersonationLevel=impersonate}!\\" strComputer "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery("Associators of " _

"{Win32_Service.Name='" SSname "'} Where " _

"AssocClass=Win32_DependentService " "Role=Antecedent")

For Each objService In colServiceList

x = objService.StopService()

Next

Sleep 2000

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name='" SSname "'")

For Each objService In colServiceList

errReturn = objService.StopService()

Next

End Sub

Private Sub ListView1_Click()

'

End Sub

Private Sub ListView1_DblClick()

tmpLp = ListView1.SelectedItem.Index

If ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(2) = "Stopped" Then

Call startSS(ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(1))

Open "c:\SERVERS_LOG.log" For Append As #1

Print #1, ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(1) " Form " " Stopped ---- Running" " " Now()

Close 1

Else

Call closeSS(ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(1))

Open "c:\SERVERS_LOG.log" For Append As #1

Print #1, ListView1.ListItems(ListView1.SelectedItem.Index).SubItems(1) " Form " " Running ---- Stopped " " " Now()

Close 1

End If

Call ss2

ListView1.ListItems(tmpLp).Selected = True

End Sub

'

'Public Function ListTextWidth(ByRef lstThis As ListView) As Long

'Dim i As Long

'Dim tR As RECT

'Dim lW As Long

'Dim lWidth As Long

'Dim lHDC As Long

'With lstThis.Parent.Font

'.Name = lstThis.Font.Name

'.Size = lstThis.Font.Size

'.Bold = lstThis.Font.Bold

'.Italic = lstThis.Font.Italic

'End With

'lHDC = lstThis.Parent.hdc

''便历所有的列表项以找到最长的项

'For i = 1 To lstThis.ListItems.Count - 1

'DrawText lHDC, lstThis.ListItems(i), -1, tR, DT_CALCRECT

'lW = tR.Right - tR.Left + 8

'If (lW lWidth) Then lWidth = lW

'Next i

''返回最长列表项的长度(像素)

'ListTextWidth = lWidth

'End Function

Sub startSS(ByVal SSname As String)

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

"{impersonationLevel=impersonate}!\\" strComputer "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery _

("Select * from Win32_Service where Name='" SSname "'")

For Each objService In colServiceList

errReturn = objService.StartService()

Next

Sleep 2000

Set colServiceList = objWMIService.ExecQuery("Associators of " _

"{Win32_Service.Name='" SSname "'} Where " _

"AssocClass=Win32_DependentService " "Role=Dependent")

For Each objService In colServiceList

x = objService.StartService()

Next

End Sub

Sub ss2()

ListView1.ListItems.Clear

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

"{impersonationLevel=impersonate}!\\" strComputer "\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery _

("Select * from Win32_Service")

'objLogFile.Write (objService.SystemName) ","

'objLogFile.Write (objService.Name) ","

'objLogFile.Write (objService.ServiceType) ","

'objLogFile.Write (objService.state) ","

'objLogFile.Write (objService.ExitCode) ","

'objLogFile.Write (objService.ProcessID) ","

'objLogFile.Write (objService.AcceptPause) ","

'objLogFile.Write (objService.AcceptStop) ","

'objLogFile.Write (objService.Caption) ","

'objLogFile.Write (objService.Description) ","

'objLogFile.Write (objService.DesktopInteract) ","

'objLogFile.Write (objService.DisplayName) ","

'objLogFile.Write (objService.ErrorControl) ","

'objLogFile.Write (objService.PathName) ","

'objLogFile.Write (objService.Started) ","

'objLogFile.Write (objService.StartMode) ","

'objLogFile.Write (objService.StartName) ","

'objLogFile.writeline

Open "c:\系统服务.log" For Append As #1

Print #1, Now()

For Each objService In colListOfServices

Debug.Print objService.Name '打印服务名称

Print #1, objService.Name

Print #1, objService.state

Print #1, objService.Description

Print #1, objService.PathName

Print #1, "********************************************************************************"

With ListView1.ListItems.Add

.SubItems(1) = objService.Name

.SubItems(2) = objService.state

On Error Resume Next

SRVDsc(ListView1.ListItems.Count) = objService.Description

'.SubItems(3) = objService.Description

End With

Next

Close #1

End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)

ListView1.ToolTipText = SRVDsc(ListView1.SelectedItem.Index)

End Sub

谁能提供一些VB。NET关于蓝牙编程的实例啊

去网上找蓝芽的SDK.....

新手的话,最好先学好基础的..一开始就搞那个不好..


当前文章:vb.net蓝牙编程 vbnet web编程
浏览路径:http://njwzjz.com/article/hpgijp.html