WMI query
I've been trying to run a simple query to get the amount of memory on my
machine using WMI. However, I seem to be running into a snag. When I hit the
mem = queryObj("MaxCapacity") line, I get an error of "A first chance
exception of type 'System.Management.ManagementException' occurred in
System.Management.dll."
I only seem to get this on non-string returns. If I remove the reference to
MaxCapacity and just ask it to return the tag, it works fine.
Could someone point out what I'm missing here?
Thank you,
ne.
Dim mem As UInt32 = 0
Try
Dim searcher As New Management.ManagementObjectSearcher("select
* from Win32_physicalmemory")
For Each queryObj As Management.ManagementObject In
searcher.Get()
mem = queryObj("MaxCapacity")
MsgBox(queryObj("tag") & " size: " & Convert.ToString(mem))
Next
Catch ex As Exception
End Try
.
Relevant Pages
- Re: WMI query
... John Timney (MVP) ... machine using WMI. ... Dim mem As UInt32 = 0 ... Catch ex As Exception ... (microsoft.public.dotnet.languages.vb) - Re: Not enough storage is available to process this command. (Exceptio
... My guess is that it is a memory allocation problem with Windows ... Management Instrumentation. ... The code makes a managed call to WMI ... I have a piece of code that gives an exception in some cases. ... (microsoft.public.security) - Re: How to troubleshoot bugchecks on my own?
... not a memory problem. ... From that exception record and context, ... execute the instruction - without a problem. ... (microsoft.public.win32.programmer.kernel) - Re: Bsod irql_not_less_or_equal
... *** Memory manager detected 2 instanceof page corruption, ... likely to have memory corruption. ... the driver/function that caused the problem. ... The exception code that was not handled ... (microsoft.public.windows.vista.performance_maintenance) - Re: Strange sudden shutdown issue with CF app
... Phone devices are notoriously low on virtual memory right out of the box because the OEMs decide to put every little thing into its own DLL and then have 25 processes launched at boot. ... Chris Tacke, Embedded MVP ... We have created an app that basically connects to a web service gets data, then stores it locally on the device, and when a record needs to be modified/added the system first tries to connect the web server sees if its availible, if not then it stores in locally on the device until the connection comes back, now I noticed that if the device does not mess around with the data connection then the application sits nicely as long as its open, and never gets shut down. ... But again most of the time I get no exception at all but just simply disappears. ... (microsoft.public.dotnet.framework.compactframework) |
|