Jump to content

Gdi32 Calls How Do I Draw On An App Using This Dll?


Recommended Posts

I am attempting to draw on a window using the gdi32.dll dllcall, to no luck as I cannot even get the getpixel function in it to work and return anything but a blank.

I need assistance in this endeavor, it is for a game called RuneScape, and I am trying to make a FILLED SQUARE with the pixel color under the mouse to the left of the game window (it is a java game and has a margin on both sides)... AND I am trying to DRAW an UNFILLED box (not square, but rectangular) on the actual game area, to show an area that is to be searched.

I have worked out several things...

1. Autodropper (legit, works on own items, used for powermining, ie. you mine a full inventory of ore and then drop as you don't need it, then keep mining till full again, then repeat. Has MSGBOX that asks how many you want to drop MAX of 28 = FULL INV)

2. Autorun change (switch from run to walk, does a pixel checksum to see what is on at the moment, then uses and if statement to compare to the predetermined checksum value I have hardcoded into the script)

3. Tab switcher (game is tab based, inv in one, atk style another, run another, stats another, etc... Soon to incorporate checksums on those to determine what tab you are in, so no extra calls to tab switch functions are needed if you are already in that tab)

4. Username and password stored in registry, so future runs of program can auto populate logon screen.

5. Want to Sell/Buy/Trade sender inputbox with optional formatting codes you can type, and then number of times to send (max of 9, has 10sec delay between each so no spamming!) keeps previous sent message so if nobody responded you can send again

I need this assistance on the gdi32 calls. Please give links or whatever code you may be able to help with

so that I may draw on this game window...

Thanks in advance,

Onoitsu2

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Link to comment
Share on other sites

I got it to work... somewhat I cannot draw on the java applet as it will not show up for long, and I do not wish to burn up cpu time with too short a sleep delay. BUT what I did get to work is the little box that updates the color that is at the mouse coords...

$color_Black = 0x000000
Func RunescapeColorFind()
    if $colorfind = 0 then
    
    $colorfind = 1
    While $colorfind
    ToolTip("Put mouse over color then press F3",$StatusPos[0] + 20,$StatusPos[1])
    $color = PixelGetColor(MouseGetPos(0),MouseGetPos(1))
    Opt("ColorMode",1)
    $pix = PixelGetColor(MouseGetPos(0),MouseGetPos(1))
    Opt("ColorMode",0)
    $pix = Hex($pix,6)
    $pix = "0x" & $pix
        for $a = 30 to 40 Step 1
            for $b = 330 to 340 step 1
                DllCall ("gdi32.dll", "long", "SetPixel", "long", $runedc[0], "long", $a, "long", $b, "long", $pix)
            next
        next
        Sleep(100)
    WEnd
    Else
    $colorfind = 0
    Return
    EndIf
    for $a = 30 to 40 Step 1
     for $b = 330 to 340 step 1
            DllCall ("gdi32.dll", "long", "SetPixel", "long", $runedc[0], "long", $a, "long", $b, "long", $color_Black)
     next
    next
    ToolTip("")
    Return $color
EndFunc

Above code helps you to find a certain colored pixel, then returns the color, and sets the display area back to black.

HotKeySet("{F3}","RunescapeColorFind")
    $color = Call("RunescapeColorFind")
    HotKeySet("{F3}")

Above code is in the function that calls the colorfind function

Func Terminate()
    if WinActive("RuneScape - the massive online adventure game by Jagex Ltd") Then
    Call("HotKeysUnbind")

    for $a = 30 to 40 Step 1
     for $b = 330 to 340 step 1
            DllCall ("gdi32.dll", "long", "SetPixel", "long", $runedc[0], "long", $a, "long", $b, "long", $color_Black)
     next
    next
    DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0,  "int", $runedc)
    Exit 0
    EndIf
EndFunc

Above code is the terminate function (condensed to that section) that sets that section back to black if you exit while still in the colorfind function.

Things I have made:[font="Trebuchet Ms"]_CheckTimeBlock UDF(LT)MOH Call Ignore List (MOH = Modem On Hold)[/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...