Click here to Skip to main content
15,886,056 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
how i can display memory type?
in vb.net
windows applecation

eg:
memory type : ddr3
memory Capacity (size): 3072 MB


** Attach a picture of your program is ready
His name is: CPU-Z

http://im23.gulfup.com/2012-09-19/1348086800251.jpg[^]
Posted
Comments
[no name] 19-Sep-12 16:43pm    
Have you looked at WMI (Win32_PhysicalMemory)?
Sergey Alexandrovich Kryukov 19-Sep-12 17:11pm    
Would be good to know. An interesting question, my 5.
--SA

I found something about this here[^].
I can't confirm the validity of this information, but at least it is something. The answer that has the information is this:

According to this kb article[^], certain types of memory will be listed as unknown since it wasn't in the SMBIOS (which WMI uses) at the time. Apparently it hasn't been updated since then. It says it applies to Windows Server 2003 but I see the same results on Windows 7 x64.

I suppose to get around this, you can cut the middle man and not use WMI but use the SMBIOS directly. I won't be of much help there but at least it will give you a direction to go on. answered Apr 15 '11 at 3:40 Jeff Mercado

Comments to this answer:
1) No, that's still accurate. Not all memory produced has the necessary information encoded in its EEPROM. If it's not there, it can't be read. Simple as that. – Cody Gray Apr 15 '11 at 6:59
2) but when i use a software called CPU-Z it gives me all the infomation, so i know that it is stored someware. – ambiguousPanda Apr 17 '11 at 14:57
3) @ambiguous: Yeah that's what I was thinking too. Though Cody has a point, it could be that CPU-Z stores the information that they find based on serial numbers. – Jeff Mercado Apr 17 '11 at 18:12

-------------------------------------------------
I found a second source that seems to provide a bit of a hack solution for this and an explanation as to why:
Source[^]

The gist of the solution is in the answer from Martin Xie:
Generally, the memory type can be retrieved like this:
C#
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_PhysicalMemory"); 
foreach(ManagementObject obj in searcher.Get())
{
   Console.WriteLine("Name: {0}\n",obj.GetPropertyValue("MemoryType"));
   Console.Read();
}

The Win32_PhysicalMemory WMI class has the MemoryType property that at least supports DDR-2. However, the DDR-3 type is not in the MemoryType list as you said.
http://msdn.microsoft.com/en-us/library/aa394347(VS.85).aspx[^]

Then you can try detecting the DDR-3 memory type like this:
C#
switch (memoryTypeValue) 
{
     case 20: s = "DDR"; break;
     case 21: s = "DDR2"; break;
     default:
           if(memoryTypeValue >= 1 && memoryTypeValue <= 19) s = "non-DDR menory";
           else s = "DDR3?"; //Assume unknown memory(case 0, and 22+) to be DDR3
           break;
}
 
Share this answer
 
v4
This is a subject I have been looking into for a while.
One of the problems as to why WMI and SMBIOS does not return DDR 3 can be answered by viewing the Specification for your version of SMBIOS here http://www.dmtf.org/standards/smbios[^].
In order to see what version you have you can use Win32_Bios and get the following two properties.
SMBIOSMajorVersion and SMBIOSMinorVersion, then on the link above look for the version column and then that is the specs you are under. Without being able to update your bios to a new SMBIOS Version there is not much you can do there. The earlier versions than the most current one did not have DDR3 listed. Without looking into every version I’m not sure when it was added.
Another suggestion I have seen was to use the Class “MSSmBios_RawSMBiosTables” located in "Root\WMI".
Last night I created a quick application to pull all of the information and populate a text box. It is displayed as Decimal format rather than Hex like the program listed here http://www.codeguru.com/welcomead[^].
After getting the information I found a way to convert every byte to (Char) without going thru the trouble of detecting the table structure. If you compare the output to Win32_PhysicalMemory what is returned is the same. So if you cannot get it from a normal class then this option appears that it won’t get it either.
So how do you get the information? You can use a tool like PC-Wizard located here http://www.cpuid.com/softwares/pc-wizard.html[^]
They have two versions one installs it on a system and the other is in a Zip file so you can throw on a USB stick and take it along with you.
Ok so how do they do it? They use driver to enumerate the system bus and then get the components attached to it. Then enumerate for the properties of the components.
How to do it in VB or C#? I don’t have a clue. But they do have a Dev site for a trial to the API http://www.cpuid-pro.com/[^]
I hope that answers why you can’t get it in WMI, but it still does not tell you how to do it In C# or VB.Net.
Best I can tell, you would have to do allot of API calls to the system bus to get it done.
 
Share this answer
 
I know these things but I want an example of open source

Thank you very much
 
Share this answer
 
Comments
Sandeep Mewara 23-Sep-12 3:07am    
This is not an answer. Please use 'Have a Question or Comment' link to respond to an answer. It will notify answerer of your comment such that he can come back and reply. Or if needed, use Improve Question link to edit/update your question at anytime.
ledtech3 23-Sep-12 9:15am    
I have not found any sample code yet.
ledtech3 23-Sep-12 13:40pm    
There seems to be a big black hole around this subject.
The closest I have come so far a a Lone Header file called "DeviceCategories.h" Located on my system in "C:\Program Files\Microsoft SDKs\Windows\v7.1\Include"
With a Line that reads:
#define DEVICEDISPLAY_CATEGORY_COMPONENT_SYSTEM_MEMORY L"Component.System.Memory"
Using a strings utility it does not show up listed as a include for any other file in that directory.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900