Sign in to follow this  
Followers 0

WinAPIEx UDF

476 posts in this topic




Posted (edited)

Awesome :) , much to play without bothering MSDN ;) , this one get's 5 stars without even reading the UDF (yet)...

Edit: Awesome #2, I've never seen a custom au3.userudfs.properties, didn't even know it exits :)...

Edited by KaFu

Share this post


Link to post
Share on other sites

Posted

Very nice, I like the file extension example.

Share this post


Link to post
Share on other sites

Posted (edited)

Awesome :) , much to play without bothering MSDN ;) , this one get's 5 stars without even reading the UDF (yet)...

Thanks.

Edit: Awesome #2, I've never seen a custom au3.userudfs.properties, didn't even know it exits :) ...

Thanks #2. Maybe this will be useful to you. Edited by Yashied

Share this post


Link to post
Share on other sites

Posted (edited)

Thanks #2. Maybe this will be useful to you.

Looks very nice, will check it out :) ! Edited by KaFu

Share this post


Link to post
Share on other sites

Posted

Thank you very much for the share. In case any one like me like the hinting call tip using parameterized string:

_WinAPI_AddFontResource ($sFont) (required: #include <WinAPIEx.au3>)
_WinAPI_AnimateWindow ($hWnd, $iFlags [, $iDuration]) (required: #include <WinAPIEx.au3>)
_WinAPI_BringWindowToTop ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_CloseWindow ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_CopyFileEx ($sSource, $sDestination, $pProgressRoutine [, $iFlags]) (required: #include <WinAPIEx.au3>)
_WinAPI_CopyImage ($hImage [, $iType [, $xDesired [, $yDesired [, $iFlags]]]]) (required: #include <WinAPIEx.au3>)
_WinAPI_CreateIcon ($hInstance, $iWidth, $iHeight, $iPlanes, $iBitsPixel, $hANDBits, $hXORBits) (required: #include <WinAPIEx.au3>)
_WinAPI_CreateIconIndirect ($hBitmap, $hMask [, $XHotspot [, $YHotspot [, $iFlag]]]) (required: #include <WinAPIEx.au3>)
_WinAPI_DrawAnimatedRects ($hWnd, $iAnim, $tRectFrom, $tRectTo) (required: #include <WinAPIEx.au3>)
_WinAPI_DrawBitmap ($hDC, $iX, $iY, $hBitmap) (required: #include <WinAPIEx.au3>)
_WinAPI_DuplicateBitmap ($hBitmap) (required: #include <WinAPIEx.au3>)
_WinAPI_DuplicateIcon ($hIcon) (required: #include <WinAPIEx.au3>)
_WinAPI_EjectMedia ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_EmptyWorkingSet ([$iPID=0]) (required: #include <WinAPIEx.au3>)
_WinAPI_EnumResourceNames ($hModule, $sType, $pEnumFunc [, $lParam]) (required: #include <WinAPIEx.au3>)
_WinAPI_EnumResourceTypes ($hModule, $pEnumFunc [, $lParam]) (required: #include <WinAPIEx.au3>)
_WinAPI_ExtractAssociatedIcon ($hInstance, $sIcon, $iIndex) (required: #include <WinAPIEx.au3>)
_WinAPI_FatalExit ($iCode) (required: #include <WinAPIEx.au3>)
_WinAPI_FindResource ($hInstance, $sResName, $sResType) (required: #include <WinAPIEx.au3>)
_WinAPI_FindResourceEx ($hInstance, $sResName, $sResType, $iResLang) (required: #include <WinAPIEx.au3>)
_WinAPI_FreeHandle ($hObject) (required: #include <WinAPIEx.au3>)
_WinAPI_FreeIcon ($hIcon) (required: #include <WinAPIEx.au3>)
_WinAPI_FreeObject ($hObject) (required: #include <WinAPIEx.au3>)
_WinAPI_FreeResource ($hResData) (required: #include <WinAPIEx.au3>)
_WinAPI_GetActiveWindow () (required: #include <WinAPIEx.au3>)
_WinAPI_GetBitmapDimension ($hBitmap) (required: #include <WinAPIEx.au3>)
_WinAPI_GetBkColor ($hDC) (required: #include <WinAPIEx.au3>)
_WinAPI_GetClassLong ($hWnd, $nIndex) (required: #include <WinAPIEx.au3>)
_WinAPI_GetCompression ($sPath) (required: #include <WinAPIEx.au3>)
_WinAPI_GetDriveBusType ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_GetDriveGeometryEx ($iDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_GetDriveNumber ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_GetDriveType ([$sDrive='']) (required: #include <WinAPIEx.au3>)
_WinAPI_GetFontResourceInfo ($sFont) (required: #include <WinAPIEx.au3>)
_WinAPI_GetForegroundWindow () (required: #include <WinAPIEx.au3>)
_WinAPI_GetHandleInformation ($hObject) (required: #include <WinAPIEx.au3>)
_WinAPI_GetIconBitmap ($hIcon) (required: #include <WinAPIEx.au3>)
_WinAPI_GetIconDimension ($hIcon) (required: #include <WinAPIEx.au3>)
_WinAPI_GetIconMask ($hIcon) (required: #include <WinAPIEx.au3>)
_WinAPI_GetKeyboardLayout ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_GetKeyboardLayoutList () (required: #include <WinAPIEx.au3>)
_WinAPI_GetKeyboardState () (required: #include <WinAPIEx.au3>)
_WinAPI_GetKeyNameText ($lParam) (required: #include <WinAPIEx.au3>)
_WinAPI_GetKeyState ($vkCode) (required: #include <WinAPIEx.au3>)
_WinAPI_GetLayeredWindowAttributes ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_GetTextColor ($hDC) (required: #include <WinAPIEx.au3>)
_WinAPI_GetTextMetrics ($hDC) (required: #include <WinAPIEx.au3>)
_WinAPI_GetThemeColor ($hWnd, $sClass, $iPart, $iState, $iProp) (required: #include <WinAPIEx.au3>)
_WinAPI_GetVersionEx () (required: #include <WinAPIEx.au3>)
_WinAPI_GetWorkArea () (required: #include <WinAPIEx.au3>)
_WinAPI_GlobalSize ($hMem) (required: #include <WinAPIEx.au3>)
_WinAPI_InvalidateRect ($hWnd [, $tRECT [, $iFlag]]) (required: #include <WinAPIEx.au3>)
_WinAPI_InvalidateRgn ($hWnd [, $hRgn [, $iFlag]]) (required: #include <WinAPIEx.au3>)
_WinAPI_IsChild ($hWndParent, $hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_IsDoorOpen ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_IsIconic ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_IsNetworkAlive () (required: #include <WinAPIEx.au3>)
_WinAPI_IsPressed ( [, $iFrom [, $iTo]]) (required: #include <WinAPIEx.au3>)
_WinAPI_IsWindowEnabled ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_IsWritable ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_IsZoomed ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_keybd_event ($vkCode, $iScanCode, $iFlag, $iExtraInfo) (required: #include <WinAPIEx.au3>)
_WinAPI_KillTimer ($hWnd, $iTimerId) (required: #include <WinAPIEx.au3>)
_WinAPI_LoadMedia ($sDrive) (required: #include <WinAPIEx.au3>)
_WinAPI_LoadResource ($hInstance, $hResInfo) (required: #include <WinAPIEx.au3>)
_WinAPI_LockResource ($hResData) (required: #include <WinAPIEx.au3>)
_WinAPI_LockWorkStation () (required: #include <WinAPIEx.au3>)
_WinAPI_OpenIcon ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_PrivateExtractIcon ($sIcon, $iIndex, $iWidth, $iHeight) (required: #include <WinAPIEx.au3>)
_WinAPI_RemoveFontResource ($sFont) (required: #include <WinAPIEx.au3>)
_WinAPI_RestartDialog ( [, $sText [, $iFlags [, $hParent]]]) (required: #include <WinAPIEx.au3>)
_WinAPI_SetActiveWindow ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_SetClassLong ($hWnd, $nIndex, $dwNewLong) (required: #include <WinAPIEx.au3>)
_WinAPI_SetCompression ($sPath, $iCompression) (required: #include <WinAPIEx.au3>)
_WinAPI_SetForegroundWindow ($hWnd) (required: #include <WinAPIEx.au3>)
_WinAPI_SetHandleInformation ($hObject, $iMask, $iFlags) (required: #include <WinAPIEx.au3>)
_WinAPI_SetKeyboardLayout ($hWnd, $sLayout) (required: #include <WinAPIEx.au3>)
_WinAPI_SetKeyboardState ($tState) (required: #include <WinAPIEx.au3>)
_WinAPI_SetLayeredWindowAttributes ($hWnd, $iRGB, $iAlpha, $iFlags) (required: #include <WinAPIEx.au3>)
_WinAPI_SetParent ($hWndChild, $hWndParent) (required: #include <WinAPIEx.au3>)
_WinAPI_SetTimer ($hWnd, $iTimerId, $iElapse, $pTimerFunc) (required: #include <WinAPIEx.au3>)
_WinAPI_Shell_NotifyIcon ($iMessage, $tNOTIFYICONDATA) (required: #include <WinAPIEx.au3>)
_WinAPI_ShellAbout ($sTitle, $sName, $sText [, $hIcon [, $hParent]]) (required: #include <WinAPIEx.au3>)
_WinAPI_SHExtractIcons ($sIcon, $iIndex, $iWidth, $iHeight) (required: #include <WinAPIEx.au3>)
_WinAPI_SHGetFileInfo ($sPath, $iFlags [, $iAttributes]) (required: #include <WinAPIEx.au3>)
_WinAPI_ShowOwnedPopups ($hWnd, $iFlag) (required: #include <WinAPIEx.au3>)
_WinAPI_SizeofResource ($hInstance, $hResInfo) (required: #include <WinAPIEx.au3>)
_WinAPI_SwitchColor ($iColor) (required: #include <WinAPIEx.au3>)
_WinAPI_SwitchToThisWindow ($hWnd [, $iFlag]) (required: #include <WinAPIEx.au3>)
_WinAPI_ValidateRect ($hWnd [, $tRECT [, $iFlag]]) (required: #include <WinAPIEx.au3>)
_WinAPI_ValidateRgn ($hWnd [, $hRgn [, $iFlag]]) (required: #include <WinAPIEx.au3>)

..hope you find it helpful.

Share this post


Link to post
Share on other sites

Posted

Good contribution, well done!

Share this post


Link to post
Share on other sites

Posted

Nice! Five stars.

But better will be to prepare/post this on Trac (as feature request) in form for standard WinAPI include file.

I have added some API functions there too.

Share this post


Link to post
Share on other sites

Posted

This is Great! 5* from me! Thankyou!

Share this post


Link to post
Share on other sites

Posted

This is fantastic! Can't remember which ones I'm getting credit for but that's old age for you. A couple of possible additions:

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetLocalTime
; Description ...: Gets the local time
; Syntax.........: _WinAPI_GetLocalTime()
; Parameters ....: 
; Return values .: Success       - Array with eight values
;									0 - Year
;									1 - Month
;									2 - Day of week
;									3 - Day
;									4 - Hour
;									5 - Minute
;									6 - Second
;									7 - Milliseconds
; Author ........: WideBoyDixon
; Modified.......:
; Remarks .......:
; Related .......: _WinAPI_GetSystemTime
; Link ..........;
; Example .......;
; ===============================================================================================================================
Func _WinAPI_GetLocalTime()
	Local $aRet[8], $SystemTime = DllStructCreate("ushort[8]")
	DllCall("kernel32.dll", "none", "GetLocalTime", "ptr", DllStructGetPtr($SystemTime))
	For $i = 1 To 8
		$aRet[$i - 1] = DllStructGetData($SystemTime, 1, $i)
	Next
	Return $aRet
EndFunc

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetSystemTime
; Description ...: Gets the system time
; Syntax.........: _WinAPI_GetSystemTime()
; Parameters ....: 
; Return values .: Success       - Array with eight values
;									0 - Year
;									1 - Month
;									2 - Day of week
;									3 - Day
;									4 - Hour
;									5 - Minute
;									6 - Second
;									7 - Milliseconds
; Author ........: WideBoyDixon
; Modified.......:
; Remarks .......:
; Related .......: _WinAPI_GetLocalTime
; Link ..........;
; Example .......;
; ===============================================================================================================================
Func _WinAPI_GetSystemTime()
	Local $aRet[8], $SystemTime = DllStructCreate("ushort[8]")
	DllCall("kernel32.dll", "none", "GetSystemTime", "ptr", DllStructGetPtr($SystemTime))
	For $i = 1 To 8
		$aRet[$i - 1] = DllStructGetData($SystemTime, 1, $i)
	Next
	Return $aRet
EndFunc

WBD

Share this post


Link to post
Share on other sites

Posted (edited)

Sorry! Just found a couple more which I use in order to provide support for translation of my applications:

; ===============================================================================================================================
; _WinAPI_GetLocaleInfo()
; ===============================================================================================================================

Global Const $LOCALE_NOUSEROVERRIDE         = 0x80000000   ;// do not use user overrides
Global Const $LOCALE_USE_CP_ACP             = 0x40000000   ;// use the system ACP
Global Const $LOCALE_RETURN_NUMBER          = 0x20000000   ;// return number instead of string

;  The following LCTypes are mutually exclusive in that they may NOT be used in combination with each other.
Global Const $LOCALE_ILANGUAGE              = 0x00000001   ;// language id
Global Const $LOCALE_SLANGUAGE              = 0x00000002   ;// localized name of language
Global Const $LOCALE_SENGLANGUAGE           = 0x00001001   ;// English name of language
Global Const $LOCALE_SABBREVLANGNAME        = 0x00000003   ;// abbreviated language name
Global Const $LOCALE_SNATIVELANGNAME        = 0x00000004   ;// native name of language

Global Const $LOCALE_ICOUNTRY               = 0x00000005   ;// country code
Global Const $LOCALE_SCOUNTRY               = 0x00000006   ;// localized name of country
Global Const $LOCALE_SENGCOUNTRY            = 0x00001002   ;// English name of country
Global Const $LOCALE_SABBREVCTRYNAME        = 0x00000007   ;// abbreviated country name
Global Const $LOCALE_SNATIVECTRYNAME        = 0x00000008   ;// native name of country

Global Const $LOCALE_IDEFAULTLANGUAGE       = 0x00000009   ;// default language id
Global Const $LOCALE_IDEFAULTCOUNTRY        = 0x0000000A   ;// default country code
Global Const $LOCALE_IDEFAULTCODEPAGE       = 0x0000000B   ;// default oem code page
Global Const $LOCALE_IDEFAULTANSICODEPAGE   = 0x00001004   ;// default ansi code page
Global Const $LOCALE_IDEFAULTMACCODEPAGE    = 0x00001011   ;// default mac code page

Global Const $LOCALE_SLIST                  = 0x0000000C   ;// list item separator
Global Const $LOCALE_IMEASURE               = 0x0000000D   ;// 0 = metric, 1 = US

Global Const $LOCALE_SDECIMAL               = 0x0000000E   ;// decimal separator
Global Const $LOCALE_STHOUSAND              = 0x0000000F   ;// thousand separator
Global Const $LOCALE_SGROUPING              = 0x00000010   ;// digit grouping
Global Const $LOCALE_IDIGITS                = 0x00000011   ;// number of fractional digits
Global Const $LOCALE_ILZERO                 = 0x00000012   ;// leading zeros for decimal
Global Const $LOCALE_INEGNUMBER             = 0x00001010   ;// negative number mode
Global Const $LOCALE_SNATIVEDIGITS          = 0x00000013   ;// native ascii 0-9

Global Const $LOCALE_SCURRENCY              = 0x00000014   ;// local monetary symbol
Global Const $LOCALE_SINTLSYMBOL            = 0x00000015   ;// intl monetary symbol
Global Const $LOCALE_SMONDECIMALSEP         = 0x00000016   ;// monetary decimal separator
Global Const $LOCALE_SMONTHOUSANDSEP        = 0x00000017   ;// monetary thousand separator
Global Const $LOCALE_SMONGROUPING           = 0x00000018   ;// monetary grouping
Global Const $LOCALE_ICURRDIGITS            = 0x00000019   ;// # local monetary digits
Global Const $LOCALE_IINTLCURRDIGITS        = 0x0000001A   ;// # intl monetary digits
Global Const $LOCALE_ICURRENCY              = 0x0000001B   ;// positive currency mode
Global Const $LOCALE_INEGCURR               = 0x0000001C   ;// negative currency mode

Global Const $LOCALE_SDATE                  = 0x0000001D   ;// date separator
Global Const $LOCALE_STIME                  = 0x0000001E   ;// time separator
Global Const $LOCALE_SSHORTDATE             = 0x0000001F   ;// short date format string
Global Const $LOCALE_SLONGDATE              = 0x00000020   ;// long date format string
Global Const $LOCALE_STIMEFORMAT            = 0x00001003   ;// time format string
Global Const $LOCALE_IDATE                  = 0x00000021   ;// short date format ordering
Global Const $LOCALE_ILDATE                 = 0x00000022   ;// long date format ordering
Global Const $LOCALE_ITIME                  = 0x00000023   ;// time format specifier
Global Const $LOCALE_ITIMEMARKPOSN          = 0x00001005   ;// time marker position
Global Const $LOCALE_ICENTURY               = 0x00000024   ;// century format specifier (short date)
Global Const $LOCALE_ITLZERO                = 0x00000025   ;// leading zeros in time field
Global Const $LOCALE_IDAYLZERO              = 0x00000026   ;// leading zeros in day field (short date)
Global Const $LOCALE_IMONLZERO              = 0x00000027   ;// leading zeros in month field (short date)
Global Const $LOCALE_S1159                  = 0x00000028   ;// AM designator
Global Const $LOCALE_S2359                  = 0x00000029   ;// PM designator

Global Const $LOCALE_ICALENDARTYPE          = 0x00001009   ;// type of calendar specifier
Global Const $LOCALE_IOPTIONALCALENDAR      = 0x0000100B   ;// additional calendar types specifier
Global Const $LOCALE_IFIRSTDAYOFWEEK        = 0x0000100C   ;// first day of week specifier
Global Const $LOCALE_IFIRSTWEEKOFYEAR       = 0x0000100D   ;// first week of year specifier

Global Const $LOCALE_SDAYNAME1              = 0x0000002A   ;// long name for Monday
Global Const $LOCALE_SDAYNAME2              = 0x0000002B   ;// long name for Tuesday
Global Const $LOCALE_SDAYNAME3              = 0x0000002C   ;// long name for Wednesday
Global Const $LOCALE_SDAYNAME4              = 0x0000002D   ;// long name for Thursday
Global Const $LOCALE_SDAYNAME5              = 0x0000002E   ;// long name for Friday
Global Const $LOCALE_SDAYNAME6              = 0x0000002F   ;// long name for Saturday
Global Const $LOCALE_SDAYNAME7              = 0x00000030   ;// long name for Sunday
Global Const $LOCALE_SABBREVDAYNAME1        = 0x00000031   ;// abbreviated name for Monday
Global Const $LOCALE_SABBREVDAYNAME2        = 0x00000032   ;// abbreviated name for Tuesday
Global Const $LOCALE_SABBREVDAYNAME3        = 0x00000033   ;// abbreviated name for Wednesday
Global Const $LOCALE_SABBREVDAYNAME4        = 0x00000034   ;// abbreviated name for Thursday
Global Const $LOCALE_SABBREVDAYNAME5        = 0x00000035   ;// abbreviated name for Friday
Global Const $LOCALE_SABBREVDAYNAME6        = 0x00000036   ;// abbreviated name for Saturday
Global Const $LOCALE_SABBREVDAYNAME7        = 0x00000037   ;// abbreviated name for Sunday
Global Const $LOCALE_SMONTHNAME1            = 0x00000038   ;// long name for January
Global Const $LOCALE_SMONTHNAME2            = 0x00000039   ;// long name for February
Global Const $LOCALE_SMONTHNAME3            = 0x0000003A   ;// long name for March
Global Const $LOCALE_SMONTHNAME4            = 0x0000003B   ;// long name for April
Global Const $LOCALE_SMONTHNAME5            = 0x0000003C   ;// long name for May
Global Const $LOCALE_SMONTHNAME6            = 0x0000003D   ;// long name for June
Global Const $LOCALE_SMONTHNAME7            = 0x0000003E   ;// long name for July
Global Const $LOCALE_SMONTHNAME8            = 0x0000003F   ;// long name for August
Global Const $LOCALE_SMONTHNAME9            = 0x00000040   ;// long name for September
Global Const $LOCALE_SMONTHNAME10           = 0x00000041   ;// long name for October
Global Const $LOCALE_SMONTHNAME11           = 0x00000042   ;// long name for November
Global Const $LOCALE_SMONTHNAME12           = 0x00000043   ;// long name for December
Global Const $LOCALE_SMONTHNAME13           = 0x0000100E   ;// long name for 13th month (if exists)
Global Const $LOCALE_SABBREVMONTHNAME1      = 0x00000044   ;// abbreviated name for January
Global Const $LOCALE_SABBREVMONTHNAME2      = 0x00000045   ;// abbreviated name for February
Global Const $LOCALE_SABBREVMONTHNAME3      = 0x00000046   ;// abbreviated name for March
Global Const $LOCALE_SABBREVMONTHNAME4      = 0x00000047   ;// abbreviated name for April
Global Const $LOCALE_SABBREVMONTHNAME5      = 0x00000048   ;// abbreviated name for May
Global Const $LOCALE_SABBREVMONTHNAME6      = 0x00000049   ;// abbreviated name for June
Global Const $LOCALE_SABBREVMONTHNAME7      = 0x0000004A   ;// abbreviated name for July
Global Const $LOCALE_SABBREVMONTHNAME8      = 0x0000004B   ;// abbreviated name for August
Global Const $LOCALE_SABBREVMONTHNAME9      = 0x0000004C   ;// abbreviated name for September
Global Const $LOCALE_SABBREVMONTHNAME10     = 0x0000004D   ;// abbreviated name for October
Global Const $LOCALE_SABBREVMONTHNAME11     = 0x0000004E   ;// abbreviated name for November
Global Const $LOCALE_SABBREVMONTHNAME12     = 0x0000004F   ;// abbreviated name for December
Global Const $LOCALE_SABBREVMONTHNAME13     = 0x0000100F   ;// abbreviated name for 13th month (if exists)

Global Const $LOCALE_SPOSITIVESIGN          = 0x00000050   ;// positive sign
Global Const $LOCALE_SNEGATIVESIGN          = 0x00000051   ;// negative sign
Global Const $LOCALE_IPOSSIGNPOSN           = 0x00000052   ;// positive sign position
Global Const $LOCALE_INEGSIGNPOSN           = 0x00000053   ;// negative sign position
Global Const $LOCALE_IPOSSYMPRECEDES        = 0x00000054   ;// mon sym precedes pos amt
Global Const $LOCALE_IPOSSEPBYSPACE         = 0x00000055   ;// mon sym sep by space from pos amt
Global Const $LOCALE_INEGSYMPRECEDES        = 0x00000056   ;// mon sym precedes neg amt
Global Const $LOCALE_INEGSEPBYSPACE         = 0x00000057   ;// mon sym sep by space from neg amt

Global Const $LOCALE_FONTSIGNATURE          = 0x00000058   ;// font signature
Global Const $LOCALE_SISO639LANGNAME        = 0x00000059   ;// ISO abbreviated language name
Global Const $LOCALE_SISO3166CTRYNAME       = 0x0000005A   ;// ISO abbreviated country name

Global Const $LOCALE_IDEFAULTEBCDICCODEPAGE = 0x00001012   ;// default ebcdic code page
Global Const $LOCALE_IPAPERSIZE             = 0x0000100A   ;// 0 = letter, 1 = a4, 2 = legal, 3 = a3
Global Const $LOCALE_SENGCURRNAME           = 0x00001007   ;// english name of currency
Global Const $LOCALE_SNATIVECURRNAME        = 0x00001008   ;// native name of currency
Global Const $LOCALE_SYEARMONTH             = 0x00001006   ;// year month format string
Global Const $LOCALE_SSORTNAME              = 0x00001013   ;// sort name
Global Const $LOCALE_IDIGITSUBSTITUTION     = 0x00001014   ;// 0 = none, 1 = context, 2 = native digit

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetLocaleInfo
; Description ...: Gets local specific info
; Syntax.........: _WinAPI_GetLocaleInfo($iLocale, $iLCType)
; Parameters ....: $iLocale      - Identifies a valid Windows locale
;                  $iLCType      - Identifies the information to be retrieved
; Return values .: Success       - String containing the requested information
;                  Failure       - Empty string with @error set to 1
; Author ........: WideBoyDixon
; Modified.......:
; Remarks .......:
; Related .......: _WinAPI_GetUserDefaultLCID
; Link ..........;
; Example .......;
; ===============================================================================================================================
Func _WinAPI_GetLocaleInfo($iLocale, $iLCType)
	Local $aResult = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", $Locale, "long", $LCType, "ptr", 0, "long", 0)
	If @error Then Return SetError(1, 0, "")
	Local $lpBuffer = DllStructCreate("char[" & $aResult[0] & "]")
	$aResult = DllCall("kernel32.dll", "long", "GetLocaleInfo", "long", $Locale, "long", $LCType, "ptr", DllStructGetPtr($lpBuffer), "long", $aResult[0])
	If @error Or ($aResult[0] = 0) Then Return SetError(1, 0, "")
	Return SetError(0, 0, DllStructGetData($lpBuffer, 1))
EndFunc

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_GetUserDefaultLCID
; Description ...: Gets local specific info
; Syntax.........: _WinAPI_GetUserDefaultLCID()
; Parameters ....: 
; Return values .: Success       - The default LCID for the user
;                  Failure       - Zero with @error set to 1
; Author ........: WideBoyDixon
; Modified.......:
; Remarks .......:
; Related .......: _WinAPI_GetLocaleInfo
; Link ..........;
; Example .......;
; ===============================================================================================================================
Func _WinAPI_GetUserDefaultLCID()
	Local $aResult = DllCall("kernel32.dll", "long", "GetUserDefaultLCID") ; Get the default LCID for this user
	If @error Then Return SetError(1, 0, 0)
	Return SetError(0, 0, $aResult[0])
EndFunc

Would be great to have those in there too :)

WBD

Edited by WideBoyDixon

Share this post


Link to post
Share on other sites

Posted (edited)

Can't remember which ones I'm getting credit for but that's old age for you.

Do you remember this?

:)

EDIT:

_WinAPI_GetLocalTime() and _WinAPI_GetSystemTime() already exist (Date.au3).

_WinAPI_GetLocaleInfo() and _WinAPI_GetUserDefaultLCID() - agreed, thanks for that.

Edited by Yashied

Share this post


Link to post
Share on other sites

Posted (edited)

The library has been updated.

Added functions

_WinAPI_DeregisterShellHookWindow

_WinAPI_FileTimeToLocalFileTime

_WinAPI_FileTimeToSystemTime

_WinAPI_GetIdleTime

_WinAPI_GetLocaleInfo

_WinAPI_GetModuleFileNameEx

_WinAPI_GetProcessCreationTime

_WinAPI_GetTickCount

_WinAPI_GetThemeAppProperties

_WinAPI_GetUserDefaultLCID

_WinAPI_IsThemeActive

_WinAPI_PickIconDlg

_WinAPI_RegisterShellHookWindow

_WinAPI_SetFilePointerEx

_WinAPI_SetThemeAppProperties

_WinAPI_SHFormatDrive

_WinAPI_SHGetSpecialFolderPath

+ Examples

Edited by Yashied

Share this post


Link to post
Share on other sites

Posted

Additions off the top of my head: GetProcAddress

_WinAPI_GetForegroundWindow() already exists in WinAPI.au3. Who knows why SetForegroundWindow() isn't in there also...

Share this post


Link to post
Share on other sites

Posted

The library has been updated.

Added functions

_WinAPI_EnumResourceLanguagesToArray

_WinAPI_EnumResourceNamesToArray

_WinAPI_EnumResourceTypesToArray

_WinAPI_GetFontResourceInfoEx

_WinAPI_GetProcAddress

Share this post


Link to post
Share on other sites

Posted

Should you ever get the function header info completed and submit these for inclusion into the WinAPI.au3 include file, you should be aware that some of these functions have close relatives already present in existing UDF files.

_WinAPI_FileTimeToLocalFileTime similar as _Date_Time_FileTimeToLocalFileTime

_WinAPI_FileTimeToSystemTime similar as _Date_Time_FileTimeToSystemTime

_WinAPI_FreeHandle similar as _WinAPI_CloseHandle

_WinAPI_FreeIcon similar as _WinAPI_DestroyIcon

_WinAPI_FreeObject similar as _WinAPI_DeleteObject

_WinAPI_GetWorkArea similar as _WinAPI_SystemParametersInfo

_WinAPI_GlobalSize similar as _MemGlobalSize

_WinAPI_KillTimer similar as _Timer_KillTimer

Or adding examples to the existing functions in the help file would be helpful.

You do good work.

Thanks for sharing.

Share this post


Link to post
Share on other sites

Posted

Should you ever get the function header info completed and submit these for inclusion into the WinAPI.au3 include file, you should be aware that some of these functions have close relatives already present in existing UDF files.

_WinAPI_FileTimeToLocalFileTime similar as _Date_Time_FileTimeToLocalFileTime

_WinAPI_FileTimeToSystemTime similar as _Date_Time_FileTimeToSystemTime

_WinAPI_FreeHandle similar as _WinAPI_CloseHandle

_WinAPI_FreeIcon similar as _WinAPI_DestroyIcon

_WinAPI_FreeObject similar as _WinAPI_DeleteObject

_WinAPI_GetWorkArea similar as _WinAPI_SystemParametersInfo

_WinAPI_GlobalSize similar as _MemGlobalSize

_WinAPI_KillTimer similar as _Timer_KillTimer

Or adding examples to the existing functions in the help file would be helpful.

You do good work.

Thanks for sharing.

_WinAPI_FileTimeToLocalFileTime(), _WinAPI_FileTimeToSystemTime(), _WinAPI_GlobalSize() - Added, because it`s used in other functions within the library.

_WinAPI_FreeHandle(), _WinAPI_FreeIcon() - Without stupid _WinAPI_Check().

_WinAPI_GetWorkArea(), _WinAPI_#Timer() - Easier to use.

Thanks anyway.

Share this post


Link to post
Share on other sites

Posted

Well done again! Very useful WinApi stuff! Also 5* from me >_<

Greetings from s/w coast of Turkey :(

UEZ

Share this post


Link to post
Share on other sites

Posted (edited)

I suggest someone to do write a description for any functions of this library. Ofcourse, credit in the title for you. Edited by Yashied

Share this post


Link to post
Share on other sites

Posted

As of v3.3.1.0 _WinAPI_GetLayeredWindowAttributes() and _WinAPI_SetLayeredWindowAttributes() exist in WinAPI.au3 for those running the beta and wondering why you're getting errors.

http://www.autoitscript.com/forum/index.php?showtopic=95367&view=findpost&p=685558

Share this post


Link to post
Share on other sites

Posted

As of v3.3.1.0 _WinAPI_GetLayeredWindowAttributes() and _WinAPI_SetLayeredWindowAttributes() exist in WinAPI.au3 for those running the beta and wondering why you're getting errors.

http://www.autoitscript.com/forum/index.php?showtopic=95367&view=findpost&p=685558

Just —Āomment these functions.

Share this post


Link to post
Share on other sites

Posted

The library has been updated.

Added functions

_WinAPI_DuplicateCursor

_WinAPI_EnumDisplaySettings

_WinAPI_FreeCursor

_WinAPI_GetCursor

_WinAPI_LoadCursor

_WinAPI_LoadCursorFromFile

_WinAPI_SetSystemCursor

Changes

  • Renamed _WinAPI_EnumResource#ToArray() to _WinAPI_EnumResource#()
  • Renamed _WinAPI_GetFontResourceInfoEx() to _WinAPI_GetFontResourceInfo()
  • Changed _WinAPI_GetFontResourceInfo()
  • Changed _WinAPI_AddFontResource()
  • Changed _WinAPI_RemoveFontResource()
  • Changed _WinAPI_GetKeyboardLayout(), _WinAPI_GetKeyboardLayoutList(), _WinAPI_SetKeyboardLayout(), and _WinAPI_EnumResourceLanguages() - working now with LCID (See examples)

Share this post


Link to post
Share on other sites

Posted

The library has been updated.

Added functions

_WinAPI_CreateSemaphore

_WinAPI_GetDefaultPrinter

_WinAPI_GetProcessMemoryInfo

_WinAPI_GetWindowInfo

_WinAPI_OpenSemaphore

_WinAPI_ReleaseSemaphore

Changes

  • Renamed some functions to facilitate their use (eg _WinAPI_SHExtractIcons() to _WinAPI_ShellExtractIcons())
  • Fixed some minor bugs
  • Added descriptions for ALL functions
  • Added several new examples

This is final release of the library. In this form, I will support its in the future. Perhaps part of the functions of the UDF will be added in the following versions of AutoIt. But so far, who are interested, use this library. Of course, who wishes, may offer its WinAPI-functions for inclusion in the library. But do not offer the functions for working with threads. AutoIt will still not work with them, at least without a headache.

Share this post


Link to post
Share on other sites

Posted (edited)

The library has been updated.

Added functions

_WinAPI_CreateSemaphore

_WinAPI_GetDefaultPrinter

_WinAPI_GetProcessMemoryInfo

_WinAPI_GetWindowInfo

_WinAPI_OpenSemaphore

_WinAPI_ReleaseSemaphore

Changes

  • Renamed some functions to facilitate their use (eg _WinAPI_SHExtractIcons() to _WinAPI_ShellExtractIcons())
  • Fixed some minor bugs
  • Added descriptions for ALL functions
  • Added several new examples

This is final release of the library. In this form, I will support its in the future. Perhaps part of the functions of the UDF will be added in the following versions of AutoIt. But so far, who are interested, use this library. Of course, who wishes, may offer its WinAPI-functions for inclusion in the library. But do not offer the functions for working with threads. AutoIt will still not work with them, at least without a headache.

you can add and this...

MsgBox(4096, LockDevice("F:", 1), "Try yo CD")
;MsgBox(4096, LockDevice("F:", 0), "All Better")
Func LockDevice($szdrivewithcolon, $block)
    Local Const $invalid_handle_value = -1
    Local Const $open_existing = 3
    Local Const $file_attribute_normal = 128
    Local Const $file_share_write = 2
    Local Const $file_share_read = 1
    Local Const $generic_read = 2147483648
    Local Const $ioctl_storage_media_removal = 2967556
    $block = Not (Not $block)
    $szdrivewithcolon = StringReplace($szdrivewithcolon, "\", "")
    If StringLen($szdrivewithcolon) <> 2 Then Return -1
    $szdrivewithcolon = "\\.\" & $szdrivewithcolon
    $hdrive = DllCall("kernel32.dll", "int", "CreateFile", "str", $szdrivewithcolon, _
            "int", $generic_read, "int", BitOR($file_share_read, $file_share_write), "ptr", 0, "int", $open_existing, _
            "int", $file_attribute_normal, "ptr", 0)
    If $hdrive[0] = $invalid_handle_value Then Return -2
    $bool = DllStructCreate("byte")
    DllStructSetData($bool, 1, $block)
    $lockmediarslt = DllCall("kernel32.dll", "int", "DeviceIoControl", "int", $hdrive[0], _
            "int", $ioctl_storage_media_removal, "ptr", DllStructGetPtr($bool), "int", 1, _
            "int", 0, "int", 0, "int_ptr", 0, "ptr", 0)
    DllCall("kernel32.dll", "int", "CloseHandle", "int", $hdrive[0])
    $bool = 0
    Return $lockmediarslt[0]
EndFunc   ;==>LockDevice
Edited by psandu.ro

Share this post


Link to post
Share on other sites

Posted

@psandu.ro

Nice addition, thanks. Will be added.

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

  • Recently Browsing   0 members

    No registered users viewing this page.