Announcement

Collapse
No announcement yet.

using pbtyp

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • using pbtyp

    I am attempting to register my first experimental com, and for that I need to first learn how embed the type lib info created by using #com tlib on meta command into my dll that contain the com class.

    When I used pbtyp command to do that, by entering window console command "pbtyp myclass.dll" (assuming that myclass.tlb is defaulted) , I got following message:

    "type library file myclass.rc not found."

    The help file states that the resource file parameter is optional and I don't use resource file to create this com. So any help is appreciated !


    Regards and Thanks.

    Kunhock

  • #2
    Create a resource file (.rc) and compile it.

    make sure #Com TLib On is set

    then add #Include "myresource.pbr" to your COM source.


    Compile COM lib and run PBTYP.
    Scott Slater
    Summit Computer Networks, Inc.
    www.summitcn.com

    Comment


    • #3
      This is how I do it and it never fails.

      First create a resource file "MYCOMSERVER.RC"
      add:
      1 TYPELIB "MYCOMSERVER.TLB"

      Then compile your dll with:

      #COMPILE DLL "MYCOMSERVER.DLL"
      #COM TLIB ON

      This will create "MYCOMSERVER.TLB"

      Compile Your resource file to produce the MYCOMSERVER.PBR
      Note-> you will have to recompile "MYCOMSERVER.RC" every time
      you compile with #COM TLIB ON

      Compile your sever a second time with
      #COM TLIB OFF
      and
      #RESOURCE "MYCOMSERVER.PBR"

      It is a bit of a pain but as long as I am prudent with the steps it has always worked.

      James

      Comment


      • #4
        There has GOT to be an easier /better way.

        I can hear UpdateResource() calling me....
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          MCM,
          I thought so at first but it's basically a chicken egg scenario.
          The only way to produce the TLB is to compile with #COM TLIB ON

          Probably pbtyp would be fewer steps but that means exiting the ide.
          Using UpdateResource() would also require an external program.

          I just got used to using the steps shown and all it requires is to comment out or change one line.
          Actually you don't even have to use #COM TLIB OFF or comment out the line. Just Make sure you recompile the rc and compile the dll a second time.

          It's still a WAY LOT easier than the C++ way.

          James

          Comment


          • #6
            Batch file to comile?
            Code:
            Compile RC==> RES  (RC.exe) 
            PBRES    RES==>PBR 
            Compile DLL
            Run pbtyp
            Re-compile resource which now has TLIB info added==>RES
            PBRES to convert RES to PBR
            Rec-compile DLL against new PBR
            ????

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              1 - Compile RC==> RES (RC.exe)
              2 - PBRES RES==>PBR
              3 - Compile DLL
              4 - Run pbtyp
              5 - Re-compile resource which now has TLIB info added==>RES
              6 - PBRES to convert RES to PBR
              7 - Rec-compile DLL against new PBR

              If I'm not mistaken you don't need steps 1,2,5,6,7 if you don't need any other resources.
              I usually need other resources so I just got in the habit of using the method I posted.

              You don't need #4 if you are using a resource, pbtyp embeds the tlb in the dll without a resource.

              James

              Comment


              • #8
                You don't need #4 if you are using a resource, pbtyp embeds the tlb in the dll without a resource
                Just re-read the doc... is says it embeds the tlb in the dll AS a resource. I wonder how it does that without importing UpdateResource... unless it calls that dynamically.

                I guess I'll just have to get around to trying it.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Thanks

                  Thanks for all the helps !!!

                  Kunhock

                  Comment

                  Working...
                  X