Passing STDPicture To DLL Class Module

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce A. Wilkinson

    Passing STDPicture To DLL Class Module

    Greetings All

    I am currently attempting to pass an STDPicture object to the Picture
    property of a class module within a DLL. However, none of the usual methods
    seem to apply. The Microsoft Knowledge base has very little on the
    STDPicture object.

    Does anyone know if there is a build-in limitation that prevents you from
    passing this type of object? If so, is there a work around method I've
    missed? If anyone could point me toward some documentation that would
    explain this I would greatly appreciate it.

    Thanks.

    Bruce


  • Larry Serflaten

    #2
    Re: Passing STDPicture To DLL Class Module

    "Bruce A. Wilkinson" <bwilkins@grole n.com> wrote[color=blue]
    > Greetings All
    >
    > I am currently attempting to pass an STDPicture object to the Picture
    > property of a class module within a DLL. However, none of the usual methods
    > seem to apply. The Microsoft Knowledge base has very little on the
    > STDPicture object.
    >
    > Does anyone know if there is a build-in limitation that prevents you from
    > passing this type of object? If so, is there a work around method I've
    > missed? If anyone could point me toward some documentation that would
    > explain this I would greatly appreciate it.[/color]


    What problems are you having?
    If you actually mean a picture PROPERTY then are you using the Set keyword?

    LFS




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    • Bruce A. Wilkinson

      #3
      Re: Passing STDPicture To DLL Class Module

      The dll is part of a graphics program I have written. The "Picture"
      property is defined in the dll as an StdPicture object... (The Variable
      "PreviewIma ge " is also Globally dimensioned within the dll as an StdPicture
      object)

      Public Property Set Picture(ByVal vData As StdPicture)

      PreviewImage = vData

      End Property

      When the object is assigned to an image control within the Exe program it
      works fine. But when it is passed to the dll's "Picture" property it
      generates an error. Any other type of object passes without problem as long
      as the Exe and the Dll objects are defined the same. However, with the
      StdPicture object, an error is generated. This occurs even when the property
      is left vacant of code.

      Has anyone else ran into this problem?


      Comment

      • Rick Rothstein

        #4
        Re: Passing STDPicture To DLL Class Module

        You're into an area of VB that I've never played with before; so, if this
        question seems silly, you will have to forgive me... and, if it works, I'll
        not have an explanation as to why.<g> What happens if you pass the
        StdPicture object ByRef instead of ByVal?

        Rick - MVP


        "Bruce A. Wilkinson" <bwilkins@grole n.com> wrote in message
        news:sMAJb.721$ Nd.686334@newsh og.newsread.com ...[color=blue]
        > The dll is part of a graphics program I have written. The "Picture"
        > property is defined in the dll as an StdPicture object... (The Variable
        > "PreviewIma ge " is also Globally dimensioned within the dll as an[/color]
        StdPicture[color=blue]
        > object)
        >
        > Public Property Set Picture(ByVal vData As StdPicture)
        >
        > PreviewImage = vData
        >
        > End Property
        >
        > When the object is assigned to an image control within the Exe program it
        > works fine. But when it is passed to the dll's "Picture" property it
        > generates an error. Any other type of object passes without problem as[/color]
        long[color=blue]
        > as the Exe and the Dll objects are defined the same. However, with the
        > StdPicture object, an error is generated. This occurs even when the[/color]
        property[color=blue]
        > is left vacant of code.
        >
        > Has anyone else ran into this problem?
        >
        >[/color]


        Comment

        • Larry Serflaten

          #5
          Re: Passing STDPicture To DLL Class Module

          "Bruce A. Wilkinson" <bwilkins@grole n.com> wrote
          [color=blue]
          > The dll is part of a graphics program I have written. The "Picture"
          > property is defined in the dll as an StdPicture object... (The Variable
          > "PreviewIma ge " is also Globally dimensioned within the dll as an StdPicture
          > object)
          >
          > Public Property Set Picture(ByVal vData As StdPicture)
          >
          > PreviewImage = vData
          >
          > End Property
          >
          >
          > Has anyone else ran into this problem?[/color]

          I repeat:
          If you actually mean a picture PROPERTY then are you using the Set keyword?


          Public Property Set Picture(ByVal vData As StdPicture)

          Set PreviewImage = vData

          End Property



          LFS







          -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
          http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
          -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

          Comment

          • Bruce A. Wilkinson

            #6
            Re: Problem Solved

            Thanks very much Rick. Passing the image ByRef instead of ByVal was the
            answer. It funny when you get involved in a large project how the little
            things can elude you.

            Thanks for the suggestion. It was much appreciated.

            Bruce


            Comment

            • Bruce A. Wilkinson

              #7
              Re: Passing STDPicture To DLL Class Module

              Yes I am using the Set keyword. The problem was that I was trying to pass
              the object ByVal instead of ByRef.

              Thanks for your help. Have a great week.


              Comment

              • Larry Serflaten

                #8
                Re: Passing STDPicture To DLL Class Module

                "Bruce A. Wilkinson" <bwilkins@grole n.com> wrote[color=blue]
                > Yes I am using the Set keyword. The problem was that I was trying to pass
                > the object ByVal instead of ByRef.
                >
                > Thanks for your help. Have a great week.[/color]


                In a property Set assignment, ByVal or ByRef would not matter,
                they both point to the same object. What does matter is whether you
                use Set in the assignment. Whenever you are using objects, expect to
                use Set. What you posted, should not have compiled without the Set
                keyword...
                [color=blue]
                > (The Variable "PreviewIma ge " is also Globally dimensioned within the
                > dll as an StdPicture object)[/color]
                [color=blue]
                > Public Property Set Picture(ByVal vData As StdPicture)
                > PreviewImage = vData
                > End Property[/color]


                If PreviewImage is in fact declared as a StdPicture object, you should
                have gotten the 'Invalid use of Property' error on compile because it
                is missing the Set keyword. In this case, ByVal or ByRef only pertain
                to the actual variable being passed, not the object it points to.

                LFS




                -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
                http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
                -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

                Comment

                Working...