locked
Registration Free or Admin Free ActiveX msflxgrd.ocx RRS feed

  • Question

  • I have a Win32 unmanaged code C++ application that uses msflxgrd.ocx that I would like to deploy by xcopy to computers to which I do not have admin rights. I thought that the easiest way to do this with VS2010 was to set properties in Configuration Properties >> Manifest Tool >> Isolated COM >> Component File Name to "msflxgrd.ocx" (http://msdn.microsoft.com/en-us/library/zzbcs3x5(v=vs.100).aspx), but the compiler reports error c10100aa: "some incorrect options. So, what are the correct options? And then when I should have entered the correct options, which files do I need to xcopy to the application deployment folder?

    I also read from "Register MSFLXGRD.OCX on machines with non-admin rights" (http://social.msdn.microsoft.com/forums/en-us/vcgeneral/thread/37C02571-A0C0-4C31-9A89-AA9FC692EC90) that perhaps the ocx can be registered without admin rights, but then I read that I have to write a "manifest". So, how do I write a manifest?

    Any hints would be appreciated.


    Peter
    • Moved by lucy-liu Tuesday, February 7, 2012 7:57 AM it is a c++ issue (From:Visual Studio Extensibility)
    Saturday, February 4, 2012 12:04 AM

Answers

  • Well, the registration script isn't required. That file helps fill in some things like the ProgIDs. So unless your application calls functions like CLSIDFromProgID then it wouldn't make much of a difference.

    On the other hand, if you are using an automation control and don't know what the type library is, then I am a bit surprised. But since you are using it from an unmanaged C++ application then you are likely not using IDispatch since that is awkward to use. Anyway, the type library is distributed with automation controls and contains the information about all of the COM interfaces defined by the COM object.

    There are two methods of distributing the type library, either as a stand alone .tlb file, or embedded as a resource in the control itself. Msflxgrd.ocx should have it embedded as a resource of type TYPELIB and ID 1. So just point mt to the DLL for both the -dll option and -tlb option and it should give you a fairly good manifest there. From doing that to some version I had around, I got the following manifest:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <file name="msflxgrd.ocx" hashalg="SHA1">
    <comClass clsid="{2334D2B2-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}">
    </comClass>
    <comClass clsid="{2334D2B4-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}">
    </comClass>
    <comClass clsid="{6262D3A0-531B-11CF-91F6-C2863C385E30}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" description="Microsoft FlexGrid Control 6.0 (SP3)">
    </comClass>
    <typelib tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" resourceid="1" version="1.0" helpdir="">
    </typelib>
    </file>
    <comInterfaceExternalProxyStub name="IVBDataObject" iid="{2334D2B1-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IVBDataObjectFiles" iid="{2334D2B3-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IRowCursor" iid="{9F6AA700-D188-11CD-AD48-00AA003C9CB6}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IMSFlexGrid" iid="{5F4DF280-531B-11CF-91F6-C2863C385E30}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    
    </assembly>

    Now if you compare that to the following manifest taken from lucy-liu's link:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
      manifestVersion="1.0">
    
    <assemblyIdentity
       type="win32"
       name="SideBySide.X"
       version="1.0.0.0" />
    
    <file name = "SideBySide.dll">
    
    <comClass
        clsid="{[CLSID_SideBySideClass]}"
        threadingModel = "Apartment" />
    
    <typelib tlbid="{[LIBID_SideBySide]}"
           version="1.0" helpdir=""/>
    
    </file>
    
    <comInterfaceExternalProxyStub 
        name="ISideBySideClass" 
        iid="{[IID_ISideBySideClass]}"
        proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
        baseInterface="{00000000-0000-0000-C000-000000000046}"
        tlbid = "{[LIBID_SideBySide]}" />
    
    </assembly>
    

    See how close they are already? This manifest is almost ready for you to just set it as a dependent assembly, all you need to do is fill in some information into the assembly element. The biggest thing that is missing is the assemblyIdentity tag. All you would have to do is give it one, say <assemblyIdentity name="Microsoft.FlexGrid" type="win32" version="6.0.0.0" /> name the manifest file Microsoft.FlexGrid.manifest, put that manifest file in the same directory as the msflxgrd.ocx file and there you go. From that point, all you have to do is set the /MANIFESTDEPENDENCY linker option and point it to Microsoft.FlexGrid version 6.0.0.0 and you are done.

    The other thing you would need to fill in is the threading model attribute. If you just set it to Apartment for each comClass entry then you probably wont have any problems.

    If you want to put these two settings into the manifest tool settings for your project as is, then it will probably work. Just remember to point both the DLL path and the type library path to point at the flex grid control.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    • Marked as answer by Peter Manas Saturday, February 11, 2012 3:02 PM
    Thursday, February 9, 2012 1:08 AM

All replies

  • Hi Peter,

    It is a C++ issue, I will move it to Visual C++ General forum for a better support.

    Thank you for your understanding!

    Best regards,

    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, February 7, 2012 7:56 AM
  • Hi Peter,

    I think you should refer to this link , http://msdn.microsoft.com/en-us/library/ms973913.aspx . this link is a walkthrough which tells about registration-free activation of Com components"

    Best regards,

    Lucy



    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, February 7, 2012 8:00 AM
  • That link to the forum that you gave is telling you to use registration free COM, the manifest is the way that it is done. So it isn't telling you how to register it using non admin rights, but more like telling you to write an assembly manifest so you can use registration free COM.

    As to how you write a manifest, well, any text editor will do, it is just an XML file with a .manifest extension.

    To write this successfully you will need a few bits of information, and if that control is installed on your system then this is available. You would need the CLSID of the control (which is available in HKCR\CLSID or HKCR\Wow6432node\CLSID depending on if your system is 64 bit or 32 bit and if the control is 64 bit or 32 bit). The type library ID, which is available in HKCR\TypeLib, and the CLSID should be pointing to it. The ProgID which is available in HKCR and again, the CLSID should be pointing at it. Finally, the list of proxy stubs that it uses, now this one could be awkward.

    One of the simplest methods that I've found for getting some of this information is by running mt.exe and giving the type library and the dll file names on the command line. The output manifest should contain a good chunk of this information and you can use it as a base to input the rest of the information, so you can get a working assembly manifest for registration free COM.

    The link that lucy-liu gave is a good one to follow. The layout that it gives of the registration free COM being a private assembly does make things a lot easier. It saves a lot of trouble for you since all you have to do is write the registration free COM manifest once, and then make it a dependant assembly for your application.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Tuesday, February 7, 2012 2:56 PM
  • Hi Lucy,

    Thank you, but I posted my query because I had already read the July 2005 walkthrough, found it terribly complicated, and figured that by now, Visual Studio 2010 must have supplied an easier way. Also Properties Pages includes a Manifest Tool >> Isolated COM item that suggests that what I want to do can be done easily, perhaps by just entering the OCX file as the Component File Name together with specifying some other options. But VS2010 on compilation reports error c10100aa: "some incorrect options." Can't I just enter the correct options, whatever they might be?


    Peter

    Tuesday, February 7, 2012 11:46 PM
  • The easy way involves putting in at the very least the dll and the tlb files into the MT command line. Did you do that? The -dll option can't be used on its own, it has to be used in conjunction with either the -tlb or the -rgs option.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Wednesday, February 8, 2012 7:00 PM
  • Hi Crescens2k,

    Thank you for your two replies. I am studying your first reply to figure out what I have to do, but it looks like I'll have to put in a week's work to figure it all out, which is why I submitted this query, figuring that there must be an easier way, considering that VS2010 has this "Manifest Tool" node. So, I enter "msflxgrd.ocx" as the Component File Name, and I see that I must enter a Type Library File (tlb) and Register Script File (rgs). So then, what are those? Is there an easy way to do this, or must I first spend a few days learning about tlb and rgs files?


    Peter

    Wednesday, February 8, 2012 11:16 PM
  • Well, the registration script isn't required. That file helps fill in some things like the ProgIDs. So unless your application calls functions like CLSIDFromProgID then it wouldn't make much of a difference.

    On the other hand, if you are using an automation control and don't know what the type library is, then I am a bit surprised. But since you are using it from an unmanaged C++ application then you are likely not using IDispatch since that is awkward to use. Anyway, the type library is distributed with automation controls and contains the information about all of the COM interfaces defined by the COM object.

    There are two methods of distributing the type library, either as a stand alone .tlb file, or embedded as a resource in the control itself. Msflxgrd.ocx should have it embedded as a resource of type TYPELIB and ID 1. So just point mt to the DLL for both the -dll option and -tlb option and it should give you a fairly good manifest there. From doing that to some version I had around, I got the following manifest:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <file name="msflxgrd.ocx" hashalg="SHA1">
    <comClass clsid="{2334D2B2-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}">
    </comClass>
    <comClass clsid="{2334D2B4-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}">
    </comClass>
    <comClass clsid="{6262D3A0-531B-11CF-91F6-C2863C385E30}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" description="Microsoft FlexGrid Control 6.0 (SP3)">
    </comClass>
    <typelib tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" resourceid="1" version="1.0" helpdir="">
    </typelib>
    </file>
    <comInterfaceExternalProxyStub name="IVBDataObject" iid="{2334D2B1-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IVBDataObjectFiles" iid="{2334D2B3-713E-11CF-8AE5-00AA00C00905}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IRowCursor" iid="{9F6AA700-D188-11CD-AD48-00AA003C9CB6}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    <comInterfaceExternalProxyStub name="IMSFlexGrid" iid="{5F4DF280-531B-11CF-91F6-C2863C385E30}" tlbid="{5E9E78A0-531B-11CF-91F6-C2863C385E30}" proxyStubClsid32="{00020424-0000-0000-C000-000000000046}">
    </comInterfaceExternalProxyStub>
    
    </assembly>

    Now if you compare that to the following manifest taken from lucy-liu's link:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" 
      manifestVersion="1.0">
    
    <assemblyIdentity
       type="win32"
       name="SideBySide.X"
       version="1.0.0.0" />
    
    <file name = "SideBySide.dll">
    
    <comClass
        clsid="{[CLSID_SideBySideClass]}"
        threadingModel = "Apartment" />
    
    <typelib tlbid="{[LIBID_SideBySide]}"
           version="1.0" helpdir=""/>
    
    </file>
    
    <comInterfaceExternalProxyStub 
        name="ISideBySideClass" 
        iid="{[IID_ISideBySideClass]}"
        proxyStubClsid32="{00020424-0000-0000-C000-000000000046}"
        baseInterface="{00000000-0000-0000-C000-000000000046}"
        tlbid = "{[LIBID_SideBySide]}" />
    
    </assembly>
    

    See how close they are already? This manifest is almost ready for you to just set it as a dependent assembly, all you need to do is fill in some information into the assembly element. The biggest thing that is missing is the assemblyIdentity tag. All you would have to do is give it one, say <assemblyIdentity name="Microsoft.FlexGrid" type="win32" version="6.0.0.0" /> name the manifest file Microsoft.FlexGrid.manifest, put that manifest file in the same directory as the msflxgrd.ocx file and there you go. From that point, all you have to do is set the /MANIFESTDEPENDENCY linker option and point it to Microsoft.FlexGrid version 6.0.0.0 and you are done.

    The other thing you would need to fill in is the threading model attribute. If you just set it to Apartment for each comClass entry then you probably wont have any problems.

    If you want to put these two settings into the manifest tool settings for your project as is, then it will probably work. Just remember to point both the DLL path and the type library path to point at the flex grid control.


    This is a signature

    Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    • Marked as answer by Peter Manas Saturday, February 11, 2012 3:02 PM
    Thursday, February 9, 2012 1:08 AM
  • Thank you, thank you! Cresens2k. The short story is that the answer is in the last sentence: "If you want to put these two settings into the manifest tool settings for your project as is, then it will probably work. Just remember to point both the DLL path and the type library path to point at the flex grid control."

    So, I go to Properties, select Manifest Tool >> Isolated COM, and type in "msflxgrd.ocx" for both "Type Library File" and "Component File Name." OK it. Build. Done. All that's left to do is copy "msflxgrd.ocx" to the deployment folder, together with the EXE file. No manifest, no mess, nothing. It just works!

    The long story is that I didn't understand the last message until I had spent three hours going through the steps you suggested, figuring out how to read a manifest, what mt.exe does, and the like. I was almost done doing it the long way until I read your last sentence again, when at last I understood it. So, thank you again.


    Peter

    Saturday, February 11, 2012 3:28 PM