Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Programm zum erstellen einer Linie


  • Please log in to reply
10 replies to this topic
harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

Ok hi :D

 

also ich suche eine Möglichkeit quasi einen Ankerpunkt im Zentrum des Desktop zu machen und von dort aus eine gerade Linie bis zu meinem Mauszeiger. Je nachdem wohin ich meinen Mauszeiger bewege soll die Linie natürlich auch mitkommen, idial wäre wenn ich noch die Möglichkeit hätte die Auflösung einstellen könnte für den Ankerpunkt (zb. 800x600/1024x768 etc). Ich habe schon etwas rumgesucht aber nichts gefunden das funktioniert außer einem AHK script welches zwar genau das amcht was ich will, ich aber dadurch nichts anderes mehr anklicken kann und mein PC einfriert.

Ich bin echt für jedes bischen Hilfe dankbar und falls das noch wichtig ist, es geht um Win7 32bit.

 

MfG



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Kannst du das AHK script mal posten.


Visit the new forum ahkscript.org.

http://ahkscript.org


harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

Ja klar http://www.file-uplo...eOptv2.zip.html <-- das ist die Surce welche dem am nächsten kommt.



harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

Hier is noch eins das ich gefunden habe nur das es für die 800x600 Auflösung ist.

; <COMPILER: v1.0.47.3>
WinGetPos, XXX, YYY, Width, Height, [Conquer2.0]
XXX+=400
YYY+=300
XXB=%XXX%
YYB=%YYY%
XXA=%XXX%
YYA=%YYY%
XXB+=480
YYB+=350
XXA-=480
YYA-=370

#Persistent
Menu, Tray, Icon, Shell32.dll, 44
Gui, Add, DropDownList, w53 x5 y10 Choose12 vColorChoice, Aqua|Black|Blue|Fuchsia|Gray|Green|Lime|Maroon|Navy|Olive|Purple|Red|Silver|Teal|White|Yellow|
Gui, Add, DropDownList, w53 x5 y35 Choose2 vwww, 1|2|3|4|5|6|7|8|9|FUN|
Gui, +toolwindow
Gui, Add, Button, x60 y10 w35 h47 vButton gStart, Reset
Gui, Show, x1 y1 h100 w150, Line

Gui, Show

Start:


Gui, Submit, Hide

CoordMode, Mouse, Screen

if www=FUN
{
www=99
}

Black    = 000000
Green    = 008000
Silver    = C0C0C0
Lime       = 00FF00
Gray       = 808080
Olive       = 808000
White    = FFFFFF
Yellow    = FFFF00
Maroon    = 800000
Navy    = 000080
Red       = FF0000
Blue       = 0000FF
Purple    = 800080
Teal       = 008080
Fuchsia    = FF00FF
Aqua    = 00FFFF
blank = 000001

Gui, 1:+LastFound +AlwaysOnTop +ToolWindow
Gui, 1:-Caption
Gui, 1:Color, 000001
WinSet, TransColor, 000001
GuiHwnd := WinExist()
Gui, 1:Show
Gui, 1:Maximize
SetTimer, DrawLine, 100
return

DrawLine:
MouseGetPos, M_x, M_y

if (M_x >= XXA and M_y >= YYA and M_x <= XXB and M_y <= YYB)
{
If (M_x != Old_M_x or M_y != Old_M_y)
   WinSet, Redraw,, ahk_id %GuiHwnd%

Canvas_DrawLine(GuihWnd, XXX, YYY, M_x, M_y, www, %ColorChoice%)
Canvas_DrawLine(GuihWnd, M_x, M_y, M_x, M_y, 30, blank)
}

Old_M_x := M_x
Old_M_y := M_y

return


esc::exitapp


Canvas_DrawLine(hWnd, p_x1, p_y1, p_x2, p_y2, p_w, p_color)
   {

   hDC := DllCall("GetDC", UInt, hWnd)
   hCurrPen := DllCall("CreatePen", UInt, 0, UInt, p_w, UInt, Convert_BGR(p_color))
   DllCall("SelectObject", UInt,hdc, UInt,hCurrPen)
   DllCall("gdi32.dll\MoveToEx", UInt, hdc, Uint,p_x1, Uint, p_y1, Uint, 0 )
   DllCall("gdi32.dll\LineTo", UInt, hdc, Uint, p_x2, Uint, p_y2 )
   DllCall("ReleaseDC", UInt, 0, UInt, hDC)
   DllCall("DeleteObject", UInt,hCurrPen)
   }


Convert_BGR(RGB)
   {
   StringLeft, r, RGB, 2
   StringMid, g, RGB, 3, 2
   StringRight, b, RGB, 2
   Return, "0x" . b . g . r
   }



