Jump to content

Recommended Posts

Posted

Added Help file (WinAPIEx.chm inside the archive) that contains detailed information and examples for all functions from this library. Special thanks to MrCreatoR for help in the creation (generation) HTML pages for this file.

Posted

examples for all functions from this library

Thats a lot of work! I was content with the examples you provided before but with all (300 I counted in au3.user.calltips.api) is fantastic.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Posted (edited)

I'm just wondering, why this awesome collection of funcs isn't in default AutoIt Include library yet? :(

Great work, mate.

Edited by Kaster
Signature
Posted (edited)

Hi,

Not sure if it's useful or not.

I use these for using my own fonts in my GUI when I don't want to add the font to the users pc.

Functions AddFontResourceEx and RemoveFontResourceEx:

Global Const $FR_PRIVATE = 0x10
Global Const $FR_NOT_ENUM = 0x20

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_AddFontResourceEx
; Description ...: Adds the font resource from the specified file to the system.
; Syntax.........: _WinAPI_AddFontResourceEx($sFileName[, $iFlag = $FR_PRIVATE])
; Parameters ....: $sFileName  - Font file resource to add
;                                 Supported font resources: .fon, .fnt, .ttf, .ttc, .fot, .otf, .mmm, .pfb, .pfm
;                                 To add a font whose information comes from several resource files,
;                                 use the file names separated by a | --for example, abcxxxxx.pfm | abcxxxxx.pfb.
;                  $iFlag      - $FR_PRIVATE
;                                 Only the process that called the AddFontResourceEx function can use this font.
;                                 When the font name matches a public font, the private font will be chosen.
;                                 When the process terminates, the system will remove all fonts installed by the process.
;                              - $FR_NOT_ENUM
;                                 No process, including the process that called the function, can enumerate this font.
; Return values .: Success     - The number of fonts added
;                  Failure     - 0
; Author ........:
; Modified.......:
; Remarks .......: This function allows a process to use fonts without allowing other processes access to the fonts.
;                  When finished using a font resource remove the resource by calling _WinAPI_RemoveFontResourceEx().
; Related .......: _WinAPI_RemoveFontResourceEx
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _WinAPI_AddFontResourceEx($sFileName, $iFlag = $FR_PRIVATE)
    Local $aResult
    $aResult = DllCall("Gdi32.dll", "int", "AddFontResourceEx", "str", $sFileName, "dword", $iFlag, "ptr", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_RemoveFontResourceEx
; Description ...: Removes the fonts in the specified file from the system font table.
; Syntax.........: _WinAPI_RemoveFontResourceEx($sFileName[, $iFlag = $FR_PRIVATE])
; Parameters ....: $sFileName  - Font file resource to Remove
;                  $iFlag      - $FR_PRIVATE or $FR_NOT_ENUM
;                                 Use the same flag that was used when _WinAPI_AddFontResourceEx was called.
; Return values .: Success     - Non Zero
;                  Failure     - 0
; Author ........:
; Modified.......:
; Remarks .......: This function will only remove the font if the font was added with the _WinAPI_AddFontResourceEx function and
;                  the same flag that was used when _WinAPI_AddFontResourceEx was called.
; Related .......: _WinAPI_AddFontResourceEx
; Link ..........:
; Example .......:
; ===============================================================================================================================
Func _WinAPI_RemoveFontResourceEx($sFileName, $iFlag = $FR_PRIVATE)
    Local $aResult
    $aResult = DllCall("Gdi32.dll", "int", "RemoveFontResourceEx", "str", $sFileName, "dword", $iFlag, "ptr", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Crude example using the functions:

#include <GUIConstantsEx.au3>

Global Const $FR_PRIVATE = 0x10
Global Const $FR_NOT_ENUM = 0x20

Global $iReturn, $hGui, $iLabel, $sFontFile = @ScriptDir & "\SLIDER.TTF", $hFont, $msg

; The font is only available to the script process only.
$iReturn = _WinAPI_AddFontResourceEx($sFontFile)

$hGui = GUICreate("Font example", 330, 50)
$iLabel = GUICtrlCreateLabel("Example of using a private font.", 10, 10, 310, 30)
GUICtrlSetFont(-1, 12, Default, Default, "Slider")
GUISetState(@SW_SHOW, $hGui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ; _WinAPI_RemoveFontResourceEx not really needed in this case, but supplied for an example.
            ; When the script process closes the font is removed from the system pool automatically.
            If $iReturn Then _WinAPI_RemoveFontResourceEx($sFontFile)
            Exit
    EndSwitch
WEnd

Func _WinAPI_AddFontResourceEx($sFileName, $iFlag = $FR_PRIVATE)
    Local $aResult
    $aResult = DllCall("Gdi32.dll", "int", "AddFontResourceEx", "str", $sFileName, "dword", $iFlag, "ptr", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Func _WinAPI_RemoveFontResourceEx($sFileName, $iFlag = $FR_PRIVATE)
    Local $aResult
    $aResult = DllCall("Gdi32.dll", "int", "RemoveFontResourceEx", "str", $sFileName, "dword", $iFlag, "ptr", 0)
    If @error Then Return SetError(@error, @extended, 0)
    Return $aResult[0]
EndFunc

Zipped font used in the example attached (unzip it to the script directory)

Cheers

Edit: Corrected _WinAPIEx_RemoveFontResourceEx() function as 0x10 was used instead of the variable $iFlag

Edit: Simplified the Example, added to the $sFileName parameter description, removed the Ex from _WinAPIEx_ in function names.

SLIDER.TTF.zip

Edited by smashly
  • 2 weeks later...
Posted

The library has been updated.

v2.4

Changes

  • The following functions are renamed with a change in their headers (see Help file).

    _WinAPI_AddFontResource => _WinAPI_AddFontResourceEx

    _WinAPI_RemoveFontResource => _WinAPI_RemoveFontResourceEx

  • Changed a headers for the following functions.

    _WinAPI_CopyFileEx

    _WinAPI_MoveFileEx

    _WinAPI_ShellGetFileInfo

    _WinAPI_StructToArray

  • Removed _WinAPI_ExtractAssociatedIcon() function, use _WinAPI_ShellExtractAssociatedIcon().
  • The following functions now returns a COM errors in the @extended flag code, similar _WinAPI_Reg... functions. For everyone else, you can use _WinAPI_GetLastError().

    _WinAPI_AssocGetPerceivedType

    _WinAPI_AssocQueryString

    _WinAPI_CreateStreamOnHGlobal

    _WinAPI_GetHGlobalFromStream

    _WinAPI_GetThemeColor

    _WinAPI_ShellEmptyRecycleBin

    _WinAPI_ShellGetSpecialFolderLocation

    _WinAPI_ShellILCreateFromPath

    _WinAPI_ShellQueryRecycleBin

  • The following functions are replaced by their Unicode versions (headers saved).

    _WinAPI_CreateSemaphore

    _WinAPI_OpenSemaphore

    _WinAPI_EnumResourceLanguages

    _WinAPI_EnumResourceNames

    _WinAPI_EnumResourceTypes

    _WinAPI_FindResource

    _WinAPI_FindResourceEx

  • Added the following functions.

    _WinAPI_AdjustWindowRectEx

    _WinAPI_AssocGetPerceivedType

    _WinAPI_AddMRUString

    _WinAPI_BroadcastSystemMessage

    _WinAPI_BrowseForFolderDlg

    _WinAPI_CoTaskMemAlloc

    _WinAPI_CoTaskMemFree

    _WinAPI_CoTaskMemRealloc

    _WinAPI_CreateMRUList

    _WinAPI_EnumMRUList

    _WinAPI_FreeMRUList

    _WinAPI_GetBinaryType

    _WinAPI_GetKeyboardType

    _WinAPI_GetSystemInfo

    _WinAPI_GetSystemWow64Directory

    _WinAPI_GetTextFace

    _WinAPI_IsProcessInJob

    _WinAPI_SendMessageTimeout

    _WinAPI_ShellExtractAssociatedIcon

    _WinAPI_ShellGetPathFromIDList

    _WinAPI_ShellGetSpecialFolderLocation

    _WinAPI_ShellILCreateFromPath

    _WinAPI_ShowShareFolderUI

    _WinAPI_StrLen

    _WinAPI_UpdateLayeredWindowEx

  • Added examples for the functions above.
  • Many internal changes, mainly related to the types of data to work on 64-bit systems.
  • Updated Help file.

  • 3 weeks later...
Posted

The library has been updated.

v2.5

Changes

  • Changed a headers for the following functions.

    _WinAPI_DrawBitmap

    _WinAPI_GetThemeColor

  • Added the following structures.

    $tagBITMAPV4HEADER

    $tagBITMAPV5HEADER

  • Added the following functions.

    _WinAPI_CloseThemeData

    _WinAPI_CreateCaret

    _WinAPI_DestroyCaret

    _WinAPI_DrawThemeBackground

    _WinAPI_DrawThemeParentBackground

    _WinAPI_DrawThemeText

    _WinAPI_GetCaretBlinkTime

    _WinAPI_GetCaretPos

    _WinAPI_GetCurrentThemeName

    _WinAPI_GetThemeDocumentationProperty

    _WinAPI_GetThemeFont

    _WinAPI_GetThemeInt

    _WinAPI_GetThemeMargins

    _WinAPI_GetThemePartSize

    _WinAPI_GetThemePosition

    _WinAPI_GetThemeRect

    _WinAPI_GetUpdateRect

    _WinAPI_GetUpdateRgn

    _WinAPI_HideCaret

    _WinAPI_IsThemeBackgroundPartiallyTransparent

    _WinAPI_IsThemePartDefined

    _WinAPI_OpenThemeData

    _WinAPI_PlaySound

    _WinAPI_SetCaretBlinkTime

    _WinAPI_SetCaretPos

    _WinAPI_ShellChangeNotifyDeregister

    _WinAPI_ShellChangeNotifyRegister

    _WinAPI_ShowCaret

  • Added examples for the functions above.
  • Rewrite some examples for compatibility with Windows Vista/7.
  • Updated Help file.

Posted

@Yashied, you are the man.

I was just about to attempt writing a couple of functions I need (via DLL calls) and lo and behold you have added them into the latest version already. Nice work.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

  • 2 weeks later...
Posted

The library has been updated.

v2.6

Changes

  • Removed the following functions.

    _WinAPI_ShareFolderDlg

    _WinAPI_WinHelp

  • Changed the _WinAPI_SetKeyboardLayout() function. Now, if the specified keyboard layout not loaded in the system, the function returns an error.
  • Rewrited (header is changed, see description) _WinAPI_StructToArray() function.
  • Added the following functions.

    _WinAPI_ActivateKeyboardLayout

    _WinAPI_CommandLineToArgv

    _WinAPI_DeviceIoControl

    _WinAPI_GetCurrentHwProfile

    _WinAPI_GetPerformanceInfo

    _WinAPI_GetPosFromRect

    _WinAPI_GetProfilesDirectory

    _WinAPI_GetVersion

    _WinAPI_IsLoadKBLayout

    _WinAPI_IsWow64Process

    _WinAPI_LoadKeyboardLayout

    _WinAPI_MessageBoxCheck

    _WinAPI_PatBlt

    _WinAPI_ShellAddToRecentDocs

    _WinAPI_ShellObjectProperties

    _WinAPI_ShutdownDlg

    _WinAPI_UnloadKeyboardLayout

    *Windows Vista and above

    _WinAPI_DrawThemeTextEx

    _WinAPI_DwmGetColorizationColor

    _WinAPI_DwmGetWindowAttribute

    _WinAPI_DwmEnableBlurBehindWindow

    _WinAPI_DwmEnableComposition

    _WinAPI_DwmExtendFrameIntoClientArea

    _WinAPI_DwmIsCompositionEnabled

    _WinAPI_DwmQueryThumbnailSourceSize

    _WinAPI_DwmRegisterThumbnail

    _WinAPI_DwmSetWindowAttribute

    _WinAPI_DwmUnregisterThumbnail

    _WinAPI_DwmUpdateThumbnailProperties

    _WinAPI_GetTickCount64

    _WinAPI_LoadIconWithScaleDown

    _WinAPI_ShellGetKnownFolderPath

    _WinAPI_ShellGetStockIconInfo

    _WinAPI_ShellOpenWithDlg

  • Added examples for the functions above.
  • Changed some examples.
  • Few internal changes, mainly related to the types of data to work on 64-bit systems.
  • Updated Help file.

Posted

The library has been updated.

v2.6

Changes

  • Removed the following functions.

    _WinAPI_ShareFolderDlg

    _WinAPI_WinHelp

  • Changed the _WinAPI_SetKeyboardLayout() function. Now, if the specified keyboard layout not loaded in the system, the function returns an error.
  • Rewrited (header is changed, see description) _WinAPI_StructToArray() function.
  • Added the following functions.

    _WinAPI_ActivateKeyboardLayout

    _WinAPI_CommandLineToArgv

    _WinAPI_DeviceIoControl

    _WinAPI_GetCurrentHwProfile

    _WinAPI_GetPerformanceInfo

    _WinAPI_GetPosFromRect

    _WinAPI_GetProfilesDirectory

    _WinAPI_GetVersion

    _WinAPI_IsLoadKBLayout

    _WinAPI_IsWow64Process

    _WinAPI_LoadKeyboardLayout

    _WinAPI_MessageBoxCheck

    _WinAPI_PatBlt

    _WinAPI_ShellAddToRecentDocs

    _WinAPI_ShellObjectProperties

    _WinAPI_ShutdownDlg

    _WinAPI_UnloadKeyboardLayout

    *Windows Vista and above

    _WinAPI_DrawThemeTextEx

    _WinAPI_DwmGetColorizationColor

    _WinAPI_DwmGetWindowAttribute

    _WinAPI_DwmEnableBlurBehindWindow

    _WinAPI_DwmEnableComposition

    _WinAPI_DwmExtendFrameIntoClientArea

    _WinAPI_DwmIsCompositionEnabled

    _WinAPI_DwmQueryThumbnailSourceSize

    _WinAPI_DwmRegisterThumbnail

    _WinAPI_DwmSetWindowAttribute

    _WinAPI_DwmUnregisterThumbnail

    _WinAPI_DwmUpdateThumbnailProperties

    _WinAPI_GetTickCount64

    _WinAPI_LoadIconWithScaleDown

    _WinAPI_ShellGetKnownFolderPath

    _WinAPI_ShellGetStockIconInfo

    _WinAPI_ShellOpenWithDlg

  • Added examples for the functions above.
  • Changed some examples.
  • Few internal changes, mainly related to the types of data to work on 64-bit systems.
  • Updated Help file.

Hi, Nice work!

But why can't I get the return value of the function _WinAPI_DwmGetWindowAttribute, and the example also not.

would you like to check that? Thx!

Posted (edited)

Hi, Nice work!

But why can't I get the return value of the function _WinAPI_DwmGetWindowAttribute, and the example also not.

would you like to check that? Thx!

Works fine for me. What exactly is not working? What error you got? Edited by Yashied
Posted (edited)

Works fine for me. What exactly is not working? What error you got?

I got no data in console

More: I've known the problem. The title is in chinese on my computer. Thx.

Edited by netegg
  • 2 weeks later...
Posted (edited)

Hi,Yashied,

would you like to give an example of _winapi_shellgetfileinfo?

i can't got any info by the function, and the example in the title 'SHGetFileInfo()' in the forum can not yet.

on the other hand, i notice, the $tSHFILEINFO in that example is not a parameter, why?

($tSHFILEINFO = _WinAPI_ShellGetFileInfo(_WinAPI_ShellGetSpecialFolderPath($CSIDL_MYPICTURES), $SHGFI_ICONLOCATION))

Pls give an example, OK?

Edited by netegg
  • 2 weeks later...
Posted (edited)

Yashied, three more for your great library :mellow:. Found these following a discussion about reducing GUI flickering on control repositioning by using $WS_EX_COMPOSITED through a comment of Greenhorn here.

"If the BeginDeferWindowPos function succeeds, the return value identifies the multiple-window-position structure. The multiple-window-position structure is an internal structure; an application cannot access it directly. DeferWindowPos fills the multiple-window-position structure with information about the target position for one or more windows about to be moved. The EndDeferWindowPos function uses the information in this structure to change the position and size of a number of windows simultaneously."

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.6.1
    Author:         KaFu

    Script Function:
    Delayed movement of windows & controls with BeginDeferWindowPos, DeferWindowPos & EndDeferWindowPos (reduces flicker)

    Simultaneously updates the position and size of one or more windows in a single screen-refreshing cycle / change the position and size of a number of windows simultaneously

#ce ----------------------------------------------------------------------------

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Winapi.au3>

Opt("GUIOnEventMode", 1)
GUICreate("My GUI", 600, 600)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Dim $cButtons[50]
$x = 0
For $i = 0 To 6
    For $y = 0 To 6
        $x += 1
        $cButtons[$x] = GUICtrlCreateButton("Button " & $x, 15 + (($y + 1) * 60), 15 + (($i + 1) * 60), 60, 60)
    Next
Next
GUISetState(@SW_SHOW)

While 1

    $hWinPosInfo = _WinAPI_BeginDeferWindowPos()
    For $i = 1 To 49
        _WinAPI_DeferWindowPos($hWinPosInfo, GUICtrlGetHandle($cButtons[$i]), 0, 0, 0, 0, 0, BitOR(0x0001, 0x0002, 0x0080))
    Next
    _WinAPI_EndDeferWindowPos($hWinPosInfo)

    Sleep(250)

    $hWinPosInfo = _WinAPI_BeginDeferWindowPos()
    For $i = 1 To 49
        _WinAPI_DeferWindowPos($hWinPosInfo, GUICtrlGetHandle($cButtons[$i]), 0, 0, 0, 0, 0, BitOR(0x0001, 0x0002, 0x0040))
    Next
    _WinAPI_EndDeferWindowPos($hWinPosInfo)

    Sleep(250)

WEnd

Func _Exit()
    GUIDelete()
    Exit
EndFunc   ;==>_Exit

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_BeginDeferWindowPos
; Description....: Allocates memory for a multiple-window- position structure and returns the handle to the structure.
; Syntax.........: _WinAPI_BeginDeferWindowPos($nNumWindows)
; Parameters.....: $nNumWindows  - The initial number of windows for which to store position information (the DeferWindowPos function increases the size of the structure, if necessary)
; Return values..: Success       - If the function succeeds, the return value identifies the multiple-window-position structure. If insufficient system resources are available to allocate the structure, the return value is NULL. To get extended error information, call GetLastError.
;                  Failure       - 0 and sets the @error flag to non-zero.
; Author.........: KaFu
; Modified.......:
; Remarks........:
; Related........: _WinAPI_DeferWindowPos, _WinAPI_EndDeferWindowPos
; Link...........: @@MsdnLink@@ BeginDeferWindowPos http://msdn.microsoft.com/en-us/library/ms632672%28VS.85%29.aspx
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_BeginDeferWindowPos($nNumWindows = 1)
    Local $hWinPosInfo = DllCall("User32.dll", "HANDLE", "BeginDeferWindowPos", "int", $nNumWindows)
    If (@error) Or (Not $hWinPosInfo[0]) Then
        Return SetError(_WinAPI_GetLastError(), 0, '')
    EndIf
    Return $hWinPosInfo
EndFunc   ;==>_WinAPI_BeginDeferWindowPos

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_DeferWindowPos
; Description....: Updates the specified multiple-window – position structure for the specified window. The function then returns a handle to the updated structure.
; Syntax.........: _WinAPI_DeferWindowPos(ByRef $hWinPosInfo, $hWnd, $hWndInsertAfter, $x, $y, $cx, $cy, $uFlags)
; Parameters.....: $hWinPosInfo  - multiple-window-position structure as returned by _WinAPI_BeginDeferWindowPos
;                  $hWndInsertAfter - A handle to the window that precedes the positioned window in the Z order. This parameter must be a window handle or one of the following values.
;                       HWND_BOTTOM ((HWND) 1) Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status And is placed at the bottom of all other windows.
;                       HWND_NOTOPMOST ((HWND) - 2) Places the window above all non - topmost windows(that is, behind all topmost windows). This flag has no effect If the window is already a non - topmost window.
;                       HWND_TOP ((HWND) 0) Places the window at the top of the Z order.
;                       HWND_TOPMOST ((HWND) - 1) Places the window above all non - topmost windows. The window maintains its topmost position even when it is deactivated.
;                  $x - The x-coordinate of the window's upper-left corner.
;                  $y - The y-coordinate of the window's upper-left corner.
;                  $cx - The window's new width, in pixels.
;                  $cy - The window's new height, in pixels.
;                  $uFlags - A combination of the following values that affect the size and position of the window.
;                       SWP_DRAWFRAME 0x0020 Draws a frame(defined In the window's class description) around the window.
;                       SWP_FRAMECHANGED 0x0020 Sends a WM_NCCALCSIZE message To the window, even If the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window' s size is being changed.
;                       SWP_HIDEWINDOW 0x0080 Hides the window.
;                       SWP_NOACTIVATE 0x0010 Does Not activate the window. If this flag is Not set, the window is activated And moved To the top of either the topmost Or non - topmost group(depending on the setting of the hWndInsertAfter parameter).
;                       SWP_NOCOPYBITS 0x0100 Discards the entire contents of the client area. If this flag is Not specified, the valid contents of the client area are saved And copied back into the client area after the window is sized Or repositioned.
;                       SWP_NOMOVE 0x0002 Retains the current position(ignores the x And y parameters).
;                       SWP_NOOWNERZORDER 0x0200 Does Not change the owner window's position in the Z order.
;                       SWP_NOREDRAW 0x0008 Does Not redraw changes. If this flag is set, no repainting of any kind occurs. This applies To the client area, the nonclient area(including the title bar And scroll bars), And any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate Or redraw any parts of the window And parent window that need redrawing.
;                       SWP_NOREPOSITION 0x0200 Same as the SWP_NOOWNERZORDER flag.
;                       SWP_NOSENDCHANGING 0x0400 Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
;                       SWP_NOSIZE 0x0001 Retains the current size(ignores the cx And cy parameters).
;                       SWP_NOZORDER 0x0004 Retains the current Z order(ignores the hWndInsertAfter parameter).
;                       SWP_SHOWWINDOW 0x0040 Displays the window.
; Return values..: Success       - If the function succeeds, the return value will be TRUE and the multiple-window-position structure $hWinPosInfo will be updated ByRef.
;                  Failure       - 0 and sets the @error flag to non-zero.
; Author.........: KaFu
; Modified.......:
; Remarks........:
; Related........: _WinAPI_BeginDeferWindowPos, _WinAPI_EndDeferWindowPos
; Link...........: @@MsdnLink@@ DeferWindowPos http://msdn.microsoft.com/en-us/library/ms632681%28v=VS.85%29.aspx
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_DeferWindowPos(ByRef $hWinPosInfo, $hWnd, $hWndInsertAfter, $x, $y, $cx, $cy, $uFlags)
    If Not IsArray($hWinPosInfo) Then Return SetError(1, 0, '')
    Local $Ret = DllCall("User32.dll", "HANDLE", "DeferWindowPos", "HANDLE", $hWinPosInfo[0], "HWND", $hWnd, "HWND", $hWndInsertAfter, "int", $x, "int", $y, "int", $cx, "int", $cy, "UINT", $uFlags)
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(_WinAPI_GetLastError(), 0, '')
    EndIf
    $hWinPosInfo = $Ret
    Return True
EndFunc   ;==>_WinAPI_DeferWindowPos

; #FUNCTION# ====================================================================================================================
; Name...........: _WinAPI_EndDeferWindowPos
; Description....: Simultaneously updates the position and size of one or more windows in a single screen-refreshing cycle.
; Syntax.........: _WinAPI_EndDeferWindowPos($hWinPosInfo)
; Parameters.....: $hWinPosInfo  - multiple-window-position structure as returned by _WinAPI_BeginDeferWindowPos
; Return values..: Success       - If the function succeeds, the return will be TRUE
;                  Failure       - 0 and sets the @error flag to non-zero.
; Author.........: KaFu
; Modified.......:
; Remarks........:
; Related........: _WinAPI_BeginDeferWindowPos, _WinAPI_DeferWindowPos
; Link...........: @@MsdnLink@@ EndDeferWindowPos http://msdn.microsoft.com/en-us/library/ms633440%28v=VS.85%29.aspx
; Example........: Yes
; ===============================================================================================================================
Func _WinAPI_EndDeferWindowPos($hWinPosInfo)
    If Not IsArray($hWinPosInfo) Then Return SetError(1, 0, '')
    Local $Ret = DllCall("User32.dll", "HANDLE", "EndDeferWindowPos", "HANDLE", $hWinPosInfo[0])
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(_WinAPI_GetLastError(), 0, '')
    EndIf
    Return True
EndFunc   ;==>_WinAPI_EndDeferWindowPos
Edited by KaFu
Posted (edited)

The library has been updated.

v2.7

Changes

  • Removed the following functions.

    _WinAPI_DuplicateIcon

    _WinAPI_FreeHandle

    _WinAPI_FreeIcon

    _WinAPI_FreeObject

    _WinAPI_PrivateExtractIcon

    Use as a replacement the following functions, respectively.

    _WinAPI_CopyIcon

    _WinAPI_CloseHandle

    _WinAPI_DestroyIcon

    _WinAPI_DeleteObject

    _WinAPI_ShellExtractIcon

  • Renamed the following functions.

    _WinAPI_DuplicateBitmap => _WinAPI_CopyBitmap

    _WinAPI_DuplicateCursor => _WinAPI_CopyCursor

    _WinAPI_DuplicateStruct => _WinAPI_CopyStruct

    _WinAPI_FitToBitmap => _WinAPI_ResizeBitmap

    _WinAPI_FreeCursor => _WinAPI_DestroyCursor

    _WinAPI_SetLibraryColorMode => _WinAPI_SetUDFColorMode

    _WinAPI_ShellExtractIcons => _WinAPI_ShellExtractIcon

  • The following functions replaced by their Unicode versions.

    _WinAPI_GetObjectEx

    _WinAPI_GetTextMetrics

  • Added the following functions.

    _WinAPI_BeginDeferWindowPos

    _WinAPI_CalculatePopupWindowPosition

    _WinAPI_CloseEnhMetaFile

    _WinAPI_CopyEnhMetaFile

    _WinAPI_CreateEnhMetaFile

    _WinAPI_DeferWindowPos

    _WinAPI_DeleteEnhMetaFile

    _WinAPI_EndDeferWindowPos

    _WinAPI_GetEnhMetaFile

    _WinAPI_GetEnhMetaFileBits

    _WinAPI_GetEnhMetaFileDescription

    _WinAPI_GetEnhMetaFileDimension

    _WinAPI_GetEnhMetaFileHeader

    _WinAPI_GetFileVersionInfo

    _WinAPI_GetModuleFileName

    _WinAPI_GetModuleHandleEx

    _WinAPI_GetProcessCommandLine

    _WinAPI_GetUDFColorMode

    _WinAPI_GetUDFVersion

    _WinAPI_SetEnhMetaFileBits

    _WinAPI_SwapDWord

    _WinAPI_PlayEnhMetaFile

    _WinAPI_VerQueryRoot

    _WinAPI_VerQueryValue

  • Added examples for the functions above.
  • Updated Help file.

Edited by Yashied

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