Jump to content

Recommended Posts

Posted

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

Posted (edited)

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
Posted

@Andreik

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

Cheers, FireFox.

Posted

@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

Posted

@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!

Posted

@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.

Posted

@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.

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
×
×
  • Create New...