user arrays and VARIANT *

Discussion in 'C++' started by gilnux, Nov 30, 2006.

  1. gilnux

    gilnux Guest

    Hi all

    I've got nearly 2 years experience programming in C and image
    processing. Now I have to migrate one of my applications to a MFC
    interface. I am having problems with the VARIANT variable. Let's see.

    I have been using Matrox Imaging Lybrary (MIL). With this library, I
    can load an image and pass this image into a C array using the function
    MbufGet() and perform all my calculations using C.

    If my image is 256 pixels wide and 192 pixels high, I need to create a
    two dimensions array. If my image is 8 bits depth, I have to use an 8
    bits variable, that is, I use unsigned char.

    So I declare my array:

    unsigned char myArray[192][256]

    and I have my image loaded: myImageBuffer

    So I use the function

    MbufGet(myImageBuffer, myArray)

    and just it, the value of each pixel is transferred to each element of
    myArray.

    Now I have to do exactly the same in my MFC interface. I have to use
    now ActiveMIL instead of MIL. Now my imageBuffer is an object of the
    class CImage1 with a method Get().

    So I load my image from a file:

    imageBuffer.Load("myfile.tif");

    and when I use the Get() method, like:

    imageBuffer.Get(myArray, ...)

    I get errors like:

    CImage1::Get : cannot convert parameter 1 from 'unsigned char
    [192][256]' to 'VARIANT *'

    I check the declaration of the Get() method and it looks like:

    void Get(VARIANT * UserArray, ...

    I have spent several days trying to get information about VARIANT but I
    haven't got any clue, I still don't know how to transfer my image
    from a buffer to an array.

    Any hint? Any help of suggestion is welcomed.

    Many thanks
     
    gilnux, Nov 30, 2006
    #1
    1. Advertising

  2. gilnux

    mlimber Guest

    gilnux wrote:
    > I've got nearly 2 years experience programming in C and image
    > processing. Now I have to migrate one of my applications to a MFC
    > interface. I am having problems with the VARIANT variable. Let's see.

    [snip]
    > Now I have to do exactly the same in my MFC interface. I have to use
    > now ActiveMIL instead of MIL. Now my imageBuffer is an object of the
    > class CImage1 with a method Get().
    >
    > So I load my image from a file:
    >
    > imageBuffer.Load("myfile.tif");
    >
    > and when I use the Get() method, like:
    >
    > imageBuffer.Get(myArray, ...)
    >
    > I get errors like:
    >
    > CImage1::Get : cannot convert parameter 1 from 'unsigned char
    > [192][256]' to 'VARIANT *'
    >
    > I check the declaration of the Get() method and it looks like:
    >
    > void Get(VARIANT * UserArray, ...
    >
    > I have spent several days trying to get information about VARIANT but I
    > haven't got any clue, I still don't know how to transfer my image
    > from a buffer to an array.
    >
    > Any hint? Any help of suggestion is welcomed.


    Variants are a common need (Boost has one, too, for instance), but
    specific third-party implementations like this are off-topic here. Try
    in a Microsoft-specific group. A description of what is on-topic here
    and a list of some other groups you might consider can be found here:

    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9

    Cheers! --M
     
    mlimber, Nov 30, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. cr88192
    Replies:
    3
    Views:
    586
    cr88192
    Sep 7, 2005
  2. Thilanga

    Handling VARIANT Arrays

    Thilanga, Sep 8, 2003, in forum: C++
    Replies:
    2
    Views:
    3,659
    Thomas Matthews
    Sep 8, 2003
  3. Adem
    Replies:
    10
    Views:
    625
    Old Wolf
    Nov 12, 2008
  4. Adem
    Replies:
    10
    Views:
    497
    Old Wolf
    Nov 12, 2008
  5. Philipp
    Replies:
    21
    Views:
    1,186
    Philipp
    Jan 20, 2009
Loading...

Share This Page