03-11-2010 11:57 AM
smercurio_fc wrote:
Would you consider .NET to be a candidate for "best". If so, the amount of installed RAM can be easily acquired using the Microsoft.VisualBasic.Devices.ComputerInfo class:
03-11-2010 01:10 PM
altenbach wrote:
Thanks, I went with this and it seems to work. (first time I dragged this snipped onto my diagram, my entire project crashed, though 😞 Ouch!).
Odd. I had used the Code Capture Tool. Maybe it creates something that 2009 doesn't like, though I suspect it's more likely to do with the fact that I was using .NET.
Will this also work on computers that don't have .NET framework installed?
Unfortunately, no. A .NET-free version would need to use the Windows API via DLLs/Call Library Function Node to call the GlobalMemoryStatusEx function. The details of the structure are here. Attached is a VI that does this.
03-11-2010 01:41 PM
smercurio_fc wrote:
A .NET-free version would need to use the Windows API via DLLs/Call Library Function Node to call the GlobalMemoryStatusEx function. The details of the structure are here. Attached is a VI that does this.
03-12-2010 10:34 AM - edited 03-12-2010 10:37 AM
Upon testing the executable on Vista machines, it seem I cannot get e.g. the "ProcessorNameString" from the registry unless I select to run in "XP compatibility mode" or select "Run as Administrator".
Is there a way to configure the installer so one of these options is applied automatically? Just curious.
(Also, I don't have access to a Windows 7 machine. Does it act like Vista in this case?)
03-12-2010 11:41 AM
altenbach wrote:Upon testing the executable on Vista machines, it seem I cannot get e.g. the "ProcessorNameString" from the registry unless I select to run in "XP compatibility mode" or select "Run as Administrator".
Odd. I can see why you would need to be admin to be able to write to that key, but one should be able to read it. On XP, at least, the permissions are such that the special account Everyone can read that key. I don't have Vista to check this, and my Win 7 machine is at home so I can check this tonight.
Is there a way to configure the installer so one of these options is applied automatically? Just curious.
Yes. For the compatibility mode there's the branch HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers. There should be separate keys for each application. The key name is the full path to the executable. The type is string (REG_SZ), and the data is the compatibility mode, e.g., WINXPSP2, WIN95, WIN2000. There also a similar key in HKEY_CURRENT_USER. Not sure which one takes precedence. Note that you need to be admin to be able to create these keys.
As for Windows 7, it has those keys as well, but I read in one site that those keys are either obsolete or that the values get written someplace else. I can check on my Windows 7 machine.
As far as setting the "Run as Administrator" programmatically, I'm not sure if you can do this. Seems to be a security risk to me.
03-12-2010 12:10 PM - edited 03-12-2010 12:19 PM
Ah, looking more closely at the "open registry key", there is a optional input for "security access mask" where I can select e.g. "Key_read" or "Key_query_value", which I assume is "read-only access" I'll try this.
Found some documentation at microsoft. The LabVIEW help does not give any details.
If uwired (the way I had it!), it defaults to read/write.
That might be it....
03-12-2010 12:34 PM
Success! Using "Key_query_value" as security access mask solves the vista problem. 🙂
(I did not bother to look into this earlier, because things worked fine under XP ;))