Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

ColorPalette For ReadImage

Hi, I'm trying to use the CWIMAQViewer to load and display a bitmap from a .bmp file on my hard drive.
I program an MFC apllication.

I use:

    m_Image1 = m_Vision.CreateCWIMAQImage();
    CCWIMAQPalette somePalette = m_Viewer1.get_Palette();
    unePal.SetType(4096);
    m_Viewer1.Attach(m_Image1);

    m_Vision.ReadImage(m_Image1, "C:\\scr2.bmp", somePalette );

Of course it doesn't work becasue ReadImage wants a VARIANT for the last parmeter ColorPalette.
This last parameter should be optional, but of course, it is not.
If I try to redefine the ReadImage function in my wrapped CWIMAQVision class :

    long ReadImage(LPDISPATCH DestImage, LPCTSTR Path)                                                                                 //, VARIANT ColorPalette)
    {
        long result;
        static BYTE parms[] = VTS_DISPATCH VTS_BSTR VTS_VARIANT ;
        InvokeHelper(0x107, DISPATCH_METHOD, VT_I4, (void*)&result, parms, DestImage, Path);                          //, &ColorPalette);
        return result;
    }


Then, it compiles, it runs, but doesn't work because some exception is catched in OleDisp.cpp.........

plesae:
How to simply Read an Image in VC++
in order to make a CWIMAQImage
that will be displayed in the nice CWIMAQViewer ?

thanks.


0 Kudos
Message 1 of 3
(3,513 Views)
and is there a simple way to DISPLAY in a CWIMAQViewer an 8 bit (or 12bit) gray scale image just from a buffer like char* where the information is realy stored ?
0 Kudos
Message 2 of 3
(3,511 Views)

Hello Gael,

Please see the link below:
http://forums.ni.com/ni/board/message?board.id=231&message.id=3988&requireLogin=False

Sanaa T

Sanaa T.
National Instruments France

0 Kudos
Message 3 of 3
(3,447 Views)