Jump to content

Recommended Posts

Posted

Heh, cool, some are not correct. For example, _User32_WindowFromPoint() is not correct. When you see a structure specified as a parameter as opposed to a handle or pointer to this structure, it means pushing all it's members (in the case of union it's the greatest sized members) on the stack and calling it. So it should be:

DllCall('user32.dll',"hwnd","WindowFromPoint","int", 100, "int", 200)

...for example.

Posted (edited)

Looks like good work!

Here are my recommendations:

- you can also make UDF for kernel32.dll, gdi32.dll, shell32.dll

- you can quite easily add also generated function header (look at WinAPI.au3)

- after each dllcall() add this: If @error Then Return SetError(@error, 0, 0)

- remove from your final UDF functions which are already in standard includes (WinAPI)

Edited by Zedna
Posted

Good, but unfortunately, most of these functions does not help the user work.

$Result = _User32_...(...)

vs

$Result = DllCall('user32.dll', ...)

$Result = $Result[0]

Usefulness is questionable. It would be better adapt to AutoIt with the user interests.

For example (from WinAPIEx.au3):

Func _WinAPI_GetKeyboardLayoutList()

    Local $Ret

    $Ret = DllCall('user32.dll', 'int', 'GetKeyboardLayoutList', 'int', 0, 'ptr', 0)
    If (@error) Or ($Ret[0] = 0) Then
        Return SetError(1, 0, 0)
    EndIf

    Local $tData = DllStructCreate('ptr[' & $Ret[0] & ']')

    $Ret = DllCall('user32.dll', 'int', 'GetKeyboardLayoutList', 'int', $Ret[0], 'ptr', DllStructGetPtr($tData))
    If (@error) Or ($Ret[0] = 0) Then
        Return SetError(1, 0, 0)
    EndIf
    
    Local $List[$Ret[0] + 1] = [$Ret[0]]
    
    For $i = 1 To $List[0]
        $List[$i] = BitAND(DllStructGetData($tData, 1, $i), 0xFFFF)
    Next
    Return $List
EndFunc   ;==>_WinAPI_GetKeyboardLayoutList

Your function:

func _User32_GetKeyboardLayoutList(  $nBuff, $lpList  )
    local $vRetVal = DllCall($User32,"UINT","GetKeyboardLayoutList","int",$nBuff,"hwnd*",$lpList)
    return $vRetVal[0]
EndFunc

Just for thought...

Posted (edited)

Good, but unfortunately, most of these functions does not help the user work.

$Result = _User32_...(...)

vs

$Result = DllCall('user32.dll', ...)

$Result = $Result[0]

Usefulness is questionable

Well, you don't have to know the data types.

I really prefer:

$iResult = _User32_IsChild(  $hWndParent, $hWnd  )

over

$iResult = DllCall($User32,"int","IsChild","hwnd",$hWndParent,"hwnd",$hWnd)
$iResult = $iResult[0]

Heh, cool, some are not correct. For example, _User32_WindowFromPoint() is not correct. When you see a structure specified as a parameter as opposed to a handle or pointer to this structure, it means pushing all it's members (in the case of union it's the greatest sized members) on the stack and calling it. So it should be:

Eerm, huh? Edited by Kip
  • 1 month later...
Posted

All you need to do now is to modify the down loader to help generate a help file for each one.

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

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