Jump to content
Sign in to follow this  
uzi17

can autoit do this? - drawing lines

Recommended Posts

uzi17

i want to make something where it will draw a coloured line horizontal, and verticle on my screen, acting like a cross hair i can use in a first person shooter game. the sniper does not have a crosshair when unscoped so i thought having the lines would help.

can auto it do this? if so can someone lead me into the right direction.

thanks

Share this post


Link to post
Share on other sites
FireFox

@uzi17

already asked so many times ! please make search on forum !

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Andreik

i want to make something where it will draw a coloured line horizontal, and verticle on my screen, acting like a cross hair i can use in a first person shooter game. the sniper does not have a crosshair when unscoped so i thought having the lines would help.

can auto it do this? if so can someone lead me into the right direction.

thanks

Try this:

HotKeySet("{ESC}","Quit"); Press ESC to quit
Global $CENTER_X = Int(@DesktopWidth/2)
Global $CENTER_Y = Int(@DesktopHeight/2)
$REFRESH = InputBox("DrawLines","Refresh time","5")
While 1
    DrawLines()
    Sleep(GUICtrlRead($REFRESH*1000))
WEnd

Func DrawLines()
    $DC = DllCall ("user32.dll", "int", "GetDC", "hwnd", "")
    For $INDEX = $CENTER_X - 25 To $CENTER_X + 25
        DrawPixel($DC,$INDEX,$CENTER_Y,0x00FF00)
    Next
    For $INDEX = $CENTER_Y - 25 To $CENTER_Y + 25
        DrawPixel($DC,$CENTER_X,$INDEX,0x00FF00)
    Next
EndFunc
    
Func DrawPixel($hDC,$X,$Y,$COLOR)
    DllCall ("gdi32.dll", "long", "SetPixel", "long", $hDC[0], "long", $X, "long", $Y, "long", $COLOR)
EndFunc

Func Quit()
    Exit
EndFunc
Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
FireFox

@Andreik

...this men will continue to ask questions without search on forum because you give him the answer :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Andreik

@Andreik

...this men will continue to ask questions without search on forum because you give him the answer :)

Cheers, FireFox.

Although many threads seem to be identical but you can not get the same thing to them. Maybe this question it was asked before, but do not want to hijack other threads with his questions.

Regards,

Andreik


When the words fail... music speaks

Share this post


Link to post
Share on other sites
monoceres

@Andreik, you've got a memory leak in your code, you need to use ReleaseDC after you're done with a device context.

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
FireFox

@Andreik

As I saw, he wanna draw pixel function. after have found the function, if he want more information about it he has just to ask his question with the function example :)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Andreik

@Andreik, you've got a memory leak in your code, you need to use ReleaseDC after you're done with a device context.

:)

Thanks monoceres. I didn't saw. I'll fix it.

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×