Im using this code to draw a line with a mouse on top of all windows, Im using mouse hook to get mouse coordinates and on each mouse movement while right mouse button is down I'm drawing the line. Im using
NOTXORPEN
so I will be able to delete the line only by drawing it again.
Init
ScreenDC := GetDcEx(GetDesktopWindow,0,DCX_LOCKWINDOWUPDATE);
PenHandle := CreatePen(PS_SOLID,HitStorage.GetPenWidth,10);
SelectObject(ScreenDC ,PenHandle);
OldPenMode := SetRop2(ScreenDC, R2_NOTXORPEN);
MoveToEx(ScreenDC, X, Y, Nil);
I'm using this code on each mouse movement :
LineTo(ScreenDC, X, Y);
This code worked for 95,98,2000,XP windows ... and now with windows 7 its very very very slow!
For general, I wrote a mouse gestures program (written in 1999) in Delphi 3 using ONLY Windows API (mouse hook was written in VC because of Delphi BUG in version 3). The program is doing exactly what
StrokeIt
is Doing but somehow
StrokeIt
managed to figure out the solution to this annoying problem.
StrokeIt
Site for Downloading :
http://www.tcbmi.com/strokeit/[
^]
Please Help ,
Thanks!!