From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Computer name.vi for 64-bit Windows 7

Solved!
Go to solution

I have seen in older posts there is a vi named 'Computer Name.vi'  (which is used in a LabVIEW project that I am trying to upgrade).  When I try to run this I get an error code:

Error -604 occurred at Open Registry Key.vi

is there a solution to this error or does anyone have access to a newer version (I am using LabVIEW 2010 and have Windows 7 64 bit)

I am attaching the vi that I am having troubles with.

-ncm
0 Kudos
Message 1 of 8
(3,495 Views)

I used Help > Explain Error in LabVIEW to figure out that error -604 is a registry permissions error. I'm guessing you don't have sufficient (admin?) privileges on that machine to be able to read the registry. I ran the ComputerName.vi you attached in LabVIEW 2010 on my Windows 7 64-bit machine and it worked fine...but I have admin privileges on my machine.

Message 2 of 8
(3,493 Views)
Solution
Accepted by topic author ncm

Also, here's another way to get the name of the machine...this one doesn't require reading the registry:

 

iptostring.png

Message 3 of 8
(3,491 Views)

Hello ncm,

 

As Darren said, the error indicates an access permission problem. The VI you provided works on my machine with the security access mask input on the open registry key VI set to KEY_READ.

 

Since the source version for the VI you provided appears to be LabVIEW 6 (probably developed on Windows 98/NT/ME), a number of things have probably changed with how Windows handles registry access that may have affected how this executes- there are a number of other ways to get the computer name and if you're in the process of bringing this project up to speed, it might be worth replacing this function while you're at it.

 

Regards, 

Tom L.
Message 4 of 8
(3,484 Views)

Thanks everyone!  I am looking forward to trying the simpler version posted (TY Darren).  I will try an post later my results.

-ncm

-ncm
0 Kudos
Message 5 of 8
(3,470 Views)

Just tried it, SO much simpler and worked perfectly.  Not sure why the other computer was using the other vi to acquire the address (unless the older versions didn't have those functions...)

Much appreciated!

-ncm

-ncm
0 Kudos
Message 6 of 8
(3,467 Views)

@ncm wrote:

Just tried it, SO much simpler and worked perfectly.  Not sure why the other computer was using the other vi to acquire the address (unless the older versions didn't have those functions...)

Much appreciated!

-ncm


I used this trick at least back in the 8.x days, but it is a subtle feature and I've met plenty of people that didn't know you could do that.  You don't even need to wire the localhost either.  If it is unwired it assumes localhost.

Message 7 of 8
(3,459 Views)

Nice Darren!

 

I just had to use this on a bit of code that broke migrating code from Win XP to Win7 and luckily I remembered your post!

 

Thanks

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 8
(3,375 Views)