CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2000
    Location
    Rotterdam, Netherlands
    Posts
    115

    Problems with Picture object in memory

    I have this routine to make a screencapture.
    The result is a Picture object.
    Then i do the following:

    set Picture1.picture= ResultPicture




    The pictures shows as it should.

    Then when i try to use the Picture1.Picture.handle as parameter for another function, it fails.

    When i repeat the same but first save the Picture1.Picture to disk with savepicture and then load it again with LoadPicture, everything goes fine!

    What is the difference in data stored in a Picture Object after screencapture, and after loading it from disk?

    If someone needs the source to understand the problem then let me know, it's to large to fit into this post.







  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Problems with Picture object in memory

    Picture box actually has 2 things!.. One picture and another Image.. Try using the .Image property it may work

    it is something to do with 2 DCs and internal management for easy blitting, overlays etc..

    RK

  3. #3
    Join Date
    Aug 2000
    Location
    Rotterdam, Netherlands
    Posts
    115

    Re: Problems with Picture object in memory

    Tried using Image and stuff.. none works...

    This might clear-up the problem:

    This one works:

    set Picture1.Picture = modScreenCapture.CaptureScreen
    SavePicture Picture1.Picture, "c:\test1.bmp"
    set Picture1.Picture = LoadPicture("c:\test1.bmp")

    If m_cDib.LoadByCapture(Picture1.Picture.handle) then
    ...




    This one doesn't work:

    set Picture1.Picture = modScreenCapture.CaptureScreen
    'SavePicture Picture1.Picture, "c:\test1.bmp"
    'set Picture1.Picture = LoadPicture("c:\test1.bmp")

    If m_cDib.LoadByCapture(Picture1.Picture.handle) then
    ...




    Why?

    What is actually happening with the imagedata after saving and loading it from file and if someone knwos, how can i alter this data so that it will be acceptd by the latter function, without saving to disk first...

    One would say: why not save to disk first?!
    I can't, because this routine must be runned about 5 times a second, and you can imagine that it will not increase the speed ;-)

    Thanx in advance!



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