Screen to file problem

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2006
Posts: 46
Reputation: toolmanx is an unknown quantity at this point 
Solved Threads: 1
toolmanx toolmanx is offline Offline
Light Poster

Screen to file problem

 
0
  #1
Nov 6th, 2008
I program using Win32 API's. I compile with Borland or Microsoft "CL".
I am on an XP machine. I use .cpp extensions to compile so C++ rules apply.

I'm trying to get the bytes from my screen and send them to a disk file.
I get a handle I call "MemDC" from the CreateCompatibleDC, use it in
a CreateDIBSection. I select the DIB into the "MemDC, then blit the
screenDC to MemDC. That works fine. I can blit it to hDC and repaint
it back to my screen as a test. No problem, that works.

My problem begins because the system sends the bytes to memory that I
can't seem to get to. I GlobalAlloc for "MyBits" with "ppvBits" pointing
to "MyBits" in DIBSection. I believe this is right. The blit "on my
machine" sends the bytes to 0x008F0020. "MyBits" on the heap starts
at 0x00820020 waiting for the bytes to come in. The bytes go to where
the system wants to send them. I accept that, but need them in "MyBits".

1. I don't know why DIBSection doesn't get "MyBits" filled in.

2. I can't memcpy from MemDC(0x008F0020) to MyBits(0x00800020)
because I don't know how to use the assigned DC handle to "MemDC" in
memcpy, as the memcpy source. Sorry, if I should know, I don't. I
thought I did, but nothing worked.

3. I tried to GlobalAlloc memory with "MemDC" as the pointer. I get
a DWORD pointer assigned to "MemDC" on GlobalLock but when
CreateCompatibleDC gets its handle, the handle does all the
work, not the pointer to the heap that I assigned. My heap section
with the DWORD pointer "MemDC" pointing to the assigned heap area
just sits there just like the area where "MyBits" points. The
blit ignores the "MemDC" pointer and plops the bytes where it
wants them.

I'll take any of three solutions. Since I have the bytes, memcpy
seems like a good way if I can find out how to use the handle to
"MemDC" as a source. I don't know why when blitting, DIB doesn't
get "MyBits" filled in. That would do the trick too. Lastly, I
considered using a Union but I'll bet I'd have trouble getting
the bytes into the Union. There must be an easy way to do this
but I'm having trouble seeing the trees because the forest
keeps getting in the way.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1,433
Reputation: William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of William Hemsworth has much to be proud of 
Solved Threads: 118
Sponsor
William Hemsworth William Hemsworth is online now Online
Nearly a Posting Virtuoso

Re: Screen to file problem

 
0
  #2
Nov 6th, 2008
Maybe this thread will help you Link
Last edited by William Hemsworth; Nov 6th, 2008 at 11:05 am.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 46
Reputation: toolmanx is an unknown quantity at this point 
Solved Threads: 1
toolmanx toolmanx is offline Offline
Light Poster

Re: Screen to file problem

 
0
  #3
Nov 7th, 2008
Thanks for the thread. It looks interesting. I have only given it a quick scan so far. I will carefully look it over in the next day or so and see if it solves the problem.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC