Click here to Skip to main content
15,901,505 members
Home / Discussions / COM
   

COM

 
QuestionWQL Queries for Win32_Directory Events Pin
ragavan11-Dec-05 19:14
ragavan11-Dec-05 19:14 
QuestionDisabling right click on flash OCX Pin
Xeronith10-Dec-05 19:03
Xeronith10-Dec-05 19:03 
Questioni cannt insert the values from an asp page to ms-acess database Pin
jibybabu9-Dec-05 2:44
jibybabu9-Dec-05 2:44 
QuestionCOM(WebBrowser Problem) Pin
Arun Appukuttan8-Dec-05 17:20
Arun Appukuttan8-Dec-05 17:20 
AnswerRe: COM(WebBrowser Problem) Pin
Sufyan_shani7-Jan-06 2:46
Sufyan_shani7-Jan-06 2:46 
GeneralRe: COM(WebBrowser Problem) Pin
Arun Appukuttan11-Jan-06 0:21
Arun Appukuttan11-Jan-06 0:21 
QuestionHow to call a C# com component from VC++ Pin
meesho8-Dec-05 10:34
meesho8-Dec-05 10:34 
AnswerRe: How to call a C# com component from VC++ Pin
Lim Bio Liong8-Dec-05 18:49
Lim Bio Liong8-Dec-05 18:49 
Hello meesho,

Just like a normal COM DLL or EXE, a .NET module which has been wrapped as a COM module needs to have its information written into the registry in order for the COM sub-system to locate it and load it into memory for a client.

REGASM.EXE
----------
This is achieved via the REGASM.EXE utility. REGASM performs similarly to the well-known REGSVR32.EXE utility which is used to register COM modules. REGASM uses the metadata contained inside a .NET assembly to generate COM-equivalent information which are then used to insert entries into the registry.

The entries written into the registry include the CLSIDs and ProgIDs of .NET classes which are exposed as COM classes. This registration process is important for COM clients in the discovery and loading process.

Call the REGASM.EXE utility inside the Visual Studio .NET command prompt as folows :

regasm <.NET DLL Assembly Name> /tlb

The "/tlb" flag commands REGASM.EXE to produce a Type Library File (.TLB) for the .NET Assembly. It is useful for your VC++ client to import.

In your VC++ code, you import the .TLB file using the #import keyword, e.g. :

#import "(TLB file path)";

GACUTIL.EXE
-----------
Next, for ease of discovery and loading by the .NET CLR engine, your .NET DLL Assembly -should- be registered into the GAC (Global Assembly Cache). This is not 100% required but will make life must easiler for your client apps.

In order that a .NET module be registered to the GAC, it needs to be digitally signed. This requires a Strong Name Key (SNK) file. You can create an SNK file using the "sn.exe" .NET utility.

Another step to take is to set the path of the SNK file in the AssemblyKeyFile attribute in the AssemblyInfo.cs file :

[assembly: AssemblyKeyFile("..\\..\\KeyFile.snk")]

To register an assembly into the GAC, we use the GACUTIL.EXE utility. For example :

gacutil -i <.NET DLL Assembly Name>

An alternative to using GACUTIL.EXE is to copy your DLL Assembly into a folder location that can be discovered by the .NET CLR.

Give it all a try, meesho. Let me know if you need further clarifications.



Best Regards,
Bio.


-- modified at 2:24 Friday 9th December, 2005
Questionhow to drag and drop xml element from treeview to web browser control Pin
fadi moon8-Dec-05 1:02
fadi moon8-Dec-05 1:02 
QuestionE-Book for ActiveX Programming Pin
Rajkamal_dfine6-Dec-05 18:08
Rajkamal_dfine6-Dec-05 18:08 
AnswerRe: E-Book for ActiveX Programming Pin
Amol Ravatale7-Dec-05 0:20
Amol Ravatale7-Dec-05 0:20 
QuestionLPSTR and LPBYTE passing to a dll Pin
Paul_5916-Dec-05 6:33
Paul_5916-Dec-05 6:33 
AnswerRe: LPSTR and LPBYTE passing to a dll Pin
JonEngle6-Dec-05 7:05
JonEngle6-Dec-05 7:05 
GeneralRe: LPSTR and LPBYTE passing to a dll Pin
Paul_5916-Dec-05 8:40
Paul_5916-Dec-05 8:40 
GeneralRe: LPSTR and LPBYTE passing to a dll Pin
JonEngle6-Dec-05 9:12
JonEngle6-Dec-05 9:12 
GeneralRe: LPSTR and LPBYTE passing to a dll Pin
Paul_5916-Dec-05 9:50
Paul_5916-Dec-05 9:50 
GeneralRe: LPSTR and LPBYTE passing to a dll Pin
JonEngle6-Dec-05 10:27
JonEngle6-Dec-05 10:27 
QuestionDLLHost.exe Terminates on Windows Server 2003 Pin
Gupta Suraj5-Dec-05 19:15
Gupta Suraj5-Dec-05 19:15 
QuestionHow &quot;DCOM server process launcher&quot; works? Pin
Chintoo7235-Dec-05 17:30
Chintoo7235-Dec-05 17:30 
AnswerRe: How &amp;quot;DCOM server process launcher&amp;quot; works? Pin
Chintoo7235-Dec-05 17:44
Chintoo7235-Dec-05 17:44 
QuestionOut-of-process COM in C# Pin
london_ste2-Dec-05 4:57
london_ste2-Dec-05 4:57 
AnswerRe: Out-of-process COM in C# Pin
Lim Bio Liong5-Dec-05 13:13
Lim Bio Liong5-Dec-05 13:13 
GeneralRe: Out-of-process COM in C# Pin
london_ste8-Dec-05 6:17
london_ste8-Dec-05 6:17 
GeneralRe: Out-of-process COM in C# Pin
Lim Bio Liong8-Dec-05 16:03
Lim Bio Liong8-Dec-05 16:03 
Questionwhy to put extern C before const IID? Pin
Lane Yu1-Dec-05 23:32
Lane Yu1-Dec-05 23:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.