Announcement

Collapse
No announcement yet.

Understanding inc files

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

  • Understanding inc files

    Using many examples, I am trying to write some code using inc files which I have generated. After approx 8 hours on a very few lines of code I need some pointers!
    I am coming to com after a lot of VB years and am very ignorant of the "real world" of com.

    Using the PB9 sample with the MSAgent I deduce as follows.
    When I declare an object then it is AS the name shown in the inc file as the "INTERFACE IDENTIFIER"
    When I create an INSTANCE of the object I use the name shown in the inc file as the "PROGID"
    When I then set or retrieve a property I use the name shown in the inc file as the "INTERFACE NAME"

    The Agent.inc file seems "well formed" (to use an XML expression).

    The inc file I am generating from a 3rd party product, seems a bit of a mess, with the three items above being assigned very different names.

    So to my questions.
    1. Are the above assumptions correct?
    2. I have tried two TypeLibrary browsers (PB9 & Jose Roca's) and while the naming conventions may differ somewhat the results follow the same pattern. The inc file creation still relies on the source tlb. olb or exe?
    (I am aware that Phoenix also has a TypeLibrary browser but this does not appear to be available in the trial download.)
    3. Will the "Intellisense" in Phoenix 3 bring me back to the VB comfort (laziness) level where I don't have to troll through inc files trying to figure out what the exe design team decided to name things.

    Any pointers will be much appreciated.

    Ian B

  • #2
    What is the name of the third-party product?

    3. Will the "Intellisense" in Phoenix 3 bring me back to the VB comfort (laziness)
    level where I don't have to troll through inc files trying to figure out what the
    exe design team decided to name things.
    It will.

    The Type Library Browser in Phoenix 2.0 is built-in and is not available for download.
    Dominic Mitchell
    Phoenix Visual Designer
    http://www.phnxthunder.com

    Comment


    • #3
      Using the PB9 sample with the MSAgent I deduce as follows.
      When I declare an object then it is AS the name shown in the inc file as the "INTERFACE IDENTIFIER"
      When I create an INSTANCE of the object I use the name shown in the inc file as the "PROGID"
      When I then set or retrieve a property I use the name shown in the inc file as the "INTERFACE NAME"
      1. Are the above assumptions correct?
      Not quite.

      When you declare an object then it is AS the name shown in the inc file as the "INTERFACE NAME".

      When you then set or retrieve a property you use the name shown in the inc file as "PROPERTY GET or SET", or "METHOD" if it is not a property.

      Example:

      You declare the object using the Interface Name:

      Code:
      DIM AgentCtrlEx AS IAgentCtlEx
      You create an instance of the object using the ProgID or the ClsID:

      Code:
      AgentCtrlEx = NEWCOM $PROGID_Agent2
      or

      Code:
      AgentCtrlEx = NEWCOM CLSID $CLSID_Agent
      You get the property using a compound syntax with the name of the object variable, a dot and the name of the property:

      Code:
      AgentChars = AgentCtrlEx.Characters
      Forum: http://www.jose.it-berater.org/smfforum/index.php

      Comment


      • #4
        2. I have tried two TypeLibrary browsers (PB9 & Jose Roca's) and while the naming conventions may differ somewhat the results follow the same pattern. The inc file creation still relies on the source tlb. olb or exe?
        The information is extracted from type libraries (.tlb). olb is the extension used with Office type libraries, but there is no difference between them other than the extension used.

        In most cases, the type libraries aren't provided separately, but embedded in an exe file (out of process servers), a dll (in process servers) or an ocx (ActiveX).
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          Thank you both for your comments.

          With your guidance I am now compiling error free and it may be a few hours yet before I progress from here.
          My difficulty came from the inc file comments vs the content. I made the mistake of believing the comments e.g. as an example :
          ' Interface name = _Assembly
          but in in fact the code shows the name is INTERFACE Assembly.
          With your pointers I knew where I should be looking.

          Thanks again

          Ian B

          Comment


          • #6
            My difficulty came from the inc file comments vs the content. I made the mistake of believing the comments e.g. as an example :
            ' Interface name = _Assembly
            but in in fact the code shows the name is INTERFACE Assembly.
            The name assigned in the type library is "_Assembly", but as leading underscores are not allowed by the PB compilers, I have chosen to remove them and PB has chosen to add the prefix "Int". Anyway, the names don't have to be exact because interfaces are identified by its IID, e.g. $IID_IAgentCtlEx = GUID$("{8563FF20-8ECC-11D1-B9B4-00C04FD97575}"). As long as the GUID is the correct one, you could even change all instances of IAgentCtlEx to e.g. IanBayly and will still work.
            Forum: http://www.jose.it-berater.org/smfforum/index.php

            Comment


            • #7
              Thank you for that further explanation José, I am slowly progressing thanks to your guidance.

              Ian B


              Comment


              • #8
                "_Assembly" is not a legal name. Legal names must begin with a letter. All BASIC user-defined symbols must begin with a letter.

                BTW, as long as you brought up the 'comment issues' in #INCLUDE files generated by the PB COM browser, check out the spelling of "Version dependent" and "version independent" in same.

                When I see carelessness like this, I can't help but wonder where else carelessness has slipped in.

                MCM
                (yes I DID send in a bug report on the spelling thing)
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment

                Working...
                X