Yashied

WinAPIEx UDF

480 posts in this topic

Thanks again for the gigant WinAPI collection and maintenance! ;)

Happy new year to all www.autoitscript.com members!

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites



#82 ·  Posted (edited)

The library has been updated.

v2.1

Added functions

_WinAPI_DuplicateStruct

_WinAPI_EnumSystemLocales

_WinAPI_EqualStruct

_WinAPI_GetDateFormat

_WinAPI_GetTimeFormat

_WinAPI_GetSystemDefaultLCID

+ few examples

Changes

  • Added a few constants.
  • Fixed a bug related to the declaration of variables.
  • Renamed some internal functions.

WinAPI Extended UDF Library for AutoIt 3.3.0.0 is deprecated. This version will not be supported with the release of the next (after 3.3.2.0) AutoIt stable version. Use library for AutoIt 3.3.2.0.

Edited by Yashied

Share this post


Link to post
Share on other sites

#83 ·  Posted (edited)

Share this post


Link to post
Share on other sites

Thanks to the whole team that developed this UDF.

Using its _WinAPI_EnumProcessWindows function saved me a lot of time.

Keep up the good work hope to see more useful functions. :mellow:

Share this post


Link to post
Share on other sites

The library has been updated.

v2.2

Added functions

_WinAPI_EnumChildProcess

_WinAPI_EnumDeviceDrivers

_WinAPI_GetDeviceDriverBaseName

_WinAPI_GetDeviceDriverFileName

_WinAPI_GetParentProcess

_WinAPI_GetProcessName

_WinAPI_LockFile

_WinAPI_PathFindExtension

_WinAPI_PathFindFileName

_WinAPI_PathFindNextComponent

_WinAPI_PathGetArgs

_WinAPI_PathGetCharType

_WinAPI_PathGetDriveNumber

_WinAPI_PathIsExe

_WinAPI_PathIsFileSpec

_WinAPI_PathIsRelative

_WinAPI_PathIsSameRoot

_WinAPI_PathRenameExtension

_WinAPI_PathUnExpandEnvStrings

_WinAPI_PrintWindow

_WinAPI_QueryPerformanceCounter

_WinAPI_QueryPerformanceFrequency

_WinAPI_ShellChangeNotify

_WinAPI_ShellEmptyRecycleBin

_WinAPI_ShellFileOperation

_WinAPI_ShellGetSettings

_WinAPI_ShellQueryRecycleBin

_WinAPI_ShellSetSettings

_WinAPI_UnlockFile

+ few examples

Share this post


Link to post
Share on other sites

Great library :mellow:

Just a minor suggestion...

In _WinAPI_DllInstall change...

RunWait(@SystemDir & '\regsvr32.exe /s ' & $sPath)

to...

ShellExecuteWait(@SystemDir & '\regsvr32.exe','/s ' & $sPath)

and In _WinAPI_DllUninstall, change...

RunWait(@SystemDir & '\regsvr32.exe /s /u ' & $sPath)

to...

ShellExecuteWait(@SystemDir & '\regsvr32.exe','/s /u ' & $sPath)

This avoids a possible privileges issue because the run api does not transfer admin privileges where as the shellexecute api does.

There is also a better way of doing this that I am looking into that skips regsvr32.exe completely (and just relies on a couple DllCalls), but I don't have it entirely worked out yet.

Once again, great library!


_________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell

Share this post


Link to post
Share on other sites

#87 ·  Posted (edited)

Small update (version number has not changed).

_WinAPI_GetProcessCreationTime() and _WinAPI_RegQueryLastWriteTime() functions now returns a $tagFILETIME instead of $tagSYSTEMTIME structure (see examples).

Edited by Yashied

Share this post


Link to post
Share on other sites

Thanks


Share this post


Link to post
Share on other sites

Awesome work Yashied !


73 108 111 118 101 65 117 116 111 105 116

Share this post


Link to post
Share on other sites

Little Handy function from me

Func _WinAPI_GetFileType($hFile)
    $aRet = DllCall("kernel32.dll", "int", "GetFileType", "hwnd", $hFile)
    If (@error) Or (Not $aRet[0]) Then Return SetError(1, 0, False)
    Switch $aRet[0]
        Case 1
            Return SetError(0, 0, "DISK")
        Case 2
            Return SetError(0, 0, "FILE")
        Case 3
            Return SetError(0, 0, "PIPE")
        Case Else
            Return SetError(0, 0, "UNKNOWN")
    EndSwitch
EndFunc   ;==>_WinAPI_GetFileType

73 108 111 118 101 65 117 116 111 105 116

Share this post


Link to post
Share on other sites

#91 ·  Posted (edited)

;_WinAPI_ShellAppBarMessage
;Sends an appbar message to the system.
;
;Syntax
;UINT_PTR SHAppBarMessage( DWORD dwMessage, PAPPBARDATA pData );
;
;MSDN
;http://msdn2.microsoft.com/en-us/library/ms647647.aspx
;
;Author zHcH
;For more information,please visit
;http://hi.baidu.com/zhch_ao
#cs

