Click here to Skip to main content
15,895,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralFile exists Pin
act_x23-Dec-03 6:27
act_x23-Dec-03 6:27 
GeneralRe: File exists Pin
Joe Woodbury23-Dec-03 6:58
professionalJoe Woodbury23-Dec-03 6:58 
GeneralRe: File exists Pin
David Crow23-Dec-03 10:05
David Crow23-Dec-03 10:05 
GeneralGetting the Image of a WIndow Pin
vladimir_india23-Dec-03 6:27
vladimir_india23-Dec-03 6:27 
GeneralRe: Getting the Image of a WIndow Pin
l a u r e n23-Dec-03 7:13
l a u r e n23-Dec-03 7:13 
GeneralRe: Getting the Image of a WIndow Pin
vladimir_india23-Dec-03 20:52
vladimir_india23-Dec-03 20:52 
GeneralRe: Getting the Image of a WIndow Pin
Robert Kuster23-Dec-03 10:28
Robert Kuster23-Dec-03 10:28 
GeneralRe: Getting the Image of a WIndow Pin
vladimir_india23-Dec-03 21:05
vladimir_india23-Dec-03 21:05 
Hats off!
undoubtedly, its a great article.

But something strange happened when i used WM_PRINT. None of the windows got printed, except my very own application window.

Actually my application is kind of SPY++, so it identifies a window by mouse cursor position. The HWND is then send to the folowing function get_image().

following is the code snippet i'm using currently:

BOOL CVenomDlg::get_image(HWND hwnd)
{

HBITMAP hBitmap ;
HDC hdc,hdcMem;
BITMAP bitmap ;
RECT rc;

::GetWindowRect(hwnd,&rc);//get the bounding rectamgle

hdc=::GetDC(hwnd);//get the dc
hdcMem = ::CreateCompatibleDC (hdc) ;//create memory dc
hBitmap = ::CreateCompatibleBitmap (hdc, rc.right-rc.left, rc.bottom-rc.top) ;//create bitmap
::GetObject (hBitmap, sizeof (BITMAP), &bitmap) ;//get bitmap info into bitmap struct
::SelectObject (hdcMem, hBitmap) ;//make the bitmap as the surface of memory dc
::SendMessage(hwnd, WM_PRINT , (WPARAM) hdcMem,PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED);

::ReleaseDC(hwnd,hdc);

//copy the data to clipboard also!
::OpenClipboard(hwnd);

::EmptyClipboard();
::SetClipboardData(CF_BITMAP, hBitmap);
::CloseClipboard();

//the clipboard contains a black rectangle???

//copy the image to static control...
//my own stuff to copy the hdcMem contents to a
//static control
.
.
.
.

::DeleteObject(hdcMem);
::DeleteObject(hBitmap);

return(TRUE);
}


-Vladimir India
GeneralUrgent Help Needed Pin
Binayak23-Dec-03 6:12
Binayak23-Dec-03 6:12 
GeneralRe: Urgent Help Needed Pin
Jörgen Sigvardsson23-Dec-03 7:23
Jörgen Sigvardsson23-Dec-03 7:23 
GeneralRe: Urgent Help Needed Pin
Binayak23-Dec-03 7:34
Binayak23-Dec-03 7:34 
GeneralRe: Urgent Help Needed Pin
Jörgen Sigvardsson23-Dec-03 7:38
Jörgen Sigvardsson23-Dec-03 7:38 
GeneralRe: Urgent Help Needed Pin
WoutL23-Dec-03 22:26
WoutL23-Dec-03 22:26 
Generallong!=long? //RECT problem Pin
IndrekSnt23-Dec-03 5:09
IndrekSnt23-Dec-03 5:09 
GeneralRe: long!=long? //RECT problem Pin
Dominik Reichl23-Dec-03 5:20
Dominik Reichl23-Dec-03 5:20 
GeneralRe: long!=long? //RECT problem Pin
IndrekSnt23-Dec-03 5:26
IndrekSnt23-Dec-03 5:26 
GeneralRe: long!=long? //RECT problem Pin
Jörgen Sigvardsson23-Dec-03 7:12
Jörgen Sigvardsson23-Dec-03 7:12 
GeneralRe: long!=long? //RECT problem Pin
WoutL24-Dec-03 2:16
WoutL24-Dec-03 2:16 
QuestionHow detect of USB Web-Came connect on PC Pin
Vladimir Konychev23-Dec-03 4:45
Vladimir Konychev23-Dec-03 4:45 
Questionhow do I use slider control in VC6? Pin
gamerPotatoe23-Dec-03 3:37
gamerPotatoe23-Dec-03 3:37 
AnswerRe: how do I use slider control in VC6? Pin
David Crow23-Dec-03 4:24
David Crow23-Dec-03 4:24 
GeneralConvert an int to char array rep Pin
Anonymous23-Dec-03 2:58
Anonymous23-Dec-03 2:58 
GeneralRe: Convert an int to char array rep Pin
Ian Darling23-Dec-03 3:28
Ian Darling23-Dec-03 3:28 
GeneralRe: Convert an int to char array rep Pin
Anonymous23-Dec-03 4:21
Anonymous23-Dec-03 4:21 
GeneralRe: Convert an int to char array rep Pin
nde_plume23-Dec-03 4:19
nde_plume23-Dec-03 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.