可以得网卡的create table #tb(id int identity(1,1),hostname nchar(128),loginname nchar(128),net_address nchar(12),net_ip nvarchar(15))
insert into #tb(hostname,net_address,loginname)
select distinct hostname,net_address,loginame from master..sysprocesses where hostname<>''declare @id int,@sql varchar(500)
select @id=max(id) from #tbcreate table #ip(id int,a varchar(8000))
while @id>0
begin
select @sql='ping '+hostname from #tb where id=@id
insert #ip(a) exec master..xp_cmdshell @sql
update #ip set id=@id where id is null
set @id=@id-1
endupdate #tb set net_ip=left(a,patindex('%:%',a)-1)
from #tb a inner join (
select id,a=substring(a,patindex('Ping statistics for %:%',a)+20,20) from #ip
where a like 'Ping statistics for %:%') b on a.id=b.idselect * from #tbdrop table #tb,#ip

解决方案 »

  1.   

    转无枪狙击手的declare @ip varchar(15),@sql varchar(1000)--得到ip地址
    create table #ip(a varchar(200))
    set @sql='ping '+host_name()+' -a -n 1 -l 1'
    insert into #ip exec master..xp_cmdshell @sqlselect @ip=left(a,patindex('%:%',a)-1) from(
    select a=substring(a,patindex('Ping statistics for %:%',a)+20,20)
    from #ip where a like 'Ping statistics for %:%') a--显示结果
    select 用户计算机名=host_name(),ip地址=@ipdrop table #ip/*用户计算机名                                                                                                                           ip地址            
    -------------------------------------------------------------------------------------------------------------------------------- --------------- 
    FLYSTONE                                                                                                                         192.168.0.76
    */
      

  2.   

    硬盘的ID,你可以自己编写个DLL,然后在SQL中注册成外部扩展过程,然后执行
      

  3.   

    CREATE   PROCEDURE   dbo.SP_SPIDtoIP   @SPID   int 
    AS   
    --   SPID   to   MAC   
    --   lj   
    DECLARE   @MAC   as   varchar(12)   
    SELECT   @MAC   =   NET_ADDRESS   FROM   master..sysprocesses   WHERE   SPID   =   @SPID   
    --   MAC   to   IP   
    DECLARE   @MACDisplay   as   varchar(18)   
    DECLARE   @IP   as   varchar(15)   
    CREATE   TABLE   #temp   (OUTPUT   varchar(255)   null)   
    SET   NOCOUNT   ON   
    INSERT   INTO   #temp   EXEC   master..xp_cmdshell   'arp   -a'   
    if   @@error <> 0   
    begin   
    RAISERROR   ('The   level   for   job_id:%d   should   be   between   %d   and   %d.',   16,   1)   
    --ROLLBACK   TRANSACTION   
    end   
    SELECT   @MACDisplay   =   LEFT(@MAC,   2)   +   '-'   +   SUBSTRING(@MAC,   3,   2)   +   '-'   +   SUBSTRING(@MAC,   5,   2)   +   '-'   +   SUBSTRING(@MAC,   7,   2)   +   '-'   +   SUBSTRING(@MAC,   9,   2)   +   '-'   +   SUBSTRING(@MAC,   11,   2)   SELECT   @IP   =   SUBSTRING(output,   3,   15)   FROM   #temp   WHERE   output   LIKE   '%'   +   @MACDisplay   +   '%'   
    --   Resolve   the   IP   
    --DECLARE   @CMD   as   varchar(100)   
    --select   @CMD   =   'master..xp_cmdshell   "ping   -a   '   +   @IP   +   '"'   
    --exec   (@CMD)   
    select @macdisplay
    DROP   TABLE   #temp   
    SET   NOCOUNT   OFF
    GOexec SP_SPIDtoIP 53
    drop proc SP_SPIDtoIP
      

  4.   

    这个估计光用sql语句难了点.可考虑在前台用开发语言来获取.
      

  5.   

    select distinct hostname,net_address,loginame from master..sysprocesses
      

  6.   

    网卡可用MAC,其它 的考虑外部扩展存储过程
      

  7.   

    --这是我PB的一些代码
    获得系统基本信息
    (独孤求败二零零四年二月十二日整理于深圳市南山区)
    当一个应用程序在工作时,会不可避免地和操作系统发生数据交换,虽然在PB中提供了Environment对象来获得系统的一些信息,然而这些信息往往是不够的,比如CPU、本机IP地址等,这些内容只有用Windows API来获得了。
    1、建立一个工作空间(workspace),取名为:systeminfo。2、建立一个应用(application),取名为:systeminfo。3、创建用户对象u_sysinfo,并添加Microsoft Winsock OCX控件。4、定义u_sysinfo的实例变量。
    public:
    string cpuid,cpuprovider
    string filesystem,volumename
    ulong VolumeSerialNumber,MaxComponentLength,FileSystemFlags
    long dlength,dmemoryload,dtotalphys,davailphys,dtotalpagefile
    long davailpagefile,dtotalvirtual,davailvirtual
    ulong dwoemid,dwpagesize,lpminappaddress,lpmaxappaddress,dwactiveprocessormask
    ulong dwnumberofprocessors,dwprocessortype,dwallocationgranularity,dwreserved
    ulong sectorspercluster,bytespersector,numberoffreeclusters,totalnumberofclusters
    ulong mbtotal,mbfree5、定义u_sysinfo的局部外部函数
    PUBLIC FUNCTION ulong GetComputerName(ref string lpBuffer,ref ulong nSize) LIBRARY "kernel32.dll" 
    ALIAS FOR "GetComputerNameA"
    PUBLIC FUNCTION ulong GetDriveType(string nDrive) LIBRARY "kernel32.dll" ALIAS FOR "GetDriveTypeA"
    FUNCTION ulong GetDiskFreeSpace(ref string lpRootPathName,ref ulong  lpSectorsPerCluster,ref ulong 
    lpBytesPerSector,ref ulong  lpNumberOfFreeClusters,ref ulong lpTtoalNumberOfClusters) 
    LIBRARY "kernel32.dll" ALIAS FOR "GetDiskFreeSpaceA"
    PUBLIC FUNCTION ulong GetTickCount() LIBRARY "kernel32.dll"
    PUBLIC Subroutine GetSystemInfo(ref ws_info lpSystemInfo) LIBRARY "kernel32.dll"
    PUBLIC FUNCTION ulong waveOutGetNumDevs() LIBRARY "winmm.dll"
    PUBLIC FUNCTION ulong WNetGetUser(ref string lpName,ref string lpUserName,ref ulong lpnLength) 
    LIBRARY "mpr" ALIAS FOR "WNetGetUserA"
    PUBLIC FUNCTION ulong GetSystemMetrics(ulong nIndex) LIBRARY "user32.dll"
    PUBLIC FUNCTION ulong GetWindowsDirectory(ref string lpBuffer,ulong nSize) LIBRARY "kernel32.dll" 
    ALIAS FOR "GetWindowsDirectoryA"
    PUBLIC FUNCTION ulong GetSystemDirectory(ref string lpBuffer,ulong nSize) LIBRARY "kernel32.dll" 
    ALIAS FOR "GetSystemDirectoryA" 
    PUBLIC FUNCTION ulong GetTempPath(ulong nBufferLength,ref string lpBuffer) LIBRARY "kernel32.dll" 
    ALIAS FOR "GetTempPathA"
    PUBLIC FUNCTION ulong GetKeyboardType(ulong nTypeFlag) LIBRARY "user32.dll"
    PUBLIC FUNCTION ulong QueryPerformanceFrequency(ref double lpFrequency) LIBRARY "kernel32.dll"
    PUBLIC FUNCTION ulong QueryPerformanceCounter(ref ulong lpPerformanceCount) LIBRARY "kernel32.dll"
    //PUBLIC FUNCTION ulong EnumPrinterDrivers(ref string pName,ref string pEnvironment,ulong Level,ref 
    Byte pDriverInfo,ulong cdBuf,ref ulong pcbNeeded,ref ulong pcRetruned) LIBRARY 
    "winspool.drv" ALIAS FOR "EnumPrinterDriversA"
    PUBLIC Subroutine GlobalMemoryStatus(ref ws_memory lpBuffer) LIBRARY "kernel32.dll"
    //FUNCTIONon ulong GlobalReAlloc(ulong hMem,ulong dwBytes,ulong wFlags) LIBRARY "kernel32.dll"
    PUBLIC FUNCTION ulong RegOpenKey(ulong hKey,ref string lpSubKey,ref ulong phkResult) LIBRARY 
    "advapi32.dll" ALIAS FOR "RegOpenKeyA"
    PUBLIC FUNCTION ulong RegCloseKey(ulong hKey) LIBRARY "advapi32.dll"
    PUBLIC FUNCTION ulong RegQueryValueEx(ulong hKey,ref string lpValueName,ulong lpReserved,ref ulong 
    lpType,ref long lpData,ref ulong lpcbData) LIBRARY "advapi32.dll" ALIAS FOR 
    "RegQueryValueExA"
    //Function ulong EnumDisplaySettingsA(ulong xx,ulong modenum,ref DEVMODE 
    lpdevmode)Library"kernel32.dll"
    //PUBLIC FUNCTION ulong DeviceCapabilities(ref string lpDeviceName,ref string lpPort,ulong 
    iIndex,ref string lpOutput,ref DEVMODE lpDevMode) LIBRARY "winspool.drv" ALIAS FOR 
    "DeviceCapabilitiesA"
    PUBLIC FUNCTION ulong GetVolumeInformation(string lpRootPathName,ref string lpVolumeNameBuffer,
    ulong nVolumeNameSize,ref ulong lpVolumeSerialNumber,ref ulong lpMaximumComponentLength,
    ref ulong lpFileSystemFlags,ref string lpFileSystemNameBuffer,ulong nFileSystemNameSize) 
    LIBRARY "kernel32.dll" ALIAS FOR "GetVolumeInformationA"
    FUNCTION long GetMACAddress(long lana,ref long addr[6]) Library "utils.dll"
    FUNCTION long GetLanaID(ref long lana[254]) LIBRARY "utils.dll"
    Function ulong GetMHZ()Library"mydll.dll"6、用户对象级函数
    1)、of_GetComputerName(),获得计算机的标识(即计算机名)。
     
    ulong ll_comsize
    ulong ll_flag
    ll_comsize = 256
    string ls_computerName
    //获得计算机的名称
    ll_flag = GetComputerName(ls_computerName,ll_comsize)
    If ll_flag<> 1 then 
    return "Get Computer Failure"
    else
    return ls_computerName
    End if2)、of_GetCpuInfo(),获得CPU一些基本信息。
     
    ws_cpuinfo lstr_cpu
    string ls_temp
    RegistryGet("HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0","Identifier",RegString!,ls_temp)
    lstr_cpu.cpuid = ls_temp
    cpuid = ls_temp
    RegistryGet("HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0","VendorIdentifier",RegString!,ls_temp)
    lstr_cpu.cpuprovider = ls_temp
    cpuprovider = ls_temp3)、of_GetCpuStatus(),获得CPU当前的使用频率,是从0%到100%之间的一个常数。
     
    ulong ls_username,lpcbData,lpType
    lpcbData = 4
    lpType = 4
    ulong phkResult
    ls_username = 0
    string lbSubkey
    long lpData
    lbSubkey = "PerfStats\StatData"
    ls_username =  RegOpenKey(16*16*16*16*16*16*16*8+6,lbSubKey,phkResult)//The first parameters is HKEY_DYN_DATA = &80000006(HANDLE)
    string lpValueName
    lpValueName = "KERNEL\CPUUsage"
    ls_username = RegQueryValueEx(phkResult,lpValueName,0,lpType,lpData,lpcbData)
    ls_username = RegCloseKey(phkResult)
    return lpdata4)、of_GetDiskVolume(),获得磁盘空间大小。
     
    ulong ll_MBFree 
    ulong ll_MBTotal 
    ulong ll_sectorspercluster     //  Sectors/Cluster
    ulong ll_bytespersector      //  Bytes/Sector
    ulong ll_numberoffreeclusters    //  Number of Free Clusters
    ulong ll_toalnumberofclusters    //  Total Number of Clusters
    GetDiskFreeSpace(as_driver, ll_sectorspercluster, ll_bytespersector,ll_numberoffreeclusters, 
    ll_toalnumberofclusters)
    sectorspercluster=ll_sectorspercluster
    bytespersector=ll_bytespersector
    numberoffreeclusters=ll_numberoffreeclusters
    totalnumberofclusters=ll_toalnumberofclusters
    mbfree = (ll_sectorspercluster * ll_bytespersector * (ll_numberoffreeclusters / 1024)) / 1024
    mbtotal = (ll_sectorspercluster * ll_bytespersector * (ll_toalnumberofclusters / 1024)) / 10245)、of_GetDriverType(),获得各个磁盘的种类。
     
    ulong ul_drivetype
    string ls_drive
    ul_drivetype = GetDriveType(a_drivename) 
    choose case ul_drivetype
    case 0
    ls_Drive = "Unknown Driver"
    Case 1
    ls_Drive = "Drive Does Not exist"
    Case 2
    ls_Drive = "Floppy driver"
    Case 3
    ls_Drive = "HardDisk driver"
    Case 4
    ls_Drive = "Network driver"
    Case 5
    ls_Drive = "CD-ROM driver"
    Case 6
    ls_Drive = "RAM driver"
    End choose
    Return ls_drive
    6)、of_GetIPAddress(),获得本机IP地址。
     
    return ole_1.object.localip7)、of_GetKeyBoardType(),获得用户键盘种类。
     
    return  GetKeyboardType(0)
    8)、of_GetLongInID(),获得登陆的用户名称。
     
    string ls_username,ls_cmpname
    ulong ll_length,lul_runtime
    ls_cmpname = ""
    ls_username = space(64)
    ll_length = 64
    lul_runtime=WNetGetUser(ls_cmpName,ls_UserName,ll_Length)
    If lul_runtime=0 then 
    return ls_UserName
    else
    return "Error"
    End if9)、of_GetMacAddress(),获得网卡的物理地址。
     
    long lana[254],ll_lananum,mac[6]
    long i,j
    If Not FileExists("utils.dll") Then 
    MessageBox("错误","无法找到 utils.dll 文件")
    Return ""
    End If
    j=1
    String ls_macaddress[254]
    ll_lananum = GetLanaID(lana)
    for i=1 to ll_lananum
       if GetMacAddress(lana[i],mac) = 0 then
          ls_macaddress[j] = string(mac[1])+"," +string(mac[2])+"," +  string(mac[3])+"," + 
    string(mac[4])+"," + string(mac[5])+"," + string(mac[6])    
       j++
       end if
    next
    string ls_return
    For i = 1 to j
    If ls_macaddress[i]="" Then exit
    ls_return = ls_return+ls_macaddress[i]+"|"
    next
    return ls_return
      

  8.   

    10)、of_GetMemory(),获得内存的使用情况。
     
    ws_memory str_memory
    GlobalMemoryStatus(str_memory)
    dlength = str_memory.dlength
    dmemoryload = str_memory.dmemoryload
    dtotalphys = str_memory.dtotalphys
    davailphys = str_memory.davailphys
    dtotalpagefile = str_memory.dtotalpagefile
    davailpagefile = str_memory.davailpagefile
    dtotalvirtual = str_memory.dtotalvirtual
    davailvirtual = str_memory.davailvirtual
    return11)、of_GetMHZ()。
     
    IF not Fileexists("Mydll.dll") Then 
    MessageBox("错误","无法找到 MyDll.dll !!!")
    return 0
    End If
    ulong ul_mhz
    ul_mhz = GetMhz()
    return ul_mhz12)、of_GetNetCard(),获得网卡的名称。
     
    environment l_env
    getenvironment(l_env)
    Integer li_rtn
    string ls_username
    Choose case l_env.ostype
    case Windows!
    li_rtn = 
    RegistryGet("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\0000","DriverDesc",
    RegString!,ls_username)
    If li_rtn <> 1 Then 
    li_rtn = 
    RegistryGet("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\Net\0001","DriverDesc",
    RegString!,ls_username)
    if li_rtn<> 1 Then 
    ls_username = "Ether Netword Card can not be detected"
    End if
    End if
    case WindowsNT!
    RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\
    CurrentVersion\NetworkCards\1","Title",RegString!,ls_username)
    End choose
    return ls_username13)、of_GetOSVersion(),获得操作系统版本。
     
    Environment l_env
    string ls_osver
    GetEnvironment(l_env)
    Choose case l_env.ostype
    CASE Macintosh!
    ls_osver = 
    "Macintosh "+string(l_env.OSMajorRevision)+"."+string(l_env.OSMinorRevision)
    CASE aix!
    ls_osver = "Aix "+string(l_env.OSMajorRevision)+"."+string(l_env.OSMinorRevision)
    CASE Windows!
    If l_env.OSMajorRevision>=4 and l_env.OSMinorRevision>0 then 
    ls_osver = "Windows 98"
    else
    ls_osver = "Windows 95"
    End if
    CASE WindowsNT!
    RegistryGet("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ProductOptions",
    "ProductType",RegString!,ls_osver)
    If ls_osver = "WinNT" then
    ls_osver = "Windows NT WorkStation"
    elseif ls_osver = "ServerNT" then
    ls_osver = "Windows NT Server"
    else
    ls_osver = "Windows NT Domain Controler"
    End if
    CASE ELSE
    ls_osver = "Unknown OS"
    End Choose
    Return ls_osver14)、of_GetServicePack(),获得Windows NT的ServicePack版本。
     
    string ls_username
    long ll_rtn
    ll_rtn = RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion",
    "CSDVersion",RegString!,ls_username)
    If ll_rtn = -1 then
    ls_username="ERROR"
    end if
    return ls_username15)、of_GetSystemDir(),获得系统目录。
     
    ulong ll_length
    string ls_username
    ll_length=64
    ls_username = space(64)
    GetSystemDirectory(ls_username,ll_length)
    return trim(ls_username)16)、of_GetSystemInfo(),获得系统信息。
     
    ws_info lstr_1
    GetSystemInfo(lstr_1)
    dwoemid = lstr_1.dwoemid
    dwpagesize = lstr_1.dwpagesize
    lpminappaddress = lstr_1.lpminappaddress
    lpmaxappaddress = lstr_1.lpmaxappaddress
    dwactiveprocessormask = lstr_1.dwactiveprocessormask
    dwnumberofprocessors = lstr_1.dwnumberofprocessors
    dwprocessortype = lstr_1.dwprocessortype
    dwallocationgranularity = lstr_1.dwallocationgranularity
    dwreserved = lstr_1.dwreserved
    return lstr_1
    17)、of_GetTempPath(),获得临时文件存放路径。
     
    ulong ll_length
    string ls_username
    ll_length=64
    ls_username = space(64)
    GetTempPath(ll_length,ls_username)
    return trim(ls_username)18)、of_GetTickCount(),获得系统开机时间的长短。
     
    ulong lul_runtime
    integer li_Hour,li_Minute,li_Second
    lul_runtime=GetTickCount()
    li_Hour = (lul_runtime/1000)/3600
    li_minute = (lul_runtime/1000 - 3600*li_hour)/60
    li_second = lul_runtime/1000 - 3600*li_hour - li_minute*60 
    string ls_rtn
    ls_rtn = string(li_hour)+" H "+string(li_minute)+" M "+string(li_second)+" S"
    return ls_rtn
    19)、of_GetVolumeInfo(),获得各个磁盘的卷标和文件系统。
     
    string lpVolumeNameBuffer
    string lpFileSystemNameBuffer
    ulong nVolumeNameSize
    ulong lpVolumeSerialNumber
    ulong lpMaximumComponentLength
    ulong lpFileSystemFlags
    ulong nFileSystemNameSize
    lpVolumeNameBuffer = space(64)
    lpFileSystemNameBuffer = space(64)
    nVolumeNameSize=len(lpVolumeNameBuffer)
    nFileSystemNameSize=len(lpFileSystemNameBuffer)
    GetVolumeInformation(as_drive,lpVolumeNameBuffer,nVolumeNameSize,&
    lpVolumeSerialNumber,lpMaximumComponentLength,lpFileSystemFlags,lpFileSystemNameBuffer,
    nFileSystemNameSize)
    FileSystem= lpFileSystemNameBuffer
    VolumeName = lpVolumeNameBuffer
    VolumeSerialNumber=lpVolumeSerialNumber
    MaxComponentLength = lpMaximumComponentLength
    FileSystemFlags=lpFileSystemFlags20)、of_GetWaveDevice(),获得系统的多媒体播放设备的个数。
     
    integer ll_length
    ll_length =waveOutGetNumDevs()
    If ll_length>0 then 
    return ll_length
    else
    return 0
    End if
    21)、of_GetWindowDir(),获得操作系统的安装路径。
     
    ulong ll_length
    string ls_username
    ll_length=64
    ls_username = space(64)
    GetWindowsDirectory(ls_username,ll_length)
    return trim(ls_username)22)、of_GetWindowMode()。
     
    ulong ll_length
    ll_length = GetSystemMetrics(67) 
    Choose case ll_length 
    case 1
    return "Safe Mode"
    case 2
    return "Safe Mode With NetSupport"
    case else
    return "Normal Mode"
    End choose7、建立一个窗口,w_systeminfo,各个按钮的clicked事件如下:
    1)、GetComputerName:
    sle_computername.text = uo_1.of_ComputerName()2)、GetCpuInformation:
    uo_1.of_GetCpuInfo()
    ddlb_cpuinfo.additem("Cpu ID: "+uo_1.cpuid) 
    ddlb_cpuinfo.additem("Cpu Provider: "+uo_1.cpuprovider) 
    ddlb_cpuinfo.selectitem(1)3)、GetCpuStatus:
    timer(0.1,parent)4)、GetDriverType:
    String ls_drive
    ls_drive = "abcdefghijklmnopqrstuvwxyz"
    Integer li_i
    For li_i = 1 to 26
    ddlb_drivetype.additem(mid(ls_drive,li_i,1)+":\ "+uo_1.of_getdrivetype(mid(ls_drive,li_i,1)+":\"))
    End For
    ddlb_drivetype.selectitem(1)5)、GetLoginID:
    sle_loginid.text = uo_1.of_GetLoginID()6)、GetMacAddress:
    string ls_macaddress
    string ls_address[254]
    ls_macaddress = uo_1.of_getmacaddress()
    integer li_pos,i,li_start
    i = 1
    li_start = 1
    li_pos = 1
    do 
    li_pos = Pos(ls_macaddress,"|",li_start)
    ls_address[i] = Mid(ls_macaddress,li_start,li_pos - li_start)
    li_start = li_pos + 1
    i++
    loop until i>254 or ls_address[i - 1]=""
    For i = 1 to 254
    if ls_address[i] = "" Then exit
    ddlb_macaddress.additem(ls_address[i])
    End For
    ddlb_macaddress.selectitem(1)
    7)、GetMemory:
    uo_1.of_getmemory()
    ddlb_memory.Additem("dlength = " + string(uo_1.dlength))
    ddlb_memory.Additem("dmemoryload = " + string(uo_1.dmemoryload)+"%")
    ddlb_memory.Additem("dtotalphys = " + string(uo_1.dtotalphys))
    ddlb_memory.Additem("davailphys = " + string(uo_1.davailphys))
    ddlb_memory.Additem("dtotalpagefile = " + string(uo_1.dtotalpagefile))
    ddlb_memory.Additem("davailpagefile = " + string(uo_1.davailpagefile))
    ddlb_memory.Additem("dtotalvirtual = " + string(uo_1.dtotalvirtual))
    ddlb_memory.Additem("davailvirtual = " + string(uo_1.davailvirtual))
    ddlb_memory.selectitem(5)8)、GetMhz:
    sle_mhz.text = String(uo_1.of_GetMhz())9)、GetOSVersion:
    sle_osversion.text = uo_1.of_getosversion()10)、GetServicePack:
    sle_servicePack.text = uo_1.of_GetServicePack()11)、GetSystemDir:
    sle_systemdir.text = uo_1.of_getSystemDir()12)、GetTempDir:
    sle_tempdir.text = uo_1.of_gettemppath()
      

  9.   

    13)、GetSystemInfo:
    uo_1.of_GetsystemInfo()
    ddlb_systeminfo.additem("OemID = "+string(uo_1.dwoemid))
    ddlb_systeminfo.additem("PageSize = "+string(uo_1.dwPagesize))
    ddlb_systeminfo.additem("MinAppAddress = "+string(uo_1.lpminappaddress))
    ddlb_systeminfo.additem("MaxAppAddress = "+string(uo_1.lpmaxappaddress))
    ddlb_systeminfo.additem("ActiveProcessorMask = "+string(uo_1.dwactiveprocessormask))
    ddlb_systeminfo.additem("NumberofProcessors = "+string(uo_1.dwnumberofprocessors))
    ddlb_systeminfo.additem("ProcessorType = "+string(uo_1.dwprocessortype))
    ddlb_systeminfo.additem("AllocationGranularity = "+string(uo_1.dwallocationgranularity))
    ddlb_systeminfo.additem("Reserved = "+string(uo_1.dwreserved))
    ddlb_systeminfo.selectitem(5)14)、GetTickCount:
    sle_tickcount.text = uo_1.of_GetTickCount()15)、GetKeyBoardType:
    choose case uo_1.of_GetKeyboardType() 
    case 1
    sle_keyboard.text = "IBM PC/XT( ) or compatible (83-key) keyboard"
    case 2
    sle_keyboard.text = "Olivetti 'ICO' (102-key) keyboard"
    case 3
    sle_keyboard.text = "IBM PC/AT (84-key) or similar keyboard"
    case 4
    sle_keyboard.text = "IBM enhanced (101- or 102-key) keyboard"
    case 5
    sle_keyboard.text = "Nokia 1050 and similar keyboards"
    case 6
    sle_keyboard.text = "Nokia 9140 and similar keyboards"
    case 7
    sle_keyboard.text = "Japanese keyboard"
    case else
    sle_keyboard.text = "Hardware dependent and specified by the OEM"
    End choose
    16)、GetWindowMode:
    sle_windowmode.text = uo_1.of_getwindowmode()17)、GetWindowDir:
    sle_windowdir.text = uo_1.of_getwindowdir()18)、GetWaveDevice:
    sle_wavedevice.text = string(uo_1.of_getwavedevice())19)、GetIPAddress:
    sle_ipaddress.text = uo_1.of_getipaddress()20)、GetNetCard:
    sle_netcard.text = uo_1.of_getnetcard()21)、GetDiskInfo:
    lv_1.deletecolumns()
    lv_1.deleteitems()
    lv_1.addcolumn("Driver",Left!,250)
    lv_1.addcolumn("FileSystem",Left!,350)
    lv_1.addcolumn("VolumeName",Left!,400)
    lv_1.addcolumn("VolumeSerialNumber",Left!,650)
    lv_1.addcolumn("MaxComponentLength",Left!,650)
    lv_1.addcolumn("FileSystemFlags",Left!,500)
    lv_1.addcolumn("SectorsPerCluster",Left!,600)
    lv_1.addcolumn("BytesPerSector",Left!,500)
    lv_1.addcolumn("NumberofFreeClusters",Left!,700)
    lv_1.addcolumn("TotalNumberofClusters",Left!,750)
    lv_1.addcolumn("FreeDiskVolume",Left!,600)
    lv_1.addcolumn("TotalDiskVolume",Left!,650)
    lv_1.addcolumn("Used Ratio",Left!,350)
    String ls_drive,ls_status
    ls_drive = "abcdefghijklmnopqrstuvwxyz"
    Integer li_i
    For li_i = 1 to 26
    ls_status = uo_1.of_getdrivetype(mid(ls_drive,li_i,1)+":\")
    if ls_status<>"Drive Does Not exist" Then
    uo_1.of_getvolumeInfo(mid(ls_drive,li_i,1)+":\")
    uo_1.of_getdiskvolume(mid(ls_drive,li_i,1)+":\")
    Choose case lower(ls_status)
    case "floppy driver"
    if uo_1.mbtotal = 0 Then 
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+"0%",1)
    else
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+String(Long(((uo_1.mbtotal - uo_1.mbfree)/uo_1.mbtotal)*100))+"%",1)
    End if
    Case "harddisk driver"
    if uo_1.mbtotal = 0 Then 
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+"0%",2)
    else
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+String(Long(((uo_1.mbtotal - uo_1.mbfree)/uo_1.mbtotal)*100))+"%",2)
    End if
    case "cd-rom driver"
    if uo_1.mbtotal = 0 Then 
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+"0%",3)
    else
    lv_1.Additem(mid(ls_drive,li_i,1)+":\"+"~t"+trim(string(uo_1.FileSystem))+"~t"+trim(string(uo_1.VolumeName))+"~t"+string(uo_1.VolumeSerialNumber)+"~t"+string(uo_1.MaxComponentLength)+"~t"+string(uo_1.FileSystemFlags)+"~t"+string(uo_1.SectorsPerCluster)+"~t"+string(uo_1.BytesPerSector)+"~t"+string(uo_1.NumberofFreeClusters)+"~t"+string(uo_1.TotalNumberofClusters)+"~t"+string(uo_1.mbfree)+"MB"+"~t"+string(uo_1.mbtotal)+"MB"+"~t"+String(Long(((uo_1.mbtotal - uo_1.mbfree)/uo_1.mbtotal)*100))+"%",3)
    End if
    End Choose
    End If
    End For
    //FileSystem= lpFileSystemNameBuffer
    //VolumeName = lpVolumeNameBuffer
    //VolumeSerialNumber=lpVolumeSerialNumber
    //MaxComponentLength = lpMaximumComponentLength
    //FileSystemFlags=lpFileSystemFlags
    8、效果图:
     
      

  10.   

    搞死人11)、of_GetMHZ()。 
      
    IF   not   Fileexists("Mydll.dll")   Then   
    MessageBox("错误","无法找到   MyDll.dll   !!!") 
    return   0 
    End   If 
    ulong   ul_mhz 
    ul_mhz   =   GetMhz() 
    return   ul_mhz 还有动态 库
      

  11.   


    --网卡ID
    DECLARE @NetID VARCHAR(32)
    EXEC master..xp_by02 @NetID OUTPUT
    select @NetID
    ------
    --显示芯片信息
    exec xp_msver 'Platform'--可参照联机帮助,有几项选择--处理器类型
    exec xp_msver 'ProcessorType'
      

  12.   

    搞错,
    等一下把使用方法和文件上传到空间里
    那个是PB写的Dll文件。。
    添加为存储过程..
      

  13.   

    没,
    只是传的DLL文件和使用方法,
    好像CSDN没刷新暂时看不到
      

  14.   

    declare @ip varchar(15),@sql varchar(1000)--得到ip地址
    create table #ip(a varchar(200))
    set @sql='ping '+host_name()+' -a -n 1 -l 1'
    insert into #ip exec master..xp_cmdshell @sqlselect @ip=left(a,patindex('%:%',a)-1) from(
    select a=substring(a,patindex('Ping statistics for %:%',a)+20,20)
    from #ip where a like 'Ping statistics for %:%') a--显示结果
    select 用户计算机名=host_name(),ip地址=@ipdrop table #ip/*
      

  15.   

    if object_id('tempdb..#temp') is not null
    drop  table #temp
    create table #temp
    (
    id int identity(1,1)
    ,info nvarchar(max)
    )insert into #temp
    Exec xp_cmdshell 'ipconfig /all'select t.info
    from 
    (select 
    case  when info like '%Host Name%' then 'host name='+stuff(info,1,patindex('%:%',info),'')
      when info like '%IP Address%' then 'IP='+stuff(info,1,patindex('%:%',info),'')
      when info like '%Physical Address%' then 'MAC Address='+stuff(info,1,patindex('%:%',info),'')
      when info like '%Subnet Mask%' then 'Sub Mask='+stuff(info,1,patindex('%:%',info),'')
      when info like '%Default GateWay%' then 'Default GetWay='+stuff(info,1,patindex('%:%',info),'')
      when info like '%DNS Servers%' then 'DNS Servers='+stuff(info,1,patindex('%:%',info),'')
      else ''
    end as info
    from #temp)as t
    where t.info <>''
    drop table #temp