Sign in to follow this  
Followers 0
Kip

User32.au3

10 posts in this topic

#1 ·  Posted (edited)

Title says enough.

I created it with an automatic MSDN page downloader, so some of the datatypes can be wrong.

Let me know if you see any.

Anyway:

User32.au3

I hope you like it.

None of the functions have any descriptions. Just use MSDN for that.

Edited by Kip

Share this post


Link to post
Share on other sites



good work, where can i get the msdn page downloader?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#8 ·  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

Share this post


Link to post
Share on other sites

just function by name?

Where's the structure constant for the point variant?

Share this post


Link to post
Share on other sites

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


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

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  
Followers 0