-----

Hoffe jemand kann mir weiter helfen :)



harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

irgend jemand ne Idee ?



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Der Code sollte Funktionieren und dich nicht beim arbeiten stören:

CoordMode,Mouse,Screen
Gui, +LastFound +AlwaysOnTop +ToolWindow
Gui, -Caption
Gui, Color, 000001
WinSet, TransColor, 000001
Gui, show
Gui, Maximize
Loop
{
Canvas_DrawTheLine(3, "000000")
sleep,20
}
Canvas_DrawTheLine( p_w, p_color)
   {
   static mouseoldx,mouseoldy
   MouseGetPos, P2x, P2y
   If ((p2x!=mouseoldx)||(P2y!=mouseoldy))
   {
   WinSet, Redraw
   }
   mouseoldx:=P2x,mouseoldy:=P2y
   hDC := DllCall("GetDC", UInt, WinExist())
   hCurrPen := DllCall("CreatePen", UInt, 0, UInt, p_w, UInt, Convert_BGR(p_color))
   DllCall("SelectObject", UInt,hdc, UInt,hCurrPen)
   DllCall("gdi32.dll\MoveToEx", UInt, hdc, Uint,A_ScreenWidth//2, Uint, A_ScreenHeight//2, Uint, 0 )
   DllCall("gdi32.dll\LineTo", UInt, hdc, Uint, p2x-p_w-1, Uint, p2y+((A_ScreenHeight//2<p2y)?p_w+1:-p_w-1) )
   DllCall("ReleaseDC", UInt, 0, UInt, hDC)
   DllCall("DeleteObject", UInt,hCurrPen)
   }

Convert_BGR(RGB)
   {
   StringLeft, r, RGB, 2
   StringMid, g, RGB, 3, 2
   StringRight, b, RGB, 2
   Return, "0x" . b . g . r
   }

Visit the new forum ahkscript.org.

http://ahkscript.org


harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

#Edit

- AHK geupdated und ich kann es starten.

- Doch leider kann ich nicht anderes machen sobald das Script an ist, weder ordner oder noch irgend etwas      anderes lässt dich dann bewegen. unsure.png



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Welches Windows benutzt du?


Visit the new forum ahkscript.org.

http://ahkscript.org


harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

win7 32bit



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Versuch das hier mal:

    CoordMode,Mouse,Screen
    Gui, +LastFound +AlwaysOnTop +ToolWindow
    Gui, -Caption
    Gui, Color, 000001
    WinSet, TransColor, 000001
    Gui, show
    Gui, Maximize
    Loop
    {
    Canvas_DrawTheLine(3, "000000")
    sleep,20
    }
    Canvas_DrawTheLine( p_w, p_color)
    {
    static mouseoldx,mouseoldy
    MouseGetPos, P2x, P2y
    If ((p2x!=mouseoldx)||(P2y!=mouseoldy))
    {
    WinSet, Redraw
    }
    mouseoldx:=P2x,mouseoldy:=P2y
    hDC := DllCall("GetDC", UInt, WinExist())
    hCurrPen := DllCall("CreatePen", UInt, 0, UInt, p_w, UInt, Convert_BGR(p_color))
    DllCall("SelectObject", UInt,hdc, UInt,hCurrPen)
    p2x-=A_ScreenWidth
    p2y-=A_ScreenHeigth    
If ((p2y**2>p_w**2)&&(p2x**2>p_w**2))
{
    p2x:=((p2x**2**0.5)-(p_w+1))*(p2x<0?-1:1)+A_ScreenWidth//2
    p2y:=((p2y**2**0.5)-(p_w+1))*(p2y<0?-1:1)+A_ScreenHeight//2
    DllCall("gdi32.dll\MoveToEx", UInt, hdc, Uint,A_ScreenWidth//2, Uint, A_ScreenHeight//2, Uint, 0 )
    DllCall("gdi32.dll\LineTo", UInt, hdc, Uint, p2x, Uint, p2y)
}   
    DllCall("ReleaseDC", UInt, 0, UInt, hDC)
    DllCall("DeleteObject", UInt,hCurrPen)
 }
     
    Convert_BGR(RGB)
    {
    StringLeft, r, RGB, 2
    StringMid, g, RGB, 3, 2
    StringRight, b, RGB, 2
    Return, "0x" . b . g . r
    }

Visit the new forum ahkscript.org.

http://ahkscript.org


harris1386
  • Members
  • 7 posts
  • Last active: Jun 22 2013 07:20 PM
  • Joined: 09 Jun 2013

Das geht noch weniger als das vorher, es lässt sich weiterhin nichts anklicken und die Linie folgt diesmal dem Zeiger nicht sondern blinkt einfach nur rum :/