av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

VB.NET獲取網(wǎng)卡地址代碼實現(xiàn)過程

VB.NET開發(fā)語言是一款面向?qū)ο蟮墓δ軓姶蟮木幊陶Z言。它的應(yīng)用可以幫助開發(fā)人員實現(xiàn)許多功能需求。比如VB.NET獲取網(wǎng)卡地址等。下面就會針對這一方法進(jìn)行一個詳細(xì)的解讀,希望對大家有所幫助。#t#

十年的昌樂網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。網(wǎng)絡(luò)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整昌樂建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)建站從事“昌樂網(wǎng)站設(shè)計”,“昌樂網(wǎng)站推廣”以來,每個客戶項目都認(rèn)真落實執(zhí)行。

程序語言: Microsoft Visual Basic 4.0,5.0,6.0

運行平臺: WINDOWS

功能描述: IPX和NETBIOS接口需要網(wǎng)絡(luò)地址。該文通過詳細(xì)的步驟演示了如何通過VB.NET獲取網(wǎng)卡地址。

VB.NET獲取網(wǎng)卡地址步驟:

1)在Visual Basic生成標(biāo)準(zhǔn)的EXE文件。缺省創(chuàng)建 Form1。

2)在Form1中添加一命令按鈕,缺省名為Command1。

3)把下列代碼放到Form1中說明部分。

 
 
 
  1. Option Explicit   
  2. Private Const NCBASTAT = &H33   
  3. Private Const NCBNAMSZ = 16   
  4. Private Const HEAP_ZERO_MEMORY = &H8   
  5. Private Const HEAP_GENERATE_EXCEPTIONS = &H4   
  6. Private Const NCBRESET = &H32   
  7. Private Type NCB   
  8. ncb_command As Byte 'Integer   
  9. ncb_retcode As Byte 'Integer   
  10. ncb_lsn As Byte 'Integer   
  11. ncb_num As Byte ' Integer   
  12. ncb_buffer As Long 'String   
  13. ncb_length As Integer   
  14. ncb_callname As String * NCBNAMSZ   
  15. ncb_name As String * NCBNAMSZ   
  16. ncb_rto As Byte 'Integer   
  17. ncb_sto As Byte ' Integer   
  18. ncb_post As Long   
  19. ncb_lana_num As Byte 'Integer   
  20. ncb_cmd_cplt As Byte 'Integer   
  21. ncb_reserve(9) As Byte ' Reserved, must be 0   
  22. ncb_event As Long   
  23. End Type   
  24. Private Type ADAPTER_STATUS   
  25. adapter_address(5) As Byte 'As String * 6   
  26. rev_major As Byte 'Integer   
  27. reserved0 As Byte 'Integer   
  28. adapter_type As Byte 'Integer   
  29. rev_minor As Byte 'Integer   
  30. duration As Integer   
  31. frmr_recv As Integer   
  32. frmr_xmit As Integer   
  33. iframe_recv_err As Integer   
  34. xmit_aborts As Integer   
  35. xmit_success As Long   
  36. recv_success As Long   
  37. iframe_xmit_err As Integer   
  38. recv_buff_unavail As Integer   
  39. t1_timeouts As Integer   
  40. ti_timeouts As Integer   
  41. Reserved1 As Long   
  42. free_ncbs As Integer   
  43. max_cfg_ncbs As Integer   
  44. max_ncbs As Integer   
  45. xmit_buf_unavail As Integer   
  46. max_dgram_size As Integer   
  47. pending_sess As Integer   
  48. max_cfg_sess As Integer   
  49. max_sess As Integer   
  50. max_sess_pkt_size As Integer   
  51. name_count As Integer   
  52. End Type   
  53. Private Type NAME_BUFFER   
  54. name As String * NCBNAMSZ   
  55. name_num As Integer   
  56. name_flags As Integer   
  57. End Type   
  58. Private Type ASTAT   
  59. adapt As ADAPTER_STATUS   
  60. NameBuff(30) As NAME_BUFFER   
  61. End Type   
  62. Private Declare Function Netbios 
    Lib "netapi32.dll" (pncb As NCB) As Byte   
  63. Private Declare Sub CopyMemory Lib 
    "kernel32" Alias "RtlMoveMemory" _   
  64. (hpvDest As Any, ByVal hpvSource 
    As Long, ByVal cbCopy As Long)   
  65. Private Declare Function GetProcessHeap 
    Lib "kernel32"() As Long   
  66. Private Declare Function HeapAlloc
     Lib "kernel32" _   
  67. (ByVal hHeap As Long, ByVal 
    dwFlags As Long, _   
  68. ByVal dwBytes As Long) As Long   
  69. Private Declare Function HeapFree Lib 
    "kernel32" (ByVal hHeap As Long, _   
  70. ByVal dwFlags As Long, lpMem As Any) As Long  

把下面的VB.NET獲取網(wǎng)卡地址的代碼放入Command1_Click的事件中:

 
 
 
  1. Private Sub Command1_Click()   
  2. Dim myNcb As NCB   
  3. Dim bRet As Byte   
  4. myNcb.ncb_command = NCBRESET   
  5. bRet = Netbios(myNcb)   
  6. myNcb.ncb_command = NCBASTAT   
  7. myNcb.ncb_lana_num = 0   
  8. myNcb.ncb_callname = "* "   
  9. Dim myASTAT As ASTAT, tempASTAT As ASTAT   
  10. Dim pASTAT As Long   
  11. myNcb.ncb_length = Len(myASTAT)   
  12. Debug.Print Err.LastDllError   
  13. pASTAT = HeapAlloc(GetProcessHeap(), 
    HEAP_GENERATE_EXCEPTIONS _   
  14. Or HEAP_ZERO_MEMORY, myNcb.ncb_length)   
  15. If pASTAT = 0 Then   
  16. Debug.Print "memory allcoation failed!"   
  17. Exit Sub   
  18. End If   
  19. myNcb.ncb_buffer = pASTAT   
  20. bRet = Netbios(myNcb)   
  21. Debug.Print Err.LastDllError   
  22. CopyMemory myASTAT, myNcb.
    ncb_buffer, Len(myASTAT)   
  23. MsgBox Hex(myASTAT.adapt
    .adapter_address(0)) & " " & _   
  24. Hex(myASTAT.adapt.adapter_
    address(1)) _   
  25. & " " & Hex(myASTAT.adapt
    .adapter_address(2)) & " " _   
  26. & Hex(myASTAT.adapt.adapter_address(3)) _   
  27. & " " & Hex(myASTAT.adapt.
    adapter_address(4)) & " " _   
  28. & Hex(myASTAT.adapt.adapter_address(5))   
  29. HeapFree GetProcessHeap(), 
    0, pASTAT   
  30. End Sub  

4)按F5,運行該程序。

5)點擊Command1。注意,網(wǎng)卡地址將在一信息框中顯示出來。至此,VB.NET獲取網(wǎng)卡地址的操作就結(jié)束了。


網(wǎng)站標(biāo)題:VB.NET獲取網(wǎng)卡地址代碼實現(xiàn)過程
分享路徑:http://uogjgqi.cn/article/codicpp.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流