|
-
July 23rd, 2008, 10:28 AM
#1
GUID creation
I are making an automation addin, following this link:
http://blogs.msdn.com/eric_carter/ar...01/273127.aspx
It contains this code:
Code:
# Imports System
# Imports System.Runtime.InteropServices
# Imports Microsoft.Win32
#
# Namespace AutomationAddin
#
# ' Replace the Guid below with your own guid that
# ' you generate using Create GUID from the Tools menu
# <Guid("5268ABE2-9B09-439d-BE97-2EA60E103EF6")> _
# <ClassInterface(ClassInterfaceType.AutoDual)> _
# <ComVisible(True)> _
# Public Class MyFunctions
#
# Public Sub New()
# End Sub
#
# Public Function MultiplyNTimes(ByVal number1 As Double, ByVal number2 As Double, ByVal timesToMultiply As Double) As Double
# Dim result As Double = number1
# For i As Double = 0 To timesToMultiply - 1
# result = result * number2
# Next
#
# Return result
# End Function
#
# <ComRegisterFunctionAttribute()> _
# Public Shared Sub RegisterFunction(ByVal type As Type)
# Registry.ClassesRoot.CreateSubKey(GetSubKeyName(type, "Programmable"))
# Dim key As RegistryKey = Registry.ClassesRoot.OpenSubKey(GetSubKeyName(type, "InprocServer32"), True)
# key.SetValue("", System.Environment.SystemDirectory + "\mscoree.dll", RegistryValueKind.[String])
# End Sub
#
# <ComUnregisterFunctionAttribute()> _
# Public Shared Sub UnregisterFunction(ByVal type As Type)
# Registry.ClassesRoot.DeleteSubKey(GetSubKeyName(type, "Programmable"), False)
# End Sub
#
# Private Shared Function GetSubKeyName(ByVal type As Type, ByVal subKeyName As String) As String
# Dim s As New System.Text.StringBuilder()
# s.Append("CLSID\{")
# s.Append(type.GUID.ToString().ToUpper())
# s.Append("}\")
# s.Append(subKeyName)
#
# Return s.ToString()
# End Function
# End Class
# End Namespace
The problem is in the lines:
Code:
# ' Replace the Guid below with your own guid that
# ' you generate using Create GUID from the Tools menu
# <Guid("5268ABE2-9B09-439d-BE97-2EA60E103EF6")> _
# <ClassInterface(ClassInterfaceType.AutoDual)> _
# <ComVisible(True)> _
# Public Class MyFunctions
But VB.NET express does not have "Create GUID" option in the Tools Menu, I don't know how to create a GUID.
I have found the function System.Guid.NewGuid().ToString() , and I think that I can create a new project, use the function to create a GUID, and replace it on the code.
Is this a correct way?
_
-
July 23rd, 2008, 10:44 AM
#2
Re: GUID creation
It's like what you had to do in MushClient to get a brand new plugin id.
It'll work. so it shouldn't matter. Basically, you're doing through code what the full visual studio does through a button click. Not to say that you couldn't make your own guid creator. Never have understood microsoft. Here's the express edition. You can use the full vb language, but we take away things like Automatically created sql connections! WOOO! I have to code an extra three lines, man.
Microsoft Visual Basic 2008 Express Edition
.NET Framwork 3.5 Beta SP1
-
July 23rd, 2008, 10:56 AM
#3
Re: GUID creation
 Originally Posted by ccubed
...
It'll work. so it shouldn't matter. Basically, you're doing through code what the full visual studio does through a button click. Not to say that you couldn't make your own guid creator. Never have understood microsoft. Here's the express edition. You can use the full vb language, but we take away things like Automatically created sql connections! WOOO! I have to code an extra three lines, man. 
Thanks for your answer.
I have found a GUID in the assembly information of my dll, and Copy-Pasted it on the code.
Don't know if that makes sense, just testing.
If it don't work, I gonna try to generate a nother one, And if still it does not work, the I gonna need to lost my time trying to learn what the %&$$· thing is that and how to make it.
-
July 24th, 2008, 01:06 PM
#4
Re: GUID creation
Easy way is:
Dim myGuid As Guid
myGuid = Guid.NewGuid
-
July 25th, 2008, 12:50 AM
#5
Re: GUID creation
 Originally Posted by Marraco
I have found the function System.Guid.NewGuid().ToString() , and I think that I can create a new project, use the function to create a GUID, and replace it on the code.
Is this a correct way?
Yes, you're on the right track
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|