Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Capture image of window with scrolling
#1
I am trying to capture a image with scrolling. Is it possible with QM?
#2
Could you give an example? Like to capture whole web page even if part of it is invisible? Then store to the clipboard?
#3
Something like this:


Attached Files Image(s)
   
#4
QM will not do this. I know one method - WM_PRINT - but it only works in the calling process, and is not perfect. I believe you can find a specialized application for this.
#5
and for capture a region?
#6
Lucas, QM is a macro program, not a screen capturing/manipulation program.
#7
I thought that there was some DLL for it, sorry.
#8
Function CaptureRect

Code:
Copy      Help
;/
function# x y wid hei [$saveToBmpFile] [&getHbitmap]

;Captures a rectangle region on the screen.
;Can save the captured bitmap to a bmp file, or get bitmap handle, or store to the clipboard.
;If saveToBmpFile and getHbitmap not used, stores to the clipboard.
;Returns 1 on success, 0 on failure.


;x, y, wid, hei - rectangle coordinates.
;saveToBmpFile - will save to this bmp file. Use "" if don't want to save.
;getHbitmap - int variable that receives bitmap handle. Use 0 if not needed. Later call DeleteObject.


;EXAMPLE
;CaptureRect 100 100 200 200



#if QMVER<0x02020000
dll gdi32
,#CreateCompatibleBitmap hDC nWidth nHeight
,#BitBlt hDestDC x y nWidth nHeight hSrcDC xSrc ySrc dwRop
dll user32
,#OpenClipboard hWnd
,#EmptyClipboard
,#SetClipboardData wFormat hMem
,#CloseClipboard
def SRCCOPY          0xCC0020
#endif

int dcs=GetDC(0) ;;get screen device context
int dc=CreateCompatibleDC(0) ;;create memory device context
int bm=CreateCompatibleBitmap(dcs wid hei) ;;create bitmap
int oldbm=SelectObject(dc bm) ;;select it into the memory dc
BitBlt(dc 0 0 wid hei dcs x y SRCCOPY) ;;copy from screen dc to memory dc

int r(1) action

if(len(saveToBmpFile)) ;;save
,action|1
,r=SaveBitmap(bm saveToBmpFile)
,
if(&getHbitmap and r) ;;get HBITMAP
,action|2
,getHbitmap=bm
,
if(!action) ;;store to the clipboard
,r=OpenClipboard(_hwndqm)
,if(r)
,,EmptyClipboard
,,r=SetClipboardData(CF_BITMAP bm)!0
,,CloseClipboard

;release memory
ReleaseDC(0 dcs)
SelectObject(dc oldbm)
DeleteObject(dc)
if(action&2=0) DeleteObject(bm)

ret r
#9
Perfect.
Thank you very much
#10
Hi, have you found a better way?
If not, can you show me an example of how to use WM_PRINT?
#11
Cannot use WM_PRINT in QM. And probably it gets only the visible part.
Need to scroll somehow. Either with mouse, or with messages such as WM_VSCROLL, or with accessible object functions. Then CaptureImageOnScreen.
#12
Can you show me how to know how many WM_VSCROLL to send and then how to join the images?
#13
I afraid it's too difficult for me.
#14
WM_VSCROLL works with less apps than accessible objects. Probably does not work with web browsers.

-----

Found nothing useful in stackoverflow.
#15
Can you use the code: https://github.com/ShareX/ShareX?
#16
Yes. In the source code find the functions that are used to capture scrolling window. Create new class library project in Visual Studio, add the code there, make dll. Use the dll in QM.
#17
It's too difficult for me.
Can you help?
#18
I can help only with the "Use the dll in QM" part.


Forum Jump:


Users browsing this thread: 1 Guest(s)