Click here to Skip to main content
15,885,875 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: irc via socket Pin
Adno23-Oct-07 14:59
Adno23-Oct-07 14:59 
GeneralRe: irc via socket Pin
Mark Salsbery24-Oct-07 6:07
Mark Salsbery24-Oct-07 6:07 
GeneralRe: irc via socket Pin
Adno24-Oct-07 9:03
Adno24-Oct-07 9:03 
GeneralRe: irc via socket Pin
Mark Salsbery24-Oct-07 10:59
Mark Salsbery24-Oct-07 10:59 
GeneralRe: irc via socket Pin
Moak8-Nov-07 12:16
Moak8-Nov-07 12:16 
QuestionCommunication between windows forms Pin
UnHolyKnight55523-Oct-07 11:35
UnHolyKnight55523-Oct-07 11:35 
AnswerRe: Communication between windows forms Pin
Hamid_RT23-Oct-07 20:48
Hamid_RT23-Oct-07 20:48 
QuestionSave image to bitmap Pin
JBAK_CP23-Oct-07 10:35
JBAK_CP23-Oct-07 10:35 
Hello...I'm trying to save an image that I captured to the clipboard to a bitmap image. and i've been unable to do so....I can open MS Paint and paste to save my image (Therefore I can confirm that part of the code works), but i'm trying to do it from within my executable. I tried to use 'CImage' to attach and save, but did not have any success under VC 6.0(Undeclared identifier for CImage). Any help would be greatly apperciated, Thanks!

Using VC++ 6.0, MFC dialog based

//Code that I have to capture image to clipboard

BOOL FullWnd;<br />
	FullWnd = TRUE;<br />
	CWnd *wnd=GetActiveWindow(); <br />
	HDC hdc;<br />
	HBITMAP m_Bitmap,m_OldBitmap,hMainBmp ;<br />
<br />
	 CDC dc;<br />
     if(FullWnd)<br />
        { /* full window */<br />
         hdc = ::GetWindowDC(wnd->m_hWnd);<br />
         dc.Attach(hdc);<br />
        } /* full window */<br />
     else<br />
        { /* client area only */<br />
         hdc = ::GetDC(wnd->m_hWnd);<br />
         dc.Attach(hdc);<br />
        } /* client area only */<br />
<br />
     CDC memDC;<br />
     memDC.CreateCompatibleDC(&dc);<br />
<br />
     CBitmap bm;<br />
     CRect r;<br />
     if(FullWnd)<br />
        wnd->GetWindowRect(&r);<br />
     else<br />
         wnd->GetClientRect(&r);<br />
<br />
     CString s;<br />
     wnd->GetWindowText(s);<br />
     CSize sz(r.Width(), r.Height());<br />
     bm.CreateCompatibleBitmap(&dc, sz.cx, sz.cy);<br />
     CBitmap * oldbm = memDC.SelectObject(&bm);<br />
     memDC.BitBlt(0, 0, sz.cx, sz.cy, &dc, 0, 0, SRCCOPY);<br />
<br />
	 BitBlt(memDC, 0,0,sz.cx,sz.cy, hdc,0,0,SRCCOPY); <br />
	 hMainBmp =(HBITMAP) SelectObject(memDC, oldbm);<br />
<br />
     wnd->GetParent()->OpenClipboard();<br />
     ::EmptyClipboard();<br />
     ::SetClipboardData(CF_BITMAP, bm.m_hObject);<br />
     CloseClipboard();<br />
<br />
     memDC.SelectObject(oldbm);<br />
     bm.Detach();  <br />
 <br />
<br />
     //***THIS DIDNT' WORK<br />
      /*<br />
	CImage m_Image;<br />
	m_Image.Attach(hMainBmp);<br />
	m_Image.Save("c:\\test.bmp");<br />
     */<br />
<br />

AnswerRe: Save image to bitmap Pin
Neo Andreson23-Oct-07 18:09
Neo Andreson23-Oct-07 18:09 
AnswerRe: Save image to bitmap Pin
Hamid_RT23-Oct-07 20:46
Hamid_RT23-Oct-07 20:46 
Questionhelp me Pin
lgbean23-Oct-07 9:47
lgbean23-Oct-07 9:47 
Questionrun-time created control handling Pin
mr_Tuborg23-Oct-07 9:00
mr_Tuborg23-Oct-07 9:00 
AnswerRe: run-time created control handling Pin
David Crow23-Oct-07 10:06
David Crow23-Oct-07 10:06 
GeneralRe: run-time created control handling Pin
mr_Tuborg23-Oct-07 18:45
mr_Tuborg23-Oct-07 18:45 
AnswerRe: run-time created control handling Pin
Mark Salsbery23-Oct-07 10:19
Mark Salsbery23-Oct-07 10:19 
GeneralRe: run-time created control handling Pin
mr_Tuborg23-Oct-07 18:39
mr_Tuborg23-Oct-07 18:39 
AnswerRe: run-time created control handling Pin
Stephen Hewitt23-Oct-07 16:31
Stephen Hewitt23-Oct-07 16:31 
GeneralRe: run-time created control handling Pin
Mark Salsbery24-Oct-07 5:06
Mark Salsbery24-Oct-07 5:06 
QuestionDetect right-click on Tab Header Pin
neil478123-Oct-07 8:58
neil478123-Oct-07 8:58 
AnswerRe: Detect right-click on Tab Header Pin
Mark Salsbery23-Oct-07 10:23
Mark Salsbery23-Oct-07 10:23 
GeneralRe: Detect right-click on Tab Header Pin
neil478123-Oct-07 10:42
neil478123-Oct-07 10:42 
GeneralRe: Detect right-click on Tab Header Pin
Mark Salsbery23-Oct-07 11:16
Mark Salsbery23-Oct-07 11:16 
GeneralRe: Detect right-click on Tab Header Pin
neil478123-Oct-07 11:23
neil478123-Oct-07 11:23 
QuestionNavigate a IE Window to some other site Pin
vikrant kpr23-Oct-07 8:46
vikrant kpr23-Oct-07 8:46 
QuestionRe: Navigate a IE Window to some other site Pin
David Crow23-Oct-07 10:12
David Crow23-Oct-07 10:12 

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.