Re: [問題] 有擷取螢幕的功能嗎 ?

看板C_Sharp (C#)作者 (祝有情人終成父母)時間19年前 (2006/07/16 19:39), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
現在才看到這篇. 就是用GDI32作沒錯, (DirectX也行, 不過比較麻煩) 抓完圖之後記得要作cleanup: User32.ReleaseDC(User32.GetDesktopWindow(), hdcSrc); GDI32.DeleteDC(hdcDest); GDI32.DeleteObject(hBitmap); ※ 引述《icools (icools)》之銘言: : 謝謝我後來有找到了... : 先引入 GDI32 DLL : //for capture Screen : int hdcSrc = User32.GetWindowDC(User32.GetDesktopWindow()),hdcDest = GDI32.CreateCompatibleDC(hdcSrc), hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,GDI32.GetDeviceCaps(hdcSrc,8),GDI32.GetDeviceCaps(hdcSrc,10)); : GDI32.SelectObject(hdcDest,hBitmap); : GDI32.BitBlt(hdcDest,0,0,GDI32.GetDeviceCaps(hdcSrc,8), GDI32.GetDeviceCaps(hdcSrc,10), hdcSrc,0,0,0x00CC0020); : 之後hBitmap就會得到要擷取的圖片了.. : ※ 引述《xsoe (n/a)》之銘言: : : WinAPI: BitBlt : : or using DirectX -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.135.60.155
文章代碼(AID): #14kYMFIT (C_Sharp)
文章代碼(AID): #14kYMFIT (C_Sharp)