你得先補基礎。
網站的建設成都創新互聯專注網站定制,經驗豐富,不做模板,主營網站定制開發.小程序定制開發,H5頁面制作!給你煥然一新的設計體驗!已為成都門窗定制等企業提供專業服務。
最好去學校,找計算機系的學生,抄下專業專業課程和對應的課本(說不定順便能討些舊課本),賣齊這些課本(一般學校里面就有書店)慢慢學。
(以下課程不全)
至少需要讀一遍的:計算機導論、程序設計基礎、軟件工程、編譯原理
重點學習的:算法與數據結構、面向對象程序設計
還有VB.Net需要一定的基礎,建議先從 C++ 或 VB(版本6.0)入門
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之后的版本完全沒有聯系,幾乎沒有相同之處,兩種不同體系的語言
你可以在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
都可以,可以用winsock,也可以自己重寫SOCKET套接字.建議你如果工期緊,可以先用WINSOCK.當然最好是自己學用SOCKET套接字.這對未來開發網絡通訊是很有幫助的.因為用WINSOCK有個毛病就是殺毒軟件總會阻止
前幾天搞的
在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
去網上找藍芽的SDK.....
新手的話,最好先學好基礎的..一開始就搞那個不好..
名稱欄目:vb.net藍牙編程 vbnet web編程
本文地址:http://vcdvsql.cn/article28/hpgijp.html
成都網站建設公司_創新互聯,為您提供關鍵詞優化、網站收錄、建站公司、外貿建站、微信小程序、云服務器
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