VB辅导:取得网卡序列号

2026-05-07
很多软件以取得网卡地址作为license验证,这不失为一个验证合法用户的好办法,不过要付出回复用户电话、传真的代价哦 

  将下面这段代码拷贝到程序中,然后在你的程序需要的时候调用ethernetaddress(0),该函数返回的字符串就是您机器上网卡的以太序列号。
  private const ncbastat = &h33

  private const ncbnamsz = 16

  private const heap_zero_memory = &h8

  private const heap_generate_exceptions = &h4

  private const ncbreset = &h32

  private type ncb

   ncb_command as byte

   ncb_retcode as byte

   ncb_lsn as byte

   ncb_num as byte

   ncb_buffer as long

   ncb_length as integer

   ncb_callname as string * ncbnamsz

   ncb_name as string * ncbnamsz

   ncb_rto as byte

   ncb_sto as byte

   ncb_post as long

   ncb_lana_num as byte

   ncb_cmd_cplt as byte

   ncb_reserve(9) as byte ’’ reserved, must be 0

   ncb_event as long

  end type