LoadImage From DIB?

Discussion in 'MFC' started by syg19, Jul 14, 2010.

  1. syg19

    syg19 New Member

    Joined:
    Jul 14, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello, I am trying to take an image which has been loaded to the DIB and display it (right now I'm just trying to get it to display on the "main window" anyway possible, picturebox would be ideal but isn't necessary at the moment. Anyway here is my code:

    Code:
    int loadjpgfilefrombuffer(LPTSTR fname, imgdes *image)
    { ....
       HDC hDC;
       PAINTSTRUCT ps;
       HPALETTE hpal;
    
       hDC = BeginPaint(NULL, &ps);
       /* Display the image beginning at (0,0) */
       viewimageex(NULL, hDC, &hpal, 0, 0, &image,0,0,VIEWDITHER);      
       EndPaint(NULL, &ps);
    }
    
    The part of code I left out is a function that takes an image file (jpg) and allocates a DIB to load it into then loads it.

    I am getting the following error:

    error C2664: 'viewimageex' : cannot convert parameter 6 from 'imgdes **__w64 ' to 'imgdes *'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

    If you have any thoughts or advice please share them. I can provide more information if needed just ask didn't want to post all the code as it wasn't relevant. Thank you.


    EDIT: I did a reinterpret cast to get it to imgdes* so now it runs fine with no errors but no image is displayed? Can anyone help?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice