load gif into program

This is a discussion on load gif into program within the Windows Programming forums, part of the Platform Specific Boards category; hey, i was wondering how easy it would be to load a gif into a program similarly to how you ...

  1. #1
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378

    load gif into program

    hey, i was wondering how easy it would be to load a gif into a program similarly to how you can load in a bitmap. that way at runtime, you dont have to give the user the program and a bunch of pictures. you can just give them the program and they can run with it.
    Registered Linux User #380033. Be counted: http://counter.li.org

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Have you looked at GDI+? Will handle GIF as well as BMP, JPG ect
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    i've got it downloaded but i haven't been able to find any helping reading material stating what function(s) i need to use to load the gifs.
    however, i did download a batch image editor and converted all of the gifs to bmps as well as resizing them, so now the only point would be for knowledge and to make my programs size smaller. although, compressed its only 74KB lol
    Registered Linux User #380033. Be counted: http://counter.li.org

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Look at the Image class. ie Image::FromFile()
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    two questions, just to be sure: this will work for win32 correct? because i dont do MFC..
    would i still declare the control as SS_BITMAP? and the pretend that the file is a bitmap, even though its a gif? i.e. would i still send a message to change the image using the IMAGE_BITMAP for the WPARAM, etc.?
    also - i downloaded the platform sdk from M$ from here: http://www.microsoft.com/downloads/d...displaylang=en
    and when i try to compile in Dev-C++ i'm getting a ........TON of errors:
    Code:
    gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include"  -I"C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include"   
    
    In file included from main.c:2:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:25: error: syntax error before "Gdiplus"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:26: error: syntax error before '{' token
    
    In file included from main.c:2:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:30: error: syntax error before '}' token
    
    In file included from C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:32,
                     from main.c:2:
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusBase.h:18: error: syntax error before "GdiplusBase"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusBase.h:19: error: syntax error before '{' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusBase.h:25: error: syntax error before "new"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusBase.h:29: error: syntax error before "delete"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusBase.h:33: error: syntax error before "new"
    
    In file included from C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:34,
                     from main.c:2:
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:521: error: syntax error before "type"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h: In function `ObjectTypeIsValid':
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:524: error: `type' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:524: error: (Each undeclared identifier is reported only once
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:524: error: for each function it appears in.)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h: At top level:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:548: error: `EmfPlusRecordType' undeclared here (not in a function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:548: error: enumerator value for `WmfRecordTypeSetBkColor' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:549: error: enumerator value for `WmfRecordTypeSetBkMode' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:550: error: enumerator value for `WmfRecordTypeSetMapMode' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:551: error: enumerator value for `WmfRecordTypeSetROP2' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:552: error: enumerator value for `WmfRecordTypeSetRelAbs' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:553: error: enumerator value for `WmfRecordTypeSetPolyFillMode' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:554: error: enumerator value for `WmfRecordTypeSetStretchBltMode' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:555: error: enumerator value for `WmfRecordTypeSetTextCharExtra' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:556: error: enumerator value for `WmfRecordTypeSetTextColor' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:557: error: enumerator value for `WmfRecordTypeSetTextJustification' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:558: error: enumerator value for `WmfRecordTypeSetWindowOrg' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:559: error: enumerator value for `WmfRecordTypeSetWindowExt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:560: error: enumerator value for `WmfRecordTypeSetViewportOrg' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:561: error: enumerator value for `WmfRecordTypeSetViewportExt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:562: error: enumerator value for `WmfRecordTypeOffsetWindowOrg' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:563: error: enumerator value for `WmfRecordTypeScaleWindowExt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:564: error: enumerator value for `WmfRecordTypeOffsetViewportOrg' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:565: error: enumerator value for `WmfRecordTypeScaleViewportExt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:566: error: enumerator value for `WmfRecordTypeLineTo' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:567: error: enumerator value for `WmfRecordTypeMoveTo' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:568: error: enumerator value for `WmfRecordTypeExcludeClipRect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:569: error: enumerator value for `WmfRecordTypeIntersectClipRect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:570: error: enumerator value for `WmfRecordTypeArc' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:571: error: enumerator value for `WmfRecordTypeEllipse' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:572: error: enumerator value for `WmfRecordTypeFloodFill' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:573: error: enumerator value for `WmfRecordTypePie' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:574: error: enumerator value for `WmfRecordTypeRectangle' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:575: error: enumerator value for `WmfRecordTypeRoundRect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:576: error: enumerator value for `WmfRecordTypePatBlt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:577: error: enumerator value for `WmfRecordTypeSaveDC' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:578: error: enumerator value for `WmfRecordTypeSetPixel' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:579: error: enumerator value for `WmfRecordTypeOffsetClipRgn' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:580: error: enumerator value for `WmfRecordTypeTextOut' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:581: error: enumerator value for `WmfRecordTypeBitBlt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:582: error: enumerator value for `WmfRecordTypeStretchBlt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:583: error: enumerator value for `WmfRecordTypePolygon' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:584: error: enumerator value for `WmfRecordTypePolyline' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:585: error: enumerator value for `WmfRecordTypeEscape' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:586: error: enumerator value for `WmfRecordTypeRestoreDC' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:587: error: enumerator value for `WmfRecordTypeFillRegion' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:588: error: enumerator value for `WmfRecordTypeFrameRegion' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:589: error: enumerator value for `WmfRecordTypeInvertRegion' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:590: error: enumerator value for `WmfRecordTypePaintRegion' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:591: error: enumerator value for `WmfRecordTypeSelectClipRegion' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:592: error: enumerator value for `WmfRecordTypeSelectObject' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:593: error: enumerator value for `WmfRecordTypeSetTextAlign' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:594: error: enumerator value for `WmfRecordTypeDrawText' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:595: error: enumerator value for `WmfRecordTypeChord' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:596: error: enumerator value for `WmfRecordTypeSetMapperFlags' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:597: error: enumerator value for `WmfRecordTypeExtTextOut' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:598: error: enumerator value for `WmfRecordTypeSetDIBToDev' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:599: error: enumerator value for `WmfRecordTypeSelectPalette' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:600: error: enumerator value for `WmfRecordTypeRealizePalette' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:601: error: enumerator value for `WmfRecordTypeAnimatePalette' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:602: error: enumerator value for `WmfRecordTypeSetPalEntries' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:603: error: enumerator value for `WmfRecordTypePolyPolygon' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:604: error: enumerator value for `WmfRecordTypeResizePalette' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:605: error: enumerator value for `WmfRecordTypeDIBBitBlt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:606: error: enumerator value for `WmfRecordTypeDIBStretchBlt' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:607: error: enumerator value for `WmfRecordTypeDIBCreatePatternBrush' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:608: error: enumerator value for `WmfRecordTypeStretchDIB' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:609: error: enumerator value for `WmfRecordTypeExtFloodFill' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:610: error: enumerator value for `WmfRecordTypeSetLayout' not integer constant
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:611: error: enumerator value for `WmfRecordTypeResetDC' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:612: error: enumerator value for `WmfRecordTypeStartDoc' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:613: error: enumerator value for `WmfRecordTypeStartPage' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:614: error: enumerator value for `WmfRecordTypeEndPage' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:615: error: enumerator value for `WmfRecordTypeAbortDoc' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:616: error: enumerator value for `WmfRecordTypeEndDoc' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:617: error: enumerator value for `WmfRecordTypeDeleteObject' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:618: error: enumerator value for `WmfRecordTypeCreatePalette' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:619: error: enumerator value for `WmfRecordTypeCreateBrush' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:620: error: enumerator value for `WmfRecordTypeCreatePatternBrush' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:621: error: enumerator value for `WmfRecordTypeCreatePenIndirect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:622: error: enumerator value for `WmfRecordTypeCreateFontIndirect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:623: error: enumerator value for `WmfRecordTypeCreateBrushIndirect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:624: error: enumerator value for `WmfRecordTypeCreateBitmapIndirect' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:625: error: enumerator value for `WmfRecordTypeCreateBitmap' not integer constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusEnums.h:626: error: enumerator value for `WmfRecordTypeCreateRegion' not integer constant
    In file included from C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/gdiplus.h:35,
                     from main.c:2:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:22: error: syntax error before string constant
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:24: error: syntax error before "DrawImageAbort"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:24: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:25: error: syntax error before "GetThumbnailImageAbort"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:25: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:75: error: syntax error before "Size"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:75: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:76: error: syntax error before "SizeF"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:76: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:77: error: syntax error before "Point"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:77: warning: data definition has no type or storage class
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:78: error: syntax error before "PointF"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:78: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:79: error: syntax error before "Rect"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:79: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:80: error: syntax error before "RectF"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:80: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:81: error: syntax error before "CharacterRange"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:81: warning: data definition has no type or storage class
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:116: error: syntax error before "SizeF"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:117: error: syntax error before '{' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:124: error: syntax error before '&' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:125: error: 'SizeF' redeclared as different kind of symbol
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:76: error: previous declaration of 'SizeF' was here
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h: In function `SizeF':
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:126: error: `Width' undeclared (first use in this function)
    
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:126: error: `size' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:127: error: `Height' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h: At top level:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:132: error: conflicting types for 'SizeF'
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:125: error: previous definition of 'SizeF' was here
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:132: error: conflicting types for 'SizeF'
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:125: error: previous definition of 'SizeF' was here
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h: In function `SizeF':
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:133: error: `Width' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:134: error: `Height' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h: At top level:
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:137: error: syntax error before "operator"
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:149: error: syntax error before '&' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h: In function `Equals':
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:163: error: syntax error before '}' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:215: error: conflicting types for 'Height'
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:162: error: previous definition of 'Height' was here
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:216: error: syntax error before '}' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:270: error: syntax error before '}' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:323: error: conflicting types for 'Y'
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:269: error: previous definition of 'Y' was here
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:324: error: syntax error before '}' token
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:459: error: parameter `bottom' is initialized
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:459: error: `a' undeclared (first use in this function)
    C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Include/GdiplusTypes.h:459: confused by earlier errors, bailing out
    
    make.exe: *** [main.o] Error 1
    
    Execution terminated
    so uh... ? whats wrong? lol thanks for your help



    /*------ Edit ------*/
    after including the lib & include paths in VC++ 2005 EE (i HAVE included such paths in Dev-C++ also) it seems to have no problems with the headers / libs / etc. it just doesn't like my code, lol which makes sense b/c i dont know what i'm doing :] but this is the code i'm trying:
    Code:
    #include <windows.h>
    #include <gdiplus.h>
    
    /*  Declare Windows procedure  */
    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
    
    /*  Make the class name into a global variable  */
    char szClassName[ ] = "WindowsApp";
    
    int WINAPI WinMain (HINSTANCE hThisInstance,
                        HINSTANCE hPrevInstance,
                        LPSTR lpszArgument,
                        int nFunsterStil)
    
    {
        HWND hwnd;               /* This is the handle for our window */
        MSG messages;            /* Here messages to the application are saved */
        WNDCLASSEX wincl;        /* Data structure for the windowclass */
    
        /* The Window structure */
        wincl.hInstance = hThisInstance;
        wincl.lpszClassName = szClassName;
        wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
        wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
        wincl.cbSize = sizeof (WNDCLASSEX);
    
        /* Use default icon and mouse-pointer */
        wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
        wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
        wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
        wincl.lpszMenuName = NULL;                 /* No menu */
        wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
        wincl.cbWndExtra = 0;                      /* structure or the window instance */
        /* Use Windows's default color as the background of the window */
        wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    
    
        /* Register the window class, and if it fails quit the program */
        if (!RegisterClassEx (&wincl))
            return 0;
    
        /* The class is registered, let's create the program*/
        hwnd = CreateWindowEx (
               0,                   /* Extended possibilites for variation */
               szClassName,         /* Classname */
               "Windows App",       /* Title Text */
               WS_OVERLAPPEDWINDOW, /* default window */
               CW_USEDEFAULT,       /* Windows decides the position */
               CW_USEDEFAULT,       /* where the window ends up on the screen */
               544,                 /* The programs width */
               375,                 /* and height in pixels */
               HWND_DESKTOP,        /* The window is a child-window to desktop */
               NULL,                /* No menu */
               hThisInstance,       /* Program Instance handler */
               NULL                 /* No Window Creation data */
               );
    
        /* Make the window visible on the screen */
        ShowWindow (hwnd, nFunsterStil);
    
        /* Run the message loop. It will run until GetMessage() returns 0 */
        while (GetMessage (&messages, NULL, 0, 0))
        {
            /* Translate virtual-key messages into character messages */
            TranslateMessage(&messages);
            /* Send message to WindowProcedure */
            DispatchMessage(&messages);
        }
    
        /* The program return-value is 0 - The value that PostQuitMessage() gave */
        return messages.wParam;
    }
    
    
    /*  This function is called by the Windows function DispatchMessage()  */
    
    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
        switch (message)                  /* handle the messages */
        {
            case WM_CREATE:
                 CreateWindowEx(0, TEXT("STATIC"), TEXT(""), WS_VISIBLE | WS_CHILD | SS_BITMAP,
                   15, 15, 71, 96, hwnd, (HMENU)100, GetModuleHandle(NULL), 0);
                 CreateWindowEx(0, TEXT("BUTTON"), TEXT("Load Image"), WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON | WS_TABSTOP,
                   15, 150, 70, 25, hwnd, (HMENU)101, GetModuleHandle(NULL), 0);
                 CreateWindowEx(0, TEXT("BUTTON"), TEXT("Exit"), WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | WS_TABSTOP,
                   15, 185, 70, 25, hwnd, (HMENU)102, GetModuleHandle(NULL), 0);
            break;
            case WM_COMMAND:
                 switch(LOWORD(wParam))
                 {
                     case 101:
                     {
                          Image *img = Image::FromFile("chick.gif");
                          SendMessage(GetDlgItem(hwnd, 100), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)img);
                     }
                     break;
                     case 102:
                          SendMessage(hwnd, WM_CLOSE, 0, 0);
                     break;
                 }
            break;
            case WM_CLOSE: DestroyWindow(hwnd);    
            case WM_DESTROY:
                PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
                break;
            default:                      /* for messages that we don't deal with */
                return DefWindowProc (hwnd, message, wParam, lParam);
        }
    
        return 0;
    }
    and these are the errors:
    .\main.cpp(93) : error C2065: 'Image' : undeclared identifier
    .\main.cpp(93) : error C2065: 'img' : undeclared identifier
    .\main.cpp(93) : error C2064: term does not evaluate to a function taking 1 arguments
    so is there a tutorial somewhere on using the function? MSDN wasn't much help for me here..
    Last edited by willc0de4food; 01-10-2006 at 01:15 AM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  6. #6
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,255
    That's probably because GDI+ is a C++ only. Why they've done that I don't know, but either way it'll never work in your C file.

    The cheaters' way to do it is:-
    Code:
    LPPICTURE LoadPicture(char *szFilename)
    {
       LPPICTURE lpPicture;
    
       // This is an OLE function, filename must be in Unicode
    #ifndef UNICODE
       unsigned short wzFilename[MAX_PATH];
       MultiByteToWideChar(GetACP(), MB_PRECOMPOSED, szFilename, -1, wzFilename, MAX_PATH);
    #else
       char *wzFilename;
       wzFilename = szFilename;
    #endif
       if (OleLoadPicturePath(wzFilename, NULL, 0, 0, &IID_IPicture, (void **)&lpPicture) != S_OK)
          return NULL;
    
       return lpPicture;
    }
    And when you want to show it on a DC:-
    Code:
    int iHiWidth, iHiHeight; // gives you size in HIMETRICs
    BITMAP bmp; // pixel size in here
    HBITMAP hbmp;
    
    lpPicture->lpVtbl->get_Width(lpPicture, &iHiWidth);
    lpPicture->lpVtbl->get_Height(lpPicture, &iHiHeight);
    lpPicture->lpVtbl->get_Handle(lpPicture, (OLE_HANDLE *)&hbmp);
    GetObject(hbmp, sizeof(BITMAP), &bmp);
    lpPicture->lpVtbl->Render(lpPicture, hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, 0, iHiHeight, iHiWidth, -iHiHeight, NULL);
    When you're finished with it, remember to:-
    Code:
    lpPicture->lpVtbl->Release(lpPicture);
    Depending on which version of Windows is being used, you may also need to call CoInitialize().
    Last edited by SMurf; 01-10-2006 at 06:34 AM.

  7. #7
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    iIi see. well thats definitely good to know, lol.
    i'm running xp pro

    thanks
    Registered Linux User #380033. Be counted: http://counter.li.org

  8. #8
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Smurf's code has some errors in the UNICODE handling. The strings should be declared as wide strings.

    Here is my code to load pictures. It uses pretty much the same technique as Smurf's, except I use OleLoadPicture instead of OleLoadPicturePath. This was because in my project I had to manipulate the buffer before I rendered it. In my code the picture is double buffered so it doesn't flicker, and it automatically resizes to fill the window that it is being rendered on. It should compile as it is.
    Code:
    #include <windows.h>
    #include <tchar.h>
    #include <ocidl.h>
    #include <olectl.h>
    #define HIMETRIC_PER_INCH 2540
    
    typedef struct tagPictureData
    {
    	IPicture	*IPic;
    	SIZE		sizeInPixels;
    	SIZE		sizeInHiMetric;
    
    } PictureData;
    
    
    void* LoadPicture(LPCTSTR name)
    {
    	HANDLE		hFile;
    	DWORD		dwFileSize, dwBytesRead;
    	LPVOID		pData;
    	HGLOBAL		hGlobal;
    	BOOL		bRet;
    	LPSTREAM	pStream = NULL;
    	HRESULT		hr;
    	LPPICTURE	lpPicture;
    	HDC			hdc;
    	int			nPixelsPerInchX, nPixelsPerInchY;
    	PictureData	*picData;
    	SIZE		sizeInHiMetric, sizeInPixels;
    	
    
    	hdc = GetDC(NULL);
    
    	/* Get the number of pixels on the screen */
    	nPixelsPerInchX = GetDeviceCaps(hdc, LOGPIXELSX);
    	nPixelsPerInchY = GetDeviceCaps(hdc, LOGPIXELSY);
    
    	ReleaseDC(NULL, hdc);
    
    
    	hFile = CreateFile(name,GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL);
    	if(hFile == INVALID_HANDLE_VALUE)
    		return NULL;
    
    	dwFileSize = GetFileSize(hFile,NULL);
    	if(dwFileSize == -1)
    	{
    		CloseHandle(hFile);
    		return NULL;
    	}
    
    	hGlobal = GlobalAlloc(GMEM_MOVEABLE,dwFileSize);
    	if(hGlobal == NULL)
    	{
    		CloseHandle(hFile);
    		return NULL;
    	}
    
    	pData = GlobalLock(hGlobal);
    	if(pData == NULL)
    	{
    		GlobalUnlock(hGlobal);
    		CloseHandle(hFile);
    		return NULL;
    	}
    
    	dwBytesRead = 0;
    	bRet = ReadFile(hFile,pData,dwFileSize,&dwBytesRead,NULL);
    
    	GlobalUnlock(hGlobal);
    	CloseHandle(hFile);
    
    	if(!bRet)
    	{
    		return NULL;
    	}
    
    	hr = CreateStreamOnHGlobal(hGlobal,TRUE,&pStream);
    	if(!(SUCCEEDED(hr)))
    	{
    		if(pStream)
    			pStream->lpVtbl->Release(pStream);
    
    		return NULL;
    	}
    	else if(pStream == NULL)
    	{
    		return NULL;
    	}
    
    	hr = OleLoadPicture(pStream,0,FALSE,&IID_IPicture,(LPVOID*)&lpPicture);
    
    	if(!(SUCCEEDED(hr)) || lpPicture == NULL)
    	{
    		pStream->lpVtbl->Release(pStream);
    		return FALSE;
    	}
    
    	pStream->lpVtbl->Release(pStream);
    
    	/* Get the picture's width in himetric */
    	hr = lpPicture->lpVtbl->get_Width(lpPicture,&sizeInHiMetric.cx);
    	if(hr != S_OK)
    	{
    		lpPicture->lpVtbl->Release(lpPicture);
    		return FALSE;
    	}
    
    	/* Get the picture's height in himetric */
    	hr = lpPicture->lpVtbl->get_Height(lpPicture,&sizeInHiMetric.cy);
    	if(hr != S_OK)
    	{
    		lpPicture->lpVtbl->Release(lpPicture);
    		return FALSE;
    	}
    
    	/* Convert HiMetric to pixels */
    	sizeInPixels.cx = (nPixelsPerInchX * sizeInHiMetric.cx +
    				HIMETRIC_PER_INCH / 2) / HIMETRIC_PER_INCH;
    	sizeInPixels.cy = (nPixelsPerInchY * sizeInHiMetric.cy +
    				HIMETRIC_PER_INCH / 2) / HIMETRIC_PER_INCH;
    
    	picData = malloc(sizeof(*picData));
    	memset(picData,0,sizeof(*picData));
    
    	picData->IPic = lpPicture;
    	picData->sizeInPixels = sizeInPixels;
    	picData->sizeInHiMetric = sizeInHiMetric;
    
    	return picData;
    }
    
    
    void DrawPicture(HWND hwnd, HDC hdc, void* hPicture)
    {
    	PictureData		*picData;
    	HPALETTE		hPaletteOld, hPaletteMemOld;
    	HRESULT			hr;
    	RECT			rc;
    	IPicture		*IPic;
    	OLE_HANDLE		hOlePalette;
    	float			winRatio, picRatio;
    	RECT			r;
    	int				diff;
    	HDC				hdcMem;
    	HBITMAP			bmp,bmpOld;
    		
    	memset(&r,0,sizeof(r));
    
    	picData = (PictureData*)hPicture;
    	if(picData == NULL || hdc == NULL || hwnd == NULL || picData->IPic == NULL) return;
    
    	IPic = picData->IPic;
    
    	/* Get the picture's palette */
    	hr = IPic->lpVtbl->get_hPal(IPic,&hOlePalette);
    	if(hr != S_OK)
    		return;
    
    	/* Select the picture's palette */
    	hPaletteOld = SelectPalette(hdc,(HPALETTE)hOlePalette,FALSE);
    	RealizePalette(hdc);
    
    	GetClientRect(hwnd,&rc);
    
    	winRatio = (float)rc.right / rc.bottom;
    	picRatio = (float)picData->sizeInPixels.cx / picData->sizeInPixels.cy;
    
    	if(winRatio > picRatio)
    	{
    		int width;
    
    		r.bottom = rc.bottom;
    		r.top = rc.top;
    
    		width = (int)(picRatio * rc.bottom);
    		diff = (rc.right - width) / 2;
    
    		r.right = width;
    		r.left = diff;	
    	}
    	else
    	{
    		int height;
    		r.right = rc.right;
    		r.left = 0;
    		height = (int)(rc.right / picRatio);
    		diff = (rc.bottom - height) / 2;
    		r.bottom = height;
    		r.top = diff;
    	}
    
    	hdcMem = CreateCompatibleDC(hdc);
    	bmp = CreateCompatibleBitmap(hdc,rc.right - rc.left, rc.bottom - rc.top);
    	bmpOld = SelectObject(hdcMem,bmp);
    	hPaletteMemOld = SelectPalette(hdcMem,(HPALETTE)hOlePalette,FALSE);
    	RealizePalette(hdcMem);
    
    	IPic->lpVtbl->Render(IPic,hdcMem,
    			r.left,
    			r.top,
    			r.right,
    			r.bottom,
    			0,
    			picData->sizeInHiMetric.cy,
    			picData->sizeInHiMetric.cx,
    			-picData->sizeInHiMetric.cy,
    			&rc);
    
    	BitBlt(hdc,0, 0, rc.right, rc.bottom,hdcMem, 0, 0, SRCCOPY);
    
    	SelectObject(hdcMem,bmpOld);
    	if(hPaletteMemOld)
    		SelectPalette(hdcMem,hPaletteMemOld,FALSE);
    
    	DeleteObject(bmp);
    	DeleteObject(hdcMem);
    
    	if (hPaletteOld != NULL) SelectPalette(hdc,hPaletteOld, FALSE);
    	if (hOlePalette)  DeleteObject((HPALETTE)hOlePalette);
    }
    
    void DeletePicture(void *hPicture)
    {
    	PictureData		*picData = (PictureData*)hPicture;
    
    	if(hPicture == NULL || picData->IPic == NULL)
    		return;
    
    	picData->IPic->lpVtbl->Release(picData->IPic);
    	free(picData);
    }

  9. #9
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    mm..i may be doing something wrong, but i saved it as a new win32 proj, C++ in dev-cpp n i got this:
    Code:
    LoadPic.cpp: In function `void* LoadPicture(const TCHAR*)':
    LoadPic.cpp:82: error: 'struct IStream' has no member named 'lpVtbl'
    LoadPic.cpp:91: error: invalid initialization of reference of type 'const IID&' from expression of type 'const IID*'
    C:/Dev-Cpp/include/olectl.h:313: error: in passing argument 4 of `HRESULT OleLoadPicture(IStream*, LONG, BOOL, const IID&, void**)'
    LoadPic.cpp:95: error: 'struct IStream' has no member named 'lpVtbl'
    LoadPic.cpp:99: error: 'struct IStream' has no member named 'lpVtbl'
    LoadPic.cpp:102: error: 'struct IPicture' has no member named 'lpVtbl'
    LoadPic.cpp:105: error: 'struct IPicture' has no member named 'lpVtbl'
    LoadPic.cpp:110: error: 'struct IPicture' has no member named 'lpVtbl'
    LoadPic.cpp:113: error: 'struct IPicture' has no member named 'lpVtbl'
    LoadPic.cpp:123: error: invalid conversion from `void*' to `PictureData*'
    
    LoadPic.cpp: In function `void DrawPicture(HWND__*, HDC__*, void*)':
    LoadPic.cpp:156: error: 'struct IPicture' has no member named 'lpVtbl'
    
    LoadPic.cpp:195: error: invalid conversion from `void*' to `HBITMAP__*'
    LoadPic.cpp:199: error: 'struct IPicture' has no member named 'lpVtbl'
    
    LoadPic.cpp: In function `void DeletePicture(void*)':
    LoadPic.cpp:230: error: 'struct IPicture' has no member named 'lpVtbl'
    
    make.exe: *** [LoadPic.o] Error 1
    should there b a lib linked?
    Registered Linux User #380033. Be counted: http://counter.li.org

  10. #10
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    My code was for C, you are compiling it as C++.

    So instead of
    x->lpVtbl->foo(x,...);
    you would do:
    x->foo(...);

    For example:
    Code:
    pStream->lpVtbl->Release(pStream);
    would be changed to
    Code:
    pStream->Release();
    LoadPic.cpp:123: error: invalid conversion from `void*' to `PictureData*'
    C++ requires you to explicitly cast this.

    I think that's all you need to change.

  11. #11
    Shibby willc0de4food's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    378
    well it was previously stated that GDI+ was strictly C++, so i figured any code posted thereafter was going to be C++. personally I like C better than C++ :] but thats def. good to know, lol



    bah...ich verstehe nicht. so by changing it to a C file and adding it to a dif. C project, i got more errors :[ :[
    Code:
     Compiler: Default compiler
    Building Makefile: "C:\Documents and Settings\Tim Hansen\My Documents\c\GDI\Makefile.win"
    Executing  make...
    make.exe -f "C:\Documents and Settings\Tim Hansen\My Documents\c\GDI\Makefile.win" all
    gcc.exe ../../CPP/GDI/main.o  -o "Project1.exe" -L"C:/Dev-Cpp/lib" -L"C:/Program Files/Microsoft Visual Studio 8/Microsoft Platform SDK/Lib" -mwindows  
    
    ../../CPP/GDI/main.o:main.c:(.text+0x1e4): undefined reference to `CreateStreamOnHGlobal@12'
    ../../CPP/GDI/main.o:main.c:(.text+0x236): undefined reference to `IID_IPicture'
    ../../CPP/GDI/main.o:main.c:(.text+0x251): undefined reference to `OleLoadPicture@20'
    collect2: ld returned 1 exit status
    
    make.exe: *** [Project1.exe] Error 1
    Last edited by willc0de4food; 01-10-2006 at 09:50 PM.
    Registered Linux User #380033. Be counted: http://counter.li.org

  12. #12
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Anytime you get errors that begin with "undefined reference to X", those are linker errors. What it means is that you are calling a function, or using a variable, but your linker can't find the function implementation anywhere. 9 times out of 10 this means you need to link to some external library.

    If you do a search for CreateStreamOnHGlobal, you see in the documentation that is needs to be linked to Ole32.dll. A similar search on OleLoadPicture gives us olepro32.dll.

  13. #13
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Sorry did not realise you were using C.

    I have only used GDI+ in C++. MSDN states it is for C/C++ so I did not think to mention that.

    You could try calling the image functions through the flat file Gdiplusflat.h (ensure Gdiplus.dll is linked) and try to bypass the C++ wrapper. This is not recomended though.

    Possibly worth a look, though is not in C but a mix of C and C++ using .cpp files.
    http://www.codeproject.com/vcpp/gdip...tion_in__c.asp
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  14. #14
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,255
    Quote Originally Posted by bithub
    Smurf's code has some errors in the UNICODE handling. The strings should be declared as wide strings.
    How so? I thought it worked quite well: if UNICODE isn't defined, convert the ANSI szFilename to wide wzFilename. Otherwise, szFilename will automatically be wide (sizeof(char) == 2) and nothing else is needed.

  15. #15
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Otherwise, szFilename will automatically be wide (sizeof(char) == 2) and nothing else is needed.
    How do you figure that szFilename will be a wide char string? Considering it's declared as a char*, that is impossible.
    If UNICODE is defined, you get:
    Code:
    char *wzFilename;  /* wzFilename is a regular char array */
    wzFilename = szFilename; /* this does nothing except assign the char array to another pointer */
    /* Here you get an error trying to pass a char* when the function wants an unsigned short* */
    if (OleLoadPicturePath(wzFilename, NULL, 0, 0, &IID_IPicture, (void **)&lpPicture) != S_OK)
          return NULL;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21