Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CaptureImageOrColor : Continuous recording of the dimensions
#1
I need to monitor the dimensions of the rectangle being drawn in CaptureImageOrColor function. With the following statements I can do that, but after a rectangle is drawn. Could you please advice for a continuous recording while the rectangle is being drawn? Many thanks in advance.

Function tempf08
Code:
Copy      Help
,if(d.flags&32) DT_Ok hDlg; ret
,d.inmenu=1
,int cx cy
,cx=d.r.right-d.r.left
,cy=d.r.bottom-d.r.top
,str sm=F"{d.r.top} {d.r.bottom} {d.r.left} {d.r.right} : {cx} - {cy}"
,ShowTooltip_Smart sm -1 10 10 300 7 "Rectangle dimensions"
,z=ShowMenu(_s hDlg 0 2)
,shutdown -6 0 "ShowTooltip_Smart"

,d.inmenu=0
,if(!z) ret
#2
Add your code below d.erase=DrawFocusRect(dc &d.r). Not tested.
#3
Dear Gintaras,

Many thanks for this advice. Actually, I had tested it but my problem is that once in sub.Dlg the code loops until left button is up, and the [OK. Cancel etc] listbox is displayed. During this period, ie. from starting drawing until left button is up, everything on the display is frozen, and no QM output is displayed. Everything accumulated in QM output is displayed after left button is up. It is worth mentioning that even the system tray clock is not updated during this period. I am still trying to find the actual statement which freezes the display. Best regards.
#4
The reason is what tells you the tooltip: "Note: this is snapshot, not real windows...". It is a full-screen window (hDlg) covering all other windows. To display something, use eg OnScreenDisplay or some other topmost window, or even draw the text in hDlg.
#5
Thank you for a very clear and extremely helpful explanation. I will try it and let you know.
#6
Thanks again, it works perfectly. As always, I feel much indebted.


Attached Files
.zip   CaptureImageOrColor_SES.zip (Size: 4.71 KB / Downloads: 370)
#7
Very nice tool, could you provide this missing function "ShowTooltip_Smart"?
#8
You may look in thread :
Tooltip

Best regards
#9
Even though I could not find the exact match but I could use "ShowTooltip" function to substitute and it works just fine.
Thanks for a useful tool.
#10
Actually, "ShowTooltip_Smart" is almost the same function, with little localization.
#11
I see. Thanks for clarification. Big Grin
#12
Dear Gintaras,
I need to continuously monitoring, while the mouse is moved, the pointer position. Therefore, I made three modifications to your code, as it follows :

Function tempf08
Code:
Copy      Help
,SetCapture hDlg
;,r.right=66; r.bottom=86; OffsetRect &r -d.xs+d.xmagn -d.ys; InvalidateRect hDlg &r 0 ;;erase magnifier
,r.right=66; r.bottom=100; OffsetRect &r -d.xs+d.xmagn -d.ys; InvalidateRect hDlg &r 0 ;;erase magnifier
,
,case WM_MOUSEMOVE
,xm p hDlg 1
,dc=GetDC(hDlg)
,if(hDlg!=GetCapture) ;;draw magnifier/color
;,,r.right=66; r.bottom=86; OffsetRect &r -d.xs+d.xmagn -d.ys ;;calc frame
,,r.right=66; r.bottom=100; OffsetRect &r -d.xs+d.xmagn -d.ys ;;calc frame
,,if(PtInRect(&r p.x p.y)) d.xmagn=iif(d.xmagn 0 300); InvalidateRect hDlg &r 0; goto gr ;;move away
,,z=GetStockObject(BLACK_BRUSH); FrameRect dc &r z; r.top+65; FrameRect dc &r z ;;draw frames
,,StretchBlt(dc r.left+1 r.top-64 64 64 d.bms.dc p.x p.y 16 16 SRCCOPY) ;;draw magnifier
;,,draw color
;,,_s.format("0x%06X" GetPixel(d.bms.dc p.x p.y))
,,_s.format("0x%06X[]%s" GetPixel(d.bms.dc p.x p.y) F"{p.x}-{p.y}")
,,InflateRect &r -1 -1; FillRect dc &r 1+COLOR_WINDOW; r.left+2; r.top+2
,,z=SelectObject(dc _hfont); DrawTextW dc @_s -1 &r 0; SelectObject(dc z)


It works satisfactorily. However, I would appreciate your comments. Thank you in advance.


Forum Jump:


Users browsing this thread: 1 Guest(s)