| | |
Screen to file problem
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2006
Posts: 46
Reputation:
Solved Threads: 1
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.
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.
![]() |
Similar Threads
- Big problem with a Compaq Presario 5410US (Troubleshooting Dead Machines)
- Write to Screen and File{I-O question} (C++)
- Windows xp setup problem (Windows NT / 2000 / XP)
- Screen Resolution in KDE (*nix Software)
- Lines are being skipped in the input file. (Visual Basic 4 / 5 / 6)
- Mandrake 9.2 Screen Res problem (Window and Desktop Managers)
Other Threads in the C++ Forum
- Previous Thread: Calculate sin(x)
- Next Thread: Trouble compiling static-linking library
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion convert count data database delete desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game generator getline google graph homeworkhelper iamthwee ifstream input int integer java lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






