----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: Sitaraman Message 10 in Discussion Hi Shrinivas The Path problem is also solved. As i told you, i tried this approach Getting the clsid based on progid 1) Get the Type(Lib.ClassName) and Instantiate Object 2) Pass the Type and version number to a fn 3) In tht fn Concatenate Type and version Number and treat it as the ProgId 4) Search HKCR in registry for that key with the name as progid and get the <clsid> 5) <Clsid> is got Getting the COM DLL/EXE Path based on clsid 6) Search for HKCR\CLSD\<Clsid> Key 7) Check If InprocServer32 Key is there(in case of COM Dll) and get the value from that key. If InProcServer32 is not there then get the LocalServer32(in case of COM Exe) Key's Value This way u will get he COM DLL/EXE path The prob with this is that the way the Interop fools around the wrapper assembly for the com component(Interop.xx.dll). I tried testing with Excel9, CDONTS1.2 and AD02.7 and the observation was Excel Type:Excel.ApplicationClass Version: 9.0 ProgId in Registry:Excel.Application.9 CDONTS Type: CDONTS.NewMailClass Version:1.2 ProgId in Registry : CDONTS.NewMail.1 ADODB Type : ADODB.ConnectionClass Version : 2.7 ProgId in Registry : ADODB.Connection.2.7 So one prob was that the word "Class" is appended to the Classname. This we can truncate. But if u look at the above info, u find that the progid is not always type+.+version. Sometimes the end part of version is truncated(excel, cdonts) and sometimes not(adodb). So the part where the clisd is got from progid is risky and unreliable. However Do note that Getting the com dll path path from clsid is quite reliable. So the one thing to do is to get the clsid from the object instance and that will solve all the problems I checked the Interopservices namespace class members and found that there is a class called GUIDAttribute. When u instantiate the object from the InterOp Assembly using loadfrom and createinstance, you can get the GUID of this coclass(clsid) by getting the CustomAttribute attached to such objects. Sample code is l_objObject = p_objAssembly.CreateInstance(l_objType.ToString) Dim l_objCustomAttributes As Object = l_objObject.GetType.GetCustomAttributes (GetType(System.Runtime.InteropServices.GuidAttribute) , True) Dim l_objGUIDAttribute As System.Runtime.InteropServices.GuidAttribute = l_objCustomAttributes(0) MsgBox l_objGUIDAtttribute.value So i use this one code segment to replace the Steps 1 to 5 above( getting the clsid), which is the actual problem area and then continue with steps 6,7. This way you can print the path of the COM DLLs . Only condition for the version, path etc retrieval is that the referred dll should have atleast one type which can be instantiated. Im attaching the updated source code solution for ur reference Hope this helps regards, s ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/BDotNet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
