资源描述:
《纯PBAPI取局域网计算机名、IP、MAC、工作组等信息》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、´¿PB+APIÈ¡¾ÖÓòÍø¼ÆËã»úÃû¡¢IP¡¢MAC¡¢¹¤×÷×éµÈÐÅÏ¢.txtÎÒÃÇÓÃÒ»Ö»ÑÛ¾¦¿´¼ûÏÖʵµÄ»Òǽ£¬È´ÓÃÁíÒ»Ö»ÑÛ¾¦Ó¸ҷÉÏ裬½Ó½üÃÎÏë¡£ÄÐÈËϲ»¶Ìý»°µÄÅ®ÈË£¬µ«ÄÐÈËÈôÊÇϲ»¶Ò»¸öÅ®ÈË£¬¾Í»á²»Öª²»¾õÌýËýµÄ»°¡£ÍøÉÏһЩȡ¾ÖÓòÍøËùÓмÆËã»úÐÅÏ¢µÄ±à³Ì»ù±¾¶¼Óõ½Ò»Ð©DLL£¬ÓеÄÀý³ÌÖ»ÄÜÈ¡2000/XPµÄ¼
2、ÆËã»úÃû¡£ÕâÀïÎÒÌṩһÖÖ·½·¨£¬´¿´âʹÓÃPB+APIÀ´ÊµÏÖÈ¡¾ÖÓòÍøÒ»¸öÍø¶ÎµÄËùÓмÆËã»úµÄÐÅÏ¢£¨Ê¹ÓÃÁËÍøÉÏÏÂÔصġ¶PBÀ©³äº¯Êý1.5¡·£©¡£¶øÇÒ£¬°´ÕÕ´Ë·½·¨£¬ÎÒÃÇ¿ÉÒÔÈ¡µÃÈκÎDOSÃüÁîÄÜÈ¡µÃµÄÐÅÏ¢¡£Ê¹ÓõÄAPI£ºFunctionbooleanIsWindow(Longhwnd)Library"user32.dll"FUNCTIONulongWinExec
3、(refstringlpCmdLine,ulongnCmdShow)LIBRARY"kernel32.dll"ʹÓõ½µÄ¡¶PBÀ©³äº¯Êý1.5¡·Öеĺ¯Êýuf_Network_Ping¡¢uf_file_isavailable¡£ËäȻʹÓá¶PBÀ©³äº¯Êý1.5¡·Ê±ÐèÒªÒ»¸ömhand.dll£¬µ«ÊÇÎÒÃÇÓõ½µÄ2¸öº¯Êý²¢Ã»ÓÐʹÓõ½mhand.dll£¬ËùÒÔÒ²ËãÊÇûÓнèÖúµÚÈý·½DLL¡£¼ìË÷IPµÈÐÅϢʹÓ
4、Ã2¸ö×Ô½¨µÄº¯Êý£ºf_searchip():stringls_ip,ls_temp//ls_tempΪÐèÒª¼ìË÷µÄip¶Î£¬¸ñʽΪxxx.xxx.xxx.È磺192¡£168¡£0¡£ls_temp=192.168.0.fori=1to255ls_ip=ls_temp+string(i)f_searchip1(ls_ip)nextf_searchip1(stringls_ip)://µÃµ½Ò»¸öÒ»¸öipµØÖ·¼ÆËã»úÐÅÏ¢²¢ÇÒ²åÈëÊý¾Ý´°¿Úu_kch
5、slu_kchsstringls_templongll_row,pintegerli_filenumulongll_handlestringls_pcname,ls_mac,ls_groupsle_ts.text='ÕýÔÚ¼ìË÷'+as_ip//Èç¹ûÄÜpingͨΪÓÐЧipifnot(lu_kchs.uf_Network_Ping(as_ip))thenreturn//ʹÓÃNBTSTATÃüÁîÈ¡µÃÏà¹ØÐÅÏ¢ls_temp="nbtstat-a"+as_ip+">temp"+as_i
6、pli_FileNum=FileOpen("run.bat",StreamMode!,Write!,LockWrite!,Replace!)FileWrite(li_FileNum,ls_temp)FileClose(li_filenum)ls_temp='run.bat'll_handle=WinExec(ls_temp,0)//µÈ´ýDOS´°¿Ú¹Ø±ÕDoWhileisWindow(ll_handle)Yield()Loop//µÈ´ýÁÙʱÎļþ´´½¨³É¹¦dowhilenot(lu_kchs.
7、uf_file_isavailable("temp"+as_ip))Yield()Loop//È¡¼ÆËã»úmac,¹¤×÷×éµÈÐÅÏ¢li_FileNum=FileOpen("temp"+as_ip,StreamMode!,Read!)ifli_FileNum>0thenFileRead(li_FileNum,ls_temp)FileClose(li_filenum)FileDelete("temp"+as_ip)p=pos(ls_temp,'MACAddress=')ls_mac=mid(ls_te
8、mp,p+14,17)p=pos(ls_temp,'UNIQUERegistered')ls_pcname=trim(mid(ls_temp,p-21,14))p=pos(ls_temp,'GROUPRegistered')ls_group=trim(mid(ls_temp,p-21,14))ifls_mac='NetBT_Tcpip_{942'thenl