procit
asked on
How to read registry key value in c# on windows7 64 bit
I have made one com component dll, In that one method returns Registry key value, and one is simple return string.
for e.g.
public string Hello()
{
return "Hello from object";
}
public string IsAgent()
{
return Registry.GetValue(@"HKEY_L OCAL_MACHI NE\SOFTWAR E\Test\Age nt", "IsAgent", "0").ToString();
}
Then we have register that dll by making setup & deployment project in vs2010 (framework2.0). Then we are trying to access that method in javascript, for e.g
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>ObjectEmbedingTest< /title> </head>
<body>
<form method="POST" name="MyForm" id="MyForm">
<object id="HelloControl" name="HelloControl" border="0" classid="clsid:9A081BF8-6B 1A-4850-B8 B1-94AF128 2EEC3" >
</object>
</form>
<script type ="text/javascript">
var objAgentControl = document.forms(0).HelloCon trol;
alert('objAgentControl=' + objAgentControl.Hello());
alert(objAgentControl.IsAg ent());
</script>
</body>
</html>
In this on windows7 32 bit, both methods are working fine, but when we installed it on windows7 64 bit m/c Hello() method working fine but IsAgent() is not working.
for e.g.
public string Hello()
{
return "Hello from object";
}
public string IsAgent()
{
return Registry.GetValue(@"HKEY_L
}
Then we have register that dll by making setup & deployment project in vs2010 (framework2.0). Then we are trying to access that method in javascript, for e.g
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>ObjectEmbedingTest<
<body>
<form method="POST" name="MyForm" id="MyForm">
<object id="HelloControl" name="HelloControl" border="0" classid="clsid:9A081BF8-6B
</object>
</form>
<script type ="text/javascript">
var objAgentControl = document.forms(0).HelloCon
alert('objAgentControl=' + objAgentControl.Hello());
alert(objAgentControl.IsAg
</script>
</body>
</html>
In this on windows7 32 bit, both methods are working fine, but when we installed it on windows7 64 bit m/c Hello() method working fine but IsAgent() is not working.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi,
registry key path will be different for Win 7 64 bit..
will be under "Wow6432Node".. your path should be like below..
ie:
(@"HKEY_LOCAL_MACHINE\SOFT WARE\Wow64 32Node\Tes t\Agent
registry key path will be different for Win 7 64 bit..
will be under "Wow6432Node".. your path should be like below..
ie:
(@"HKEY_LOCAL_MACHINE\SOFT
ASKER
Thx.
Yes, I have used Example 2 from this link http://www.rhyous.com/2011/01/24/how-read-the-64-bit-registry-from-a-32-bit-application-or-vice-versa/,
And Now I can access that IsAgent method, but after loading page there is one more message "COM Surrogate has stopped working.", Is it related to this code?
Yes, I have used Example 2 from this link http://www.rhyous.com/2011/01/24/how-read-the-64-bit-registry-from-a-32-bit-application-or-vice-versa/,
And Now I can access that IsAgent method, but after loading page there is one more message "COM Surrogate has stopped working.", Is it related to this code?
Open in new window