CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    281

    How To Display .png

    Alright, I have a .png I want to load into a .dll so it will show up when I inject it into a game. How can I load a .png?

  2. #2
    Join Date
    Jun 2005
    Location
    Chennai , India
    Posts
    1,375

    Thumbs up Re: How To Display .png

    Quote Originally Posted by Rehorav
    Alright, I have a .png I want to load into a .dll so it will show up when I inject it into a game. How can I load a .png?
    To display a PNG file in dialog box, do the following in the OnPaint
    function of the dialog. Have a CStatic control in the dialog where the file
    is to be displayed.
    Code:
    .h file
    CStatic m_Pic
    Code:
    .cpp file
    OnPaint(...)
    {
    ...
    CPaintDC dc(CWnd::FromHandle(m_Pic.m_hWnd));
    CGdiplusPicture pic;
    pic.LoadPicture(strPathToPNGFile);
    pic.Render(dc.GetSafeHdc(), rcRender, 0L);
    ....
    }
    Edit :Have you tried GDI+
    Last edited by jayender.vs; July 30th, 2006 at 02:43 AM. Reason: Added info
    It takes seconds for rating…that actually compensates the minutes taken for giving answers
    The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
    Regards, Be generous->Rate people
    Jayender!!

  3. #3
    Join Date
    Nov 2005
    Posts
    281

    Re: How To Display .png

    Well, I need to load the .png, like stored as a resource, and be able to place it in co-ords X,Y. Its not in a dialog box, but I'm injecting the .dll into a game and I want to have the .png display when its injected.

  4. #4
    Join Date
    Jul 2005
    Location
    E: 120°.6, N: 31°.3′
    Posts
    795

    Re: How To Display .png

    Your .dll has already been ready for your case ??
    You just wanna realize loading your .png file by using .dll to inject into a game , right ????

    If I have not understand your case yet , pls. attach your project with zip format here .
    Little by little one goes far
    Keep moving.......!
    Nothing is impossible !

  5. #5
    Join Date
    Oct 2000
    Location
    India
    Posts
    4,620

    Thumbs up Re: How To Display .png

    Hi,

    You can use either GDI+ as mentioned by jayender.vs or you can take a
    look at a free open source library called CxImage if you need to do raw
    processing of the image data.
    All luck and have a great day.

    Regards,
    V.Girish

    Visit www.geocities.com/contactgirish for Source code, Tutorials, FAQs and Downloads.

  6. #6
    Join Date
    Mar 2006
    Posts
    31

    Re: How To Display .png

    If you need to load a png from your resource file, it's a little more involved but you can do it with GDI+. Let me know if you want me to post some code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured