Dark Machine писал(а):- Код: Выделить всё
#COMPILE EXE
#DIM ALL
#INCLUDE "win32api.inc"
SUB DrawLine(StartX AS LONG, StartY AS LONG, EndX AS LONG, EndY AS LONG, LineStyle AS LONG, LineWidth AS LONG, LineColor AS LONG)
LOCAL Pnt AS POINTAPI, y AS INTEGER, PenHND, DeskTopDc, z AS LONG
DeskTopDc = GetWindowDC(GetDesktopWindow)
PenHND = CreatePen(LineStyle, LineWidth, LineColor)
z = SelectObject(DeskTopDc, PenHND)
y = MoveToEx(DeskTopDc, StartX, StartY, Pnt)
y = LineTo(DeskTopDc, EndX, EndY)
END SUB
FUNCTION PBMAIN
DrawLine 100, 100, 300, 300, %PS_Solid, 1, %RED
MSGBOX "Red line on desktop!"
END FUNCTION
Добавлю некоторое уточнение:
After painting is complete, the ReleaseDC function must be called to release the device context. Not releasing the window device context has serious effects on painting requested by applications.