Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Free Drawing with OnScreenDraw for telestrator function
Hi Gintaras,
I am trying to use the On-screendraw functions to make a small telestrator program. But it only works if I move really slow because of the absolute time difference between when the position is sampled and flickers a lot. I realize that a better way would be to gather all the positions that the mouse goes through and then "paint" those positions but not really sure how to do this. Any ideas?
Thanks, S

Macro OSD FreeDraw
Copy      Help
int color=ColorFromRGB(255 0 0)
POINT p1 p2 p3 pp
xm p1; pp=p1
int h m
,ifk((1)) m=1; else if(m) break
,xm p2
,OnScreenDraw(p2.x p2.y 20 20 &OSD_Proc_Red_Light 0 210)
,xm p3
,OnScreenDraw(p3.x p3.y 20 20 &OSD_Proc_Red_Light 0 210)
,if(!memcmp(&pp &p2 sizeof(POINT))) continue
wait 0.01

Use window handle
,int h=OnScreenDraw(...... h)

maybe don't call OnScreenDraw 2 times. They draw the same. But maybe your callback function draws differently, I don't know.
I tried rewriting it as you suggested but still getting spotty instead of continuous tracing.
Here is my current latest version: Note: Win-T triggers, then press t to cause trace with mouse movement (telestrator) and then double click t to erase. Can press and release t to make multiple tracings before double clicking to clear/end function

Function Telestrator
Trigger Wt     Help - how to add the trigger to the macro
Copy      Help
int color=ColorFromRGB(255 0 0)
POINT p1 p2 p3 pp
xm p1; pp=p1
int h m
,,wait 0.1 K t
,,,,ifk(t) m=1; else if(m) break
,,,,xm p2
,,,,h = OnScreenDraw(p2.x p2.y 10 10 &OSD_Proc_Red_Light 0 210 h)
,,,,if(!memcmp(&pp &p2 sizeof(POINT))) continue
,,wait 0.4 KF t;err continue

II think for smoother tracing, I will need to get the exact coordinates that the mouse cursor went through and then paint them sequentially. This seems like it should be possible through GetMouseMovePointsEx but don't know how to implement in QM. I am looking at

but not successful yet at converting msdn stuff into QM.

Any thoughts?
Why using h for flags?

The code could be simpler than your last version. And probably don't need to collect mouse points.
sorry if I made it unnecessarily confusing but the h was the window hwnd not for flags...maybe I put it in the wrong place.
either way, if you move mouse too quickly in tracing mode, it creates gaps between circles instead of a continuous tracing/drawing line.
If I got all the points from GetMouseMovePoints, then could create continuous trace but maybe there is a simpler way.
I tried getting the x and y with a hook procedure taken from other stuff in the forum but got still same disconnected tracing.
Thanks for trying to help me with this,
Hi Gintaras,
Sorry to bug you about this. The GetMouseMovePoints function would be useful for telestrator as well as gesture functions where it is important to know over what onscreen elements the gesture included (like lasso gesture).
I can't seem to figure out how to import this MSDN function into QM. Any suggestions?
Thanks, S
Windows Mobile 6.5 This topic has not yet been rated - Rate this topic A version of this page is also available for
Windows Embedded CE 6.0 R3

This function retrieves points, associated with WM_LBUTTONDOWN and WM_MOUSEMOVE messages, that the OS typically discards when an application cannot process these messages as fast as the application receives these messages.


BOOL WINAPI GetMouseMovePoints(
PPOINT pptBuf,
UINT nBufPoints,
UINT* pnPointsRetrieved
[out] Pointer to an array of POINT structures. This buffer contains the points retrieved from the current mouse move.

[in] Unsigned integer that specifies the size, in points, of the buffer passed in the pptBuf parameter.

[out] Pointer to an unsigned integer. This parameter contains the number of points actually retrieved into the pptBuf buffer.

Return Value
TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError.

This function allows an application to track mouse or stylus input at a somewhat higher resolution than the resolution of the display screen. This behavior improves inking performance. This function does not draw the ink, but just allows you to collect the points more easily so that another function can draw the ink.

This function is not supported for emulation.

Use GetMouseMovePointsEx, don't need to import somehow.
I think I meant GetMouseMovePointsEx instead of GetMouseMovePoints but still don't know how to use it in QM. I don't find anything in the search or system functions.
It's Windows API, look in MSDN library. I never used it, not sure if it would be useful in on-screen drawing, anyway, can draw without it, it will probably just make more difficult.
ok, I understand, but still can't get the drawing to be continuous with Onscreendraw. It still skips spaces when I move mouse too quickly. Strange.
Thanks, S
If delay is 10 ms, should not skip. Can try even 5 or 2. Mouse messages are not sent at such high rate. Probably highest is 10 ms.
If need 100% reliable, use low-level mouse hook. Some examples should be in this forum.
Also, make sure it draws always in the same window, ie use handle properly.

Forum Jump:

Users browsing this thread: 1 Guest(s)