Thread: insert/add a GIF image in VC++ 6.0

  1. #1
    Registered User
    Join Date
    Aug 2006
    Location
    Colombo
    Posts
    3

    insert/add a GIF image in VC++ 6.0

    Hi..

    Someone please help me to insert/add a GIF image in VC++ 6.0. And also I want to change the image's position (In XY Coordinates) and to rotate the Image in specified angles.(rotate only the image not the whole panel in the frame)

    I tried with GDI+..But failed to work with GDI+ in VC++ 6.0

    It is better if you can provide me some sample codes to do that.

    I need someones help in the above matter...



    Thanks

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>I tried with GDI+..But failed<<

    Assuming you have a version of the psdk installed that includes gdi+, it should be fine for working with gifs. Post some code and any error messages associated with that code.

    >>I want to change the image's position (In XY Coordinates) and to rotate the Image<<

    Search google for rotation and translation.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Aug 2006
    Location
    Colombo
    Posts
    3

    Question Error in compiling

    I have Downloaded and installed the Platform SDK Redistributable: GDI+ (File Name: gdiplus_dnld.exe Version: 3102.1360 ) to the computer.But I cannot compile GDI+ included project .It says that no such directory or file.The error code is given below.



    Compiling resources...
    Compiling...
    StdAfx.cpp
    d:\_thisara\gdi_c++\gdi++\stdafx.h(22) : fatal error C1083: Cannot open include file: 'gdiplus.h': No such file or directory
    Error executing cl.exe.

    Please tell me what else I have to do inorder to proceed with GDI+

    Thanks

    Thisara
    tdk02

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Make sure the gdiplus headers and lib are in your compiler's include and lib directories. If they're not then modify your compiler settings to point to those directories. Alternatively, but only as a quick fix, you can #include the file by enclosing its full name and path in quotes(""); similarly you can use a #pragma comment(lib,"gdiplus.lib") to link the gdiplus library. But you really should modify the compiler settings to search the include and lib paths for the psdk.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Registered User
    Join Date
    Aug 2006
    Location
    Colombo
    Posts
    3
    Hi,

    Finally I was able to succefuly use GDI + in VC++ 6.0 .

    i needed to change the position and rotate a GIF image in given angles as per user inputs in a MFC application .

    So I started to use Image object in GDI+.My intention was to make a Image object and manupulate its position and orientation.(As given in msdn page titled Drawing, Positioning, and Cloning Images - refer the link below)

    http://msdn.microsoft.com/library/de...wofGDIPlus.asp[^]

    I tried to insert a image to my main frame using "Image" in GDI+. But a runtime error (unhandled exception) is occuring when im going to run the program.The details are as follows.

    I have included "gdiplus.h" in StdAfx.h. There were no issues on that.But the problem started when i tried to insert a image using the guidelines given in above msdn link(.Drawing, Positioning, and Cloning Images - GDI+)


    As per that method I used the following code:
    Code:
    CPaintDC dc(this);
    Graphics myGraphics(dc.m_hDC);
    
    Image myImage(L"robot.gif"); // this line creates the problem
    myGraphics.DrawImage(&myImage, 20, 10);
    The program Built & compiled successfully in VC++ 6.0.But didn't run.It gaves a error.

    When I insert that code to a .NET project the error message says that ;"Unhandled exception at 0x7c9105f8 in tttdk.exe: 0xC0000005: Access violation reading location 0x00000010."
    When I break it , it shows the location of the error in the following cpp file.

    D:\VS\VC\atlmfc\src\atl\atls\allocate.cpp

    ..
    Code:
    ...
    
    CAtlTraceCategory *CAtlAllocator::GetCategory(int iCategory) const
    
    {
    
    if(iCategory == m_pProcess->CategoryCount())
    
    return NULL;
    
    
    
    ATLASSERT((iCategory < m_pProcess->CategoryCount()) || (iCategory == -1));
    
    CAtlTraceCategory *pCategory = NULL;
    
    if(iCategory >= 0)
    
    {
    
    BYTE *pb = reinterpret_cast(m_pProcess) + m_pProcess->MaxSize(); // this is the location of the error
    
    pCategory = reinterpret_cast(pb) - iCategory - 1;
    
    }
    
    return pCategory;
    
    }
    ..............
    Please help me regarding the above matter ASAP.or else tell me way to Insert a GIF image to a MFC frame and to change its position and rotate by given angles time to time.


    Thisara




    ENTC
    UoM
    Last edited by Ken Fitlike; 08-14-2006 at 09:50 AM. Reason: code tags added, unreadable colours removed

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. reading gif image pixel Information-help
    By kapil1089thekin in forum C Programming
    Replies: 2
    Last Post: 05-17-2008, 01:13 AM
  3. Help!!!! How to Identify Image block or image separator in GIF 89a
    By kapil1089thekin in forum C Programming
    Replies: 1
    Last Post: 05-06-2008, 10:53 AM
  4. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 04:20 PM
  5. Can't compile this with VC 6.0
    By uriel2013 in forum C++ Programming
    Replies: 4
    Last Post: 05-31-2003, 07:43 PM