Created
December 24, 2010 13:56
-
-
Save follesoe/754251 to your computer and use it in GitHub Desktop.
Snippet for the blog post "Free SMS Gadget for Vista using .NET Interop"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //////////////////////////////////////////////////////////////////////////////// | |
| // | |
| // Add the Gadget.Interop dll to the registry so it can be used by COM and | |
| // created in javascript as an ActiveX object | |
| // | |
| //////////////////////////////////////////////////////////////////////////////// | |
| function RegisterGadgetInterop() | |
| { | |
| try | |
| { | |
| // Full path to the Gadget.Interop.dll assembly | |
| var fullPath = System.Gadget.path + assemblyStore; | |
| var asmPath = fullPath + assemblyName; | |
| // Register the interop assembly under the Current User registry key | |
| RegAsmInstall("HKCU", progID, "Gadget.Interop.GadgetAdapter", guid, | |
| "Gadget.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9389e9f4d8844504", | |
| "1.0.0.0", asmPath); | |
| if(InteropRegistered() == false) | |
| { | |
| // Try Register the interop assembly under the Local Machine registry key | |
| RegAsmInstall("HKLM", progID, "Gadget.Interop.GadgetAdapter", guid, | |
| "Gadget.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9389e9f4d8844504", | |
| "1.0.0.0", asmPath); | |
| } | |
| } | |
| catch(e) | |
| { | |
| System.Debug.outputString("RegisterGadgetInterop fails: " + e.message); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment