|
-
Mar 4th, 2010, 11:04 PM
#1
Thread Starter
New Member
64 bit system infomation
hello everyone, this is my first post here, sorry that it has to be asking for help.
I'm looking for help with a plug-in that was written by onthecuttingedge2005 for a program called Ultra Hal, that has been written in vb. The plug-in allows Ultra Hal to tell a user there system information on a windows 32 bit operating system. I have a windows 64 bit home premium System. when I install the plug-in only the hard drive info part works. It would be great to have the rest of the functions in this plug-in work, onthecuttingedge2005 only has a 32 bit operating system, So he cannot build one for a 64 bit operating system. If this plug-in was to work on a 64 bit os, it would help out a lot of other people within our Ultra Hal community as well.
Can anyone here please convert his plug-in so that it will work on a 64 bit windows operating system. He gave the community the plug-in to use here http://www.zabaware.com/forum/topic.asp?TOPIC_ID=7004 if anyone here is willing to help I will post a link to this thread above, So who ever helps with this gets credit for there work. Me and a lot of others would be greatly appreciated. Thanks a million in advance Sincerely Sybershot
here is the plug-in made by onthecuttingedge2005 that needs converting
Code:
'Constants for drive types
Const Unknown = 0
Const Removable = 1
Const Fixed = 2
Const Remote = 3
Const CDROM = 4
Const RAMDisk = 5
Const strComputer = "."
'THIS WILL GET CPU USAGE INFORMATION
If InStr(1, InputString, "processor usage", 1) > 0 Or InStr(1, InputString, "processor time", 1) > 0 Or _
InStr(1, InputString, "cpu time", 1) > 0 Or InStr(1, InputString, "cpu usage", 1) > 0 Then
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfOS_Processor WHERE Name = '_Total'")
For Each objItem In colItems
UltraHal = " Processor usage is " & objItem.PercentProcessorTime & " %"
Next
End If
'THIS WILL GET AVAILABLE PHYSICAL MEMORY INFORMATION
If InStr(1, InputString, "physical memory", 1) > 0 Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "\rootcimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colSettings
UltraHal = " Available Physical Memory: " & _
objOperatingSystem.FreePhysicalMemory & " MB "
Next
End If
'THIS WILL GET TOTAL PHYSICAL MEMORY INFORMATION
If InStr(1, InputString, "physical memory", 1) > 0 Then
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
UltraHal = UltraHal & " Total Physical Memory: " & _
objComputer.TotalPhysicalMemory & " MB "
Next
End If
'THIS WILL GET CPU CURRENT SPEED INFORMATION
If InStr(1, InputString, "processor usage", 1) > 0 Or InStr(1, InputString, "processor time", 1) > 0 Or _
InStr(1, InputString, "cpu time", 1) > 0 Or InStr(1, InputString, "cpu usage", 1) > 0 Or InStr(1, InputString, "clock speed", 1) > 0 Then
Set oWsh = CreateObject("WScript.Shell")
Set oWshSysEnv = oWsh.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnv("COMPUTERNAME")
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\rootCIMV2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItems
UltraHal = UltraHal & " Current Clock Speed: " & objItem.CurrentClockSpeed & " MHz"
Next
End If
'THIS WILL GET THE HARD DISK SPACE INFORMATION
If InStr(1, InputString, "hard disk space", 1) > 0 Or InStr(1, InputString, "harddisk space", 1) > 0 Or _
InStr(1, InputString, "free space", 1) > 0 Or InStr(1, InputString, "storage space", 1) > 0 Then
Set oFs = CreateObject("Scripting.FileSystemObject")
Set oDrives = oFs.Drives
For Each oDrive In oDrives
Select Case oDrive.DriveType
Case Fixed
GetFreeSpaceReport = GetFreeSpaceReport & oDrive.DriveLetter & ": " & Round(oDrive.FreeSpace/(1024*1024)) & "MB free (" & Round(100 * (oDrive.FreeSpace/oDrive.TotalSize),2) & "%)" & vbcrlf
End Select
Next
Str = GetFreeSpaceReport
UltraHal = Str
End If
'THIS WILL ALLOW A USER TO SHUT DOWN THE COMPUTER
'THIS SCRIPT WILL WORK WELL WITH ASSISTANT BUT MAY CAUSE
'PROBLEMS WITH AIM BOT USERS BECAUSE ANYONE USING AIM
'COULD SHUT DOWN YOUR COMPUTER ON COMMAND.
If InStr(1, InputString, "shut down computer", 1) > 0 Or InStr(1, InputString, "shut down system", 1) > 0 Then
Set oWshX = CreateObject("WScript.Shell")
Set oWshSysEnvX = oWshX.Environment("PROCESS")
GetCurrentComputerName = oWshSysEnvX("COMPUTERNAME")
strShutdown = "shutdown -s -t 0 -f -m \" & GetCurrentComputerName
Set objShell = CreateObject("WScript.Shell")
objShell.Run strShutdown
End If
-
Mar 5th, 2010, 08:26 AM
#2
Re: 64 bit system infomation
Welcome to VBForums 
Despite the way it may seem, the issue is not actually related to 32-bit vs 64-bit - it is due to user permissions, and potentially the information provided by the motherboard too.
The chances are that most/all of it will work on your computer if you simply run it as a Windows user who has higher permissions - which you should be able to do by right-clicking on the program/script (or shortcut) when you open it.
An alternative which is likely to work without higher permissions is to get the information via API's, such as:
http://allapi.mentalis.org/apilist/G...StatusEx.shtml (near the bottom is a link to example VB6 usage)
-
Mar 5th, 2010, 09:09 AM
#3
Thread Starter
New Member
Re: 64 bit system infomation
Thanks for the warm welcome, and your time and help. it's greatly appreciated sincerely Sybershot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|