Jump to content

InvertRect API errors out on windows


Recommended Posts

Hey guys and gals,

I've come into a problem... I'm making an _InvertRect() functions, and the code is as followed:

Func _InvertRect($title, $x1, $y1, $x2, $y2)
    Local $hwnd, $DC, $RECT, $ret
    $hwnd = WinGetHandle($title)
    $DC = DLLCall ("gdi32.dll", "hwnd", "GetDC", "hWnd", $hwnd)
    $RECT = DllStructCreate("long;long;long;long")
    DllStructSetData($RECT, 1, $x1)
    DllStructSetData($RECT, 1, $x2)
    DllStructSetData($RECT, 1, $y1)
    DllStructSetData($RECT, 1, $y2)
    $ret = DlLCall("user32.dll", "int", "InvertRect", "hwnd", $DC, "ptr", $RECT)
    Return $ret[0]
EndFunc

;Testing...
MsgBox(0, "_InverRect", _InvertRect("", 0, 0, 10, 10))

When I run this, I get the windows error message that AutoIt3 has errored out or something, not an AutoIt error... With the "Send and Do Not Send" buttons... Is there a reason for this?

Thanks! :)

EDIT: Requires latest BETA.

EDIT2: Fixed the GetDC call, but same error from windows...

Edited by layer
FootbaG
Link to post
Share on other sites

ARGH!! I don't get it, I just coded up like 1,000,000 DllStruct, DllCall's and I looked at them now and they all look like they should be (how you coded them)... I think it's because I'm thinking about someone :)... :D

BTW,

Those DllStruct DllCall's I was coding were for your challenge :evil: I'm up to the BitBlt parts... I know there is a little of it is wrong too, I'll look at it again tomorrow.

Thanks! :D

FootbaG
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...