Global Const $ABM_ACTIVATE = 0x06
Global Const $ABM_GETAUTOHIDEBAR = 0x07
Global Const $ABM_GETSTATE = 0x04
Global Const $ABM_SETSTATE = 0x0000000a
Global Const $ABM_GETTASKBARPOS = 0x05
Global Const $ABM_NEW = 0x00
Global Const $ABM_QUERYPOS = 0x02
Global Const $ABM_REMOVE = 0x01
Global Const $ABM_SETAUTOHIDEBAR = 0x08
Global Const $ABM_SETPOS = 0x03
Global Const $ABM_WINDOWPOSCHANGED = 0x09
Global Const $ABS_ALWAYSONTOP = 0x2
Global Const $ABS_AUTOHIDE = 0x1
Global Const $ABE_LEFT = 0
Global Const $ABE_TOP = 1
Global Const $ABE_RIGHT = 2
Global Const $ABE_BOTTOM = 3

;-------------------------AppBar SHAppBarMessage Function------------------------------

Func _WinAPI_ShellAppBarMessage($Message,ByRef $pabd)
     local $pabd = DllStructCreate("dword;int;uint;uint;int;int;int;int;int")
     DllStructSetData($pabd,1,DllStructGetSize($pabd)) ;cbSize
     DllStructSetData($pabd,2,ControlGetHandle("Start","","Shell_TrayWnd")) ;hWnd
     $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$Message,"ptr",DllStructGetPtr($pabd))
      If Not @error Then
        If $lResult[0] Then
           Return $lResult[0]
        EndIf
      EndIf
      SetError(1)
      Return False
EndFunc

hi,

pls look this

;----------------------------------Example----------------------------------

;---------------------ep1. appbar statuse

DllStructSetData($pabd,9,BitOR($ABS_ALWAYSONTOP,$ABS_AUTOHIDE))

DllStructSetData($pabd,9,$ABS_AUTOHIDE)

DllStructSetData($pabd,9,$ABS_ALWAYSONTOP)

_WinAPI_ShellAppBarMessage($ABM_SETSTATE,$pabd)

;---------------------ep2. get appbar state

#cs

$result = _WinAPI_ShellAppBarMessage($ABM_GETSTATE,$pabd)

If BitAND($result,$ABS_ALWAYSONTOP) = $ABS_ALWAYSONTOP Then ConsoleWrite("ALWAYSONTOP" & @LF)

If BitAND($result,$ABS_AUTOHIDE) = $ABS_AUTOHIDE Then ConsoleWrite("AUTOHIDE" & @LF)

;---------------------ep3.set appbar pos

$result = _WinAPI_ShellAppBarMessage($ABM_GETTASKBARPOS, $pabd)

If $result Then

ConsoleWrite("Left : " & $result[0] & @LF)

ConsoleWrite("Top : " & $result[1] & @LF)

ConsoleWrite("Right : " & $result[2] & @LF)

ConsoleWrite("Bottom: " & $result[3] & @LF)

EndIf

Switch DllStructGetData($pabd,4)

Case 0

ConsoleWrite("ABE_LEFT" & @LF)

Case 1

ConsoleWrite("ABE_TOP" & @LF)

Case 2

ConsoleWrite("ABE_RIGHT" & @LF)

Case 3

ConsoleWrite("ABE_BOTTOM" & @LF)

EndSwitch

#ce

Edited by netegg

Share this post


Link to post
Share on other sites

#93 ·  Posted (edited)

Hi,is it possible to Enumerate STORAGE_MEDIA_TYPE? I cannot find any advise about this in WinAPI Extended UDF Library.

Edited by netegg

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#95 ·  Posted (edited)

???

This is constants, they are not used in the library.

Yes, I know. But how to ensure a cd-r or a cd-rw? Edited by netegg

Share this post


Link to post
Share on other sites

#97 ·  Posted (edited)

If file name is, lets say in russian & _WinAPI_DragQueryFileEx.au3 is saved as, utf8 format and you drag & drop this file into gui, following function returns: c:\??????.txt instead of real filepath. is there a way to fix this?

_WinAPI_DragQueryFileEx()
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Yashied,

This UDF has grown humongous! haha, I forgot about this until I saw it in your signature. I'm surprised how many functions are here that I went and coded myself - seems like there's always some form of duplication in one sense or another.

Oh, hey, in the color conversions section, this function: _WinAPI_ColorHLSToRGB() should probably have this line added before the DLLCall:

If $iSaturation=0 Then $iHue=160    ; If this isn't set correctly, the return value will always be 0 when $iHue<>160

The only way I figured this out was doing a complete port of the Microsoft Color Conversion functions, and comparing it against return values from _ColorConvertRGBtoHSL() and _ColorConvertHSLtoRGB(), which both give alot of mismatches to Color Selection boxes and the API call. The code I ported was from this article: How To Converting Colors Between RGB and HLS (HBS)

In case you're wondering, 160 is the special 'UNDEFINED' value from their code. By adding the above modification, your code should return exactly what the Color Selection boxes (and the MS code) does. Otherwise, there will be a lot of '0' return values.

Anyway, keep up the good work :(

Share this post


Link to post
Share on other sites

The library has been updated.

v2.3

Changes

  • _WinAPI_ColorHLSToRGB() returns the incorrect color if the value of saturation is 0. (Thanks Ascend4nt)
  • $tagPROCESS_MEMORY_COUNTERS structure is incorrect.

Added functions

_WinAPI_AssignProcessToJobObject

_WinAPI_CreateJobObject

_WinAPI_CreateStreamOnHGlobal

_WinAPI_DWordToInt

_WinAPI_GetProcessIoCounters

_WinAPI_GetHGlobalFromStream

_WinAPI_IntToDWord

_WinAPI_OpenJobObject

_WinAPI_QueryInformationJobObject

_WinAPI_RadialGradientFill

_WinAPI_RegConnectRegistry

_WinAPI_SetInformationJobObject

+ few examples

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