User Defined Functions

User Defined Function Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

User Defined Function | Description
_ArrayAdd | Adds a specified value at the end of an existing array.
_ArrayBinarySearch | Uses the binary search algorithm to search through a 1-dimensional array.
_ArrayCombinations | Returns an Array of the Combinations of a Set of Elements from a Selected Array
_ArrayConcatenate | Concatenate two arrays.
_ArrayDelete | Deletes the specified element from the given array.
_ArrayDisplay | Displays given 1D or 2D array array in a listview.
_ArrayFindAll | Find the indices of all ocurrences of a search query between two points in a 1D or 2D array using _ArraySearch().
_ArrayInsert | Add a new value at the specified position.
_ArrayMax | Returns the highest value held in an array.
_ArrayMaxIndex | Returns the index where the highest value occurs in the array.
_ArrayMin | Returns the lowest value held in an array.
_ArrayMinIndex | Returns the index where the lowest value occurs in the array.
_ArrayPermute | Returns an Array of the Permutations of all Elements in an Array
_ArrayPop | Returns the last element of an array, deleting that element from the array at the same time.
_ArrayPush | Add new values without increasing array size by inserting at the end the new value and deleting the first one or vice versa.
_ArrayReverse | Takes the given array and reverses the order in which the elements appear in the array.
_ArraySearch | Finds an entry within a 1D or 2D array. Similar to _ArrayBinarySearch(), except that the array does not need to be sorted.
_ArraySort | Sort a 1D or 2D array on a specific index using the quicksort/insertionsort algorithms.
_ArraySwap | Swaps two items.
_ArrayToClip | Sends the contents of an array to the clipboard, each element delimited by a carriage return.
_ArrayToString | Places the elements of an array into a single string, separated by the specified delimiter.
_ArrayTrim | Trims a certain number of characters from all elements in an array.
_ArrayUnique | Returns the Unique Elements of a 1-dimensional array.
_Assert | Display a message if assertion fails.
_ChooseColor | Creates a Color dialog box that enables the user to select a color
_ChooseFont | Creates a Font dialog box that enables the user to choose attributes for a logical font.
_ClipBoard_ChangeChain | Removes a specified window from the chain of clipboard viewers
_ClipBoard_Close | Closes the clipboard
_ClipBoard_CountFormats | Retrieves the number of different data formats currently on the clipboard
_ClipBoard_Empty | Empties the clipboard and frees handles to data in the clipboard
_ClipBoard_EnumFormats | Enumerates the data formats currently available on the clipboard
_ClipBoard_FormatStr | Returns a string representation of a standard clipboard format
_ClipBoard_GetData | Retrieves data from the clipboard in a specified format
_ClipBoard_GetDataEx | Retrieves data from the clipboard in a specified format
_ClipBoard_GetFormatName | Retrieves the name of the specified registered format
_ClipBoard_GetOpenWindow | Retrieves the handle to the window that currently has the clipboard open
_ClipBoard_GetOwner | Retrieves the window handle of the current owner of the clipboard
_ClipBoard_GetPriorityFormat | Retrieves the first available clipboard format in the specified list
_ClipBoard_GetSequenceNumber | Retrieves the clipboard sequence number for the current window station
_ClipBoard_GetViewer | Retrieves the handle to the first window in the clipboard viewer chain
_ClipBoard_IsFormatAvailable | Determines whether the clipboard contains data in the specified format
_ClipBoard_Open | Opens the clipboard and prevents other applications from modifying the clipboard
_ClipBoard_RegisterFormat | Registers a new clipboard format
_ClipBoard_SetData | Places data on the clipboard in a specified clipboard format
_ClipBoard_SetDataEx | Places data on the clipboard in a specified clipboard format
_ClipBoard_SetViewer | Adds the specified window to the chain of clipboard viewers
_ClipPutFile | Copy Files to Clipboard Like Explorer does
_ColorConvertHSLtoRGB | Converts HSL to RGB
_ColorConvertRGBtoHSL | Converts RGB to HSL
_ColorGetBlue | Returns the blue component of a given color.
_ColorGetGreen | Returns the green component of a given color.
_ColorGetRed | Returns the red component of a given color.
_ColorGetRGB | Returns an array containing RGB values in their respective positions.
_ColorSetRGB | Returns the RGB color to work with (COLORREF).
_Crypt_DecryptData | Decrypts data using the supplied key
_Crypt_DecryptFile | Decrypts a file with specified key and algorithm
_Crypt_DeriveKey | Creates a key from algorithm and password
_Crypt_DestroyKey | Frees the resources used by a key
_Crypt_EncryptData | Encrypts data using the supplied key
_Crypt_EncryptFile | Encrypts a file with specified key and algorithm
_Crypt_HashData | Hash data with specified algorithm
_Crypt_HashFile | Hash a string with specified algorithm
_Crypt_Shutdown | Uninitialize the Crypt library
_Crypt_Startup | Initialize the Crypt library
_Date_Time_CompareFileTime | Compares two file times
_Date_Time_DOSDateTimeToArray | Decode a DOS date/time to an array
_Date_Time_DOSDateTimeToFileTime | Converts MS-DOS date and time values to a file time
_Date_Time_DOSDateTimeToStr | Decode a DOS date to a string
_Date_Time_DOSDateToArray | Decode a DOS date to an array
_Date_Time_DOSDateToStr | Decode a DOS date to a string
_Date_Time_DOSTimeToArray | Decode a DOS time to an array
_Date_Time_DOSTimeToStr | Decode a DOS time to a string
_Date_Time_EncodeFileTime | Encodes and returns a $tagFILETIME structure
_Date_Time_EncodeSystemTime | Encodes and returns a $tagSYSTEMTIME structure
_Date_Time_FileTimeToArray | Decode a file time to an array
_Date_Time_FileTimeToDOSDateTime | Converts MS-DOS date and time values to a file time
_Date_Time_FileTimeToLocalFileTime | Converts a file time based on the Coordinated Universal Time to a local file time
_Date_Time_FileTimeToStr | Decode a file time to a date/time string
_Date_Time_FileTimeToSystemTime | Converts a file time to system time format
_Date_Time_GetFileTime | Retrieves the date and time that a file was created, accessed and modified
_Date_Time_GetLocalTime | Retrieves the current local date and time
_Date_Time_GetSystemTime | Retrieves the current system date and time expressed in UTC
_Date_Time_GetSystemTimeAdjustment | Determines whether the system is applying periodic time adjustments
_Date_Time_GetSystemTimeAsFileTime | Retrieves the current system date and time expressed in UTC
_Date_Time_GetSystemTimes | Retrieves system timing information
_Date_Time_GetTickCount | Retrieves the number of milliseconds that have elapsed since Windows was started
_Date_Time_GetTimeZoneInformation | Retrieves the current time zone settings
_Date_Time_LocalFileTimeToFileTime | Converts a local file time to a file time based on UTC
_Date_Time_SetFileTime | Sets the date and time that a file was created, accessed and modified
_Date_Time_SetLocalTime | Sets the current local date and time
_Date_Time_SetSystemTime | Sets the current system time and date, expressed in UTC
_Date_Time_SetSystemTimeAdjustment | Enables or disables periodic time adjustments to the system's time of day clock
_Date_Time_SetTimeZoneInformation | Sets the current time zone settings
_Date_Time_SystemTimeToArray | Decode a system time to an array
_Date_Time_SystemTimeToDateStr | Decode a system time to a date string
_Date_Time_SystemTimeToDateTimeStr | Decode a system time to a date/time string
_Date_Time_SystemTimeToFileTime | Converts a system time to file time format
_Date_Time_SystemTimeToTimeStr | Decode a system time to a time string
_Date_Time_SystemTimeToTzSpecificLocalTime | Converts a UTC time to a specified time zone's corresponding local time
_Date_Time_TzSpecificLocalTimeToSystemTime | Converts a local time to a time in UTC
_DateAdd | Calculates a new date based on a given date and add an interval.
_DateDayOfWeek | Returns the name of the weekday, based on the specified day.
_DateDaysInMonth | Returns the number of days in a month, based on the specified month and year.
_DateDiff | Returns the difference between 2 dates, expressed in the type requested
_DateIsLeapYear | Checks a given year to see if it is a leap year.
_DateIsValid | Checks the given date to determine if it is a valid date.
_DateTimeFormat | Returns the date in the PC's regional settings format.
_DateTimeSplit | Split a string containing Date and Time into two separate Arrays.
_DateToDayOfWeek | Returns the weekdaynumber for a given date.
_DateToDayOfWeekISO | Returns the ISO weekdaynumber for a given date.
_DateToDayValue | Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.
_DateToMonth | Returns the name of the Month, based on the specified month number.
_DayValueToDate | Add the given days since noon 4713 BC January 1 and returns the Gregorian date.
_DebugBugReportEnv | Outputs a string containing information for Bug report submission.
_DebugOut | Displays output on a debugging session started by _DebugSetup()
_DebugReport | Writes to a debugging session
_DebugReportEx | Writes to a debugging session a formatted message
_DebugReportVar | Writes to debugging session the content of a variable
_DebugSetup | Setups up a debug session using a specify reporting
_Degree | Converts radians to degrees.
_EventLog__Backup | Saves the event log to a backup file
_EventLog__Clear | Clears the event log
_EventLog__Close | Closes a read handle to the event log
_EventLog__Count | Retrieves the number of records in the event log
_EventLog__DeregisterSource | Closes a write handle to the event log
_EventLog__Full | Retrieves whether the event log is full
_EventLog__Notify | Enables an application to receive event notifications
_EventLog__Oldest | Retrieves the absolute record number of the oldest record in the event log
_EventLog__Open | Opens a handle to the event log
_EventLog__OpenBackup | Opens a handle to a backup event log
_EventLog__Read | Reads an entry from the event log
_EventLog__RegisterSource | Retrieves a registered handle to the specified event log
_EventLog__Report | Writes an entry at the end of the specified event log
_ExcelBookAttach | Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.
_ExcelBookClose | Closes the active workbook and removes the specified Excel object.
_ExcelBookNew | Creates new workbook and returns its object identifier.
_ExcelBookOpen | Opens an existing workbook and returns its object identifier.
_ExcelBookSave | Saves the active workbook of the specified Excel object.
_ExcelBookSaveAs | Saves the active workbook of the specified Excel object with a new filename and/or type.
_ExcelColumnDelete | Delete a number of columns from the active worksheet.
_ExcelColumnInsert | Insert a number of columns into the active worksheet.
_ExcelFontSetProperties | Set the bold, italic, and underline font properties of a range in an Excel object.
_ExcelHorizontalAlignSet | Set the horizontal alignment of each cell in a range.
_ExcelHyperlinkInsert | Inserts a hyperlink into the active page.
_ExcelNumberFormat | Applies the specified formatting to the cells in the specified R1C1 Range.
_ExcelReadArray | Create an array from a row or column of the active worksheet.
_ExcelReadCell | Read information from the active worksheet of the specified Excel object.
_ExcelReadSheetToArray | Create a 2D array from the rows/columns of the active worksheet.
_ExcelRowDelete | Delete a number of rows from the active worksheet.
_ExcelRowInsert | Insert a number of rows into the active worksheet.
_ExcelSheetActivate | Activate the specified sheet by string name or by number.
_ExcelSheetAddNew | Add new sheet to workbook - optionally with a name.
_ExcelSheetDelete | Delete the specified sheet by string name or by number.
_ExcelSheetList | Return a list of all sheets in workbook, by name, as an array.
_ExcelSheetMove | Move the specified sheet before another specified sheet.
_ExcelSheetNameGet | Return the name of the active sheet.
_ExcelSheetNameSet | Set the name of the active sheet.
_ExcelWriteArray | Write an array to a row or column on the active worksheet of the specified Excel object.
_ExcelWriteCell | Write information to a cell on the active worksheet of the specified Excel object.
_ExcelWriteFormula | Write a formula to a cell on the active worksheet of the specified Excel object.
_ExcelWriteSheetFromArray | Writes a 2D array to the active worksheet
_FileCountLines | Returns the number of lines in the specified file.
_FileCreate | Creates or zero's out the length of the file specified.
_FileListToArray | Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)
_FilePrint | Prints a plain text file.
_FileReadToArray | Reads the specified file into an array.
_FileWriteFromArray | Writes Array records to the specified file.
_FileWriteLog | Writes current date,time and the specified text to a log file.
_FileWriteToLine | Writes text to a specific line in a file.
_FTP_Close | Closes the _FTP_Open session.
_FTP_Command | Sends a command to an FTP server.
_FTP_Connect | Connects to an FTP server.
_FTP_DecodeInternetStatus | Decode a received Internet Status.
_FTP_DirCreate | Makes an Directory on an FTP server.
_FTP_DirDelete | Delete's an Directory on an FTP server.
_FTP_DirGetCurrent | Get Current Directory on an FTP server.
_FTP_DirPutContents | Puts an folder on an FTP server. Recursivley if selected.
_FTP_DirSetCurrent | Set Current Directory on an FTP server.
_FTP_FileClose | Closes the Handle returned by _FTP_FileOpen.
_FTP_FileDelete | Delete an file from an FTP server.
_FTP_FileGet | Get file from a FTP server.
_FTP_FileGetSize | Gets filesize of a file on the FTP server.
_FTP_FileOpen | Initiates access to a remote file on an FTP server for reading or writing.
_FTP_FilePut | Puts an file on an FTP server.
_FTP_FileRead | Reads data from a handle opened by _FTP_FileOpen()
_FTP_FileRename | Renames an file on an FTP server.
_FTP_FileTimeLoHiToStr | Closes the _FTP_Open session.
_FTP_FindFileClose | Delete FindFile Handle.
_FTP_FindFileFirst | Find First File on an FTP server.
_FTP_FindFileNext | Find Next File on an FTP server.
_FTP_GetLastResponseInfo | Retrieves the last error description or server response on the thread calling this function.
_FTP_ListToArray | Get Filenames, Directories or Both of current remote directory.
_FTP_ListToArray2D | Get Filenames and filesizes of current remote directory.
_FTP_ListToArrayEx | Get names, sizes, attributes aand times of files/dir of current remote directory.
_FTP_Open | Opens an FTP session.
_FTP_ProgressDownload | Downloads a file in Binary Mode and shows a Progress window or by Calling a User defined Function.
_FTP_ProgressUpload | Uploads a file in Binary Mode and shows a Progress window or by Calling a User defined Function
_FTP_SetStatusCallback | Registers callback function that WinINet functions can call as progress is made during an operation.
_GDIPlus_ArrowCapCreate | Creates an adjustable arrow line cap with the specified height and width
_GDIPlus_ArrowCapDispose | Release an adjustable arrow line cap object
_GDIPlus_ArrowCapGetFillState | Determines whether the arrow cap is filled
_GDIPlus_ArrowCapGetHeight | Gets the height of the arrow cap
_GDIPlus_ArrowCapGetMiddleInset | Gets the value of the inset
_GDIPlus_ArrowCapGetWidth | Gets the width of the arrow cap
_GDIPlus_ArrowCapSetFillState | Sets whether the arrow cap is filled
_GDIPlus_ArrowCapSetHeight | Sets the height of the arrow cap
_GDIPlus_ArrowCapSetMiddleInset | Gets the value of the inset
_GDIPlus_ArrowCapSetWidth | Sets the width of the arrow cap
_GDIPlus_BitmapCloneArea | Create a clone of a Bitmap object from the coordinates and format specified
_GDIPlus_BitmapCreateFromFile | Create a Bitmap object from file
_GDIPlus_BitmapCreateFromGraphics | Creates a Bitmap object based on a Graphics object, a width, and a height
_GDIPlus_BitmapCreateFromHBITMAP | Create a Bitmap object from a bitmap handle
_GDIPlus_BitmapCreateHBITMAPFromBitmap | Create a handle to a bitmap from a bitmap object
_GDIPlus_BitmapDispose | Release a bitmap object
_GDIPlus_BitmapLockBits | Locks a portion of a bitmap for reading or writing
_GDIPlus_BitmapUnlockBits | Unlocks a portion of a bitmap that was locked by _GDIPlus_BitmapLockBits
_GDIPlus_BrushClone | Clone a Brush object
_GDIPlus_BrushCreateSolid | Create a solid Brush object
_GDIPlus_BrushDispose | Release a Brush object
_GDIPlus_BrushGetSolidColor | Get the color of a Solid Brush object
_GDIPlus_BrushGetType | Retrieve the type of Brush object
_GDIPlus_BrushSetSolidColor | Set the color of a Solid Brush object
_GDIPlus_CustomLineCapDispose | Release a custom line cap object
_GDIPlus_Decoders | Get an array of information about the available image decoders
_GDIPlus_DecodersGetCount | Get the number of available image decoders
_GDIPlus_DecodersGetSize | Get the total size of the structure that is returned by _GDIPlus_GetImageDecoders
_GDIPlus_DrawImagePoints | Draws an image at a specified location.
_GDIPlus_Encoders | Get an array of information about the available image encoders
_GDIPlus_EncodersGetCLSID | Return the encoder CLSID for a specific image file type
_GDIPlus_EncodersGetCount | Get the number of available image encoders
_GDIPlus_EncodersGetParamList | Get the parameter list for a specified image encoder
_GDIPlus_EncodersGetParamListSize | Get the size of the parameter list for a specified image encoder
_GDIPlus_EncodersGetSize | Get the total size of the structure that is returned by _GDIPlus_GetImageEncoders
_GDIPlus_FontCreate | Create a Font object
_GDIPlus_FontDispose | Release a Font object
_GDIPlus_FontFamilyCreate | Create a Font Family object
_GDIPlus_FontFamilyDispose | Release a Font Family object
_GDIPlus_GraphicsClear | Clears a Graphics object to a specified color
_GDIPlus_GraphicsCreateFromHDC | Create a Graphics object from a device contect (DC)
_GDIPlus_GraphicsCreateFromHWND | Create a Graphics object from a window handle
_GDIPlus_GraphicsDispose | Release a Graphics object
_GDIPlus_GraphicsDrawArc | Draw an arc
_GDIPlus_GraphicsDrawBezier | Draw a bezier spline
_GDIPlus_GraphicsDrawClosedCurve | Draw a closed cardinal spline
_GDIPlus_GraphicsDrawCurve | Draw a cardinal spline
_GDIPlus_GraphicsDrawEllipse | Draw an ellipse
_GDIPlus_GraphicsDrawImage | Draw an Image object
_GDIPlus_GraphicsDrawImageRect | Draws an image at a specified location
_GDIPlus_GraphicsDrawImageRectRect | Draw an Image object
_GDIPlus_GraphicsDrawLine | Draw a line
_GDIPlus_GraphicsDrawPie | Draw a pie
_GDIPlus_GraphicsDrawPolygon | Draw a polygon
_GDIPlus_GraphicsDrawRect | Draw a rectangle
_GDIPlus_GraphicsDrawString | Draw a string
_GDIPlus_GraphicsDrawStringEx | Draw a string
_GDIPlus_GraphicsFillClosedCurve | Fill a closed cardinal spline
_GDIPlus_GraphicsFillEllipse | Fill an ellipse
_GDIPlus_GraphicsFillPie | Fill a pie
_GDIPlus_GraphicsFillPolygon | Fill a polygon
_GDIPlus_GraphicsFillRect | Fill a rectangle
_GDIPlus_GraphicsGetDC | Gets a handle to the device context of the Graphics object
_GDIPlus_GraphicsGetSmoothingMode | Gets the graphics object rendering quality
_GDIPlus_GraphicsMeasureString | Measures the size of a string
_GDIPlus_GraphicsReleaseDC | Releases the device context of the Graphics object
_GDIPlus_GraphicsSetSmoothingMode | Sets the graphics object rendering quality
_GDIPlus_GraphicsSetTransform | Sets the world transformation for a graphics object
_GDIPlus_ImageDispose | Release an image object
_GDIPlus_ImageGetFlags | Returns enumeration of pixel data attributes contained in an image
_GDIPlus_ImageGetGraphicsContext | Get the graphics context of the image
_GDIPlus_ImageGetHeight | Get the image height
_GDIPlus_ImageGetHorizontalResolution | Returns horizontal resolution in DPI (pixels per inch) of an image
_GDIPlus_ImageGetPixelFormat | Returns pixel format of an image: Bits per pixel, Alpha channels, RGB, Grayscale, Indexed etc.
_GDIPlus_ImageGetRawFormat | Returns file format GUID and image format name of an image
_GDIPlus_ImageGetType | Returns type (bitmap or metafile) of an image
_GDIPlus_ImageGetVerticalResolution | Returns horizontal resolution in DPI (pixels per inch) of an image
_GDIPlus_ImageGetWidth | Get the image width
_GDIPlus_ImageLoadFromFile | Create an image object based on a file
_GDIPlus_ImageSaveToFile | Save an image to file
_GDIPlus_ImageSaveToFileEx | Save an image to file
_GDIPlus_MatrixCreate | Creates and initializes a Matrix object that represents the identity matrix
_GDIPlus_MatrixDispose | Release a matrix object
_GDIPlus_MatrixRotate | Updates a matrix with the product of itself and a rotation matrix
_GDIPlus_MatrixScale | Updates a matrix with the product of itself and a scaling matrix
_GDIPlus_MatrixTranslate | Updates a matrix with the product of itself and a translation matrix
_GDIPlus_ParamAdd | Add a value to an enocder parameter list
_GDIPlus_ParamInit | Initialize an encoder parameter list
_GDIPlus_PenCreate | Create a pen object
_GDIPlus_PenDispose | Release a pen object
_GDIPlus_PenGetAlignment | Gets the pen alignment
_GDIPlus_PenGetColor | Gets the pen color
_GDIPlus_PenGetCustomEndCap | Gets the custom end cap for the pen
_GDIPlus_PenGetDashCap | Gets the pen dash cap style
_GDIPlus_PenGetDashStyle | Gets the pen dash style
_GDIPlus_PenGetEndCap | Gets the pen end cap
_GDIPlus_PenGetWidth | Retrieve the width of a pen
_GDIPlus_PenSetAlignment | Sets the pen alignment
_GDIPlus_PenSetColor | Sets the pen color
_GDIPlus_PenSetCustomEndCap | Sets the custom end cap for the pen
_GDIPlus_PenSetDashCap | Sets the pen dash cap style
_GDIPlus_PenSetDashStyle | Sets the pen dash style
_GDIPlus_PenSetEndCap | Sets the pen end cap
_GDIPlus_PenSetWidth | Sets the width of a pen
_GDIPlus_RectFCreate | Create a $tagGDIPRECTF structure
_GDIPlus_Shutdown | Clean up resources used by Microsoft Windows GDI+
_GDIPlus_Startup | Initialize Microsoft Windows GDI+
_GDIPlus_StringFormatCreate | Create a String Format object
_GDIPlus_StringFormatDispose | Release a String Format object
_GDIPlus_StringFormatSetAlign | Sets the text alignment of a string format object
_GetIP | Get public IP address of a network/computer.
_GUICtrlAVI_Close | Closes an AVI clip
_GUICtrlAVI_Create | Creates an AVI control
_GUICtrlAVI_Destroy | Delete the control
_GUICtrlAVI_IsPlaying | Checks whether an Audio-Video Interleaved (AVI) clip is playing
_GUICtrlAVI_Open | Opens an AVI clip and displays its first frame in an animation control
_GUICtrlAVI_OpenEx | Opens an AVI clip and displays its first frame in an animation control
_GUICtrlAVI_Play | Plays an AVI clip in an animation control
_GUICtrlAVI_Seek | Directs an AVI control to display a particular frame of an AVI clip
_GUICtrlAVI_Show | Show/Hide the AVI control
_GUICtrlAVI_Stop | Stops playing an AVI clip
_GUICtrlButton_Click | Simulates the user clicking a button
_GUICtrlButton_Create | Creates a Button control
_GUICtrlButton_Destroy | Delete the Button control
_GUICtrlButton_Enable | Enables or disables mouse and keyboard input to the specified button
_GUICtrlButton_GetCheck | Gets the check state of a radio button or check box
_GUICtrlButton_GetFocus | Retrieves if the button has keyboard focus
_GUICtrlButton_GetIdealSize | Gets the size of the button that best fits its text and image, if an image list is present
_GUICtrlButton_GetImage | Retrieves a handle to the image (icon or bitmap) associated with the button
_GUICtrlButton_GetImageList | Retrieves an array that describes the image list assigned to a button control
_GUICtrlButton_GetNote | Gets the text of the note associated with the Command Link button
_GUICtrlButton_GetNoteLength | Gets the length of the note text that may be displayed in the description for a command link button
_GUICtrlButton_GetSplitInfo | Gets information for a split button control
_GUICtrlButton_GetState | Determines the state of a button or check box
_GUICtrlButton_GetText | Retrieve the text of the button
_GUICtrlButton_GetTextMargin | Gets the margins used to draw text in a button control
_GUICtrlButton_SetCheck | Sets the check state of a radio button or check box
_GUICtrlButton_SetDontClick | Sets the state of $BST_DONTCLICK flag on a button
_GUICtrlButton_SetFocus | Sets the keyboard focus to the specified button
_GUICtrlButton_SetImage | Sets the check state of a radio button or check box
_GUICtrlButton_SetImageList | Assigns an image list to a button control
_GUICtrlButton_SetNote | Sets the text of the note associated with a command link button
_GUICtrlButton_SetShield | Sets the elevation required state for a specified button or command link to display an elevated icon
_GUICtrlButton_SetSize | Sets the size of the button
_GUICtrlButton_SetSplitInfo | Gets information for a split button control
_GUICtrlButton_SetState | Sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it.
_GUICtrlButton_SetStyle | Sets the style of a button
_GUICtrlButton_SetText | Sets the text of the button
_GUICtrlButton_SetTextMargin | Sets the margins for drawing text in a button control
_GUICtrlButton_Show | Show/Hide button
_GUICtrlComboBox_AddDir | Adds the names of directories and files
_GUICtrlComboBox_AddString | Add a string
_GUICtrlComboBox_AutoComplete | AutoComplete a ComboBox edit control
_GUICtrlComboBox_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlComboBox_Create | Create a ComboBox control
_GUICtrlComboBox_DeleteString | Delete a string
_GUICtrlComboBox_Destroy | Delete the control
_GUICtrlComboBox_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlComboBox_FindString | Search for a string
_GUICtrlComboBox_FindStringExact | Search for a string
_GUICtrlComboBox_GetComboBoxInfo | Gets information about the specified ComboBox
_GUICtrlComboBox_GetCount | Retrieve the number of items
_GUICtrlComboBox_GetCueBanner | Gets the cue banner text displayed in the edit control of a combo box
_GUICtrlComboBox_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlComboBox_GetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBox_GetDroppedControlRectEx | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBox_GetDroppedState | Determines whether the ListBox of a ComboBox is dropped down
_GUICtrlComboBox_GetDroppedWidth | Retrieve the minimum allowable width, of the ListBox of a ComboBox
_GUICtrlComboBox_GetEditSel | Gets the starting and ending character positions of the current selection in the edit control of a ComboBox
_GUICtrlComboBox_GetEditText | Get the text from the edit control of a ComboBox
_GUICtrlComboBox_GetExtendedUI | Determines whether a ComboBox has the default user interface or the extended user interface
_GUICtrlComboBox_GetHorizontalExtent | Gets the width, in pixels, that the ListBox of a ComboBox control can be scrolled horizontally
_GUICtrlComboBox_GetItemHeight | Determines the height of list items or the selection field in a ComboBox
_GUICtrlComboBox_GetLBText | Retrieve a string from the list of a ComboBox
_GUICtrlComboBox_GetLBTextLen | Gets the length, in characters, of a string in the list of a combo box
_GUICtrlComboBox_GetList | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBox_GetListArray | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBox_GetLocale | Retrieves the current locale
_GUICtrlComboBox_GetLocaleCountry | Retrieves the current country code
_GUICtrlComboBox_GetLocaleLang | Retrieves the current language identifier
_GUICtrlComboBox_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlComboBox_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlComboBox_GetMinVisible | Retrieve the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBox_GetTopIndex | Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox
_GUICtrlComboBox_InitStorage | Allocates memory for storing ListBox items
_GUICtrlComboBox_InsertString | Insert a string
_GUICtrlComboBox_LimitText | Limits the length of the text the user may type into the edit control of a ComboBox
_GUICtrlComboBox_ReplaceEditSel | Replace text selected in edit box
_GUICtrlComboBox_ResetContent | Remove all items from the ListBox and edit control of a ComboBox
_GUICtrlComboBox_SelectString | Searches the ListBox of a ComboBox for an item that begins with the characters in a specified string
_GUICtrlComboBox_SetCueBanner | Sets the cue banner text that is displayed for the edit control of a combo box
_GUICtrlComboBox_SetCurSel | Select a string in the list of a ComboBox
_GUICtrlComboBox_SetDroppedWidth | Set the maximum allowable width, in pixels, of the ListBox of a ComboBox
_GUICtrlComboBox_SetEditSel | Select characters in the edit control of a ComboBox
_GUICtrlComboBox_SetEditText | Set the text of the edit control of the ComboBox
_GUICtrlComboBox_SetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboBox_SetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlComboBox_SetItemHeight | Set the height of list items or the selection field in a ComboBox
_GUICtrlComboBox_SetMinVisible | Set the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBox_SetTopIndex | Ensure that a particular item is visible in the ListBox of a ComboBox
_GUICtrlComboBox_ShowDropDown | Show or hide the ListBox of a ComboBox
_GUICtrlComboBoxEx_AddDir | Adds the names of directories and files
_GUICtrlComboBoxEx_AddString | Add a string
_GUICtrlComboBoxEx_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlComboBoxEx_Create | Create a ComboBoxEx control
_GUICtrlComboBoxEx_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlComboBoxEx_DeleteString | Removes an item from a ComboBoxEx control
_GUICtrlComboBoxEx_Destroy | Delete the control
_GUICtrlComboBoxEx_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlComboBoxEx_FindStringExact | Search for a string
_GUICtrlComboBoxEx_GetComboBoxInfo | Gets information about the specified ComboBox
_GUICtrlComboBoxEx_GetComboControl | Gets the handle to the child combo box control
_GUICtrlComboBoxEx_GetCount | Retrieve the number of items
_GUICtrlComboBoxEx_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlComboBoxEx_GetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBoxEx_GetDroppedControlRectEx | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBoxEx_GetDroppedState | Determines whether the ListBox of a ComboBox is dropped down
_GUICtrlComboBoxEx_GetDroppedWidth | Retrieve the minimum allowable width, of the ListBox of a ComboBox
_GUICtrlComboBoxEx_GetEditControl | Gets the handle to the edit control portion of a ComboBoxEx control
_GUICtrlComboBoxEx_GetEditSel | Gets the starting and ending character positions of the current selection in the edit control of a ComboBox
_GUICtrlComboBoxEx_GetEditText | Get the text from the edit control of a ComboBoxEx
_GUICtrlComboBoxEx_GetExtendedStyle | Gets the extended styles that are in use for a ComboBoxEx control
_GUICtrlComboBoxEx_GetExtendedUI | Determines whether a ComboBox has the default user interface or the extended user interface
_GUICtrlComboBoxEx_GetImageList | Retrieves the handle to an image list assigned to a ComboBoxEx control
_GUICtrlComboBoxEx_GetItem | Retrieves an item's attributes
_GUICtrlComboBoxEx_GetItemEx | Retrieves some or all of an item's attributes
_GUICtrlComboBoxEx_GetItemHeight | Determines the height of list items or the selection field in a ComboBox
_GUICtrlComboBoxEx_GetItemImage | Retrieves the index of the item's icon
_GUICtrlComboBoxEx_GetItemIndent | Retrieves the number of image widths the item is indented
_GUICtrlComboBoxEx_GetItemOverlayImage | Retrieves the index of the item's overlay image icon
_GUICtrlComboBoxEx_GetItemParam | Retrieves the application specific value of the item
_GUICtrlComboBoxEx_GetItemSelectedImage | Retrieves the index of the item's selected image icon
_GUICtrlComboBoxEx_GetItemText | Retrieve a string from the list of a ComboBox
_GUICtrlComboBoxEx_GetItemTextLen | Gets the length, in characters, of a string in the list of a combo box
_GUICtrlComboBoxEx_GetList | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBoxEx_GetListArray | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBoxEx_GetLocale | Retrieves the current locale
_GUICtrlComboBoxEx_GetLocaleCountry | Retrieves the current country code
_GUICtrlComboBoxEx_GetLocaleLang | Retrieves the current language identifier
_GUICtrlComboBoxEx_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlComboBoxEx_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlComboBoxEx_GetMinVisible | Retrieve the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBoxEx_GetTopIndex | Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox
_GUICtrlComboBoxEx_GetUnicode | Retrieves if control is using Unicode
_GUICtrlComboBoxEx_InitStorage | Allocates memory for storing ListBox items
_GUICtrlComboBoxEx_InsertString | Inserts a new item in the control
_GUICtrlComboBoxEx_LimitText | Limits the length of the text the user may type into the edit control of a ComboBox
_GUICtrlComboBoxEx_ReplaceEditSel | Replace text selected in edit box
_GUICtrlComboBoxEx_ResetContent | Removes all items
_GUICtrlComboBoxEx_SetCurSel | Select a string in the list of a ComboBox
_GUICtrlComboBoxEx_SetDroppedWidth | Set the maximum allowable width, in pixels, of the ListBox of a ComboBox
_GUICtrlComboBoxEx_SetEditSel | Select characters in the edit control of a ComboBox
_GUICtrlComboBoxEx_SetEditText | Set the text of the edit control of the ComboBox
_GUICtrlComboBoxEx_SetExtendedStyle | Sets extended styles within a ComboBoxEx control
_GUICtrlComboBoxEx_SetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboBoxEx_SetImageList | Sets an image list for a ComboBoxEx control
_GUICtrlComboBoxEx_SetItem | Sets some or all of a item's attributes
_GUICtrlComboBoxEx_SetItemEx | Sets some or all of a item's attributes
_GUICtrlComboBoxEx_SetItemHeight | Set the height of list items or the selection field in a ComboBox
_GUICtrlComboBoxEx_SetItemImage | Sets the index of the item's icon in the control's image list
_GUICtrlComboBoxEx_SetItemIndent | Sets the number of image widths to indent the item
_GUICtrlComboBoxEx_SetItemOverlayImage | Sets the index of the item's overlay icon in the control's image list
_GUICtrlComboBoxEx_SetItemParam | Sets the value specific to the item
_GUICtrlComboBoxEx_SetItemSelectedImage | Sets the index of the item's overlay icon in the control's image list
_GUICtrlComboBoxEx_SetMinVisible | Set the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBoxEx_SetTopIndex | Ensure that a particular item is visible in the ListBox of a ComboBox
_GUICtrlComboBoxEx_SetUnicode | Sets if control is using Unicode
_GUICtrlComboBoxEx_ShowDropDown | Show or hide the ListBox of a ComboBox
_GUICtrlDTP_Create | Create a DTP control
_GUICtrlDTP_Destroy | Delete the control
_GUICtrlDTP_GetMCColor | Retrieves the specified color
_GUICtrlDTP_GetMCFont | Retrieves the month calendar font handle
_GUICtrlDTP_GetMonthCal | Retrieves the handle to child month calendar control
_GUICtrlDTP_GetRange | Retrieves the current minimum and maximum allowable system times
_GUICtrlDTP_GetRangeEx | Retrieves the current minimum and maximum allowable system times
_GUICtrlDTP_GetSystemTime | Retrieves the currently selected date and time
_GUICtrlDTP_GetSystemTimeEx | Retrieves the currently selected date and time
_GUICtrlDTP_SetFormat | Sets the display based on a given format string
_GUICtrlDTP_SetMCColor | Sets the color for a given portion of the month calendar
_GUICtrlDTP_SetMCFont | Sets the month calendar font
_GUICtrlDTP_SetRange | Sets the current minimum and maximum allowable system times
_GUICtrlDTP_SetRangeEx | Sets the current minimum and maximum allowable system times
_GUICtrlDTP_SetSystemTime | Sets the currently selected date and time
_GUICtrlDTP_SetSystemTimeEx | Sets the currently selected date and time
_GUICtrlEdit_AppendText | Append text
_GUICtrlEdit_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlEdit_CanUndo | Determines whether there are any actions in an edit control's undo queue
_GUICtrlEdit_CharFromPos | Retrieve information about the character closest to a specified point in the client area
_GUICtrlEdit_Create | Create a Edit control
_GUICtrlEdit_Destroy | Delete the Edit control
_GUICtrlEdit_EmptyUndoBuffer | Resets the undo flag of an edit control
_GUICtrlEdit_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlEdit_Find | Initiates a find dialog
_GUICtrlEdit_FmtLines | Determines whether a edit control includes soft line-break characters
_GUICtrlEdit_GetFirstVisibleLine | Retrieves the zero-based index of the uppermost visible line in a multiline edit control
_GUICtrlEdit_GetLimitText | Gets the current text limit for an edit control
_GUICtrlEdit_GetLine | Retrieves a line of text from an edit control
_GUICtrlEdit_GetLineCount | Retrieves the number of lines
_GUICtrlEdit_GetMargins | Retrieves the widths of the left and right margins
_GUICtrlEdit_GetModify | Retrieves the state of an edit control's modification flag
_GUICtrlEdit_GetPasswordChar | Gets the password character that an edit control displays when the user enters text
_GUICtrlEdit_GetRECT | Retrieves the formatting rectangle of an edit control
_GUICtrlEdit_GetRECTEx | Retrieves the formatting rectangle of an edit control
_GUICtrlEdit_GetSel | Retrieves the starting and ending character positions of the current selection
_GUICtrlEdit_GetText | Get the text from the edit control
_GUICtrlEdit_GetTextLen | Get the length of all the text from the edit control
_GUICtrlEdit_HideBalloonTip | Hides any balloon tip associated with an edit control
_GUICtrlEdit_InsertText | Insert text
_GUICtrlEdit_LineFromChar | Retrieves the index of the line that contains the specified character index
_GUICtrlEdit_LineIndex | Retrieves the character index of the first character of a specified line
_GUICtrlEdit_LineLength | Retrieves the length, in characters, of a line
_GUICtrlEdit_LineScroll | Scrolls the text
_GUICtrlEdit_PosFromChar | Retrieves the client area coordinates of a specified character in an edit control
_GUICtrlEdit_ReplaceSel | Replaces the current selection
_GUICtrlEdit_Scroll | Scrolls the text vertically
_GUICtrlEdit_SetLimitText | Sets the text limit
_GUICtrlEdit_SetMargins | Sets the widths of the left and right margins
_GUICtrlEdit_SetModify | Sets or clears the modification flag
_GUICtrlEdit_SetPasswordChar | Sets or removes the password character for an edit control
_GUICtrlEdit_SetReadOnly | Sets or removes the read-only style ($ES_READONLY)
_GUICtrlEdit_SetRECT | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRECTEx | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRECTNP | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRectNPEx | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetSel | Selects a range of characters
_GUICtrlEdit_SetTabStops | Sets the tab stops
_GUICtrlEdit_SetText | Set the text
_GUICtrlEdit_ShowBalloonTip | Displays a balloon tip associated with an edit control
_GUICtrlEdit_Undo | Undoes the last edit control operation in the control's undo queue
_GUICtrlHeader_AddItem | Adds a new header item
_GUICtrlHeader_ClearFilter | Clears the filter
_GUICtrlHeader_ClearFilterAll | Clears all of the filters
_GUICtrlHeader_Create | Creates a Header control
_GUICtrlHeader_CreateDragImage | Creates a semi-transparent version of an item's image for use as a dragging image
_GUICtrlHeader_DeleteItem | Deletes a header item
_GUICtrlHeader_Destroy | Delete the Header control
_GUICtrlHeader_EditFilter | Starts editing the specified filter
_GUICtrlHeader_GetBitmapMargin | Retrieves the width of the bitmap margin
_GUICtrlHeader_GetImageList | Retrieves the handle to the image list
_GUICtrlHeader_GetItem | Retrieves information about an item
_GUICtrlHeader_GetItemAlign | Retrieves the item text alignment
_GUICtrlHeader_GetItemBitmap | Retrieves the item bitmap handle
_GUICtrlHeader_GetItemCount | Retrieves a count of the items
_GUICtrlHeader_GetItemDisplay | Returns the item display information
_GUICtrlHeader_GetItemFlags | Returns the item flag information
_GUICtrlHeader_GetItemFormat | Returns the format of the item
_GUICtrlHeader_GetItemImage | Retrieves the index of an image within the image list
_GUICtrlHeader_GetItemOrder | Retrieves the order in which the item appears
_GUICtrlHeader_GetItemParam | Retrieves the param value of the item
_GUICtrlHeader_GetItemRect | Retrieves the bounding rectangle for a given item
_GUICtrlHeader_GetItemRectEx | Retrieves the bounding rectangle for a given item
_GUICtrlHeader_GetItemText | Retrieves the item text
_GUICtrlHeader_GetItemWidth | Retrieves the item's width
_GUICtrlHeader_GetOrderArray | Retrieves the current left-to-right order of items in a header control
_GUICtrlHeader_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlHeader_HitTest | Tests a point to determine which item is at the specified point
_GUICtrlHeader_InsertItem | Inserts a new header item
_GUICtrlHeader_Layout | Retrieves the correct size and position of the control
_GUICtrlHeader_OrderToIndex | Retrieves an index value for an item based on its order
_GUICtrlHeader_SetBitmapMargin | Sets the width of the margin, specified in pixels, of a bitmap
_GUICtrlHeader_SetFilterChangeTimeout | Sets the filter change timeout interval
_GUICtrlHeader_SetHotDivider | Changes the hot divider color
_GUICtrlHeader_SetImageList | Assigns an image list
_GUICtrlHeader_SetItem | Sets information about an item
_GUICtrlHeader_SetItemAlign | Sets the item text alignment
_GUICtrlHeader_SetItemBitmap | Sets the item bitmap handle
_GUICtrlHeader_SetItemDisplay | Returns the item display information
_GUICtrlHeader_SetItemFlags | Returns the item flag information
_GUICtrlHeader_SetItemFormat | Sets the format of the item
_GUICtrlHeader_SetItemImage | Sets the index of an image within the image list
_GUICtrlHeader_SetItemOrder | Sets the order in which the item appears
_GUICtrlHeader_SetItemParam | Sets the param value of the item
_GUICtrlHeader_SetItemText | Sets the item text
_GUICtrlHeader_SetItemWidth | Sets the item's width
_GUICtrlHeader_SetOrderArray | Sets the current left-to-right order of items
_GUICtrlHeader_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlIpAddress_ClearAddress | Clears the contents of the IP address control
_GUICtrlIpAddress_Create | Create a GUI IP Address Control
_GUICtrlIpAddress_Destroy | Delete the control
_GUICtrlIpAddress_Get | Retrieves the address from the IP address control
_GUICtrlIpAddress_GetArray | Retrieves the address from the IP address control
_GUICtrlIpAddress_GetEx | Retrieves the address from the IP address control
_GUICtrlIpAddress_IsBlank | Determines if all fields in the IP address control are blank
_GUICtrlIpAddress_Set | Sets the address in the IP address control
_GUICtrlIpAddress_SetArray | Sets the address in the IP address control
_GUICtrlIpAddress_SetEx | Sets the address in the IP address control
_GUICtrlIpAddress_SetFocus | Sets the keyboard focus to the specified field in the IP address control
_GUICtrlIpAddress_SetFont | Set font of the control
_GUICtrlIpAddress_SetRange | Sets the valid range for the specified field in the IP address control
_GUICtrlIpAddress_ShowHide | Shows/Hides the IP address control
_GUICtrlListBox_AddFile | Adds the specified filename that contains a directory listing
_GUICtrlListBox_AddString | Add a string
_GUICtrlListBox_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlListBox_ClickItem | Clicks an item
_GUICtrlListBox_Create | Create a Listbox control
_GUICtrlListBox_DeleteString | Delete a string
_GUICtrlListBox_Destroy | Delete the control
_GUICtrlListBox_Dir | Adds the names of directories and files
_GUICtrlListBox_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlListBox_FindInText | Searches for an item that contains the specified text anywhere in its text
_GUICtrlListBox_FindString | Search for a string
_GUICtrlListBox_GetAnchorIndex | Retrieves the index of the anchor item
_GUICtrlListBox_GetCaretIndex | Return index of item that has the focus rectangle
_GUICtrlListBox_GetCount | Retrieves the number of items
_GUICtrlListBox_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlListBox_GetHorizontalExtent | Retrieve from a list box the the scrollable width
_GUICtrlListBox_GetItemData | Retrieves the application defined value associated with an item
_GUICtrlListBox_GetItemHeight | Retrieves the height of items
_GUICtrlListBox_GetItemRect | Retrieves the rectangle that bounds an item
_GUICtrlListBox_GetItemRectEx | Retrieves the rectangle that bounds an item
_GUICtrlListBox_GetListBoxInfo | Retrieve the number of items per column in a specified list box
_GUICtrlListBox_GetLocale | Retrieves the current locale
_GUICtrlListBox_GetLocaleCountry | Retrieves the current country code
_GUICtrlListBox_GetLocaleLang | Retrieves the current language identifier
_GUICtrlListBox_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlListBox_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlListBox_GetSel | Retrieves the selection state of an item
_GUICtrlListBox_GetSelCount | Retrieves the total number of selected items
_GUICtrlListBox_GetSelItems | Fills a buffer with an array of selected items
_GUICtrlListBox_GetSelItemsText | Retrieves the text of selected items
_GUICtrlListBox_GetText | Returns the item (string) at the specified index
_GUICtrlListBox_GetTextLen | Gets the length of a string in a list box
_GUICtrlListBox_GetTopIndex | Retrieve the index of the first visible item in a list
_GUICtrlListBox_InitStorage | This message allocates memory for storing items
_GUICtrlListBox_InsertString | Insert a string into the list
_GUICtrlListBox_ItemFromPoint | Retrieves the zero based index of the item nearest the specified point
_GUICtrlListBox_ReplaceString | Replaces the text of an item
_GUICtrlListBox_ResetContent | Remove all items from the list box
_GUICtrlListBox_SelectString | Searchs for an item that begins with the specified string
_GUICtrlListBox_SelItemRange | Select one or more consecutive items in a multiple-selection list box
_GUICtrlListBox_SelItemRangeEx | Select one or more consecutive items in a multiple-selection list box
_GUICtrlListBox_SetAnchorIndex | Set the anchor item—that is, the item from which a multiple selection starts
_GUICtrlListBox_SetCaretIndex | Set the focus rectangle to the item at the specified index in a multiple-selection list box
_GUICtrlListBox_SetColumnWidth | Set the width, in pixels, of all columns
_GUICtrlListBox_SetCurSel | Select a string and scroll it into view, if necessary
_GUICtrlListBox_SetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlListBox_SetItemData | Sets the value associated with the specified item
_GUICtrlListBox_SetItemHeight | Sets the height, in pixels, of items
_GUICtrlListBox_SetLocale | Set the current locale
_GUICtrlListBox_SetSel | Select a string(s) in a multiple-selection list box
_GUICtrlListBox_SetTabStops | Sets the tab-stop positions
_GUICtrlListBox_SetTopIndex | Ensure that a particular item in a list box is visible
_GUICtrlListBox_Sort | Re-sorts list box if it has the $LBS_SORT style
_GUICtrlListBox_SwapString | Swaps the text of two items at the specified indices
_GUICtrlListBox_UpdateHScroll | Update the horizontal scroll bar based on the longest string
_GUICtrlListView_AddArray | Adds items from an array to the control
_GUICtrlListView_AddColumn | Adds a new column in the control
_GUICtrlListView_AddItem | Adds a new item to the end of the list
_GUICtrlListView_AddSubItem | Adds a new subitem to the control
_GUICtrlListView_ApproximateViewHeight | Calculates the approximate height required to display a given number of items
_GUICtrlListView_ApproximateViewRect | Calculates the approximate size required to display a given number of items
_GUICtrlListView_ApproximateViewWidth | Calculates the approximate width required to display a given number of items
_GUICtrlListView_Arrange | Arranges items in icon view
_GUICtrlListView_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlListView_CancelEditLabel | Cancels an item text editing operation
_GUICtrlListView_ClickItem | Clicks an item
_GUICtrlListView_CopyItems | Copy Items between 2 list-view controls
_GUICtrlListView_Create | Create a ListView control
_GUICtrlListView_CreateDragImage | Creates a drag image list for the specified item
_GUICtrlListView_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlListView_DeleteAllItems | Removes all items from a list-view control
_GUICtrlListView_DeleteColumn | Removes a column from a list-view control
_GUICtrlListView_DeleteItem | Removes an item from a list-view control
_GUICtrlListView_DeleteItemsSelected | Deletes item(s) selected
_GUICtrlListView_Destroy | Delete the listview control
_GUICtrlListView_DrawDragImage | Draw the Drage Image
_GUICtrlListView_EditLabel | Begins in place editing of the specified item text
_GUICtrlListView_EnableGroupView | Enables or disables whether the items in the control display as a group
_GUICtrlListView_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlListView_EnsureVisible | Ensures that a list-view item is either entirely or partially visible
_GUICtrlListView_FindInText | Searches for an item that contains the specified text anywhere in its text
_GUICtrlListView_FindItem | Searches for an item with the specified characteristics
_GUICtrlListView_FindNearest | Finds the item nearest to the position specified
_GUICtrlListView_FindParam | Searches for an item with the specified lParam
_GUICtrlListView_FindText | Searches for an item with the specified text
_GUICtrlListView_GetBkColor | Retrieves the background color of a list-view control
_GUICtrlListView_GetBkImage | Retrieves the background image in the control
_GUICtrlListView_GetCallbackMask | Retrieves the callback mask for the control
_GUICtrlListView_GetColumn | Retrieves the attributes of a column
_GUICtrlListView_GetColumnCount | Retrieve the number of columns
_GUICtrlListView_GetColumnOrder | Retrieves the current left-to-right order of columns
_GUICtrlListView_GetColumnOrderArray | Retrieves the current left-to-right order of columns in the control
_GUICtrlListView_GetColumnWidth | Retrieves the width of a column in report or list view
_GUICtrlListView_GetCounterPage | Calculates the number of items that can fit vertically in the visible area
_GUICtrlListView_GetEditControl | Retrieves the handle to the edit control being used to edit an item's text
_GUICtrlListView_GetExtendedListViewStyle | Retrieves the extended styles that are currently in use
_GUICtrlListView_GetFocusedGroup | Gets the group that has the focus
_GUICtrlListView_GetGroupCount | Gets the number of groups
_GUICtrlListView_GetGroupInfo | Retrieves group information
_GUICtrlListView_GetGroupInfoByIndex | Retrieves group information
_GUICtrlListView_GetGroupRect | Gets the rectangle for a specified group
_GUICtrlListView_GetGroupViewEnabled | Checks whether the control has group view enabled
_GUICtrlListView_GetHeader | Retrieves the handle to the header control
_GUICtrlListView_GetHotCursor | Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled
_GUICtrlListView_GetHotItem | Retrieves the index of the hot item
_GUICtrlListView_GetHoverTime | Retrieves the amount of time that the mouse cursor must hover over an item before it is selected
_GUICtrlListView_GetImageList | Retrieves the handle to an image list used for drawing listview items
_GUICtrlListView_GetISearchString | Retrieves the incremental search string of the control
_GUICtrlListView_GetItem | Retrieves an item's attributes
_GUICtrlListView_GetItemChecked | Returns the check state for a list-view control item
_GUICtrlListView_GetItemCount | Retrieves the number of items in a list-view control
_GUICtrlListView_GetItemCut | Determines whether the item is marked for a cut and paste operation
_GUICtrlListView_GetItemDropHilited | Determines whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_GetItemEx | Retrieves some or all of an item's attributes
_GUICtrlListView_GetItemFocused | Determines whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_GetItemGroupID | Gets the item group ID
_GUICtrlListView_GetItemImage | Retrieves the index of the item's icon
_GUICtrlListView_GetItemIndent | Retrieves the number of image widths the item is indented
_GUICtrlListView_GetItemParam | Retrieves the application specific value of the item
_GUICtrlListView_GetItemPosition | Retrieves the position of an item
_GUICtrlListView_GetItemPositionX | Retrieves the X position of an item
_GUICtrlListView_GetItemPositionY | Retrieves the Y position of an item
_GUICtrlListView_GetItemRect | Retrieves the bounding rectangle for all or part of an item
_GUICtrlListView_GetItemRectEx | Retrieves the bounding rectangle for all or part of an item
_GUICtrlListView_GetItemSelected | Determines whether the item is selected
_GUICtrlListView_GetItemSpacing | Determines the spacing between items in the control
_GUICtrlListView_GetItemSpacingX | Determines the horizontal spacing between items in the control
_GUICtrlListView_GetItemSpacingY | Determines the vertical spacing between items in the control
_GUICtrlListView_GetItemState | Retrieves the state of a listview item
_GUICtrlListView_GetItemStateImage | Gets the state image that is displayed
_GUICtrlListView_GetItemText | Retrieves the text of an item or subitem
_GUICtrlListView_GetItemTextArray | Retrieves all of a list-view item
_GUICtrlListView_GetItemTextString | Retrieves all of a list-view item
_GUICtrlListView_GetNextItem | Searches for an item that has the specified properties
_GUICtrlListView_GetNumberOfWorkAreas | Retrieves the number of working areas in the control
_GUICtrlListView_GetOrigin | Retrieves the current view origin for the control
_GUICtrlListView_GetOriginX | Retrieves the current horizontal view origin for the control
_GUICtrlListView_GetOriginY | Retrieves the current horizontal view origin for the control
_GUICtrlListView_GetOutlineColor | Retrieves the color of the border of the control
_GUICtrlListView_GetSelectedColumn | Retrieves the index of the selected column
_GUICtrlListView_GetSelectedCount | Determines the number of selected items
_GUICtrlListView_GetSelectedIndices | Retrieve indices of selected item(s)
_GUICtrlListView_GetSelectionMark | Retrieves the selection mark from the control
_GUICtrlListView_GetStringWidth | Determines the width of a specified string
_GUICtrlListView_GetSubItemRect | Retrieves information about an item bounding rectangle
_GUICtrlListView_GetTextBkColor | Retrieves the text background color of the control
_GUICtrlListView_GetTextColor | Retrieves the text color of the control
_GUICtrlListView_GetToolTips | Retrieves the ToolTip control handle
_GUICtrlListView_GetTopIndex | Retrieves the index of the topmost visible item when in list or report view
_GUICtrlListView_GetUnicodeFormat | Retrieves the UNICODE character format flag
_GUICtrlListView_GetView | Retrieves the current view of the control
_GUICtrlListView_GetViewDetails | Determines whether the view mode is in detail mode
_GUICtrlListView_GetViewLarge | Determines whether the view mode is in large icon mode
_GUICtrlListView_GetViewList | Determines whether the view mode is in list mode
_GUICtrlListView_GetViewRect | Retrieves the bounding rectangle of all items in the control
_GUICtrlListView_GetViewSmall | Determines whether the view mode is in small icon mode
_GUICtrlListView_GetViewTile | Determines whether the view mode is in tile mode
_GUICtrlListView_HideColumn | Hides the column "sets column width to zero"
_GUICtrlListView_HitTest | Determines which item is at a specified position
_GUICtrlListView_InsertColumn | Inserts a new column in the control
_GUICtrlListView_InsertGroup | Inserts a group
_GUICtrlListView_InsertItem | Inserts a new item in the control
_GUICtrlListView_JustifyColumn | Set Justification of a column for a list-view control
_GUICtrlListView_MapIDToIndex | Maps the ID of an item to an index
_GUICtrlListView_MapIndexToID | Maps an index to an item ID
_GUICtrlListView_RedrawItems | Forces the control to redraw a range of items
_GUICtrlListView_RegisterSortCallBack | Register the Simple Sort callback function
_GUICtrlListView_RemoveAllGroups | Removes all groups from the control
_GUICtrlListView_RemoveGroup | Removes a group from the control
_GUICtrlListView_Scroll | Scrolls the content of a list-view
_GUICtrlListView_SetBkColor | Sets the background color of the control
_GUICtrlListView_SetBkImage | Sets the background image in the control
_GUICtrlListView_SetCallBackMask | Changes the callback mask for the control
_GUICtrlListView_SetColumn | Sets the attributes of a column
_GUICtrlListView_SetColumnOrder | Sets the left-to-right order of columns
_GUICtrlListView_SetColumnOrderArray | Sets the left-to-right order of columns in the control
_GUICtrlListView_SetColumnWidth | Changes the width of a column
_GUICtrlListView_SetExtendedListViewStyle | Sets extended styles
_GUICtrlListView_SetGroupInfo | Sets group information
_GUICtrlListView_SetHotItem | Sets the hot item
_GUICtrlListView_SetHoverTime | Sets the amount of time which the mouse cursor must hover over an item before it is selected
_GUICtrlListView_SetIconSpacing | Sets the spacing between icons where the style is large icon
_GUICtrlListView_SetImageList | Assigns an image list to the control
_GUICtrlListView_SetItem | Sets some or all of a item's attributes
_GUICtrlListView_SetItemChecked | Sets the checked state
_GUICtrlListView_SetItemCount | Causes the list-view control to allocate memory for the specified number of items
_GUICtrlListView_SetItemCut | Sets whether the item is marked for a cut-and-paste operation
_GUICtrlListView_SetItemDropHilited | Sets whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_SetItemEx | Sets some or all of a item's attributes
_GUICtrlListView_SetItemFocused | Sets whether the item has the focus
_GUICtrlListView_SetItemGroupID | Sets the item group ID
_GUICtrlListView_SetItemImage | Sets the index of the item's icon in the control's image list
_GUICtrlListView_SetItemIndent | Sets the number of image widths to indent the item
_GUICtrlListView_SetItemParam | Sets the value specific to the item
_GUICtrlListView_SetItemPosition | Moves an item to a specified position in the control
_GUICtrlListView_SetItemPosition32 | Moves an item to a specified position in the control
_GUICtrlListView_SetItemSelected | Sets whether the item is selected
_GUICtrlListView_SetItemState | Changes the state of an item in the control
_GUICtrlListView_SetItemStateImage | Sets the state image that is displayed
_GUICtrlListView_SetItemText | Changes the text of an item or subitem
_GUICtrlListView_SetOutlineColor | Sets the color of the border
_GUICtrlListView_SetSelectedColumn | Sets the index of the selected column
_GUICtrlListView_SetSelectionMark | Sets the selection mark in the control
_GUICtrlListView_SetTextBkColor | Sets the background color of text in the control
_GUICtrlListView_SetTextColor | Sets the color of text in the control
_GUICtrlListView_SetToolTips | Sets the ToolTip control that the control will use to display ToolTips
_GUICtrlListView_SetUnicodeFormat | Sets the UNICODE character format flag for the control
_GUICtrlListView_SetView | Sets the view of the control
_GUICtrlListView_SetWorkAreas | Creates a work area within the control
_GUICtrlListView_SimpleSort | Sorts a list-view control (limited)
_GUICtrlListView_SortItems | Starts the sort call back, also sets the Arrow in the Header
_GUICtrlListView_SubItemHitTest | Determines which listview item or subitem is at a given position
_GUICtrlListView_UnRegisterSortCallBack | UnRegister the Sort callback function
_GUICtrlMenu_AddMenuItem | Adds a new menu item to the end of the menu
_GUICtrlMenu_AppendMenu | Appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu
_GUICtrlMenu_CheckMenuItem | Sets the state of the specified menu item's check mark attribute to either selected or clear
_GUICtrlMenu_CheckRadioItem | Checks a specified menu item and makes it a radio item
_GUICtrlMenu_CreateMenu | Creates a menu
_GUICtrlMenu_CreatePopup | Creates a drop down menu, submenu, or shortcut menu
_GUICtrlMenu_DeleteMenu | Deletes an item from the specified menu
_GUICtrlMenu_DestroyMenu | Destroys the specified menu and frees any memory that the menu occupies
_GUICtrlMenu_DrawMenuBar | Redraws the menu bar of the specified window
_GUICtrlMenu_EnableMenuItem | Enables, disables, or grays the specified menu item
_GUICtrlMenu_FindItem | Retrieves a menu item based on it's text
_GUICtrlMenu_FindParent | Retrieves the window to which a menu belongs
_GUICtrlMenu_GetItemBmp | Retrieves the bitmap displayed for the item
_GUICtrlMenu_GetItemBmpChecked | Retrieves the bitmap displayed if the item is selected
_GUICtrlMenu_GetItemBmpUnchecked | Retrieves the bitmap displayed if the item is not selected
_GUICtrlMenu_GetItemChecked | Retrieves the status of the menu item checked state
_GUICtrlMenu_GetItemCount | Retrieves the number of items in the specified menu
_GUICtrlMenu_GetItemData | Retrieves the application defined value associated with the menu item
_GUICtrlMenu_GetItemDefault | Retrieves the status of the menu item default state
_GUICtrlMenu_GetItemDisabled | Retrieves the status of the menu item disabled state
_GUICtrlMenu_GetItemEnabled | Retrieves the status of the menu item enabled state
_GUICtrlMenu_GetItemGrayed | Retrieves the status of the menu item grayed state
_GUICtrlMenu_GetItemHighlighted | Retrieves the status of the menu item highlighted state
_GUICtrlMenu_GetItemID | Retrieves the menu item ID
_GUICtrlMenu_GetItemInfo | Retrieves information about a menu item
_GUICtrlMenu_GetItemRect | Retrieves the bounding rectangle for the specified menu item
_GUICtrlMenu_GetItemRectEx | Retrieves the bounding rectangle for the specified menu item
_GUICtrlMenu_GetItemState | Retrieves the menu item state
_GUICtrlMenu_GetItemStateEx | Retrieves the menu flags associated with the specified menu item
_GUICtrlMenu_GetItemSubMenu | Retrieves a the submenu activated by a specified item
_GUICtrlMenu_GetItemText | Retrieves the text of the specified menu item
_GUICtrlMenu_GetItemType | Retrieves the menu item type
_GUICtrlMenu_GetMenu | Retrieves the handle of the menu assigned to the given window
_GUICtrlMenu_GetMenuBackground | Retrieves the brush to use for the menu's background
_GUICtrlMenu_GetMenuBarInfo | Retrieves information about the specified menu bar
_GUICtrlMenu_GetMenuContextHelpID | Retrieves the context help identifier
_GUICtrlMenu_GetMenuData | Retrieves the application defined value
_GUICtrlMenu_GetMenuDefaultItem | Retrieves the default menu item on the specified menu
_GUICtrlMenu_GetMenuHeight | Retrieves the maximum height of a menu
_GUICtrlMenu_GetMenuInfo | Retrieves information about a specified menu
_GUICtrlMenu_GetMenuStyle | Retrieves the style information for a menu
_GUICtrlMenu_GetSystemMenu | Allows the application to access the window menu for copying and modifying
_GUICtrlMenu_InsertMenuItem | Inserts a new menu item at the specified position
_GUICtrlMenu_InsertMenuItemEx | Inserts a new menu item at the specified position in a menu
_GUICtrlMenu_IsMenu | Determines whether a handle is a menu handle
_GUICtrlMenu_LoadMenu | Loads the specified menu resource from the executable file associated with an application instance
_GUICtrlMenu_MapAccelerator | Maps a menu accelerator key to it's position in the menu
_GUICtrlMenu_MenuItemFromPoint | Determines which menu item is at the specified location.
_GUICtrlMenu_RemoveMenu | Deletes a menu item or detaches a submenu from the specified menu
_GUICtrlMenu_SetItemBitmaps | Associates the specified bitmap with a menu item
_GUICtrlMenu_SetItemBmp | Sets the bitmap displayed for the item
_GUICtrlMenu_SetItemBmpChecked | Sets the bitmap displayed if the item is selected
_GUICtrlMenu_SetItemBmpUnchecked | Sets the bitmap displayed if the item is not selected
_GUICtrlMenu_SetItemChecked | Sets the checked state of a menu item
_GUICtrlMenu_SetItemData | Sets the application defined value for a menu item
_GUICtrlMenu_SetItemDefault | Sets the status of the menu item default state
_GUICtrlMenu_SetItemDisabled | Sets the disabled state of a menu item
_GUICtrlMenu_SetItemEnabled | Sets the enabled state of a menu item
_GUICtrlMenu_SetItemGrayed | Sets the grayed state of a menu item
_GUICtrlMenu_SetItemHighlighted | Sets the highlighted state of a menu item
_GUICtrlMenu_SetItemID | Sets the menu item ID
_GUICtrlMenu_SetItemInfo | Changes information about a menu item
_GUICtrlMenu_SetItemState | Sets the state of a menu item
_GUICtrlMenu_SetItemSubMenu | Sets the drop down menu or submenu associated with the menu item
_GUICtrlMenu_SetItemText | Sets the text for a menu item
_GUICtrlMenu_SetItemType | Sets the menu item type
_GUICtrlMenu_SetMenu | Assigns a new menu to the specified window
_GUICtrlMenu_SetMenuBackground | Sets the background brush for the menu
_GUICtrlMenu_SetMenuContextHelpID | Sets the context help identifier for the menu
_GUICtrlMenu_SetMenuData | Sets the application defined for the menu
_GUICtrlMenu_SetMenuDefaultItem | Sets the default menu item
_GUICtrlMenu_SetMenuHeight | Sets the maximum height of the menu
_GUICtrlMenu_SetMenuInfo | Sets information for a specified menu
_GUICtrlMenu_SetMenuStyle | Sets the menu style
_GUICtrlMenu_TrackPopupMenu | Displays a shortcut menu at the specified location
_GUICtrlMonthCal_Create | Creates a Month Calendar control
_GUICtrlMonthCal_Destroy | Delete the MonthCal control
_GUICtrlMonthCal_GetCalendarBorder | Gets the size of the border, in pixels
_GUICtrlMonthCal_GetCalendarCount | Gets the number of calendars currently displayed in the calendar control
_GUICtrlMonthCal_GetColor | Retrieves a given color for the control
_GUICtrlMonthCal_GetColorArray | Retrieves the color for a given portion of a month calendar control
_GUICtrlMonthCal_GetCurSel | Retrieves the currently selected date
_GUICtrlMonthCal_GetCurSelStr | Retrieves the currently selected date in string format
_GUICtrlMonthCal_GetFirstDOW | Retrieves the first day of the week
_GUICtrlMonthCal_GetFirstDOWStr | Retrieves the first day of the week as a string
_GUICtrlMonthCal_GetMaxSelCount | Retrieves the maximum date range that can be selected in a month calendar control
_GUICtrlMonthCal_GetMaxTodayWidth | Retrieves the maximum width of the "today" string in a month calendar control
_GUICtrlMonthCal_GetMinReqHeight | Retrieves the minimum height required to display a full month
_GUICtrlMonthCal_GetMinReqRect | Retrieves the minimum size required to display a full month
_GUICtrlMonthCal_GetMinReqRectArray | Retrieves the minimum size required to display a full month in a month calendar control
_GUICtrlMonthCal_GetMinReqWidth | Retrieves the minimum width required to display a full month
_GUICtrlMonthCal_GetMonthDelta | Retrieves the scroll rate for a month calendar control
_GUICtrlMonthCal_GetMonthRange | Retrieves date information that represents the high and low display limits
_GUICtrlMonthCal_GetMonthRangeMax | Retrieves date information that represents the high limit of the controls display
_GUICtrlMonthCal_GetMonthRangeMaxStr | Retrieves date information that represents the high limit of the controls display in string format
_GUICtrlMonthCal_GetMonthRangeMin | Retrieves date information that represents the low limit of the controls display
_GUICtrlMonthCal_GetMonthRangeMinStr | Retrieves date information that represents the low limit of the controls display in string format
_GUICtrlMonthCal_GetMonthRangeSpan | Returns a value that represents the range, in months, spanned
_GUICtrlMonthCal_GetRange | Retrieves the minimum and maximum allowable dates
_GUICtrlMonthCal_GetRangeMax | Retrieves the upper limit date range
_GUICtrlMonthCal_GetRangeMaxStr | Retrieves the upper limit date range in string format
_GUICtrlMonthCal_GetRangeMin | Retrieves the lower limit date range
_GUICtrlMonthCal_GetRangeMinStr | Retrieves the lower limit date range in string form
_GUICtrlMonthCal_GetSelRange | Retrieves the upper and lower limits of the date range currently selected
_GUICtrlMonthCal_GetSelRangeMax | Retrieves the upper date range currently selected by the user
_GUICtrlMonthCal_GetSelRangeMaxStr | Retrieves the upper date range currently selected by the user in string form
_GUICtrlMonthCal_GetSelRangeMin | Retrieves the lower date range currently selected by the user
_GUICtrlMonthCal_GetSelRangeMinStr | Retrieves the lower date range currently selected by the user in string form
_GUICtrlMonthCal_GetToday | Retrieves the date information for the date specified as "today"
_GUICtrlMonthCal_GetTodayStr | Retrieves the date information for the date specified as "today" in string format
_GUICtrlMonthCal_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlMonthCal_HitTest | Determines which portion of a month calendar control is at a given point
_GUICtrlMonthCal_SetCalendarBorder | Sets the size of the border, in pixels
_GUICtrlMonthCal_SetColor | Sets the color for a given portion of the month calendar
_GUICtrlMonthCal_SetCurSel | Sets the currently selected date
_GUICtrlMonthCal_SetDayState | Sets the day states for all months that are currently visible
_GUICtrlMonthCal_SetFirstDOW | Sets the first day of the week for a month calendar control
_GUICtrlMonthCal_SetMaxSelCount | Sets the maximum number of days that can be selected in a month calendar control
_GUICtrlMonthCal_SetMonthDelta | Sets the scroll rate for a month calendar control
_GUICtrlMonthCal_SetRange | Sets date information that represents the high and low limits
_GUICtrlMonthCal_SetSelRange | Sets the selection for a month calendar control to a given date range
_GUICtrlMonthCal_SetToday | Sets the date information for the date specified as "today"
_GUICtrlMonthCal_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlRebar_AddBand | Adds a new band in a rebar control
_GUICtrlRebar_AddToolBarBand | Adds a new band in a rebar control
_GUICtrlRebar_BeginDrag | Adds a new band in a rebar control
_GUICtrlRebar_Create | Create a Rebar control
_GUICtrlRebar_DeleteBand | Deletes a band from a rebar control
_GUICtrlRebar_Destroy | Delete the control
_GUICtrlRebar_DragMove | Updates the drag position in the rebar control after a previous _GUICtrlRebar_BeginDrag message
_GUICtrlRebar_EndDrag | Terminates the rebar control's drag-and-drop operation. This message does not cause an $RBN_ENDDRAG notification to be sent
_GUICtrlRebar_GetBandBackColor | Retrieves the Band background color
_GUICtrlRebar_GetBandBorders | Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band
_GUICtrlRebar_GetBandBordersEx | Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band
_GUICtrlRebar_GetBandChildHandle | Retrieves the Handle to the child window contained in the band, if any
_GUICtrlRebar_GetBandChildSize | Retrieves the Child size settings
_GUICtrlRebar_GetBandCount | Retrieves the count of bands currently in the rebar control
_GUICtrlRebar_GetBandForeColor | Retrieves the Band foreground color
_GUICtrlRebar_GetBandHeaderSize | Retrieves the size of the band's header, in pixels
_GUICtrlRebar_GetBandID | Get the value that the control uses to identify this band for custom draw notification messages
_GUICtrlRebar_GetBandIdealSize | Get Ideal width of the band, in pixels.
_GUICtrlRebar_GetBandLength | Get Length of the band, in pixels
_GUICtrlRebar_GetBandLParam | Get Application-defined value
_GUICtrlRebar_GetBandMargins | Get Length of the band, in pixels
_GUICtrlRebar_GetBandMarginsEx | Get Length of the band, in pixels
_GUICtrlRebar_GetBandRect | Retrieves the bounding rectangle for a given band in a rebar control
_GUICtrlRebar_GetBandRectEx | Retrieves the bounding rectangle for a given band in a rebar control
_GUICtrlRebar_GetBandStyle | Get the band style Flags
_GUICtrlRebar_GetBandStyleBreak | Determine if flag is set
_GUICtrlRebar_GetBandStyleChildEdge | Determine if flag is set
_GUICtrlRebar_GetBandStyleFixedBMP | Determine if flag is set
_GUICtrlRebar_GetBandStyleFixedSize | Determine if flag is set
_GUICtrlRebar_GetBandStyleGripperAlways | Determine if flag is set
_GUICtrlRebar_GetBandStyleHidden | Determine if flag is set
_GUICtrlRebar_GetBandStyleHideTitle | Determine if flag is set
_GUICtrlRebar_GetBandStyleNoGripper | Determine if flag is set
_GUICtrlRebar_GetBandStyleTopAlign | Determine if flag is set
_GUICtrlRebar_GetBandStyleUseChevron | Determine if flag is set
_GUICtrlRebar_GetBandStyleVariableHeight | Determine if flag is set
_GUICtrlRebar_GetBandText | Retrieves the display text for the band
_GUICtrlRebar_GetBarHeight | Retrieves the height of the rebar control
_GUICtrlRebar_GetBarInfo | Retrieves information about the rebar control and the image list it uses
_GUICtrlRebar_GetBKColor | Retrieves a rebar control's default background color
_GUICtrlRebar_GetColorScheme | Retrieves the color scheme information from the rebar control
_GUICtrlRebar_GetRowCount | Retrieves the number of rows of bands in a rebar control
_GUICtrlRebar_GetRowHeight | Retrieves the height of a specified row in a rebar control
_GUICtrlRebar_GetTextColor | Retrieves a rebar control's default text color
_GUICtrlRebar_GetToolTips | Retrieves the handle to any ToolTip control associated with the rebar control
_GUICtrlRebar_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlRebar_HitTest | Determines which item is at a specified position
_GUICtrlRebar_IDToIndex | Converts a band identifier to a band index in a rebar control
_GUICtrlRebar_MaximizeBand | Resizes a band in a rebar control to either its ideal or largest size
_GUICtrlRebar_MinimizeBand | Resizes a band in a rebar control to its smallest size
_GUICtrlRebar_MoveBand | Moves a band from one index to another
_GUICtrlRebar_SetBandBackColor | Set the Band background color
_GUICtrlRebar_SetBandForeColor | Set the Band foreground color
_GUICtrlRebar_SetBandHeaderSize | Set the size of the band's header, in pixels
_GUICtrlRebar_SetBandID | Set the value that the control uses to identify this band for custom draw notification messages
_GUICtrlRebar_SetBandIdealSize | Set Ideal width of the band, in pixels.
_GUICtrlRebar_SetBandLength | Set Application-defined value
_GUICtrlRebar_SetBandLParam | Set Application-defined value
_GUICtrlRebar_SetBandStyle | Set the band style Flags
_GUICtrlRebar_SetBandStyleBreak | Set whether the band is on a new line
_GUICtrlRebar_SetBandStyleChildEdge | Set whether the band has an edge at the top and bottom of the child window
_GUICtrlRebar_SetBandStyleFixedBMP | Set whether the band background bitmap does not move when the band is resized
_GUICtrlRebar_SetBandStyleFixedSize | Set whether the band can't be sized. With this style, the sizing grip is not displayed on the band
_GUICtrlRebar_SetBandStyleGripperAlways | Set whether the band will always have a sizing grip, even if it is the only band in the rebar
_GUICtrlRebar_SetBandStyleHidden | Set whether the band will not be visible
_GUICtrlRebar_SetBandStyleHideTitle | Set whether to keep band title hidden
_GUICtrlRebar_SetBandStyleNoGripper | Set whether the band will never have a sizing grip, even if there is more than one band in the rebar
_GUICtrlRebar_SetBandStyleTopAlign | Set whether to keep band in top row
_GUICtrlRebar_SetBandStyleUseChevron | Set whether to display drop-down button
_GUICtrlRebar_SetBandStyleVariableHeight | Set whether the band can be resized by the rebar control
_GUICtrlRebar_SetBandText | Retrieves the display text for the band
_GUICtrlRebar_SetBarInfo | Sets the characteristics of a rebar control
_GUICtrlRebar_SetBKColor | Retrieves a rebar control's default background color
_GUICtrlRebar_SetColorScheme | Retrieves a rebar control's default background color
_GUICtrlRebar_SetTextColor | Sets a rebar control's default text color
_GUICtrlRebar_SetToolTips | Associates a ToolTip control with the rebar control
_GUICtrlRebar_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlRebar_ShowBand | Shows or hides a given band in a rebar control
_GUICtrlRichEdit_AppendText | Appends text at the end of the client area
_GUICtrlRichEdit_AutoDetectURL | Enables or disables automatic detection of URLS
_GUICtrlRichEdit_CanPaste | Can the contents of the clipboard be pasted into the control?
_GUICtrlRichEdit_CanPasteSpecial | Can the contents of the clipboard be pasted into the control in both formats?
_GUICtrlRichEdit_CanRedo | Can an undone action be redone?
_GUICtrlRichEdit_CanUndo | Can an action be undone?
_GUICtrlRichEdit_ChangeFontSize | Increment or decrement font size(s) of selected text
_GUICtrlRichEdit_Copy | Copy text to clipboard
_GUICtrlRichEdit_Create | Create a Edit control
_GUICtrlRichEdit_Cut | Cut text to clipboard
_GUICtrlRichEdit_Deselect | Deselects text, leaving none selected
_GUICtrlRichEdit_Destroy | Delete the Rich Edit control
_GUICtrlRichEdit_EmptyUndoBuffer | Resets the undo flag of the control
_GUICtrlRichEdit_FindText | Search for a text starting at insertion point or at anchor point of selection
_GUICtrlRichEdit_FindTextInRange | Search for a text in a range of inter-character positions
_GUICtrlRichEdit_GetBkColor | Gets the background color of the control
_GUICtrlRichEdit_GetCharAttributes | Returns attributes of selected text
_GUICtrlRichEdit_GetCharBkColor | Retrieves the background color of the selected text or, if none selected, of the character to the right of the insertion point
_GUICtrlRichEdit_GetCharColor | Retrieves the color of the selected text or, if none selected, of the character to the right of the insertion point
_GUICtrlRichEdit_GetCharPosFromXY | Gets inter-character position closest to a specified point in the client area
_GUICtrlRichEdit_GetCharPosOfNextWord | Gets inter-character position before the next word
_GUICtrlRichEdit_GetCharPosOfPreviousWord | Gets inter-character position before the Previous word
_GUICtrlRichEdit_GetCharWordBreakInfo | Gets inter-character position before the Previous word
_GUICtrlRichEdit_GetFirstCharPosOnLine | Retrieves the inter-character position preceding the first character of a line
_GUICtrlRichEdit_GetFont | Gets the font attributes of a selection or, if no selection, at the insertion point
_GUICtrlRichEdit_GetLineCount | Retrieves the number of lines in a multi-line edit control
_GUICtrlRichEdit_GetLineLength | Retrieves the length of a line
_GUICtrlRichEdit_GetLineNumberFromCharPos | Retrieves the line number on which an inter-character position is found
_GUICtrlRichEdit_GetNextRedo | Retrieves the name or type ID of the next possible redo action
_GUICtrlRichEdit_GetNextUndo | Retrieves the name or type ID of the next possible Undo action
_GUICtrlRichEdit_GetNumberOfFirstVisibleLine | Gets number of the first line which is visible in the control
_GUICtrlRichEdit_GetParaAlignment | Gets the alignment of selected paragraph(s), or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaAttributes | Gets the attributes of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaBorder | Gets the border settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaIndents | Gets the border indent settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaNumbering | Gets the numbering style of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaShading | Gets the shading settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaSpacing | Gets the spacing settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaTabStops | Gets the tabstops of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetPasswordChar | Gets the password character that a rich edit control displays when the user enters text
_GUICtrlRichEdit_GetRECT | Retrieves the formatting rectangle of a control
_GUICtrlRichEdit_GetScrollPos | Gets the Scrolling position of the control
_GUICtrlRichEdit_GetSel | Gets the low and high inter-character positions of a selection
_GUICtrlRichEdit_GetSelAA | Gets the anchor and active inter-character positions of a selection, in that order
_GUICtrlRichEdit_GetSelText | Retrieves the currently selected text
_GUICtrlRichEdit_GetSpaceUnit | Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions
_GUICtrlRichEdit_GetText | Get all of the text in the control
_GUICtrlRichEdit_GetTextInLine | Gets a line of text
_GUICtrlRichEdit_GetTextInRange | Gets the text from from one inter-character position to another
_GUICtrlRichEdit_GetTextLength | Get the length of the whole text in the control
_GUICtrlRichEdit_GetVersion | Retrieves the version of Rich Edit
_GUICtrlRichEdit_GetXYFromCharPos | Retrieves the XY coordinates of an inter-character position
_GUICtrlRichEdit_GetZoom | Gets the zoom level of the control
_GUICtrlRichEdit_GotoCharPos | Moves the insertion point to an inter-character position
_GUICtrlRichEdit_HideSelection | Hides (or shows) a selection
_GUICtrlRichEdit_InsertText | Inserts text at insertion point or anchor point of selection
_GUICtrlRichEdit_IsModified | Retrieves the state of a rich edit control's modification flag
_GUICtrlRichEdit_IsTextSelected | Is text selected?
_GUICtrlRichEdit_Paste | Paste RTF or RTF with Objects from clipboard
_GUICtrlRichEdit_PasteSpecial | Paste RTF or RTF and Objects from clipboard
_GUICtrlRichEdit_PauseRedraw | Pauses redrawing of the control
_GUICtrlRichEdit_Redo | Redoes last undone action
_GUICtrlRichEdit_ReplaceText | Replaces selected text
_GUICtrlRichEdit_ResumeRedraw | Resumes redrawing of the control
_GUICtrlRichEdit_ScrollLineOrPage | Scrolls the text down or up a line or a page
_GUICtrlRichEdit_ScrollLines | Scrolls the text down or up a number of lines
_GUICtrlRichEdit_ScrollToCaret | Scrolls to show line on which caret (insertion point) is
_GUICtrlRichEdit_SetBkColor | Sets the background color of the control
_GUICtrlRichEdit_SetCharAttributes | Turns an attribute on or off for selected text or, if none selected, for text inserted at the insertion point
_GUICtrlRichEdit_SetCharBkColor | Sets the background color of selected text or, if none selected, sets the background color of text inserted at the insertion point
_GUICtrlRichEdit_SetCharColor | Sets the color of selected text or, if none selected, sets the background color of text inserted at the insertion point
_GUICtrlRichEdit_SetEventMask | Specifies which notification messages are sent to the parent window
_GUICtrlRichEdit_SetFont | Sets the font attributes of selected text or, if none selected, sets those of text inserted at the insertion point
_GUICtrlRichEdit_SetLimitOnText | Change number of characters that can be typed, pasted or streamed in as Rich Text Format
_GUICtrlRichEdit_SetModified | Sets or clears the modification flag
_GUICtrlRichEdit_SetParaAlignment | Sets alignment of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaAttributes | Sets attributes of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaBorder | Sets the border of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaIndents | Sets indents of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaNumbering | Sets numbering of paragraph(s) in the current selection or, if no selection, of paragraph(s) inserted at the insertion point
_GUICtrlRichEdit_SetParaShading | Sets the shading of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaSpacing | Sets paragraph spacing of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point
_GUICtrlRichEdit_SetParaTabStops | Sets tab stops of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point
_GUICtrlRichEdit_SetPasswordChar | Sets the characters to be displayed instead of those typed, or causes typed characters to show
_GUICtrlRichEdit_SetReadOnly | Sets or removes the read-only state
_GUICtrlRichEdit_SetRECT | Sets or clears the modification flag
_GUICtrlRichEdit_SetScrollPos | Scrolls the display such that ($ix,$iY) is in the upper left corner of the control
_GUICtrlRichEdit_SetSel | Sets the low and high character position of a selection
_GUICtrlRichEdit_SetSpaceUnit | Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions
_GUICtrlRichEdit_SetTabStops | Sets tab stops for the control
_GUICtrlRichEdit_SetText | Sets the text of a control
_GUICtrlRichEdit_SetUndoLimit | Sets the maximum number of actions that can stored in the undo queue
_GUICtrlRichEdit_SetZoom | Sets zoom level of the control
_GUICtrlRichEdit_StreamFromFile | Sets text in a control from a file
_GUICtrlRichEdit_StreamFromVar | Sets text in a control from a variable
_GUICtrlRichEdit_StreamToFile | Writes contens of a control to a file
_GUICtrlRichEdit_StreamToVar | Writes contents of a control to a variable
_GUICtrlRichEdit_Undo | Undoes the last edit control operation in the control's undo queue
_GUICtrlSlider_ClearSel | Clears the current selection range
_GUICtrlSlider_ClearTics | Removes the current tick marks from a slider
_GUICtrlSlider_Create | Create a Slider control
_GUICtrlSlider_Destroy | Delete the control
_GUICtrlSlider_GetBuddy | Retrieves the handle to a slider control buddy window at a given location
_GUICtrlSlider_GetChannelRect | Retrieves the size and position of the bounding rectangle for a sliders's channel
_GUICtrlSlider_GetChannelRectEx | Retrieves the size and position of the bounding rectangle for a sliders's channel
_GUICtrlSlider_GetLineSize | Retrieves the number of logical positions the slider moves
_GUICtrlSlider_GetLogicalTics | Retrieves an array that contains the logical positions of the tick marks for a slider
_GUICtrlSlider_GetNumTics | Retrieves the number of tick marks from a slider
_GUICtrlSlider_GetPageSize | Retrieves the number of logical positions the slider moves
_GUICtrlSlider_GetPos | Retrieves the logical position the slider
_GUICtrlSlider_GetRange | Retrieves the maximum and minimum position for the slider
_GUICtrlSlider_GetRangeMax | Retrieves the maximum position for the slider
_GUICtrlSlider_GetRangeMin | Retrieves the minimum position for the slider
_GUICtrlSlider_GetSel | Retrieves the ending and starting position of the current selection range
_GUICtrlSlider_GetSelEnd | Retrieves the ending position of the current selection range
_GUICtrlSlider_GetSelStart | Retrieves the starting position of the current selection range
_GUICtrlSlider_GetThumbLength | Retrieves the length of the slider
_GUICtrlSlider_GetThumbRect | Retrieves the size and position of the bounding rectangle for the slider
_GUICtrlSlider_GetThumbRectEx | Retrieves the size and position of the bounding rectangle for the slider
_GUICtrlSlider_GetTic | Retrieves the logical position of a tick mark
_GUICtrlSlider_GetTicPos | Retrieves the current physical position of a tick mark
_GUICtrlSlider_GetToolTips | Retrieves the handle to the ToolTip control assigned to the slider, if any.
_GUICtrlSlider_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlSlider_SetBuddy | Assigns a window as the buddy window for a slider control
_GUICtrlSlider_SetLineSize | Sets the number of logical positions the slider moves
_GUICtrlSlider_SetPageSize | Sets the number of logical positions the slider moves
_GUICtrlSlider_SetPos | Sets the current logical position of the slider
_GUICtrlSlider_SetRange | Sets the range of minimum and maximum logical positions for the slider
_GUICtrlSlider_SetRangeMax | Sets the maximum logical position for the slider
_GUICtrlSlider_SetRangeMin | Sets the minimum logical position for the slider
_GUICtrlSlider_SetSel | Sets the starting and ending positions for the available selection range
_GUICtrlSlider_SetSelEnd | Sets the ending logical position of the current selection range
_GUICtrlSlider_SetSelStart | Sets the starting logical position of the current selection range
_GUICtrlSlider_SetThumbLength | Sets the length of the slider
_GUICtrlSlider_SetTic | Sets a tick mark in a slider at the specified logical position
_GUICtrlSlider_SetTicFreq | Sets the interval frequency for tick marks in a slider
_GUICtrlSlider_SetTipSide | Positions a ToolTip control
_GUICtrlSlider_SetToolTips | Assigns a ToolTip control to a slider control
_GUICtrlSlider_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlStatusBar_Create | Create a statusbar
_GUICtrlStatusBar_Destroy | Delete the control
_GUICtrlStatusBar_EmbedControl | Embeds a child control in the control
_GUICtrlStatusBar_GetBorders | Retrieves the current widths of the horizontal and vertical borders
_GUICtrlStatusBar_GetBordersHorz | Retrieves the current width of the horizontal border
_GUICtrlStatusBar_GetBordersRect | Retrieves the current width of the rectangle border
_GUICtrlStatusBar_GetBordersVert | Retrieves the current width of the vertical border
_GUICtrlStatusBar_GetCount | Retrieves the number of parts
_GUICtrlStatusBar_GetHeight | Retrieves the height of a part
_GUICtrlStatusBar_GetIcon | Retrieves the icon for a part
_GUICtrlStatusBar_GetParts | Retrieves the number of parts and the part edges
_GUICtrlStatusBar_GetRect | Retrieves the bounding rectangle of a part
_GUICtrlStatusBar_GetRectEx | Retrieves the bounding rectangle of a part
_GUICtrlStatusBar_GetText | Retrieves the text from the specified part
_GUICtrlStatusBar_GetTextFlags | Retrieves the text length flags for a part
_GUICtrlStatusBar_GetTextLength | Retrieves the length of a part text
_GUICtrlStatusBar_GetTextLengthEx | Retrieves the uFlag of a part
_GUICtrlStatusBar_GetTipText | Retrieves the ToolTip text for a part
_GUICtrlStatusBar_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlStatusBar_GetWidth | Retrieves the width of a part
_GUICtrlStatusBar_IsSimple | Checks a status bar control to determine if it is in simple mode
_GUICtrlStatusBar_Resize | Causes the status bar to resize itself
_GUICtrlStatusBar_SetBkColor | Sets the background color
_GUICtrlStatusBar_SetIcon | Sets the icon for a part
_GUICtrlStatusBar_SetMinHeight | Sets the minimum height of a status window's drawing area
_GUICtrlStatusBar_SetParts | Sets the number of parts and the part edges
_GUICtrlStatusBar_SetSimple | Specifies whether a status window displays simple text or displays all window parts
_GUICtrlStatusBar_SetText | Sets the text in the specified part of a status window
_GUICtrlStatusBar_SetTipText | Sets the ToolTip text for a part
_GUICtrlStatusBar_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlStatusBar_ShowHide | Show/Hide the StatusBar control
_GUICtrlTab_ClickTab | Clicks a tab
_GUICtrlTab_Create | Create a TabControl control
_GUICtrlTab_DeleteAllItems | Deletes all tabs
_GUICtrlTab_DeleteItem | Deletes a tab
_GUICtrlTab_DeselectAll | Resets tabs, clearing any that were set to the pressed state
_GUICtrlTab_Destroy | Delete the control
_GUICtrlTab_FindTab | Searches for a tab with the specific text
_GUICtrlTab_GetCurFocus | Returns the index of the item that has the focus in a tab control
_GUICtrlTab_GetCurSel | Determines the currently selected tab
_GUICtrlTab_GetDisplayRect | Retrieves the display rectangle of the client area
_GUICtrlTab_GetDisplayRectEx | Retrieves the display rectangle of the client area
_GUICtrlTab_GetExtendedStyle | Retrieves the extended styles that are currently in use
_GUICtrlTab_GetImageList | Retrieves the tab control image list
_GUICtrlTab_GetItem | Retrieves information about a tab
_GUICtrlTab_GetItemCount | Retrieves the number of tabs
_GUICtrlTab_GetItemImage | Retrieves the image index for a tab
_GUICtrlTab_GetItemParam | Retrieves the param data for a tab
_GUICtrlTab_GetItemRect | Retrieves the bounding rectangle for a tab
_GUICtrlTab_GetItemRectEx | Retrieves the bounding rectangle for a tab
_GUICtrlTab_GetItemState | Retrieves the state of a tab
_GUICtrlTab_GetItemText | Retrieves the text of a tab
_GUICtrlTab_GetRowCount | Retrieves the current number of rows of tabs
_GUICtrlTab_GetToolTips | Retrieves the handle to the ToolTip control associated with the control
_GUICtrlTab_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlTab_HighlightItem | Sets the highlight state of a tab item
_GUICtrlTab_HitTest | Determines where a point lies control
_GUICtrlTab_InsertItem | Inserts a new tab
_GUICtrlTab_RemoveImage | Removes an image from the control's image list
_GUICtrlTab_SetCurFocus | Sets the focus to a specified tab
_GUICtrlTab_SetCurSel | Selects a tab
_GUICtrlTab_SetExtendedStyle | Sets the extended styles that are currently in use
_GUICtrlTab_SetImageList | Sets the image list associated with a tab control
_GUICtrlTab_SetItem | Sets information about a tab
_GUICtrlTab_SetItemImage | Sets the image of a tab
_GUICtrlTab_SetItemParam | Sets the param data of a tab
_GUICtrlTab_SetItemSize | Sets the width and height of tabs in a fixed width or owner drawn control
_GUICtrlTab_SetItemState | Sets the state of a tab
_GUICtrlTab_SetItemText | Sets the text of a tab
_GUICtrlTab_SetMinTabWidth | Sets the minimum width of items in a tab control
_GUICtrlTab_SetPadding | Sets the amount of space around each tab's icon and label
_GUICtrlTab_SetToolTips | Sets the handle to the ToolTip control associated with the control
_GUICtrlTab_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlToolbar_AddBitmap | Adds images to the image list
_GUICtrlToolbar_AddButton | Adds a button
_GUICtrlToolbar_AddButtonSep | Adds a separator
_GUICtrlToolbar_AddString | Adds a new string to the toolbar's string pool
_GUICtrlToolbar_ButtonCount | Retrieves a count of the buttons
_GUICtrlToolbar_CheckButton | Checks or unchecks a given button
_GUICtrlToolbar_ClickAccel | Clicks a specific button using it's accelerator
_GUICtrlToolbar_ClickButton | Clicks a specific button
_GUICtrlToolbar_ClickIndex | Clicks a specific button using it's index
_GUICtrlToolbar_CommandToIndex | Retrieves the index for the button associated with the specified command identifier
_GUICtrlToolbar_Create | Create a Toolbar control
_GUICtrlToolbar_Customize | Displays the Customize Toolbar dialog box
_GUICtrlToolbar_DeleteButton | Deletes a button from the toolbar
_GUICtrlToolbar_Destroy | Delete the control
_GUICtrlToolbar_EnableButton | Enables or disables the specified button
_GUICtrlToolbar_FindToolbar | Finds a specific toolbar
_GUICtrlToolbar_GetAnchorHighlight | Retrieves the anchor highlight setting
_GUICtrlToolbar_GetBitmapFlags | Retrieves the flags that describe the type of bitmap to be used
_GUICtrlToolbar_GetButtonBitmap | Retrieves the index of the bitmap associated with a button
_GUICtrlToolbar_GetButtonInfo | Retrieves information for a button
_GUICtrlToolbar_GetButtonInfoEx | Retrieves information for a button
_GUICtrlToolbar_GetButtonParam | Retrieves the button param value
_GUICtrlToolbar_GetButtonRect | Retrieves the bounding rectangle for a button
_GUICtrlToolbar_GetButtonRectEx | Retrieves the bounding rectangle for a specified toolbar button
_GUICtrlToolbar_GetButtonSize | Retrieves the current button width and height, in pixels
_GUICtrlToolbar_GetButtonState | Retrieves information about the state of the specified button
_GUICtrlToolbar_GetButtonStyle | Retrieves the style flags of a button
_GUICtrlToolbar_GetButtonText | Retrieves the display text of a button
_GUICtrlToolbar_GetColorScheme | Retrieves the color scheme information
_GUICtrlToolbar_GetDisabledImageList | Retrieves the disabled button image list
_GUICtrlToolbar_GetExtendedStyle | Retrieves the extended styles
_GUICtrlToolbar_GetHotImageList | Retrieves the hot button image list
_GUICtrlToolbar_GetHotItem | Retrieves the index of the hot item
_GUICtrlToolbar_GetImageList | Retrieves the default state image list
_GUICtrlToolbar_GetInsertMark | Retrieves the current insertion mark
_GUICtrlToolbar_GetInsertMarkColor | Retrieves the color used to draw the insertion mark
_GUICtrlToolbar_GetMaxSize | Retrieves the total size of all of the visible buttons and separators
_GUICtrlToolbar_GetMetrics | Retrieves the metrics of a toolbar control
_GUICtrlToolbar_GetPadding | Retrieves the horizontal and vertical padding
_GUICtrlToolbar_GetRows | Retrieves the number of rows of buttons
_GUICtrlToolbar_GetString | Retrieves a string from the string pool
_GUICtrlToolbar_GetStyle | Retrieves the styles currently in use for a toolbar control
_GUICtrlToolbar_GetStyleAltDrag | Indicates that the control allows buttons to be dragged
_GUICtrlToolbar_GetStyleCustomErase | Indicates that the control generates NM_CUSTOMDRAW notification messages
_GUICtrlToolbar_GetStyleFlat | Indicates that the control is flat
_GUICtrlToolbar_GetStyleList | Indicates that the control has button text to the right of the bitmap
_GUICtrlToolbar_GetStyleRegisterDrop | Indicates that the control generates TBN_GETOBJECT notification messages
_GUICtrlToolbar_GetStyleToolTips | Indicates that the control has tooltips
_GUICtrlToolbar_GetStyleTransparent | Indicates that the control is transparent
_GUICtrlToolbar_GetStyleWrapable | Indicates that the control is wrapable
_GUICtrlToolbar_GetTextRows | Retrieves the maximum number of text rows that can be displayed on a button
_GUICtrlToolbar_GetToolTips | Retrieves the handle to the ToolTip control
_GUICtrlToolbar_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlToolbar_HideButton | Hides or shows the specified button
_GUICtrlToolbar_HighlightButton | Sets the highlight state of a given button control
_GUICtrlToolbar_HitTest | Determines where a point lies within the control
_GUICtrlToolbar_IndexToCommand | Retrieves the command identifier associated with the button
_GUICtrlToolbar_InsertButton | Inserts a button
_GUICtrlToolbar_InsertMarkHitTest | Retrieves the insertion mark information for a point
_GUICtrlToolbar_IsButtonChecked | Indicates whether the specified button is checked
_GUICtrlToolbar_IsButtonEnabled | Indicates whether the specified button is enabled
_GUICtrlToolbar_IsButtonHidden | Indicates whether the specified button is hidden
_GUICtrlToolbar_IsButtonHighlighted | Indicates whether the specified button is hilighted
_GUICtrlToolbar_IsButtonIndeterminate | Indicates whether the specified button is indeterminate
_GUICtrlToolbar_IsButtonPressed | Indicates that the button is being clicked
_GUICtrlToolbar_LoadBitmap | Adds a bitmap to the image list from a file
_GUICtrlToolbar_LoadImages | Loads system defined button images into a toolbar control's image list
_GUICtrlToolbar_MapAccelerator | Determines the ID of the button that corresponds to the specified accelerator
_GUICtrlToolbar_MoveButton | Moves a button from one index to another
_GUICtrlToolbar_PressButton | Presses or releases the specified button
_GUICtrlToolbar_SetAnchorHighlight | Sets the anchor highlight setting
_GUICtrlToolbar_SetBitmapSize | Sets the size of the bitmapped images to be added to a toolbar
_GUICtrlToolbar_SetButtonBitMap | Sets the index of the bitmap associated with a button
_GUICtrlToolbar_SetButtonInfo | Sets extended information for a button
_GUICtrlToolbar_SetButtonInfoEx | Sets extended information for a button
_GUICtrlToolbar_SetButtonParam | Sets the button param value
_GUICtrlToolbar_SetButtonSize | Sets the size of the buttons to be added to a toolbar
_GUICtrlToolbar_SetButtonState | Sets information about the state of the specified button
_GUICtrlToolbar_SetButtonStyle | Sets the style flags of a button
_GUICtrlToolbar_SetButtonText | Sets the display text of a button
_GUICtrlToolbar_SetButtonWidth | Sets the minimum and maximum button widths in the toolbar control
_GUICtrlToolbar_SetCmdID | Sets the command identifier of a toolbar button
_GUICtrlToolbar_SetColorScheme | Sets the color scheme information
_GUICtrlToolbar_SetDisabledImageList | Sets the disabled image list
_GUICtrlToolbar_SetDrawTextFlags | Sets the text drawing flags for the toolbar
_GUICtrlToolbar_SetExtendedStyle | Sets the extended styles control
_GUICtrlToolbar_SetHotImageList | Sets the hot button image list
_GUICtrlToolbar_SetHotItem | Sets the hot item
_GUICtrlToolbar_SetImageList | Sets the default button image list
_GUICtrlToolbar_SetIndent | Sets the indentation for the first button control
_GUICtrlToolbar_SetIndeterminate | Sets or clears the indeterminate state of the specified button
_GUICtrlToolbar_SetInsertMark | Sets the current insertion mark for the toolbar
_GUICtrlToolbar_SetInsertMarkColor | Sets the color used to draw the insertion mark
_GUICtrlToolbar_SetMaxTextRows | Sets the maximum number of text rows displayed button
_GUICtrlToolbar_SetMetrics | Retrieves the metrics of a toolbar control
_GUICtrlToolbar_SetPadding | Sets the padding control
_GUICtrlToolbar_SetParent | Sets the window to which the control sends notification messages
_GUICtrlToolbar_SetRows | Sets the number of rows of buttons
_GUICtrlToolbar_SetStyle | Sets the style control
_GUICtrlToolbar_SetStyleAltDrag | Sets whether that the control allows buttons to be dragged
_GUICtrlToolbar_SetStyleCustomErase | Sets whether the control generates NM_CUSTOMDRAW notification messages
_GUICtrlToolbar_SetStyleFlat | Sets whether the control is flat
_GUICtrlToolbar_SetStyleList | Sets whether the control has button text to the right of the bitmap
_GUICtrlToolbar_SetStyleRegisterDrop | Sets whether the control generates TBN_GETOBJECT notification messages
_GUICtrlToolbar_SetStyleToolTips | Sets whether the control has tooltips
_GUICtrlToolbar_SetStyleTransparent | Sets whether the control is transparent
_GUICtrlToolbar_SetStyleWrapable | Sets whether the control is wrapable
_GUICtrlToolbar_SetToolTips | Associates a ToolTip control with a toolbar
_GUICtrlToolbar_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlToolbar_SetWindowTheme | Sets the visual style
_GUICtrlTreeView_Add | Adds a new item
_GUICtrlTreeView_AddChild | Adds a new item
_GUICtrlTreeView_AddChildFirst | Adds a new item
_GUICtrlTreeView_AddFirst | Adds a new item
_GUICtrlTreeView_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlTreeView_ClickItem | Click on a item
_GUICtrlTreeView_Create | Create a TreeView control
_GUICtrlTreeView_CreateDragImage | Creates a dragging bitmap for the specified item
_GUICtrlTreeView_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlTreeView_Delete | Removes an item and all its children
_GUICtrlTreeView_DeleteAll | Removes all items from a tree-view control
_GUICtrlTreeView_DeleteChildren | Deletes all children of a item
_GUICtrlTreeView_Destroy | Delete the control
_GUICtrlTreeView_DisplayRect | Returns the bounding rectangle for a tree item
_GUICtrlTreeView_DisplayRectEx | Returns the bounding rectangle for a tree item
_GUICtrlTreeView_EditText | Begins in-place editing of the specified item's text
_GUICtrlTreeView_EndEdit | Ends the editing of the item's text
_GUICtrlTreeView_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlTreeView_EnsureVisible | Ensures that a item is visible, expanding the parent item or scrolling the control if necessary
_GUICtrlTreeView_Expand | Expands or collapses the list of child items associated with the specified parent item, if any
_GUICtrlTreeView_ExpandedOnce | Indicates if the item's list of child items has been expanded at least once
_GUICtrlTreeView_FindItem | Retrieves a item based on it's text
_GUICtrlTreeView_FindItemEx | Retrieves a item based on a tree path
_GUICtrlTreeView_GetBkColor | Retrieve the text back color
_GUICtrlTreeView_GetBold | Indicates if the item is drawn in a bold style
_GUICtrlTreeView_GetChecked | Indicates if a item has its checkbox checked
_GUICtrlTreeView_GetChildCount | Retrieves the number of children of an parent item
_GUICtrlTreeView_GetChildren | Indicates whether the item children flag is set
_GUICtrlTreeView_GetCount | Retrieves a count of the items
_GUICtrlTreeView_GetCut | Indicates if the item is drawn as if selected as part of a cut and paste operation
_GUICtrlTreeView_GetDropTarget | Indicates whether the item is drawn as a drag and drop target
_GUICtrlTreeView_GetEditControl | Retrieves the handle to the edit control being used to edit a item's text
_GUICtrlTreeView_GetExpanded | Indicates whether the item is expanded
_GUICtrlTreeView_GetFirstChild | Retrieves the first child item of the specified item
_GUICtrlTreeView_GetFirstItem | Retrieves the topmost or very first item
_GUICtrlTreeView_GetFirstVisible | Retrieves the first visible item in the control
_GUICtrlTreeView_GetFocused | Indicates whether the item has focus
_GUICtrlTreeView_GetHeight | Retrieves the current height of the each item
_GUICtrlTreeView_GetImageIndex | Retrieves the normal state image index
_GUICtrlTreeView_GetImageListIconHandle | Retrieve ImageList handle
_GUICtrlTreeView_GetIndent | Retrieves the amount, in pixels, that child items are indented relative to their parent items
_GUICtrlTreeView_GetInsertMarkColor | Retrieves the color used to draw the insertion mark
_GUICtrlTreeView_GetISearchString | Retrieves the incremental search string
_GUICtrlTreeView_GetItemByIndex | Retrieve a item by its position in the list of child items
_GUICtrlTreeView_GetItemHandle | Retrieve the item handle
_GUICtrlTreeView_GetItemParam | Retrieves the application specific value of the item
_GUICtrlTreeView_GetLastChild | Retrieves the last child item of the specified item
_GUICtrlTreeView_GetLineColor | Retrieve the line color
_GUICtrlTreeView_GetNext | Retrieves the next item after the calling item
_GUICtrlTreeView_GetNextChild | Returns the next item at the same level as the specified item
_GUICtrlTreeView_GetNextSibling | Returns the next item at the same level as the specified item
_GUICtrlTreeView_GetNextVisible | Retrieves the next visible item that follows the specified item
_GUICtrlTreeView_GetNormalImageList | Retrieves the normal image list
_GUICtrlTreeView_GetParentHandle | Retrieve the parent handle of item
_GUICtrlTreeView_GetParentParam | Retrieve the parent control ID/Param of item
_GUICtrlTreeView_GetPrev | Retrieves the previous item before the calling item
_GUICtrlTreeView_GetPrevChild | Retrieves the previous child item of a specified item
_GUICtrlTreeView_GetPrevSibling | Returns the previous item before the calling item at the same level
_GUICtrlTreeView_GetPrevVisible | Retrieves the first visible item that precedes the specified item
_GUICtrlTreeView_GetScrollTime | Retrieves the maximum scroll time
_GUICtrlTreeView_GetSelected | Indicates whether the item appears in the selected state
_GUICtrlTreeView_GetSelectedImageIndex | Retrieves the index in the image list of the image displayed for the item when it is selected
_GUICtrlTreeView_GetSelection | Retrieves the currently selected item
_GUICtrlTreeView_GetSiblingCount | Retrieves the number of siblings at the level of an item
_GUICtrlTreeView_GetState | Retrieve the state of the item
_GUICtrlTreeView_GetStateImageIndex | Retrieves the index of the state image to display for the item
_GUICtrlTreeView_GetStateImageList | Retrieves the handle to the state image list
_GUICtrlTreeView_GetText | Retrieve the item text
_GUICtrlTreeView_GetTextColor | Retrieve the text color
_GUICtrlTreeView_GetToolTips | Retrieves the handle to the child ToolTip control
_GUICtrlTreeView_GetTree | Retrieve all items text
_GUICtrlTreeView_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlTreeView_GetVisible | Indicates whether the item is currently visible in the control image
_GUICtrlTreeView_GetVisibleCount | Returns the number of items that can be fully visible in the control
_GUICtrlTreeView_HitTest | Returns information about the location of a point relative to the control
_GUICtrlTreeView_HitTestEx | Returns information about the location of a point relative to the control
_GUICtrlTreeView_HitTestItem | Returns the item at the specified coordinates
_GUICtrlTreeView_Index | Retrieves the position of the item in the list
_GUICtrlTreeView_InsertItem | Insert an item
_GUICtrlTreeView_IsFirstItem | Indicates whether the tree item is very first
_GUICtrlTreeView_IsParent | Indicates whether one item is the parent of another item
_GUICtrlTreeView_Level | Indicates the level of indentation of a item
_GUICtrlTreeView_SelectItem | Selects the specified item, scrolls the item into view, or redraws the item
_GUICtrlTreeView_SelectItemByIndex | Selects the item based on it's index in the parent list
_GUICtrlTreeView_SetBkColor | Sets the back color
_GUICtrlTreeView_SetBold | Sets whether the item is drawn using a bold sytle
_GUICtrlTreeView_SetChecked | Sets whether a item has it's checkbox checked or not
_GUICtrlTreeView_SetCheckedByIndex | Sets whether an item has it's checkbox checked or not by it's index
_GUICtrlTreeView_SetChildren | Sets whether the item children flag
_GUICtrlTreeView_SetCut | Sets whether the item is drawn as if selected as part of a cut and paste operation
_GUICtrlTreeView_SetDropTarget | Sets whether the item is drawn as a drag and drop target
_GUICtrlTreeView_SetFocused | Sets whether the item appears to have focus
_GUICtrlTreeView_SetHeight | Sets the height of the each item
_GUICtrlTreeView_SetIcon | Set an item icon
_GUICtrlTreeView_SetImageIndex | Sets the index into image list for which image is displayed when a item is in its normal state
_GUICtrlTreeView_SetIndent | Sets the width of indentation for a tree-view control and redraws the control to reflect the new width
_GUICtrlTreeView_SetInsertMark | Sets the insertion mark
_GUICtrlTreeView_SetInsertMarkColor | Sets the color used to draw the insertion mark
_GUICtrlTreeView_SetItemHeight | Sets the height of an individual item
_GUICtrlTreeView_SetItemParam | Sets the value specific to the item
_GUICtrlTreeView_SetLineColor | Sets the line color
_GUICtrlTreeView_SetNormalImageList | Sets the normal image list for the control
_GUICtrlTreeView_SetScrollTime | Sets the maximum scroll time
_GUICtrlTreeView_SetSelected | Sets whether the item appears in the selected state
_GUICtrlTreeView_SetSelectedImageIndex | Sets the selected image index
_GUICtrlTreeView_SetState | Set the state of the specified item
_GUICtrlTreeView_SetStateImageIndex | Sets the index into image list for the state image
_GUICtrlTreeView_SetStateImageList | Sets the state image list for the control
_GUICtrlTreeView_SetText | Set the text of an item
_GUICtrlTreeView_SetTextColor | Sets the text color
_GUICtrlTreeView_SetToolTips | Sets the handle to the child ToolTip control
_GUICtrlTreeView_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlTreeView_Sort | Sorts the items
_GUIImageList_Add | Adds an image or images to an image list
_GUIImageList_AddBitmap | Adds a bitmap to an image list
_GUIImageList_AddIcon | Adds an icon to an image list
_GUIImageList_AddMasked | Adds an image or images to an image list, generating a mask from the specified bitmap
_GUIImageList_BeginDrag | Begins dragging an image
_GUIImageList_Copy | Source image is copied to the destination image's index
_GUIImageList_Create | Create an ImageList control
_GUIImageList_Destroy | Destroys an image list
_GUIImageList_DestroyIcon | Destroys an icon and frees any memory the icon occupied
_GUIImageList_DragEnter | Displays the drag image at the specified position within the window
_GUIImageList_DragLeave | Unlocks the specified window and hides the drag image, allowing the window to be updated
_GUIImageList_DragMove | Moves the image that is being dragged during a drag-and-drop operation
_GUIImageList_Draw | Draws an image list item in the specified device context
_GUIImageList_DrawEx | Draws an image list item in the specified device context
_GUIImageList_Duplicate | Creates a duplicate of an existing image list
_GUIImageList_EndDrag | Ends a drag operation
_GUIImageList_GetBkColor | Retrieves the current background color for an image list
_GUIImageList_GetIcon | Creates an icon from an image and mask in an image list
_GUIImageList_GetIconHeight | Retrieves the height of the images in an image list
_GUIImageList_GetIconSize | Retrieves the dimensions of images in an image list
_GUIImageList_GetIconSizeEx | Retrieves the dimensions of images in an image list
_GUIImageList_GetIconWidth | Retrieves the width of the images in an image list
_GUIImageList_GetImageCount | Retrieves the number of images in an image list
_GUIImageList_GetImageInfoEx | Retrieves information about an image
_GUIImageList_Remove | Remove Image(s) from the ImageList
_GUIImageList_ReplaceIcon | Replaces an image with an icon or cursor
_GUIImageList_SetBkColor | Sets the background color for an image list
_GUIImageList_SetIconSize | Sets the dimensions of images in an image list and removes all images from the list
_GUIImageList_SetImageCount | Resizes an existing image list
_GUIImageList_Swap | Source image is copied to the destination image's index
_GUIScrollBars_EnableScrollBar | Enable/Disable scrollbar
_GUIScrollBars_GetScrollBarInfoEx | Retrieves information about the specified scroll bar
_GUIScrollBars_GetScrollBarRect | Retrieves coordinates of the scroll bar
_GUIScrollBars_GetScrollBarRGState | Retrieves the state of a scroll bar component
_GUIScrollBars_GetScrollBarXYLineButton | Retrieves the Height or width of the thumb
_GUIScrollBars_GetScrollBarXYThumbBottom | Retrieves the Position of the bottom or right of the thumb
_GUIScrollBars_GetScrollBarXYThumbTop | Retrieves the Position of the top or left of the thumb
_GUIScrollBars_GetScrollInfo | Retrieves the parameters of a scroll bar
_GUIScrollBars_GetScrollInfoEx | Retrieves the parameters of a scroll bar
_GUIScrollBars_GetScrollInfoMax | Retrieves the maximum scrolling position
_GUIScrollBars_GetScrollInfoMin | Retrieves the minimum scrolling position
_GUIScrollBars_GetScrollInfoPage | Retrieves the page size
_GUIScrollBars_GetScrollInfoPos | Retrieves the position of the scroll box
_GUIScrollBars_GetScrollInfoTrackPos | Retrieves the immediate position of a scroll box that the user is dragging
_GUIScrollBars_GetScrollPos | Retrieves the current position of the scroll box (thumb) in the specified scroll bar
_GUIScrollBars_GetScrollRange | Retrieves the current minimum and maximum scroll box (thumb) positions for the specified scroll bar
_GUIScrollBars_Init | Initialize the scrollbars for the window
_GUIScrollBars_ScrollWindow | Scrolls the contents of the specified window's client area
_GUIScrollBars_SetScrollInfo | Sets the parameters of a scroll bar
_GUIScrollBars_SetScrollInfoMax | Sets the maximum scrolling position
_GUIScrollBars_SetScrollInfoMin | Sets the minimum scrolling position
_GUIScrollBars_SetScrollInfoPage | Sets the page size
_GUIScrollBars_SetScrollInfoPos | Sets the position of the scroll box (thumb) in the specified scroll bar
_GUIScrollBars_SetScrollRange | Sets the minimum and maximum scroll box positions for the specified scroll bar
_GUIScrollBars_ShowScrollBar | Shows or hides the specified scroll bar
_GUIToolTip_Activate | Activates or deactivates the control
_GUIToolTip_AddTool | Registers a tool with the control
_GUIToolTip_AdjustRect | Calculates the text display rectangle from the window rectangle
_GUIToolTip_BitsToTTF | Encode user bit flags to $TTF_ flags
_GUIToolTip_Create | Creates a ToolTip control
_GUIToolTip_DelTool | Removes a tool
_GUIToolTip_Destroy | Delete the ToolTip control
_GUIToolTip_EnumTools | Retrieves information about the current tool
_GUIToolTip_GetBubbleHeight | Returns the height of the control
_GUIToolTip_GetBubbleSize | Returns the width and height of the control
_GUIToolTip_GetBubbleWidth | Returns the width of a ToolTip control
_GUIToolTip_GetCurrentTool | Retrieves information for the current tool
_GUIToolTip_GetDelayTime | Retrieves the initial, pop-up or reshow durations
_GUIToolTip_GetMargin | Retrieves the top, left, bottom, and right margins
_GUIToolTip_GetMarginEx | Retrieves the top, left, bottom, and right margins
_GUIToolTip_GetMaxTipWidth | Retrieves the maximum width for a ToolTip window
_GUIToolTip_GetText | Retrieves the text
_GUIToolTip_GetTipBkColor | Retrieves the background color
_GUIToolTip_GetTipTextColor | Retrieves the text color
_GUIToolTip_GetTitleBitMap | Retrieves the title bitmap icon
_GUIToolTip_GetTitleText | Retrieve the title
_GUIToolTip_GetToolCount | Retrieves the tool count
_GUIToolTip_GetToolInfo | Retrieves the information about a specific tool
_GUIToolTip_HitTest | Retrieves the information that a ToolTip control maintains about a tool
_GUIToolTip_NewToolRect | Sets a new bounding rectangle for a tool
_GUIToolTip_Pop | Removes a displayed ToolTip from view
_GUIToolTip_PopUp | Causes the ToolTip to display at the coordinates of the last mouse message
_GUIToolTip_SetDelayTime | Sets the initial, pop-up, and reshow durations
_GUIToolTip_SetMargin | Sets the top, left, bottom, and right margins
_GUIToolTip_SetMaxTipWidth | Sets the maximum width for a ToolTip window
_GUIToolTip_SetTipBkColor | Sets the background color
_GUIToolTip_SetTipTextColor | Sets the text color
_GUIToolTip_SetTitle | Adds a standard icon and title string
_GUIToolTip_SetToolInfo | Sets the information for a tool
_GUIToolTip_SetWindowTheme | Sets the visual style
_GUIToolTip_ToolExists | Determines whether a current tool exists
_GUIToolTip_ToolToArray | Transfers a ToolInfo structure to an array
_GUIToolTip_TrackActivate | Activates or deactivates a tracking ToolTip
_GUIToolTip_TrackPosition | Sets the position of a tracking ToolTip
_GUIToolTip_TTFToBits | Decode $TTF_flags to user bit flags
_GUIToolTip_Update | Forces the current tool to be redrawn
_GUIToolTip_UpdateTipText | Sets the ToolTip text for a tool
_HexToString | Convert a hex string to a string.
_IE_Example | Display a new browser window pre-loaded with documents to be used in IE.au3 examples or your own testing
_IE_Introduction | Display introductory information about IE.au3 in a new browser window
_IE_VersionInfo | Returns an array of information about the IE.au3 version
_IEAction | Perform any of a set of simple actions on the Browser.
_IEAttach | Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode).
_IEBodyReadHTML | Returns the HTML inside the <body> tag of the document.
_IEBodyReadText | Returns the Text inside the <body> tag of the document.
_IEBodyWriteHTML | Replaces the HTML inside the <body> tag of the document.
_IECreate | Create an Internet Explorer Browser Window.
_IECreateEmbedded | Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().
_IEDocGetObj | Given any DOM object, returns a reference to the associated document object.
_IEDocInsertHTML | Inserts HTML Text in or around an element.
_IEDocInsertText | Inserts Text in or around an element.
_IEDocReadHTML | Returns the full HTML source of a document.
_IEDocWriteHTML | Replaces the HTML for the entire document.
_IEErrorHandlerDeRegister | Disable a registered user COM error handler
_IEErrorHandlerRegister | Register and enable a user COM error handler
_IEErrorNotify | Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)
_IEFormElementCheckBoxSelect | Set the value of a specified form element.
_IEFormElementGetCollection | Returns a collection object variable representing all Form Elements within a given Form.
_IEFormElementGetObjByName | Returns an object reference to a Form Element by name.
_IEFormElementGetValue | Returns the value of a given Form Element.
_IEFormElementOptionSelect | Set the value of a specified form element.
_IEFormElementRadioSelect | Set the value of a specified form element.
_IEFormElementSetValue | Set the value of a specified Form Element.
_IEFormGetCollection | Returns a collection object variable representing the Forms in the document or a single form by index.
_IEFormGetObjByName | Returns an object reference to a Form by name.
_IEFormImageClick | Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.
_IEFormReset | Reset a specified Form setting the values back to their loaded defaults.
_IEFormSubmit | Submit a specified Form.
_IEFrameGetCollection | Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page or a single Frame or iFrame by index.
_IEFrameGetObjByName | Returns an object reference to a Frame or iFrame by name.
_IEGetObjById | Returns an object variable by id or name.
_IEGetObjByName | Returns an object variable by name or id.
_IEHeadInsertEventScript | Inserts a Javascript into the Head of the document.
_IEImgClick | Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.
_IEImgGetCollection | Returns a collection object variable representing the IMG tags in the document or a single image by index.
_IEIsFrameSet | Checks to see if the specified Window contains a FrameSet.
_IELinkClickByIndex | Simulate a mouse click on a link by 0-based index (in source order).
_IELinkClickByText | Simulate a mouse click on a link with text sub-string matching the string provided.
_IELinkGetCollection | Returns a collection object containing all links in the document or a single link by index.
_IELoadWait | Wait for a browser page load to complete before returning.
_IELoadWaitTimeout | Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.
_IENavigate | Directs an existing browser window to navigate to the specified URL.
_IEPropertyGet | Returns a select property of the Browser or DOM element.
_IEPropertySet | Set a select property of the Browser or DOM element.
_IEQuit | Close the browser and remove the object reference to it.
_IETableGetCollection | Returns a collection object variable representing all the tables in a document or a single table by index.
_IETableWriteToArray | Reads the contents of a Table into an array.
_IETagNameAllGetCollection | Returns a collection object all elements in the document or document hierarchy in source order or a single element by index.
_IETagNameGetCollection | Returns a collection object of all elements in the object with the specified TagName or a single element by index.
_Iif | Perform a boolean test within an expression.
_INetExplorerCapable | Converts a string to IE(Internet Explorer) capable line
_INetGetSource | Gets the source from an URL without writing a temp file.
_INetMail | Opens default user's mail client with given address, subject, and body.
_INetSmtpMail | Sends an email without using an external email program.
_IsPressed | Check if key has been pressed
_MathCheckDiv | Checks if NumA is divisable by NumB
_Max | Evaluates which of the two numbers is higher.
_MemGlobalAlloc | Allocates the specified number of bytes from the heap
_MemGlobalFree | Frees the specified global memory object and invalidates its handle
_MemGlobalLock | Locks a global memory object and returns a pointer to the first byte of the object's memory block
_MemGlobalSize | Retrieves the current size of the specified global memory object
_MemGlobalUnlock | Decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
_MemMoveMemory | Moves memory either forward or backward, aligned or unaligned
_MemVirtualAlloc | Reserves or commits a region of pages in the virtual address space of the calling process
_MemVirtualAllocEx | Reserves a region of memory within the virtual address space of a specified process
_MemVirtualFree | Releases a region of pages within the virtual address space of a process
_MemVirtualFreeEx | Releases a region of pages within the virtual address space of a process
_Min | Evaluates which of the two numbers is lower.
_MouseTrap | Confine the Mouse Cursor to specified coords.
_NamedPipes_CallNamedPipe | Performs a read/write operation on a named pipe
_NamedPipes_ConnectNamedPipe | Enables a named pipe server process to wait for a client process to connect
_NamedPipes_CreateNamedPipe | Creates an instance of a named pipe
_NamedPipes_CreatePipe | Creates an anonymous pipe
_NamedPipes_DisconnectNamedPipe | Disconnects the server end of a named pipe instance from a client process
_NamedPipes_GetNamedPipeHandleState | Retrieves information about a specified named pipe
_NamedPipes_GetNamedPipeInfo | Retrieves information about the specified named pipe
_NamedPipes_PeekNamedPipe | Copies data from a pipe into a buffer without removing it from the pipe
_NamedPipes_SetNamedPipeHandleState | Sets the read mode and the blocking mode of the specified named pipe
_NamedPipes_TransactNamedPipe | Reads and writes to a named pipe in one network operation
_NamedPipes_WaitNamedPipe | Waits for an instance of a named pipe to become available
_Net_Share_ConnectionEnum | Lists all connections made to a shared resource
_Net_Share_FileClose | Forces a resource to close
_Net_Share_FileEnum | Returns information about open files on a server
_Net_Share_FileGetInfo | Retrieves information about a particular opening of a server resource
_Net_Share_PermStr | Returns the string representation of a resource's permissions
_Net_Share_ResourceStr | Returns the string representation of a resource
_Net_Share_SessionDel | Ends a network session between a server and a workstation
_Net_Share_SessionEnum | Provides information about sessions established on a server
_Net_Share_SessionGetInfo | Retrieves information about a session established between a server and workstation
_Net_Share_ShareAdd | Shares a server resource
_Net_Share_ShareCheck | Checks whether or not a server is sharing a device
_Net_Share_ShareDel | Deletes a share name from a server's list of shared resources
_Net_Share_ShareEnum | Retrieves information about each shared resource on a server
_Net_Share_ShareGetInfo | Retrieves information about a particular shared resource on a server
_Net_Share_ShareSetInfo | Shares a server resource
_Net_Share_StatisticsGetSvr | Retrieves operating statistics for a server
_Net_Share_StatisticsGetWrk | Retrieves operating statistics for a workstation
_Now | Returns the current Date and Time in PC's format.
_NowCalc | Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.
_NowCalcDate | Returns the current Date in format YYYY/MM/DD.
_NowDate | Returns the current Date in the Pc's format.
_NowTime | Returns the current Time in the requested format.
_PathFull | Creates a path based on the relative path you provide. The newly created absolute path is returned
_PathGetRelative | Returns the relative path to a directory
_PathMake | Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.
_PathSplit | Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.
_ProcessGetName | Returns a string containing the process name that belongs to a given PID.
_ProcessGetPriority | Get the priority of an open process
_Radian | Converts degrees to radians.
_ReplaceStringInFile | Replaces a string with another string in the given text file (binary won't work!)
_RunDOS | Executes a DOS command in a hidden command window.
_ScreenCapture_Capture | Captures a region of the screen
_ScreenCapture_CaptureWnd | Captures a screen shot of a specified window
_ScreenCapture_SaveImage | Saves an image to file
_ScreenCapture_SetBMPFormat | Sets the bit format that will be used for BMP screen captures
_ScreenCapture_SetJPGQuality | Sets the quality level that will be used for JPEG screen captures
_ScreenCapture_SetTIFColorDepth | Sets the color depth used for TIFF screen captures
_ScreenCapture_SetTIFCompression | Sets the compression used for TIFF screen captures
_Security__AdjustTokenPrivileges | Enables or disables privileges in the specified access token
_Security__GetAccountSid | Retrieves the security identifier (SID) for an account
_Security__GetLengthSid | Returns the length, in bytes, of a valid SID
_Security__GetTokenInformation | Retrieves a specified type of information about an access token
_Security__ImpersonateSelf | Obtains an access token that impersonates the calling process security context
_Security__IsValidSid | Validates a SID
_Security__LookupAccountName | Retrieves a security identifier (SID) for the account and the name of the domain
_Security__LookupAccountSid | Retrieves the name of the account for a SID
_Security__LookupPrivilegeValue | Retrieves the locally unique identifier (LUID) for a privilege value
_Security__OpenProcessToken | Returns the process handle of the calling process
_Security__OpenThreadToken | Opens the access token associated with a thread
_Security__OpenThreadTokenEx | Opens the access token associated with a thread, impersonating the client's security context if required
_Security__SetPrivilege | Enables or disables a local token privilege
_Security__SidToStringSid | Converts a binary SID to a string
_Security__SidTypeStr | Converts a Sid type to string form
_Security__StringSidToSid | Converts a String SID to a binary SID
_SendMessage | Wrapper for commonly used Dll Call
_SendMessageA | Wrapper for commonly used Dll Call (Force Ansi Call)
_SetDate | Sets the current date of the system
_SetTime | Sets the current time of the system
_Singleton | Enforce a design paradigm where only one instance of the script may be running.
_SoundClose | Closes a sound previously opened with _SoundOpen.
_SoundLength | Returns the length of the soundfile.
_SoundOpen | Opens a sound file for use with other _Sound functions.
_SoundPause | Pause a playing sound.
_SoundPlay | Play a sound file.
_SoundPos | Returns the current position of the sound.
_SoundResume | Resume a paused sound.
_SoundSeek | Seeks the sound to the specified position
_SoundStatus | Returns the status of the sound
_SoundStop | Stop a playing sound.
_SQLite_Changes | Returns number of changes (excluding triggers) of the last transaction
_SQLite_Close | Close a SQLite database.
_SQLite_Display2DResult | Returns or prints a 2Dimensional array formated to Console
_SQLite_Encode | Encodes strings or binary data for use in SQLite query's
_SQLite_ErrCode | Returns last error code (numeric)
_SQLite_ErrMsg | Returns a string describing in english the error condition for the most recent sqlite3_* API call
_SQLite_Escape | Escapes a string
_SQLite_Exec | Executes a SQLite query, does not handle results.
_SQLite_FetchData | Fetches 1 row of data from a _SQLite_Query() based query
_SQLite_FetchNames | Read out the Column names of a _SQLite_Query() based query
_SQLite_GetTable | Passes Out a 1Dimensional Array Containing Tablenames and Data of Executed Query.
_SQLite_GetTable2d | Passes out a 2Dimensional array containing Column names and Data of executed Query
_SQLite_LastInsertRowID | Returns the ROWID of the most recent insert in the database
_SQLite_LibVersion | Returns the version number of the library
_SQLite_Open | Opens/creates a SQLite database.
_SQLite_Query | Prepares a SQLite Query
_SQLite_QueryFinalize | Finalizes an _SQLite_Query() based query. The query is interrupted.
_SQLite_QueryReset | Reset a _SQLite_Query() based query
_SQLite_QuerySingleRow | Read out the first row of the result from the specified query.
_SQLite_SafeMode | Disable or Enable Safe mode
_SQLite_SetTimeout | Sets timeout for busy handler
_SQLite_Shutdown | Unloads SQLite.dll
_SQLite_SQLiteExe | Executes commands in SQLite.exe
_SQLite_Startup | Loads SQLite.dll
_SQLite_TotalChanges | Returns number of all changes (including triggers) of all transactions
_StringBetween | Returns the string between the start search string and the end search string.
_StringEncrypt | An RC4 based string encryption function.
_StringExplode | Splits up a string into substrings depending on the given delimiters as PHP Explode v5.
_StringInsert | Inserts a string within another string.
_StringProper | Changes a string to proper case, same a =Proper function in Excel
_StringRepeat | Repeats a string a specified number of times.
_StringReverse | Reverses the contents of the specified string.
_StringToHex | Convert a string to a hex string.
_TCPIpToName | Resolves IP adress to Hostname(s)
_TempFile | Generate a name for a temporary file. The file is guaranteed not to exist yet.
_TicksToTime | Converts the specified tick amount to hours, minutes and seconds.
_Timer_Diff | Returns the difference in time from a previous call to _Timer_Init
_Timer_GetIdleTime | Returns the number of ticks since last user activity (i.e. KYBD/Mouse)
_Timer_GetTimerID | Returns the Timer ID from $iwParam
_Timer_Init | Returns a timestamp (in milliseconds).
_Timer_KillAllTimers | Destroys all the timers
_Timer_KillTimer | Destroys the specified timer
_Timer_SetTimer | Creates a timer with the specified time-out value
_TimeToTicks | Converts the specified hours, minutes, and seconds to ticks.
_VersionCompare | Compares two file versions for equality
_viClose | Closes a VISA connection to an Instrument/Device
_viExecCommand | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viFindGpib | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viGpibBusReset | GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function
_viGTL | Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"
_viInteractiveControl | Interactive VISA control to test your SCPI commands.
_viOpen | Opens a VISA connection to an Instrument/Device
_viSetAttribute | Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.
_viSetTimeout | Sets the VISA timeout in MILISECONDS
_WeekNumberISO | Calculate the weeknumber of a given date.
_WinAPI_AttachConsole | Attaches the calling process to the console of the specified process
_WinAPI_AttachThreadInput | Attaches the input processing mechanism of one thread to that of another thread
_WinAPI_Beep | Generates simple tones on the speaker
_WinAPI_BitBlt | Performs a bit-block transfer of color data
_WinAPI_CallNextHookEx | Passes the hook information to the next hook procedure in the current hook chain
_WinAPI_CallWindowProc | Passes the hook information to the next hook procedure in the current hook chain
_WinAPI_ClientToScreen | Converts the client coordinates of a specified point to screen coordinates
_WinAPI_CloseHandle | Closes an open object handle
_WinAPI_CombineRgn | Combines two regions and stores the result in a third region
_WinAPI_CommDlgExtendedError | Returns a common dialog box error string. This string indicates the most recent error to occur during the execution of one of the common dialog box functions.
_WinAPI_CopyIcon | Copies the specified icon from another module
_WinAPI_CreateBitmap | Creates a bitmap with the specified width, height, and color format
_WinAPI_CreateCompatibleBitmap | Creates a bitmap compatible with the specified device context
_WinAPI_CreateCompatibleDC | Creates a memory device context compatible with the specified device
_WinAPI_CreateEvent | Creates or opens a named or unnamed event object
_WinAPI_CreateFile | Creates or opens a file or other device
_WinAPI_CreateFont | Creates a logical font with the specified characteristics
_WinAPI_CreateFontIndirect | Creates a logical font that has specific characteristics
_WinAPI_CreatePen | Creates a logical pen that has the specified style, width, and color.
_WinAPI_CreateProcess | Creates a new process and its primary thread
_WinAPI_CreateRectRgn | Creates a rectangular region
_WinAPI_CreateRoundRectRgn | Creates a rectangular region with rounded corners
_WinAPI_CreateSolidBitmap | Creates a solid color bitmap
_WinAPI_CreateSolidBrush | Creates a logical brush that has the specified solid color
_WinAPI_CreateWindowEx | Creates an overlapped, pop-up, or child window
_WinAPI_DefWindowProc | Call the default window procedure to provide default processing
_WinAPI_DeleteDC | Deletes the specified device context
_WinAPI_DeleteObject | Deletes a logical pen, brush, font, bitmap, region, or palette
_WinAPI_DestroyIcon | Destroys an icon and frees any memory the icon occupied
_WinAPI_DestroyWindow | Destroys the specified window
_WinAPI_DrawEdge | Draws one or more edges of rectangle
_WinAPI_DrawFrameControl | Draws a frame control of the specified type and style
_WinAPI_DrawIcon | Draws an icon or cursor into the specified device context
_WinAPI_DrawIconEx | Draws an icon or cursor into the specified device context
_WinAPI_DrawLine | Draws a line
_WinAPI_DrawText | Draws formatted text in the specified rectangle
_WinAPI_EnableWindow | Enables or disables mouse and keyboard input to the specified window or control
_WinAPI_EnumDisplayDevices | Obtains information about the display devices in a system
_WinAPI_EnumWindows | Enumerates all windows
_WinAPI_EnumWindowsPopup | Enumerates popup windows
_WinAPI_EnumWindowsTop | Enumerates all top level windows
_WinAPI_ExpandEnvironmentStrings | Expands environment variable strings and replaces them with their defined values
_WinAPI_ExtractIconEx | Creates an array of handles to large or small icons extracted from a file
_WinAPI_FatalAppExit | Displays a message box and terminates the application
_WinAPI_FillRect | Fills a rectangle by using the specified brush
_WinAPI_FindExecutable | Retrieves the name of the executable file associated with the specified file name
_WinAPI_FindWindow | Retrieves the handle to the top-level window whose class name and window name match
_WinAPI_FlashWindow | Flashes the specified window one time
_WinAPI_FlashWindowEx | Flashes the specified window
_WinAPI_FloatToInt | Returns a 4 byte float as an integer value
_WinAPI_FlushFileBuffers | Flushes the buffers of a specified file and causes all buffered data to be written
_WinAPI_FormatMessage | Formats a message string
_WinAPI_FrameRect | Draws a border around the specified rectangle by using the specified brush
_WinAPI_FreeLibrary | Decrements the reference count of the loaded dynamic-link library (DLL) module
_WinAPI_GetAncestor | Retrieves the handle to the ancestor of the specified window
_WinAPI_GetAsyncKeyState | Determines whether a key is up or down at the time the function is called
_WinAPI_GetBkMode | Returns the current background mix mode for a specified device context
_WinAPI_GetClassName | Retrieves the name of the class to which the specified window belongs
_WinAPI_GetClientHeight | Retrieves the height of a window's client area
_WinAPI_GetClientRect | Retrieves the coordinates of a window's client area
_WinAPI_GetClientWidth | Retrieves the width of a window's client area
_WinAPI_GetCurrentProcess | Returns the process handle of the calling process
_WinAPI_GetCurrentProcessID | Returns the process identifier of the calling process
_WinAPI_GetCurrentThread | Retrieves a pseudo handle for the calling thread.
_WinAPI_GetCurrentThreadId | Returns the thread identifier of the calling thread
_WinAPI_GetCursorInfo | Retrieves information about the global cursor
_WinAPI_GetDC | Retrieves a handle of a display device context for the client area a window
_WinAPI_GetDesktopWindow | Returns the handle of the Windows desktop window
_WinAPI_GetDeviceCaps | Retrieves device specific information about a specified device
_WinAPI_GetDIBits | Retrieves the bits of the specified bitmap and copies them into a buffer as a DIB
_WinAPI_GetDlgCtrlID | Returns the identifier of the specified control
_WinAPI_GetDlgItem | Retrieves the handle of a control in the specified dialog box
_WinAPI_GetFileSizeEx | Retrieves the size of the specified file
_WinAPI_GetFocus | Retrieves the handle of the window that has the keyboard focus
_WinAPI_GetForegroundWindow | Returns the handle of the foreground window
_WinAPI_GetGuiResources | Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process
_WinAPI_GetIconInfo | Retrieves information about the specified icon or cursor
_WinAPI_GetLastError | Returns the calling thread's lasterror code value
_WinAPI_GetLastErrorMessage | Returns the calling threads last error message
_WinAPI_GetLayeredWindowAttributes | Gets Layered Window Attributes
_WinAPI_GetModuleHandle | Returns a module handle for the specified module
_WinAPI_GetMousePos | Returns the current mouse position
_WinAPI_GetMousePosX | Returns the current mouse X position
_WinAPI_GetMousePosY | Returns the current mouse Y position
_WinAPI_GetObject | Retrieves information for the specified graphics object
_WinAPI_GetOpenFileName | Creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open
_WinAPI_GetOverlappedResult | Retrieves the results of an overlapped operation
_WinAPI_GetParent | Retrieves the handle of the specified child window's parent window
_WinAPI_GetProcessAffinityMask | Obtains a affinity masks for the process and the system
_WinAPI_GetSaveFileName | Creates a Save dialog box that lets the user specify the drive, directory, and name of a file to save
_WinAPI_GetStdHandle | Retrieves a handle for the standard input, standard output, or standard error device
_WinAPI_GetStockObject | Retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes
_WinAPI_GetSysColor | Retrieves the current color of the specified display element
_WinAPI_GetSysColorBrush | retrieves a handle identifying a logical brush that corresponds to the specified color index
_WinAPI_GetSystemMetrics | Retrieves the specified system metric or system configuration setting
_WinAPI_GetTextExtentPoint32 | Computes the width and height of the specified string of text
_WinAPI_GetWindow | Retrieves the handle of a window that has a specified relationship to the specified window
_WinAPI_GetWindowDC | Retrieves the device context (DC) for the entire window
_WinAPI_GetWindowHeight | Returns the height of the window
_WinAPI_GetWindowLong | Retrieves information about the specified window
_WinAPI_GetWindowPlacement | Retrieves the placement of the window for Min, Max, and normal positions
_WinAPI_GetWindowRect | Retrieves the dimensions of the bounding rectangle of the specified window
_WinAPI_GetWindowRgn | Obtains a copy of the window region of a window
_WinAPI_GetWindowText | Retrieves the text of the specified window's title bar
_WinAPI_GetWindowThreadProcessId | Retrieves the identifier of the thread that created the specified window
_WinAPI_GetWindowWidth | Returns the width of the window
_WinAPI_GetXYFromPoint | Returns the X/Y values from a $tagPOINT structure
_WinAPI_GlobalMemoryStatus | Retrieves information about current available memory
_WinAPI_GUIDFromString | Converts a string GUID to binary form
_WinAPI_GUIDFromStringEx | Converts a string GUID to binary form
_WinAPI_HiWord | Returns the high word of a longword value
_WinAPI_InProcess | Determines whether a window belongs to the current process
_WinAPI_IntToFloat | Returns a 4 byte integer as a float value
_WinAPI_InvalidateRect | Adds a rectangle to the specified window's update region
_WinAPI_IsClassName | Wrapper to check ClassName of the control.
_WinAPI_IsWindow | Determines whether the specified window handle identifies an existing window
_WinAPI_IsWindowVisible | Retrieves the visibility state of the specified window
_WinAPI_LineTo | Draws a line from the current position up to, but not including, the specified point.
_WinAPI_LoadBitmap | Loads the specified bitmap resource from a module's executable file
_WinAPI_LoadImage | Loads an icon, cursor, or bitmap
_WinAPI_LoadLibrary | Maps a specified executable module into the address space of the calling process
_WinAPI_LoadLibraryEx | Maps a specified executable module into the address space of the calling process
_WinAPI_LoadShell32Icon | Extracts an icon from the Shell32.dll file
_WinAPI_LoadString | loads a string resource from the executable file associated with a specified module
_WinAPI_LocalFree | Frees the specified local memory object and invalidates its handle
_WinAPI_LoWord | Returns the low word of a longword
_WinAPI_MAKELANGID | Construct language id from a primary language id and a sublanguage id
_WinAPI_MAKELCID | Construct locale id from a language id and a sort id
_WinAPI_MakeLong | Returns a longint value from two int values
_WinAPI_MakeQWord | Returns a QWORD value from two int values
_WinAPI_MessageBeep | Plays a waveform sound
_WinAPI_Mouse_Event | Synthesizes mouse motion and button clicks
_WinAPI_MoveTo | Updates the current position to the specified point
_WinAPI_MoveWindow | Changes the position and dimensions of the specified window
_WinAPI_MsgBox | Displays a message box with wider margin than original
_WinAPI_MulDiv | Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value
_WinAPI_MultiByteToWideChar | Maps a character string to a wide-character (Unicode) string
_WinAPI_MultiByteToWideCharEx | Maps a character string to a wide-character (Unicode) string
_WinAPI_OpenProcess | Returns a handle of an existing process object
_WinAPI_PathFindOnPath | Searchs for a file in the default system paths
_WinAPI_PointFromRect | Returns the top/left coordinates of a $tagRECT as a $tagPOINT structure
_WinAPI_PostMessage | Places a message in the message queue and then returns
_WinAPI_PrimaryLangId | Extract primary language id from a language id
_WinAPI_PtInRect | Determines whether the specified point lies within the specified rectangle
_WinAPI_ReadFile | Reads data from a file
_WinAPI_ReadProcessMemory | Reads memory in a specified process
_WinAPI_RectIsEmpty | Determins whether a rectangle is empty
_WinAPI_RedrawWindow | Updates the specified rectangle or region in a window's client area
_WinAPI_RegisterWindowMessage | Defines a new window message that is guaranteed to be unique throughout the system
_WinAPI_ReleaseCapture | Releases the mouse capture from a window in the current thread and restores normal mouse input processing
_WinAPI_ReleaseDC | Releases a device context
_WinAPI_ScreenToClient | Converts screen coordinates of a specified point on the screen to client coordinates
_WinAPI_SelectObject | Selects an object into the specified device context
_WinAPI_SetBkColor | Sets the current background color to the specified color value
_WinAPI_SetBkMode | Sets the background mix mode of the specified device context
_WinAPI_SetCapture | Sets the mouse capture to the specified window belonging to the current thread
_WinAPI_SetCursor | Establishes the cursor shape
_WinAPI_SetDefaultPrinter | Sets the default printer for the current user on the local computer
_WinAPI_SetDIBits | Sets the pixels in a compatible bitmap using the color data found in a DIB
_WinAPI_SetEndOfFile | Sets the physical file size for the specified file to the current position of the file pointer.
_WinAPI_SetEvent | Sets the specified event object to the signaled state
_WinAPI_SetFilePointer | Moves the file pointer of the specified file
_WinAPI_SetFocus | Sets the keyboard focus to the specified window
_WinAPI_SetFont | Sets a window font
_WinAPI_SetHandleInformation | Sets certain properties of an object handle
_WinAPI_SetLastError | Sets the last-error code for the calling thread
_WinAPI_SetLayeredWindowAttributes | Sets Layered Window Attributes
_WinAPI_SetParent | Changes the parent window of the specified child window
_WinAPI_SetProcessAffinityMask | Sets a processor affinity mask for the threads of a specified process
_WinAPI_SetSysColors | Obtains information about the display devices in a system
_WinAPI_SetTextColor | Sets the current text color to the specified color value
_WinAPI_SetWindowLong | Sets information about the specified window
_WinAPI_SetWindowPlacement | Sets the placement of the window for Min, Max, and normal positions
_WinAPI_SetWindowPos | Changes the size, position, and Z order of a child, pop-up, or top-level window
_WinAPI_SetWindowRgn | Sets the window region of a window
_WinAPI_SetWindowsHookEx | Installs an application-defined hook procedure into a hook chain
_WinAPI_SetWindowText | Changes the text of the specified window's title bar
_WinAPI_ShowCursor | Displays or hides the cursor
_WinAPI_ShowError | Displays an error message box with an optional exit
_WinAPI_ShowMsg | Displays an "Information" message box
_WinAPI_ShowWindow | Sets the specified window's show state
_WinAPI_StringFromGUID | Converts a binary GUID to string form
_WinAPI_SubLangId | Extract sublanguage id from a language id
_WinAPI_SystemParametersInfo | Retrieves or sets the value of one of the system-wide parameters
_WinAPI_TwipsPerPixelX | Returns the width of a pixel, in twips.
_WinAPI_TwipsPerPixelY | Returns the height of a pixel, in twips.
_WinAPI_UnhookWindowsHookEx | Removes a hook procedure installed in a hook chain by the _WinAPI_SetWindowsHookEx function
_WinAPI_UpdateLayeredWindow | Updates the position, size, shape, content, and translucency of a layered window
_WinAPI_UpdateWindow | Updates the client area of a window by sending a WM_PAINT message to the window
_WinAPI_WaitForInputIdle | Waits until a process is waiting for user input with no input pending, or a time out
_WinAPI_WaitForMultipleObjects | Waits until one or all of the specified objects are in the signaled state
_WinAPI_WaitForSingleObject | Waits until the specified object is in the signaled state
_WinAPI_WideCharToMultiByte | Converts a Unicode string to a multibyte string
_WinAPI_WindowFromPoint | Retrieves the handle of the window that contains the specified point
_WinAPI_WriteConsole | Writes a character string to a console screen buffer
_WinAPI_WriteFile | Writes data to a file at the position specified by the file pointer
_WinAPI_WriteProcessMemory | Writes memory in a specified process
_WinNet_AddConnection | Connects a local device to a network resource
_WinNet_AddConnection2 | Connects a local device to a network resource
_WinNet_AddConnection3 | Connects a local device to a network resource
_WinNet_CancelConnection | Cancels an existing network connection
_WinNet_CancelConnection2 | Cancels an existing network connection
_WinNet_CloseEnum | Ends a network resource enumeration started by a call to WNetOpenEnum
_WinNet_ConnectionDialog | Starts a general browsing dialog box for connecting to network resources
_WinNet_ConnectionDialog1 | Starts a general browsing dialog box for connecting to network resources
_WinNet_DisconnectDialog | Starts a general browsing dialog box for disconnecting from network resources
_WinNet_DisconnectDialog1 | Starts a general browsing dialog box for disconnecting from network resources
_WinNet_EnumResource | Continues an enumeration of network resources
_WinNet_GetConnection | Retrieves the name of the network resource associated with a local device
_WinNet_GetConnectionPerformance | Returns information about the performance of a network connection resource
_WinNet_GetLastError | Retrieves the most recent extended error
_WinNet_GetNetworkInformation | Returns extended information about a specific network provider
_WinNet_GetProviderName | Obtains the provider name for a specific type of network
_WinNet_GetResourceInformation | Identifies the network provider that owns the resource
_WinNet_GetResourceParent | Returns the parent of a network resource in the network browse hierarchy
_WinNet_GetUniversalName | Converts drived based path to universal form
_WinNet_GetUser | Retrieves the default user name, or the user name used to establish a connection
_WinNet_OpenEnum | Starts an enumeration of network resources or existing connections
_WinNet_RestoreConnection | Restores the connection to a network resource
_WinNet_UseConnection | Connects a local device to a network resource
_Word_VersionInfo | Returns an array of information about the Word.au3 version
_WordAttach | Attach to the first existing instance of Microsoft Word where the search string matches based on the selected mode.
_WordCreate | Create a Microsoft Office Word Object
_WordDocAdd | Returns an object variable representing a new empty document
_WordDocAddLink | Add a hyperlink to the document
_WordDocAddPicture | Add a picture to the document
_WordDocClose | Closes a previously opened word document
_WordDocFindReplace | Runs the specified find and replace operation.
_WordDocGetCollection | Returns a collection object containing all documents
_WordDocLinkGetCollection | Returns a collection object containing all links in the document
_WordDocOpen | Opens an existing Microsoft Word Document
_WordDocPrint | Prints all or part of the specified document.
_WordDocPropertyGet | Returns a select property of the Word Document.
_WordDocPropertySet | Set a select property of the Word Document
_WordDocSave | Saves a previously opened document
_WordDocSaveAs | Saves the specified document with a new name or format.
_WordErrorHandlerDeRegister | Disable a registered user COM error handler
_WordErrorHandlerRegister | Register and enable a user COM error handler
_WordErrorNotify | Specifies whether Word.au3 automatically notifies of Warnings and Errors (to the console)
_WordMacroRun | Runs a Visual Basic macro
_WordPropertyGet | Returns a select property of the Word Application.
_WordPropertySet | Set a select property of the Word Application.
_WordQuit | Close the window and remove the object reference to it


Function Notes

User Defined Function Notes

We have included number of files that each contain standard AutoIt3 Functions, so called User Defined Functions.
UDF's are functions/Scriptlets, written in AutoIt3, you can #include in your own script and use them without the need to program it yourself or Copy&Paste them every time you need them.

Example:

#include <date.au3>
MsgBox(0,"Today","Today's date is " & _Now())

This script will display today's date formatted in your pc's long format. e.g. "Sunday, December 18, 2004"

Many UDF's contain optional parameters that can be omitted. If you wish to specify an optional parameter, however, all parameters that precede it must be specified!
For example, consider _ArraySort ( ByRef $a_Array [, $i_Descending [, $i_Base=0 [, $i_Ubound=0 [, $i_Dim=1 [, $i_SortIndex=0 ]]]]] )
When a parameters is preceded with Byref mean that the function will update this variable with a new value. These parameters must be a variable ($xyz) and cannot be a constant.

Most UDF's indicate success/failure as a return value; others indicate it by setting the @error flag. Some do both....
@error = 0 ;is always success
Return = varies, but is typically non-zero for success to allow easy to read code...

If a function can set the @error flag, you should always check it before using a return value - if @error indicates an error then the function return value is generally undefined...


User Defined Functions

Array user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Array.au3>.

User Defined Function | Description
_ArrayAdd | Adds a specified value at the end of an existing array.
_ArrayBinarySearch | Uses the binary search algorithm to search through a 1-dimensional array.
_ArrayCombinations | Returns an Array of the Combinations of a Set of Elements from a Selected Array
_ArrayConcatenate | Concatenate two arrays.
_ArrayDelete | Deletes the specified element from the given array.
_ArrayDisplay | Displays given 1D or 2D array array in a listview.
_ArrayFindAll | Find the indices of all ocurrences of a search query between two points in a 1D or 2D array using _ArraySearch().
_ArrayInsert | Add a new value at the specified position.
_ArrayMax | Returns the highest value held in an array.
_ArrayMaxIndex | Returns the index where the highest value occurs in the array.
_ArrayMin | Returns the lowest value held in an array.
_ArrayMinIndex | Returns the index where the lowest value occurs in the array.
_ArrayPermute | Returns an Array of the Permutations of all Elements in an Array
_ArrayPop | Returns the last element of an array, deleting that element from the array at the same time.
_ArrayPush | Add new values without increasing array size by inserting at the end the new value and deleting the first one or vice versa.
_ArrayReverse | Takes the given array and reverses the order in which the elements appear in the array.
_ArraySearch | Finds an entry within a 1D or 2D array. Similar to _ArrayBinarySearch(), except that the array does not need to be sorted.
_ArraySort | Sort a 1D or 2D array on a specific index using the quicksort/insertionsort algorithms.
_ArraySwap | Swaps two items.
_ArrayToClip | Sends the contents of an array to the clipboard, each element delimited by a carriage return.
_ArrayToString | Places the elements of an array into a single string, separated by the specified delimiter.
_ArrayTrim | Trims a certain number of characters from all elements in an array.
_ArrayUnique | Returns the Unique Elements of a 1-dimensional array.


Function _ArrayAdd

Function Reference

_ArrayAdd

Adds a specified value at the end of an existing array.

#Include <Array.au3>
_ArrayAdd(ByRef $avArray, $vValue)

Parameters

$avArray | Array to modify
$vValue | Value to add

Return Value

Success: | Index of last added item
Failure: | -1, set @error
@error: | 1 - $avArray is not an array
 | 2 - $avArray is not a 1 dimensional array

Remarks

None.

Related

_ArrayConcatenate, _ArrayDelete, _ArrayInsert, _ArrayPop, _ArrayPush

Example

#include <Array.au3>

Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayAdd()")
_ArrayAdd($avArray, "Brian")
_ArrayDisplay($avArray, "$avArray AFTER _ArrayAdd()")


Function _ArrayBinarySearch

Function Reference

_ArrayBinarySearch

Uses the binary search algorithm to search through a 1-dimensional array.

#Include <Array.au3>
_ArrayBinarySearch(Const ByRef $avArray, $vValue [, $iStart = 0 [, $iEnd = 0]])

Parameters

$avArray | Array to search
$vValue | Value to find
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at

Return Value

Success: | Index that value was found at
Failure: | -1, set @error
@error: | 1 - $avArray is not an array
 | 2 - $vValue outside of array's min/max values
 | 3 - $vValue was not found in array
 | 4 - $iStart is greater than $iEnd
 | 5 - $avArray is not a 1 dimensional array

Remarks

When performing a binary search on an array of items, the contents MUST be sorted before the search is done.
Otherwise undefined results will be returned.

Related

_ArrayFindAll, _ArraySearch

Example

#include <Array.au3>

;===============================================================================
; Example 1 (using a manually-defined array)
;===============================================================================
Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

; sort the array to be able to do a binary search
_ArraySort($avArray)

; display sorted array
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort()")

; lookup existing entry
$iKeyIndex = _ArrayBinarySearch($avArray, "Jon")
If Not @error Then
MsgBox(0,'Entry found',' Index: ' & $iKeyIndex)
Else
MsgBox(0,'Entry Not found',' Error: ' & @error)
EndIf

; lookup non-existing entry
$iKeyIndex = _ArrayBinarySearch($avArray, "Unknown")
If Not @error Then
MsgBox(0,'Entry found',' Index: ' & $iKeyIndex)
Else
MsgBox(0,'Entry Not found',' Error: ' & @error)
EndIf

;===============================================================================
; Example 2 (using an array returned by StringSplit())
;===============================================================================
$avArray = StringSplit("a,b,d,c,e,f,g,h,i", ",")

; sort the array to be able to do a binary search
_ArraySort($avArray, 0, 1) ; start at index 1 to skip $avArray[0]

; display sorted array
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort()")

; start at index 1 to skip $avArray[0]
$iKeyIndex = _ArrayBinarySearch($avArray, "c", 1)
If Not @error Then
Msgbox(0,'Entry found',' Index: ' & $iKeyIndex)
Else
Msgbox(0,'Entry Not found',' Error: ' & @error)
EndIf


Function _ArrayCombinations

Function Reference

_ArrayCombinations

Returns an Array of the Combinations of a Set of Elements from a Selected Array

#Include <Array.au3>
_ArrayCombinations(ByRef $avArray, $iSet [, $sDelim = ""])

Parameters

$avArray | The Array to use
$iSet | Size of the combinations set
$sDelim | [optional] String result separator, default is "" for none

Return Value

Success: | Returns an Array of Combinations
 | Returns an array, the first element ($array[0]) contains the number of strings returned.
 | The remaining elements ($array[1], $array[2], etc.) contain the Combinations.
Failure: | Returns 0 and set @error:
@error: | 1 - The Input Must be an Array
 | 2 - $avArray is not a 1 dimensional array

Remarks

The input array must be 0-based, i.e. no counter in $array[0]. Based on an algorithm by Kenneth H. Rosen.

http://www.merriampark.com/comb.htm

Related

_ArrayPermute

Example

; *****************************************************************************
; Example 1 - Declare a 1-dimensional array, and create an array showing the Possible Combinations
; *****************************************************************************
#include <Array.au3>

Dim $aArray[5] = [1, 2, 3, 4, 5]

For $i = 1 To UBound($aArray)
$aArrayCombo = _ArrayCombinations($aArray, $i, ",")
_ArrayDisplay($aArrayCombo, "iSet = " & $i)
Next


Function _ArrayConcatenate

Function Reference

_ArrayConcatenate

Concatenate two arrays.

#Include <Array.au3>
_ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource [, $iStart = 0])

Parameters

$avArrayTarget | The array to concatenate onto
$avArraySource | The array to concatenate from
$iStart | [optional] index of the first Source Array entry (Default = 0)

Return Value

Success: | $avArrayTarget's new size
Failure: | 0, set @error
@error: | 1 - $avArrayTarget is not an array
 | 2 - $avArraySource is not an array
 | 3 - $avArrayTarget is not a 1 dimensional array
 | 4 - $avArraySource is not a 1 dimensional array
 | 5 - $avArrayTarget and $avArraySource is not a 1 dimensional array

Remarks

None.

Related

_ArrayAdd, _ArrayPush

Example

#include <Array.au3>

Local $avArrayTarget[5] = ["JPM", "Holger", "Jon", "Larry", "Jeremy"]
Local $avArraySource[5] = ["Valik", "Cyberslug", "Nutster", "Tylo", "JdeB"]

_ArrayDisplay($avArrayTarget, "$avArrayTarget BEFORE _ArrayConcatenate()")
_ArrayConcatenate($avArrayTarget, $avArraySource)
_ArrayDisplay($avArrayTarget, "$avArrayTarget AFTER _ArrayConcatenate()")


Function _ArrayDelete

Function Reference

_ArrayDelete

Deletes the specified element from the given array.

#Include <Array.au3>
_ArrayDelete(ByRef $avArray, $iElement)

Parameters

$avArray | Array to modify
$iElement | Element to delete

Return Value

Success: | New size of the array
Failure: | 0, set @error
@error: | 1 - $avArray is not an array
 | 3 - $avArray has too many dimensions (only up to 2D supported)
 | (2 - Deprecated error code)

Remarks

If the array has one element left (or one row for 2D arrays), it will be set to "" after _ArrayDelete() is used on it.

If the $ilement is greater than the array size then the last element is destroyed.

Related

_ArrayAdd, _ArrayInsert, _ArrayPop, _ArrayPush

Example

#include <Array.au3>

Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayDelete()")
_ArrayDelete($avArray, 8)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayDelete()")


Function _ArrayDisplay

Function Reference

_ArrayDisplay

Displays given 1D or 2D array array in a listview.

#Include <Array.au3>
_ArrayDisplay(Const ByRef $avArray [, $sTitle = "Array: ListView Display" [, $iItemLimit = -1 [, $iTranspose = 0 [, $sSeparator = "" [, $sReplace = "|" [, $sHeader = ""]]]]]])

Parameters

$avArray | Array to display
$sTitle | [optional] Title to use for window
$iItemLimit | [optional] Maximum number of listview items (rows) to show
$iTranspose | [optional] If set differently than default, will transpose the array if 2D
$sSeparator | [optional] Change Opt("GUIDataSeparatorChar") on-the-fly
$sReplace | [optional] String to replace any occurrence of $sSeparator with in each array element
$sheader | [optional] Header column names

Return Value

Success: | 1
Failure: | 0, set @error:
@error: | 1 - $avArray is not an array
 | 2 - $avArray has too many dimensions (only up to 2D supported)

Remarks

None.

Related

Example

#include <Array.au3>

;===============================================================================
; Example 1
;===============================================================================
$asControls = StringSplit(WinGetClassList("[active]", ""), @LF)
_ArrayDisplay($asControls, "Class List of Active Window")

;===============================================================================
; Example 2 (using a manually-defined array)
;===============================================================================
Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray set manually 1D")
_ArrayDisplay($avArray, "$avArray set manually 1D transposed", -1, 1)

;===============================================================================
; Example 3 (using an array returned by StringSplit())
;===============================================================================
$avArray = StringSplit(WinGetClassList("", ""), @LF)
_ArrayDisplay($avArray, "$avArray as a list classes in window")

;===============================================================================
; Example 4 (a 2D array)
;===============================================================================
Local $avArray[2][5] = [["JPM", "Holger", "Jon", "Larry", "Jeremy"], ["Valik", "Cyberslug", "Nutster", "JdeB", "Tylo"]]
_ArrayDisplay($avArray, "$avArray as a 2D array")
_ArrayDisplay($avArray, "$avArray as a 2D array, transposed", -1, 1)


Function _ArrayFindAll

Function Reference

_ArrayFindAll

Find the indices of all ocurrences of a search query between two points in a 1D or 2D array using _ArraySearch().

#Include <Array.au3>
_ArrayFindAll(Const ByRef $avArray, $vValue [, $iStart = 0 [, $iEnd = 0 [, $iCase = 0 [, $iPartial = 0 [, $iSubItem = 0]]]]])

Parameters

$avArray | The array to search
$vValue | What to search $avArray for
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at
$iCase | [optional] If set to 1, search is case sensitive
$iPartial | [optional] If set to 1, executes a partial search
$iSubItem | [optional] Sub-index to search on in 2D arrays

Return Value

Success: | An array of all index numbers in array containing $vValue
Failure: | -1, sets @error (see _ArraySearch() description for error codes)

Remarks

None.

Related

_ArrayBinarySearch, _ArraySearch

Example

#include <Array.au3>

Local $avArray[5] = [0, 1, 2, 1, 0]
Local $aiResult = _ArrayFindAll($avArray, 0)
_ArrayDisplay($avArray, "$avArray")
_ArrayDisplay($aiResult, "Results of searching for 0 in $avArray")


Function _ArrayInsert

Function Reference

_ArrayInsert

Add a new value at the specified position.

#Include <Array.au3>
_ArrayInsert(ByRef $avArray, $iElement [, $vValue = ""])

Parameters

$avArray | Array to modify
$iElement | Position to insert item at
$vValue | [optional] Value of item to insert

Return Value

Success: | New size of the array
Failure: | 0, sets @error
@error: | 1 - $avArray is not an array
 | 2 - $avArray is not a 1 dimensional array

Remarks

None.

Related

_ArrayAdd, _ArrayDelete, _ArrayPop, _ArrayPush

Example

#include <Array.au3>

Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayInsert()")
_ArrayInsert($avArray, 4, "New")
_ArrayDisplay($avArray, "$avArray AFTER _ArrayInsert()")


Function _ArrayMax

Function Reference

_ArrayMax

Returns the highest value held in an array.

#Include <Array.au3>
_ArrayMax(Const ByRef $avArray [, $iCompNumeric = 0 [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to search
$iCompNumeric | [optional] Comparison method: 0 - compare alphanumerically 1 - compare numerically
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at

Return Value

Success: | The maximum value in the array
Failure: | "", sets @error (see _ArrayMaxIndex() description for error codes)

Remarks

None.

Related

_ArrayMaxIndex, _ArrayMin, _ArrayMinIndex, _ArrayUnique

Example

#include <Array.au3>

Local $avArray = StringSplit("4,2,06,8,12,5", ",")

MsgBox(0,'Max String value', _ArrayMax($avArray, 0, 1))
MsgBox(0,'Max Numeric value', _ArrayMax($avArray, 1, 1))


Function _ArrayMaxIndex

Function Reference

_ArrayMaxIndex

Returns the index where the highest value occurs in the array.

#Include <Array.au3>
_ArrayMaxIndex(Const ByRef $avArray [, $iCompNumeric = 0 [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to search
$iCompNumeric | [optional] Comparison method: 0 - compare alphanumerically 1 - compare numerically
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at

Return Value

Success: | The index of the maximum value in the array
Failure: | -1, set @error
@error: | 1 - $avArray is not an array
 | 2 - $iStart is greater than $iEnd
 | 3 - $avArray is not a 1 dimensional array

Remarks

None.

Related

_ArrayMax, _ArrayMin, _ArrayMinIndex

Example

#include <Array.au3>

Local $avArray = StringSplit("4,2,06,8,12,5", ",")

MsgBox(0,'Max Index String value', _ArrayMaxIndex($avArray, 0, 1))
MsgBox(0,'Max Index Numeric value', _ArrayMaxIndex($avArray, 1, 1))


Function _ArrayMin

Function Reference

_ArrayMin

Returns the lowest value held in an array.

#Include <Array.au3>
_ArrayMin(Const ByRef $avArray [, $iCompNumeric = 0 [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to search
$iCompNumeric | [optional] Comparison method: 0 - compare alphanumerically 1 - compare numerically
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at

Return Value

Success: | The minimum value in the array
Failure: | "", sets @error (see _ArrayMinIndex() description for error codes)

Remarks

None.

Related

_ArrayMax, _ArrayMaxIndex, _ArrayMinIndex, _ArrayUnique

Example

#include <Array.au3>

Local $avArray = StringSplit("4,2,06,8,12,5", ",")

MsgBox(0,'Min String value', _ArrayMin($avArray, 0, 1))
MsgBox(0,'Min Numeric value', _ArrayMin($avArray, 1, 0))


Function _ArrayMinIndex

Function Reference

_ArrayMinIndex

Returns the index where the lowest value occurs in the array.

#Include <Array.au3>
_ArrayMinIndex(Const ByRef $avArray[, $iCompNumeric = 0 [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to search
$iCompNumeric | [optional] Comparison method: 0 - compare alphanumerically 1 - compare numerically
$iStart | [[optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at

Return Value

Success: | The index of the minimum value in the array
Failure: | -1, sets @error
@error: | 1 - $avArray is not an array
 | 2 - $iStart is greater than $iEnd
 | 3 - $avArray is not a 1 dimensional array

Remarks

None.

Related

_ArrayMax, _ArrayMaxIndex, _ArrayMin

Example

#include <Array.au3>

Local $avArray = StringSplit("4,2,06,8,12,5", ",")

MsgBox(0,'Min Index String value', _ArrayMinIndex($avArray , 0, 1))
MsgBox(0,'Min Index Numeric value', _ArrayMinIndex($avArray, 1, 1))


Function _ArrayPermute

Function Reference

_ArrayPermute

Returns an Array of the Permutations of all Elements in an Array

#Include <Array.au3>
_ArrayPermute(ByRef $avArray [, $sDelim = ""])

Parameters

$avArray | The Array to get Permutations
$sDelim | [optional] String result separator, default is "" for none

Return Value

Success: | Returns an Array of Permutations
 | $array[0] contains the number of strings returned.
 | The remaining elements ($array[1], $array[2] ... $array[n]) contain the Permutations.
Failure: | Returns 0 and set @error:
@error: | 1 - The Input Must be an Array
 | 2 - $avArray is not a 1 dimensional array

Remarks

The input array must be 0-based, i.e. no counter in $array[0]. Based on the algorithm by Alexander Bogomolny.

http://www.bearcave.com/random_hacks/permute.html

Related

_ArrayCombinations

Example

; *****************************************************************************
; Example 1 - Declare a 1-dimensional array, return an Array of permutations
; *****************************************************************************
#include <Array.au3>

Dim $aArray[4] = [1, 2, 3, 4]
$aNewArray = _ArrayPermute($aArray, ",") ;Using Default Parameters
_ArrayDisplay($aNewArray, "Array Permuted")


Function _ArrayPop

Function Reference

_ArrayPop

Returns the last element of an array, deleting that element from the array at the same time.

#Include <Array.au3>
_ArrayPop(ByRef $avArray)

Parameters

$avArray Array to modify

Return Value

Success: | The last element of the array
Failure: | "", set @error
@error: | 1 - The Input Must be an Array
 | 2 - $avArray is not a 1 dimensional array

Remarks

If the array has one element left, it will be set to "" after _ArrayPop() is used on it.

Related

_ArrayAdd, _ArrayDelete, _ArrayInsert, _ArrayPush

Example

#include <Array.au3>

Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayPop()")
While UBound($avArray)
MsgBox(0,'_ArrayPop() return value', _ArrayPop($avArray))
_ArrayDisplay($avArray, "$avArray AFTER _ArrayPop()")
WEnd


Function _ArrayPush

Function Reference

_ArrayPush

Add new values without increasing array size by inserting at the end the new value and deleting the first one or vice versa.

#Include <Array.au3>
_ArrayPush(ByRef $avArray, $vValue [, $iDirection = 0])

Parameters

$avArray | Array to modify
$vValue | Value(s) to add (can be in an array)
$iDirection | [optional] Direction to push existing array elements: 0 = Slide left (adding at the end) 1 = Slide right (adding at the start)

Return Value

Success: | 1
Failure: | 0, sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $vValue is an array larger than $avArray (so it can't fit)
 | 3 - $avArray is not a 1 dimensional array

Remarks

This function is used for continuous updates of data in array, where in other cases a vast size of array would be created.
It keeps all values inside the array (something like History), minus the first one or the last one depending on direction chosen.
It is similar to the push command in assembly.

Related

_ArrayAdd, _ArrayConcatenate, _ArrayDelete, _ArrayInsert, _ArrayPop

Example

#include <Array.au3>

Local $avArrayTarget[9] = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Local $avArraySource[2] = [100, 200]

_ArrayDisplay($avArrayTarget, "$avArrayTarget BEFORE _ArrayPush()")
_ArrayPush($avArrayTarget, $avArraySource)
_ArrayDisplay($avArrayTarget, "$avArrayTarget AFTER _ArrayPush() array to end")
_ArrayPush($avArrayTarget, $avArraySource, 1)
_ArrayDisplay($avArrayTarget, "$avArrayTarget AFTER _ArrayPush() array to beginning")
_ArrayPush($avArrayTarget, "Hello world!", 1)
_ArrayDisplay($avArrayTarget, "$avArrayTarget AFTER _ArrayPush() string to beginning")


Function _ArrayReverse

Function Reference

_ArrayReverse

Takes the given array and reverses the order in which the elements appear in the array.

#Include <Array.au3>
_ArrayReverse(ByRef $avArray [, $iStart = 0 [, $iEnd = 0]])

Parameters

$avArray | Array to modify
$iStart | [optional] Index of array to start modifying at
$iEnd | [optional] Index of array to stop modifying at

Return Value

Success | 1
Failure | 0, sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $iStart is greater than $iEnd
 | 3 - $avArray is not a 1 dimensional array

Remarks

None.

Related

_ArraySwap

Example

#include <Array.au3>

Local $avArray[10] = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayReverse()")
_ArrayReverse($avArray)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayReverse()")
_ArrayReverse($avArray, 3, 6)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayReverse() from index 3 to 6")


Function _ArraySearch

Function Reference

_ArraySearch

Finds an entry within a 1D or 2D array. Similar to _ArrayBinarySearch(), except that the array does not need to be sorted.

#Include <Array.au3>
_ArraySearch(Const ByRef $avArray, $vValue [, $iStart = 0 [, $iEnd = 0 [, $iCase = 0 [, $iPartial = 0 [, $iForward = 1 [, $iSubItem = -1]]]]]])

Parameters

$avArray | The array to search
$vValue | What to search $avArray for
$iStart | [optional] Index of array to start searching at
$iEnd | [optional] Index of array to stop searching at
$iCase | [optional] If set to 1, search is case sensitive
$iPartial | [optional] If set to 1, executes a partial search
$iForward | [optional] If set to 0, searches the array from end to beginning (instead of beginning to end)
$iSubItem | [optional] Sub-index to search on in 2D arrays

Return Value

Success: | The index that $vValue was found at
Failure: | -1, sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $avArray is not a 1 or 2 dimensional array
 | 4 - $iStart is greater than $iEnd
 | 6 - $vValue was not found in array
 | 7 - $avArray has too many dimensions
 | (3, 5 - Deprecated error codes)

Remarks

This function might be slower than _ArrayBinarySearch() but is useful when the array's order can't be altered.

Related

_ArrayBinarySearch, _ArrayFindAll

Example

#include <Array.au3>

;===============================================================================
; Example 1 (using a 1D array)
;===============================================================================
Local $avArray[6] = [ _
"String0, SubString0", _
"String1, SubString1", _
"String2, SubString2", _
"String3, SubString3", _
"String4, SubString4", _
"String5, SubString5"]

_ArrayDisplay($avArray, "$avArray")

$sSearch = InputBox("_ArraySearch() demo", "String to find?")
If @error Then Exit

$iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 1)
If @error Then
MsgBox(0, "Not Found", '"' & $sSearch & '" was not found in the array.')
Else
MsgBox(0, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ".")
EndIf

;===============================================================================
; Example 2 (using a 2D array)
;===============================================================================
Local $avArray[6][2] = [ _
["String0", "SubString0"], _
["String1", "SubString1"], _
["String2", "SubString2"], _
["String3", "SubString3"], _
["String4", "SubString4"], _
["String5", "SubString5"]]

_ArrayDisplay($avArray, "$avArray")

$sSearch = InputBox("_ArraySearch() demo", "String to find?")
If @error Then Exit

$sColumn = InputBox("_ArraySearch() demo", "Column to search?")
If @error Then Exit
$sColumn = Int($sColumn)

$iIndex = _ArraySearch($avArray, $sSearch, 0, 0, 0, 1, 1, $sColumn)
If @error Then
MsgBox(0, "Not Found", '"' & $sSearch & '" was not found on column ' & $sColumn & '.')
Else
MsgBox(0, "Found", '"' & $sSearch & '" was found in the array at position ' & $iIndex & ' on column ' & $sColumn & '.')
EndIf


Function _ArraySort

Function Reference

_ArraySort

Sort a 1D or 2D array on a specific index using the quicksort/insertionsort algorithms.

#Include <Array.au3>
_ArraySort(ByRef $avArray[, $iDescending = 0 [, $iStart = 0 [, $iEnd = 0 [, $iSubItem = 0]]]])

Parameters

$avArray | Array to sort
$iDescending | [optional] If set to 1, sort descendingly
$iStart | [optional] Index of array to start sorting at
$iEnd | [optional] Index of array to stop sorting at
$iSubItem | [optional] Sub-index to sort on in 2D arrays

Return Value

Success: | 1
Failure: | 0, sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $iStart is greater than $iEnd
 | 3 - $iSubItem is greater than subitem count
 | 4 - $avArray has too many dimensions

Remarks

None.

Related

Example

#include <Array.au3>

;===============================================================================
; Example 1 (using a 1D array)
;===============================================================================
Local $avArray[10] = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

_ArrayDisplay($avArray, "$avArray BEFORE _ArraySort()" )
_ArraySort($avArray)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() ascending" )
_ArraySort($avArray, 1)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() descending" )
_ArraySort($avArray, 0, 3, 6)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() ascending from index 3 to 6" )

;===============================================================================
; Example 2 (using a 2D array)
;===============================================================================
Local $avArray[5][3] = [ _
[5, 20, 8], _
[4, 32, 7], _
[3, 16, 9], _
[2, 35, 0], _
[1, 19, 6]]

_ArrayDisplay($avArray, "$avArray BEFORE _ArraySort()" )
_ArraySort($avArray, 0, 0, 0, 0)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() ascending column 0" )
_ArraySort($avArray, 0, 0, 0, 1)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() ascending column 1" )
_ArraySort($avArray, 0, 0, 0, 2)
_ArrayDisplay($avArray, "$avArray AFTER _ArraySort() ascending column 2" )


Function _ArraySwap

Function Reference

_ArraySwap

Swaps two items.

#Include <Array.au3>
_ArraySwap(ByRef $vItem1, ByRef $vItem2)

Parameters

$vItem1 | First item to swap
$vItem2 | Second item to swap

Return Value

None.

Remarks

This function swaps the two items in place, since they're passed by reference. Regular, non-array variables can also be swapped by this function.

Related

_ArrayReverse

Example

#include <Array.au3>

Local $avArray[2]

$avArray[0] = "World!"
$avArray[1] = "Hello"

_ArrayDisplay($avArray, "$avArray BEFORE _ArraySwap()")
_ArraySwap($avArray[0], $avArray[1])
_ArrayDisplay($avArray, "$avArray AFTER _ArraySwap()")


Function _ArrayToClip

Function Reference

_ArrayToClip

Sends the contents of an array to the clipboard, each element delimited by a carriage return.

#Include <Array.au3>
_ArrayToClip(Const ByRef $avArray [, $iStart = 0 [, $iEnd = 0]])

Parameters

$avArray | Array to copy to clipboard
$iStart | [optional] Index of array to start copying at
$iEnd | [optional] Index of array to stop copying at

Return Value

Success: | 1
Failure: | 0, sets @error:
@error: | -1 - ClipPut() failed
 | Other - See _ArrayToString() description for error codes

Remarks

None.

Related

_ArrayToString

Example

#include <Array.au3>

Local $avArray = StringSplit("a,b,c,d,e,f,g,h,i", ",")
_ArrayToClip($avArray, 1)
MsgBox(0, "_ArrayToClip() Test", ClipGet())


Function _ArrayToString

Function Reference

_ArrayToString

Places the elements of an array into a single string, separated by the specified delimiter.

#Include <Array.au3>
_ArrayToString(Const ByRef $avArray [, $sDelim = "|" [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to combine
$sDelim | [optional] Delimiter for combined string
$iStart | [optional] Index of array to start combining at
$iEnd | [optional] Index of array to stop combining at

Return Value

Success: | string which combined selected elements separated by the delimiter string.
Failure: | "", sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $iStart is greater than $iEnd
 | 3 - $avArray is not an 1 dimensional array

Remarks

None.

Related

StringSplit, _ArrayToClip

Example

#include <Array.au3>

Dim $avArray[20]

; Populate test array.
For $i = 0 to UBound( $avArray ) - 1
$avArray[$i] = Random( -20000, 20000, 1)
Next

_ArrayDisplay($avArray, "$avArray")

MsgBox(0, "_ArrayToString() getting $avArray items 1 to 7", _ArrayToString($avArray, @TAB, 1, 7))


Function _ArrayTrim

Function Reference

_ArrayTrim

Trims a certain number of characters from all elements in an array.

#Include <Array.au3>
_ArrayTrim(ByRef $avArray, $iTrimNum [, $iDirection = 0 [, $iStart = 0 [, $iEnd = 0]]])

Parameters

$avArray | Array to modify
$iTrimNum | Number of characters to remove
$iDirection | [optional] Direction to trim: 0 - trim left 1 - trim right
$iStart | [optional] Index of array to start trimming at
$iEnd | [optional] Index of array to stop trimming at

Return Value

Success: | 1
Failure: | 0, sets @error:
@error: | 1 - $avArray is not an array
 | 2 - $avArray is not an 1 dimensional array
 | 5 - $iStart is greater than $iEnd
 | (3-4 - Deprecated error codes)

Remarks

None.

Related

Example

#include <Array.au3>

Local $avArray[5]
$avArray[0] = "ab"
$avArray[1] = "bc"
$avArray[2] = "cd"
$avArray[3] = "de"
$avArray[4] = "ef"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayTrim()")
_ArrayTrim($avArray, 1, 1, 0, 4)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayTrim() right 1 character from items 1 to 3")


Function _ArrayUnique

Function Reference

_ArrayUnique

Returns the Unique Elements of a 1-dimensional array.

#Include <Array.au3>
_ArrayUnique($aArray[, $iDimension = 1 [, $iBase = 0 [, $iCase = 0 [, $vDelim = "|"]]]])

Parameters

$aArray | The Array to use
$iDimension | [[optional] The Dimension of the Array to use
$iBase | [optional] Is the Array 0-base or 1-base index. 0-base by default
$iCase | [optional] Flag to indicate if the operations should be case sensitive.
$vDelim | [optional] One or more characters to use as delimiters. However, cannot forsee its usefullness

Return Value

Success: | Returns a 1-dimensional array containing only the unique elements of that Dimension
Failure: | Returns 0 and set @Error:
@error: | 0 - No error.
 | 1 - Returns 0 if parameter is not an array.
 | 2 - _ArrayUnique failed for some other reason
 | 3 - Array dimension is invalid, should be an integer greater than 0

Remarks

Returns an array, the first element ($array[0]) contains the number of strings returned, the remaining elements ($array[1], $array[2], etc.) contain the unique strings.

Related

_ArrayMax, _ArrayMin

Example

; *****************************************************************************
; Example 1 - Declare a 1-dimensional array, that contains duplicate values.
; Use _ArrayUnique to Create a New Array that only contains the unique values.
; *****************************************************************************
#include <Array.au3>

Dim $aArray[10] = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
_ArrayDisplay($aArray, "$aArray")
$aNewArray = _ArrayUnique($aArray) ;Using Default Parameters
_ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

; ******************************************************************************************
; Example 2 - Declare a 2-dimensional array, that contains duplicate values.
; Use _ArrayUnique to Create a New 1-dimensional Array that only contains the unique values.
; ******************************************************************************************
#include <Array.au3>

Dim $aArray[6][2] = [[1, "A"],[2, "B"],[3, "C"],[1, "A"],[2, "B"],[3, "C"]]
_ArrayDisplay($aArray, "$aArray")
$aNewArray = _ArrayUnique($aArray) ;Using Default Parameters
_ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

$aNewArray = _ArrayUnique($aArray, 2) ;Using 2nd Dimension
_ArrayDisplay($aNewArray, "$aNewArray represents the 2nd Dimension of $aArray")

; *****************************************************************************************
; Example 3 - Declare a 1-dimensional array, that contains duplicate values.
; Use _ArrayUnique and case sensitivity to Create a New Array, with only the unique values.
; *****************************************************************************************
#include <Array.au3>

Dim $aArray[6][2] = [[1, "A"],[2, "B"],[3, "C"],[1, "a"],[2, "b"],[3, "c"]]
_ArrayDisplay($aArray, "$aArray")
$aNewArray = _ArrayUnique($aArray, 1, 0, 1) ;Using Default Parameters, with Case-Sensitivity
_ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray")

$aNewArray = _ArrayUnique($aArray, 2, 0, 1) ;Using Default Parameters, with Case-Sensitivity
_ArrayDisplay($aNewArray, "$aNewArray represents the 2st Dimension of $aArray")

; *****************************************************************************************
; Example 4 - Declare a 1-dimensional array, that contains duplicate values and "|".
; Use _ArrayUnique to Create a New Array, with only the unique values.
; *****************************************************************************************
#include <Array.au3>

Dim $aArray[6][2] = [[1, "|A"],[2, "B"],[3, "C"],[1, "|A"],[2, "B"],[3, "C"]]
Local $sMsgBox

$aNewArray = _ArrayUnique($aArray, 2) ;Using 2nd-Dimension

For $i = 0 To $aNewArray[0]
$sMsgBox &= "[" & $i & "]: " & $aNewArray[$i] & @CRLF
Next

;Must change paramaters to show an element containing "|" in _ArrayDisplay
_ArrayDisplay($aNewArray, "$aNewArray represents the 1st Dimension of $aArray", -1, 0, "@")


User Defined Functions

Clipboard user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Clipboard.au3>.

User Defined Function | Description
_ClipBoard_ChangeChain | Removes a specified window from the chain of clipboard viewers
_ClipBoard_Close | Closes the clipboard
_ClipBoard_CountFormats | Retrieves the number of different data formats currently on the clipboard
_ClipBoard_Empty | Empties the clipboard and frees handles to data in the clipboard
_ClipBoard_EnumFormats | Enumerates the data formats currently available on the clipboard
_ClipBoard_FormatStr | Returns a string representation of a standard clipboard format
_ClipBoard_GetData | Retrieves data from the clipboard in a specified format
_ClipBoard_GetDataEx | Retrieves data from the clipboard in a specified format
_ClipBoard_GetFormatName | Retrieves the name of the specified registered format
_ClipBoard_GetOpenWindow | Retrieves the handle to the window that currently has the clipboard open
_ClipBoard_GetOwner | Retrieves the window handle of the current owner of the clipboard
_ClipBoard_GetPriorityFormat | Retrieves the first available clipboard format in the specified list
_ClipBoard_GetSequenceNumber | Retrieves the clipboard sequence number for the current window station
_ClipBoard_GetViewer | Retrieves the handle to the first window in the clipboard viewer chain
_ClipBoard_IsFormatAvailable | Determines whether the clipboard contains data in the specified format
_ClipBoard_Open | Opens the clipboard and prevents other applications from modifying the clipboard
_ClipBoard_RegisterFormat | Registers a new clipboard format
_ClipBoard_SetData | Places data on the clipboard in a specified clipboard format
_ClipBoard_SetDataEx | Places data on the clipboard in a specified clipboard format
_ClipBoard_SetViewer | Adds the specified window to the chain of clipboard viewers


Function _ClipBoard_ChangeChain

Function Reference

_ClipBoard_ChangeChain

Removes a specified window from the chain of clipboard viewers

#Include <Clipboard.au3>
_ClipBoard_ChangeChain($hRemove, $hNewNext)

Parameters

$hRemove | Handle to the window to be removed from the chain. The handle must have been passed to the _ClipBoard_SetClipboardViewer function.
$hNewNext | Handle to the window that follows the $hRemove window in the clipboard viewer chain. This is the handle returned by _ClipBoard_SetViewer, unless the sequence was changed in response to a $WM_CHANGECBCHAIN message.

Return Value

None.

Remarks

The window identified by $hNewNext replaces the $hRemove window in the chain. The _ClipBoard_SetViewer function
sends a $WM_CHANGECBCHAIN message to the first window in the clipboard viewer chain.

Related

_ClipBoard_SetViewer

See Also

Search ChangeClipboardChain in MSDN Library

Example

#include <ClipBoard.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $hNext = 0

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize clipboard viewer
$hNext = _ClipBoard_SetViewer ($hGUI)

GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Shut down clipboard viewer
_ClipBoard_ChangeChain ($hGUI, $hNext)
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Handle $WM_CHANGECBCHAIN messages
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
; Show that message was received
MemoWrite("***** $WM_CHANGECBCHAIN *****")

; If the next window is closing, repair the chain
If $iwParam = $hNext Then
$hNext = $ilParam
; Otherwise pass the message to the next viewer
ElseIf $hNext <> 0 Then
_SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN

; Handle $WM_DRAWCLIPBOARD messages
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
; Display any text on clipboard
MemoWrite(_ClipBoard_GetData ())

; Pass the message to the next viewer
If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD


Function _ClipBoard_Close

Function Reference

_ClipBoard_Close

Closes the clipboard

#Include <Clipboard.au3>
_ClipBoard_Close()

Parameters

None.

Return Value

Success: | True
Failure: | False

Remarks

When the window has finished examining or changing the clipboard close the clipboard by calling this function.
This enables other windows to access the clipboard. Do not place an object on the clipboard after calling
this function.

Related

_ClipBoard_Open

See Also

Search CloseClipboard in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Show clipboard formats available
MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats ())

; Empty the clipboard
If Not _ClipBoard_Empty () Then _WinAPI_ShowError ("_ClipBoard_Empty failed")

; Show clipboard formats available
MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats ())

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_CountFormats

Function Reference

_ClipBoard_CountFormats

Retrieves the number of different data formats currently on the clipboard

#Include <Clipboard.au3>
_ClipBoard_CountFormats()

Parameters

None.

Return Value

Reurns the number of different data formats currently on the clipboard

Remarks

None.

Related

_ClipBoard_EnumFormats, _ClipBoard_GetPriorityFormat

See Also

Search CountClipboardFormats in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iFormat, $iCount

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Show clipboard formats available
MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats ())

; Enumerate clipboard formats
Do
$iFormat = _ClipBoard_EnumFormats ($iFormat)
If $iFormat <> 0 Then
$iCount += 1
MemoWrite("Clipboard format " & $iCount & " .: " & _ClipBoard_FormatStr ($iFormat))
EndIf
Until $iFormat = 0

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_Empty

Function Reference

_ClipBoard_Empty

Empties the clipboard and frees handles to data in the clipboard

#Include <Clipboard.au3>
_ClipBoard_Empty()

Parameters

None.

Return Value

Success: | True
Failure: | False

Remarks

Before calling this function, you must open the clipboard by using the _ClipBoard_Open function. If you specified
a NULL window handle when opening the clipboard, this function succeeds but sets the clipboard owner to NULL.
Note that this causes _ClipBoard_SetData to fail.

Related

_ClipBoard_Open, _ClipBoard_SetData, _ClipBoard_GetOwner, _ClipBoard_SetDataEx

See Also

Search EmptyClipboard in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

ShowData($hGUI)

; Empty the clipboard
If Not _ClipBoard_Empty () Then _WinAPI_ShowError ("_ClipBoard_Empty failed")

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Show clipboard statistics
Func ShowData($hGUI)
MemoWrite("GUI handle ............: " & $hGUI)
MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner ())
MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow ())
MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber ())
MemoWrite()
EndFunc ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_EnumFormats

Function Reference

_ClipBoard_EnumFormats

Enumerates the data formats currently available on the clipboard

#Include <Clipboard.au3>
_ClipBoard_EnumFormats($iFormat)

Parameters

$iFormat Specifies a clipboard format that is known to be available. To start an enumeration of formats,
set $iFormat to zero. When $iFormat is zero, the function retrieves the first available clipboard format. For
subsequent calls during an enumeration, set $iFormat to the result of the previous call.

Return Value

Success: | The clipboard format that follows the specified format
Failure: | 0

Remarks

You must open the clipboard before enumerating its formats

Related

_ClipBoard_Open, _ClipBoard_CountFormats, _ClipBoard_GetPriorityFormat, _ClipBoard_RegisterFormat

See Also

Search EnumClipboardFormats in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iFormat, $iCount

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Show clipboard formats available
MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats ())

; Enumerate clipboard formats
Do
$iFormat = _ClipBoard_EnumFormats ($iFormat)
If $iFormat <> 0 Then
$iCount += 1
MemoWrite("Clipboard format " & $iCount & " .: " & _ClipBoard_FormatStr ($iFormat))
EndIf
Until $iFormat = 0

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_FormatStr

Function Reference

_ClipBoard_FormatStr

Returns a string representation of a standard clipboard format

#Include <Clipboard.au3>
_ClipBoard_FormatStr($iFormat)

Parameters

$iFormat Specifies a clipboard format

Return Value

Returns a String representation of the clipboard format

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iFormat, $iCount

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Show clipboard formats available
MemoWrite("Clipboard formats ..: " & _ClipBoard_CountFormats ())

; Enumerate clipboard formats
Do
$iFormat = _ClipBoard_EnumFormats ($iFormat)
If $iFormat <> 0 Then
$iCount += 1
MemoWrite("Clipboard format " & $iCount & " .: " & _ClipBoard_FormatStr ($iFormat))
EndIf
Until $iFormat = 0

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetData

Function Reference

_ClipBoard_GetData

Retrieves data from the clipboard in a specified format

#Include <Clipboard.au3>
_ClipBoard_GetData([$iFormat = 1])

Parameters

$iFormat [optional] Specifies a clipboard format:
$CF_TEXT - Text format
$CF_BITMAP - Handle to a bitmap (HBITMAP)
$CF_METAFILEPICT - Handle to a metafile picture (METAFILEPICT)
$CF_SYLK - Microsoft Symbolic Link (SYLK) format
$CF_DIF - Software Arts' Data Interchange Format
$CF_TIFF - Tagged image file format
$CF_OEMTEXT - Text format containing characters in the OEM character set
$CF_DIB - BITMAPINFO structure followed by the bitmap bits
$CF_PALETTE - Handle to a color palette
$CF_PENDATA - Data for the pen extensions to Pen Computing
$CF_RIFF - Represents audio data in RIFF format
$CF_WAVE - Represents audio data in WAVE format
$CF_UNICODETEXT - Unicode text format
$CF_ENHMETAFILE - Handle to an enhanced metafile (HENHMETAFILE)
$CF_HDROP - Handle to type HDROP that identifies a list of files
$CF_LOCALE - Handle to the locale identifier associated with text in the clipboard
$CF_DIBV5 - BITMAPV5HEADER structure followed by bitmap color and the bitmap bits
$CF_OWNERDISPLAY - Owner display format
$CF_DSPTEXT - Text display format associated with a private format
$CF_DSPBITMAP - Bitmap display format associated with a private format
$CF_DSPMETAFILEPICT - Metafile picture display format associated with a private format
$CF_DSPENHMETAFILE - Enhanced metafile display format associated with a private format

Return Value

Success: | Text for text based formats or Binary data for all other formats
 | @extended is set to the # of characters for Text, or # of bytes for Binary
Failure: | 0

Remarks

This function performs all of the steps neccesary to get data from the clipboard. It checks to see if the data
format is available, opens the clipboard, closes the clipboard and returns the data in one of
two formats: String format for datatypes $CF_TEXT, $CF_OEMTEXT, or $CF_UNICODETEXT,
or Binary format for every other type. If you need a finer degree of control over retrieving data from
the clipboard, you may want to use the _ClipBoard_GetDataEx function.

Related

_ClipBoard_GetDataEx, _ClipBoard_SetData, _ClipBoard_SetDataEx

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $btn_SetData, $btn_GetData

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 450)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_SetData
_ClipBoard_SetData ("ClipBoard Library")
Case $btn_GetData
MemoWrite(_ClipBoard_GetData ())
EndSwitch
WEnd

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetDataEx

Function Reference

_ClipBoard_GetDataEx

Retrieves data from the clipboard in a specified format

#Include <Clipboard.au3>
_ClipBoard_GetDataEx([$iFormat = 1])

Parameters

$iFormat [optional] Specifies a clipboard format:
$CF_TEXT - Text format
$CF_BITMAP - Handle to a bitmap (HBITMAP)
$CF_METAFILEPICT - Handle to a metafile picture (METAFILEPICT)
$CF_SYLK - Microsoft Symbolic Link (SYLK) format
$CF_DIF - Software Arts' Data Interchange Format
$CF_TIFF - Tagged image file format
$CF_OEMTEXT - Text format containing characters in the OEM character set
$CF_DIB - BITMAPINFO structure followed by the bitmap bits
$CF_PALETTE - Handle to a color palette
$CF_PENDATA - Data for the pen extensions to Pen Computing
$CF_RIFF - Represents audio data in RIFF format
$CF_WAVE - Represents audio data in WAVE format
$CF_UNICODETEXT - Unicode text format
$CF_ENHMETAFILE - Handle to an enhanced metafile (HENHMETAFILE)
$CF_HDROP - Handle to type HDROP that identifies a list of files
$CF_LOCALE - Handle to the locale identifier associated with text in the clipboard
$CF_DIBV5 - BITMAPV5HEADER structure followed by bitmap color and the bitmap bits
$CF_OWNERDISPLAY - Owner display format
$CF_DSPTEXT - Text display format associated with a private format
$CF_DSPBITMAP - Bitmap display format associated with a private format
$CF_DSPMETAFILEPICT - Metafile picture display format associated with a private format
$CF_DSPENHMETAFILE - Enhanced metafile display format associated with a private format

Return Value

Success: | Handle to a clipboard object in the specified format
Failure: | 0

Remarks

The clipboard controls the handle that the _ClipBoard_GetData function returns, not the application. You should
copy the data immediately. The application must not free the handle nor leave it locked. The application must
not use the handle after the _ClipBoard_Empty or _ClipBoard_Close function is called, or after the _ClipBoard_SetData
function is called with the same clipboard format.

Related

_ClipBoard_SetData, _ClipBoard_GetData

See Also

Search GetClipboardData in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $btn_SetData, $btn_GetData, $hMemory, $tData

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 450)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_SetData
_ClipBoard_SetData ("ClipBoard Library")
Case $btn_GetData
; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Read clipboard text
$hMemory = _ClipBoard_GetDataEx ($CF_TEXT)
If $hMemory = 0 Then _WinAPI_ShowError ("_ClipBoard_GetDataEx failed")
; Close the clipboard
_ClipBoard_Close ()
$tData = DllStructCreate("char Text[8192]", $hMemory)
MemoWrite(DllStructGetData($tData, "Text"))
EndSwitch
WEnd

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetFormatName

Function Reference

_ClipBoard_GetFormatName

Retrieves the name of the specified registered format

#Include <Clipboard.au3>
_ClipBoard_GetFormatName($iFormat)

Parameters

$iFormat Specifies the type of format to be retrieved

Return Value

Success: | Format name
Failure: | Blank string

Remarks

The $iFormat parameter must not specify any of the predefined clipboard formats

Related

See Also

Search GetClipboardFormatNameA in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iFormat

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Register a new clipboard format
$iFormat = _ClipBoard_RegisterFormat ("AutoIt Library Text")
If $iFormat = 0 Then _WinAPI_ShowError ("_ClipBoard_RegisterFormat failed")

; Show new format
MemoWrite(_ClipBoard_GetFormatName ($iFormat))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetOpenWindow

Function Reference

_ClipBoard_GetOpenWindow

Retrieves the handle to the window that currently has the clipboard open

#Include <Clipboard.au3>
_ClipBoard_GetOpenWindow()

Parameters

None.

Return Value

Success: | The handle to the window that has the clipboard open
Failure: | Zero if no window has the clipboard open

Remarks

If an application or DLL specifies a NULL window handle when calling the _ClipBoard_Open function, the clipboard
is opened but is not associated with a window. In such a case, _ClipBoard_GetOpenWindow returns 0.

Related

_ClipBoard_GetOwner, _ClipBoard_Open

See Also

Search GetOpenClipboardWindow in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

ShowData($hGUI)

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Show clipboard statistics
Func ShowData($hGUI)
MemoWrite("GUI handle ............: " & $hGUI)
MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner ())
MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow ())
MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber ())
MemoWrite()
EndFunc ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetOwner

Function Reference

_ClipBoard_GetOwner

Retrieves the window handle of the current owner of the clipboard

#Include <Clipboard.au3>
_ClipBoard_GetOwner()

Parameters

None.

Return Value

Success: | The handle to the window that owns the clipboard
Failure: | 0

Remarks

The clipboard can still contain data even if the clipboard is not currently owned. In general, the clipboard
owner is the window that last placed data in clipboard. The _ClipBoard_Empty function assigns clipboard ownership.

Related

_ClipBoard_Empty, _ClipBoard_GetOpenWindow

See Also

Search GetClipboardOwner in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

ShowData($hGUI)

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Show clipboard statistics
Func ShowData($hGUI)
MemoWrite("GUI handle ............: " & $hGUI)
MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner ())
MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow ())
MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber ())
MemoWrite()
EndFunc ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetPriorityFormat

Function Reference

_ClipBoard_GetPriorityFormat

Retrieves the first available clipboard format in the specified list

#Include <Clipboard.au3>
_ClipBoard_GetPriorityFormat($aFormats)

Parameters

$aFormats Array with the following format:
[0] - Number of formats (n)
[1] - Format 1
[2] - Format 2
[n] - Format n

Return Value

Success: | The first clipboard format in the list for which data is available
Failure: | Format not found due to:
 | -1 - Clipboard has data, but not in any of the formats requested
 | 0 - Clipboard is empty

Remarks

None.

Related

_ClipBoard_CountFormats, _ClipBoard_EnumFormats

See Also

Search GetPriorityClipboardFormat in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aFormats[3]=[2, $CF_TEXT, $CF_OEMTEXT]

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if there is any text in the clipboard
MemoWrite("Priority formats .:. " & _ClipBoard_GetPriorityFormat($aFormats))
MemoWrite("Unicode available .: " & _ClipBoard_IsFormatAvailable($CF_UNICODETEXT))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetSequenceNumber

Function Reference

_ClipBoard_GetSequenceNumber

Retrieves the clipboard sequence number for the current window station

#Include <Clipboard.au3>
_ClipBoard_GetSequenceNumber()

Parameters

None.

Return Value

Success: | The clipboard sequence number
Failure: | 0

Remarks

The system keeps a serial number for the clipboard for each window station. This number is incremented when
the contents of the clipboard change or the clipboard is emptied. You can track this value to determine if the
clipboard contents have changed and optimize creating data objects. If clipboard rendering is delayed, the
sequence number is not incremented until the changes are rendered.

Related

See Also

Search GetClipboardSequenceNumber in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

ShowData($hGUI)

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Show clipboard statistics
Func ShowData($hGUI)
MemoWrite("GUI handle ............: " & $hGUI)
MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner ())
MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow ())
MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber ())
MemoWrite()
EndFunc ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_GetViewer

Function Reference

_ClipBoard_GetViewer

Retrieves the handle to the first window in the clipboard viewer chain

#Include <Clipboard.au3>
_ClipBoard_GetViewer()

Parameters

None.

Return Value

Success: | The handle to the first window in the clipboard viewer chain
Failure: | Zero if there is no clipboard viewer

Remarks

None.

Related

_ClipBoard_SetViewer

See Also

Search GetClipboardViewer in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $hNext = 0

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize clipboard viewer
$hNext = _ClipBoard_SetViewer ($hGUI)

GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")

MemoWrite("GUI handle ....: " & $hGUI)
MemoWrite("Viewer handle .: " & _ClipBoard_GetViewer())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Shut down clipboard viewer
_ClipBoard_ChangeChain ($hGUI, $hNext)
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Handle $WM_CHANGECBCHAIN messages
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
; Show that message was received
MemoWrite("***** $WM_CHANGECBCHAIN *****")

; If the next window is closing, repair the chain
If $iwParam = $hNext Then
$hNext = $ilParam
; Otherwise pass the message to the next viewer
ElseIf $hNext <> 0 Then
_SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN

; Handle $WM_DRAWCLIPBOARD messages
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
; Display any text on clipboard
MemoWrite(_ClipBoard_GetData ())

; Pass the message to the next viewer
If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD


Function _ClipBoard_IsFormatAvailable

Function Reference

_ClipBoard_IsFormatAvailable

Determines whether the clipboard contains data in the specified format

#Include <Clipboard.au3>
_ClipBoard_IsFormatAvailable($iFormat)

Parameters

$iFormat Specifies a standard or registered clipboard format

Return Value

Success: | True: Clipboard contains data in the specified format
Failure: | False: Clipboard does not contain data in the specified format

Remarks

None.

Related

See Also

Search IsClipboardFormatAvailable in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aFormats[3]=[2, $CF_TEXT, $CF_OEMTEXT]

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if there is any text in the clipboard
MemoWrite("Priority formats .:. " & _ClipBoard_GetPriorityFormat($aFormats))
MemoWrite("Unicode available .: " & _ClipBoard_IsFormatAvailable($CF_UNICODETEXT))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_Open

Function Reference

_ClipBoard_Open

Opens the clipboard and prevents other applications from modifying the clipboard

#Include <Clipboard.au3>
_ClipBoard_Open($hOwner)

Parameters

$hOwner Handle to the window to be associated with the open clipboard. If this parameter is 0, the open
clipboard is associated with the current task.

Return Value

Success: | True
Failure: | False

Remarks

This function fails if another window has the clipboard open. Call the _ClipBoard_Close function after every
successful call to this function. The window identified by the $hOwner parameter does not become the clipboard
owner unless the _ClipBoard_Empty function is called. If you call _ClipBoard_Open with hwnd set to 0, _ClipBoard_Empty sets
the clipboard owner to 0 which causes _ClipBoard_SetData to fail.

Related

_ClipBoard_Close, _ClipBoard_Empty, _ClipBoard_EnumFormats, _ClipBoard_GetOpenWindow, _ClipBoard_SetDataEx

See Also

Search OpenClipboard in MSDN Library

Example

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Open the clipboard
If Not _ClipBoard_Open ($hGUI) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

ShowData($hGUI)

; Close the clipboard
_ClipBoard_Close ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Show clipboard statistics
Func ShowData($hGUI)
MemoWrite("GUI handle ............: " & $hGUI)
MemoWrite("Clipboard owner .......: " & _ClipBoard_GetOwner ())
MemoWrite("Clipboard open window .: " & _ClipBoard_GetOpenWindow ())
MemoWrite("Clipboard sequence ....: " & _ClipBoard_GetSequenceNumber ())
MemoWrite()
EndFunc ;==>ShowData

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_RegisterFormat

Function Reference

_ClipBoard_RegisterFormat

Registers a new clipboard format

#Include <Clipboard.au3>
_ClipBoard_RegisterFormat($sFormat)

Parameters

$sFormat The name of the new format

Return Value

Success: | The registered clipboard format
Failure: | 0

Remarks

If a registered format with the specified name already exists, a new format is not registered and the return
value identifies the existing format. This enables more than one application to copy and paste data using the
same registered clipboard format. Note that the format name comparison is case-insensitive.

Related

_ClipBoard_EnumFormats

See Also

Search RegisterClipboardFormat in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iFormat

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Register a new clipboard format
$iFormat = _ClipBoard_RegisterFormat ("AutoIt Library Text")
If $iFormat = 0 Then _WinAPI_ShowError ("_ClipBoard_RegisterFormat failed")

; Show new format
MemoWrite(_ClipBoard_GetFormatName ($iFormat))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_SetData

Function Reference

_ClipBoard_SetData

Places data on the clipboard in a specified clipboard format

#Include <Clipboard.au3>
_ClipBoard_SetData($vData[, $iFormat = 1])

Parameters

$vData Data in Binary or String format, or optionally NULL (0) (owner must render, see below).
IMPORTANT: If a String is passed, and it is not of type $CF_TEXT, $CF_OEMTEXT, or $CF_UNICODETEXT,
it will be treated as an ANSI string. To force Unicode strings for other types, you must pass the data
in Binary format. Also, do NOT pass $CF_UNICODETEXT in Binary format (causes garbled data).
When $vData is NULL, it indicates that the window provides data in the specified clipboard format upon request.
If a window delays rendering, it must process the $WM_RENDERFORMAT and $WM_RENDERALLFORMATS messages. If this
function succeeds, the system owns the object identified by the $hMemory parameter. The application may not
write to or free the data once ownership has been transferred to the system, but it can lock and read from the
data until the _ClipBoard_Close function is called. The memory must be unlocked before the clipboard is
closed. If the $hMemory parameter identifies a memory object, the object must have been allocated using the
function with the $GMEM_MOVEABLE flag.
$iFormat [optional] Specifies a clipboard format:
$CF_TEXT - Text format
$CF_BITMAP - Handle to a bitmap (HBITMAP)
$CF_METAFILEPICT - Handle to a metafile picture (METAFILEPICT)
$CF_SYLK - Microsoft Symbolic Link (SYLK) format
$CF_DIF - Software Arts' Data Interchange Format
$CF_TIFF - Tagged image file format
$CF_OEMTEXT - Text format containing characters in the OEM character set
$CF_DIB - BITMAPINFO structure followed by the bitmap bits
$CF_PALETTE - Handle to a color palette
$CF_PENDATA - Data for the pen extensions to Pen Computing
$CF_RIFF - Represents audio data in RIFF format
$CF_WAVE - Represents audio data in WAVE format
$CF_UNICODETEXT - Unicode text format
$CF_ENHMETAFILE - Handle to an enhanced metafile (HENHMETAFILE)
$CF_HDROP - Handle to type HDROP that identifies a list of files
$CF_LOCALE - Handle to the locale identifier associated with text in the clipboard
$CF_DIBV5 - BITMAPV5HEADER structure followed by bitmap color and the bitmap bits
$CF_OWNERDISPLAY - Owner display format
$CF_DSPTEXT - Text display format associated with a private format
$CF_DSPBITMAP - Bitmap display format associated with a private format
$CF_DSPMETAFILEPICT - Metafile picture display format associated with a private format
$CF_DSPENHMETAFILE - Enhanced metafile display format associated with a private format

Return Value

Success: | The handle to the data
Failure: | 0

Remarks

This function performs all of the steps neccesary to put data on the clipboard. It will allocate the global
memory object, open the clipboard, place the data on the clipboard and close the clipboard. If you need more
control over putting data on the clipboard, you may want to use the _ClipBoard_SetDataEx function.

Related

_ClipBoard_GetData, _ClipBoard_SetDataEx, _ClipBoard_Empty, _ClipBoard_GetDataEx

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $btn_SetData, $btn_GetData

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 450)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_SetData
_ClipBoard_SetData ("ClipBoard Library")
Case $btn_GetData
MemoWrite(_ClipBoard_GetData ())
EndSwitch
WEnd

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_SetDataEx

Function Reference

_ClipBoard_SetDataEx

Places data on the clipboard in a specified clipboard format

#Include <Clipboard.au3>
_ClipBoard_SetDataEx(ByRef $hMemory [, $iFormat = 1])

Parameters

$hMemory Handle to the data in the specified format. This parameter can be NULL, indicating that the
window provides data in the specified clipboard format upon request. If a window delays rendering, it must
process the $WM_RENDERFORMAT and $WM_RENDERALLFORMATS messages. If this function succeeds, the system owns
the object identified by the $hMemory parameter. The application may not write to or free the data once
ownership has been transferred to the system, but it can lock and read from the data until the _ClipBoard_Close
function is called. The memory must be unlocked before the clipboard is closed. If the $hMemory parameter
identifies a memory object, the object must have been allocated using the function with the $GMEM_MOVEABLE
flag.
$iFormat [optional] Specifies a clipboard format:
$CF_TEXT - Text format
$CF_BITMAP - Handle to a bitmap (HBITMAP)
$CF_METAFILEPICT - Handle to a metafile picture (METAFILEPICT)
$CF_SYLK - Microsoft Symbolic Link (SYLK) format
$CF_DIF - Software Arts' Data Interchange Format
$CF_TIFF - Tagged image file format
$CF_OEMTEXT - Text format containing characters in the OEM character set
$CF_DIB - BITMAPINFO structure followed by the bitmap bits
$CF_PALETTE - Handle to a color palette
$CF_PENDATA - Data for the pen extensions to Pen Computing
$CF_RIFF - Represents audio data in RIFF format
$CF_WAVE - Represents audio data in WAVE format
$CF_UNICODETEXT - Unicode text format
$CF_ENHMETAFILE - Handle to an enhanced metafile (HENHMETAFILE)
$CF_HDROP - Handle to type HDROP that identifies a list of files
$CF_LOCALE - Handle to the locale identifier associated with text in the clipboard
$CF_DIBV5 - BITMAPV5HEADER structure followed by bitmap color and the bitmap bits
$CF_OWNERDISPLAY - Owner display format
$CF_DSPTEXT - Text display format associated with a private format
$CF_DSPBITMAP - Bitmap display format associated with a private format
$CF_DSPMETAFILEPICT - Metafile picture display format associated with a private format
$CF_DSPENHMETAFILE - Enhanced metafile display format associated with a private format

Return Value

Success: | The handle to the data
Failure: | 0

Remarks

The $iFormat parameter can identify a registered clipboard format, or it can be one of the standard clipboard
formats. If an application calls this function in response to $WM_RENDERFORMAT or $WM_RENDERALLFORMATS, the
application should not use the handle after this function has been called. If an application calls _ClipBoard_Open
with a NULL handle, _ClipBoard_Empty sets the clipboard owner to NULL; this causes this function to fail.

Related

_ClipBoard_Empty, _ClipBoard_GetData, _ClipBoard_Open, _ClipBoard_SetData

See Also

Search SetClipboardData in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $btn_SetData, $btn_GetData, $hMemory, $hLock, $tData, $sData, $iSize

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 450)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_SetData = GUICtrlCreateButton("Set ClipBoard Data", 150, 410, 120, 30)
$btn_GetData = GUICtrlCreateButton("Get ClipBoard Data", 300, 410, 120, 30)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_SetData
; Open clipboard
If Not _ClipBoard_Open (0) Then _WinAPI_ShowError ("_ClipBoard_Open failed")

; Empty clipboard
If Not _ClipBoard_Empty () Then _WinAPI_ShowError ("_ClipBoard_Empty failed")

; Create global memory buffer (show why using _ClipBoard_SetData is MUCH easier!)
$sData = "Hello from AutoIt"
$iSize = StringLen($sData) + 1
$hMemory = _MemGlobalAlloc ($iSize, $GHND)
If $hMemory = 0 Then _WinAPI_ShowError ("_Mem_GlobalAlloc failed")
$hLock = _MemGlobalLock ($hMemory)
If $hLock = 0 Then _WinAPI_ShowError ("_Mem_GlobalLock failed")
$tData = DllStructCreate("char Text[" & $iSize & "]", $hLock)
DllStructSetData($tData, "Text", $sData)
_MemGlobalUnlock ($hMemory)

; Write clipboard text
If Not _ClipBoard_SetDataEx ($hMemory, $CF_TEXT) Then _WinAPI_ShowError ("_ClipBoard_SetDataEx failed")

; Close clipboard
_ClipBoard_Close ()
Case $btn_GetData
MemoWrite(_ClipBoard_GetData ())
EndSwitch
WEnd

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _ClipBoard_SetViewer

Function Reference

_ClipBoard_SetViewer

Adds the specified window to the chain of clipboard viewers

#Include <Clipboard.au3>
_ClipBoard_SetViewer($hViewer)

Parameters

$hViewer Handle to the window to be added to the clipboard chain

Return Value

Success: | The handle to the next window in the clipboard viewer chain
Failure: | 0 if there is no clipboard viewer

Remarks

The windows that are part of the clipboard viewer chain must process the clipboard messages $WM_CHANGECBCHAIN
and $WM_DRAWCLIPBOARD. Each clipboard viewer window calls the _SendMessage function to pass these messages
to the next window in the clipboard viewer chain. A clipboard viewer window must eventually remove itself from
the clipboard viewer chain by calling the _ClipBoard_ChangeChain function.

Related

_ClipBoard_ChangeChain, _ClipBoard_GetViewer

See Also

Search SetClipboardViewer in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ClipBoard.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $hNext = 0

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Clipboard", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize clipboard viewer
$hNext = _ClipBoard_SetViewer ($hGUI)

GUIRegisterMsg($WM_CHANGECBCHAIN, "WM_CHANGECBCHAIN")
GUIRegisterMsg($WM_DRAWCLIPBOARD, "WM_DRAWCLIPBOARD")

MemoWrite("GUI handle ....: " & $hGUI)
MemoWrite("Viewer handle .: " & _ClipBoard_GetViewer())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Shut down clipboard viewer
_ClipBoard_ChangeChain ($hGUI, $hNext)
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Handle $WM_CHANGECBCHAIN messages
Func WM_CHANGECBCHAIN($hWnd, $iMsg, $iwParam, $ilParam)
; Show that message was received
MemoWrite("***** $WM_CHANGECBCHAIN *****")

; If the next window is closing, repair the chain
If $iwParam = $hNext Then
$hNext = $ilParam
; Otherwise pass the message to the next viewer
ElseIf $hNext <> 0 Then
_SendMessage ($hNext, $WM_CHANGECBCHAIN, $iwParam, $ilParam, 0, "hwnd", "hwnd")
EndIf
EndFunc ;==>WM_CHANGECBCHAIN

; Handle $WM_DRAWCLIPBOARD messages
Func WM_DRAWCLIPBOARD($hWnd, $iMsg, $iwParam, $ilParam)
; Display any text on clipboard
MemoWrite(_ClipBoard_GetData ())

; Pass the message to the next viewer
If $hNext <> 0 Then _SendMessage ($hNext, $WM_DRAWCLIPBOARD, $iwParam, $ilParam)
EndFunc ;==>WM_DRAWCLIPBOARD


User Defined Functions

Color user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Color.au3>.

User Defined Function | Description
_ColorConvertHSLtoRGB | Converts HSL to RGB
_ColorConvertRGBtoHSL | Converts RGB to HSL
_ColorGetBlue | Returns the blue component of a given color.
_ColorGetGreen | Returns the green component of a given color.
_ColorGetRed | Returns the red component of a given color.
_ColorGetRGB | Returns an array containing RGB values in their respective positions.
_ColorSetRGB | Returns the RGB color to work with (COLORREF).


Function _ColorConvertHSLtoRGB

Function Reference

_ColorConvertHSLtoRGB

Converts HSL to RGB

#Include <Color.au3>
_ColorConvertHSLtoRGB($avArray)

Parameters

$avArray An array containing HSL values in their respective positions

Return Value

Success: The array containing the RGB values for the inputted HSL values
Failure: 0, sets @error to 1

Remarks

See: EasyRGB - Color mathematics and conversion formulas.

Related

_ColorConvertRGBtoHSL

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <Color.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aiInput[3] = [120, 180, 160], $aiHSL, $aiRGB, $sOutput

$aiRGB = _ColorConvertHSLtoRGB($aiInput)
$aiHSL = _ColorConvertRGBtoHSL($aiRGB)

$sOutput &= StringFormat("| H: %.3f" & @TAB & "| R: %.3f" & @TAB & "| H: %.3f" & @CRLF, $aiInput[0], $aiRGB[0], $aiHSL[0])
$sOutput &= StringFormat("| S: %.3f" & @TAB & "| G: %.3f" & @TAB & "| S: %.3f" & @CRLF, $aiInput[1], $aiRGB[1], $aiHSL[1])
$sOutput &= StringFormat("| L: %.3f" & @TAB & "| B: %.3f" & @TAB & "| L: %.3f" & @CRLF, $aiInput[2], $aiRGB[2], $aiHSL[2])
MsgBox(0, "AutoIt", $sOutput)
EndFunc ;==>_Main


Function _ColorConvertRGBtoHSL

Function Reference

_ColorConvertRGBtoHSL

Converts RGB to HSL

#Include <Color.au3>
_ColorConvertRGBtoHSL($avArray)

Parameters

$avArray An array containing RGB values in their respective positions

Return Value

Success: The array containing the HSL values for the inputted RGB values
Failure: 0, sets @error to 1

Remarks

See: EasyRGB - Color mathematics and conversion formulas.

Related

_ColorConvertHSLtoRGB

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <Color.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aiInput[3] = [128, 255, 128], $aiHSL, $aiRGB, $sOutput

$aiHSL = _ColorConvertRGBtoHSL($aiInput)
$aiRGB = _ColorConvertHSLtoRGB($aiHSL)

$sOutput &= StringFormat("| R: %.3f" & @TAB & "| H: %.3f" & @TAB & "| R: %.3f" & @CRLF, $aiInput[0], $aiHSL[0], $aiRGB[0])
$sOutput &= StringFormat("| G: %.3f" & @TAB & "| S: %.3f" & @TAB & "| G: %.3f" & @CRLF, $aiInput[1], $aiHSL[1], $aiRGB[1])
$sOutput &= StringFormat("| B: %.3f" & @TAB & "| L: %.3f" & @TAB & "| B: %.3f" & @CRLF, $aiInput[2], $aiHSL[2], $aiRGB[2])
MsgBox(0, "AutoIt", $sOutput)
EndFunc ;==>_Main


Function _ColorGetBlue

Function Reference

_ColorGetBlue

Returns the blue component of a given color.

#Include <Color.au3>
_ColorGetBlue($nColor)

Parameters

$nColor The RGB color to work with.

Return Value

Success: The component color in the range 0-255

Remarks

None.

Related

_ColorGetGreen, _ColorGetRed, _ColorGetRGB

Example

#include <Color.au3>

$iBlueColor = _ColorGetBlue( 0x8080ff )
MsgBox( 4096, "AutoIt", $iBlueColor )


Function _ColorGetGreen

Function Reference

_ColorGetGreen

Returns the green component of a given color.

#Include <Color.au3>
_ColorGetGreen($nColor)

Parameters

$nColor The RGB color to work with.

Return Value

Success: The component color in the range 0-255

Remarks

None.

Related

_ColorGetBlue, _ColorGetRed, _ColorGetRGB

Example

#include <Color.au3>

$iGreenColor = _ColorGetGreen( 0x8080ff )
MsgBox( 4096, "AutoIt", $iGreenColor )


Function _ColorGetRed

Function Reference

_ColorGetRed

Returns the red component of a given color.

#Include <Color.au3>
_ColorGetRed($nColor)

Parameters

$nColor The RGB color to work with.

Return Value

Success: The component color in the range 0-255

Remarks

None.

Related

_ColorGetBlue, _ColorGetGreen, _ColorGetRGB

Example

#include <Color.au3>

$iRedColor = _ColorGetRed( 0x8080ff )
MsgBox( 4096, "AutoIt", $iRedColor )


Function _ColorGetRGB

Function Reference

_ColorGetRGB

Returns an array containing RGB values in their respective positions.

#Include <Color.au3>
_ColorGetRGB($nColor)

Parameters

$nColor The RGB color to work with.

Return Value

Success: | an array of values in the range 0-255:
 | [0] Red component color
 | [1] Green component color
 | [2] Blue component color
Failure: | set @error to 1

Remarks

None.

Related

_ColorSetRGB, _ColorGetRed, _ColorGetGreen, _ColorGetBlue

Example

#include <Color.au3>

$nColor = 0x8090ff

$aColor = _ColorGetRGB( $nColor )
MsgBox( 4096, "AutoIt", "Color=" & Hex($nColor) & @CRLF & " Red=" & Hex($aColor[0],2) & " Blue=" & Hex($aColor[1],2) & " Green=" & Hex($aColor[2],2))


Function _ColorSetRGB

Function Reference

_ColorSetRGB

Returns the RGB color to work with (COLORREF).

#Include <Color.au3>
_ColorSetRGB($aColor)

Parameters

$aColor an array of values in the range 0-255:
[0] Red component color
[1] Green component color
[2] Blue component color

Return Value

Success: | returns the RGB color to work with.
Failure: | set @error
@error: | 1 invalid array
 | 2 invalid color value

Remarks

@extended is preserved.

Related

_ColorGetRGB

Example

#include <Color.au3>

Dim $aColor[3] = [0x80, 0x90, 0xff]

$nColor = _ColorSetRGB( $aColor )
MsgBox( 4096, "AutoIt", " Red=" & Hex($aColor[0],2) & " Blue=" & Hex($aColor[1],2) & " Green=" & Hex($aColor[2],2) & @CRLF & _
"Color=" & Hex($nColor))


User Defined Functions

Date user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Date.au3>.

User Defined Function | Description
_Date_Time_CompareFileTime | Compares two file times
_Date_Time_DOSDateTimeToArray | Decode a DOS date/time to an array
_Date_Time_DOSDateTimeToFileTime | Converts MS-DOS date and time values to a file time
_Date_Time_DOSDateTimeToStr | Decode a DOS date to a string
_Date_Time_DOSDateToArray | Decode a DOS date to an array
_Date_Time_DOSDateToStr | Decode a DOS date to a string
_Date_Time_DOSTimeToArray | Decode a DOS time to an array
_Date_Time_DOSTimeToStr | Decode a DOS time to a string
_Date_Time_EncodeFileTime | Encodes and returns a $tagFILETIME structure
_Date_Time_EncodeSystemTime | Encodes and returns a $tagSYSTEMTIME structure
_Date_Time_FileTimeToArray | Decode a file time to an array
_Date_Time_FileTimeToDOSDateTime | Converts MS-DOS date and time values to a file time
_Date_Time_FileTimeToLocalFileTime | Converts a file time based on the Coordinated Universal Time to a local file time
_Date_Time_FileTimeToStr | Decode a file time to a date/time string
_Date_Time_FileTimeToSystemTime | Converts a file time to system time format
_Date_Time_GetFileTime | Retrieves the date and time that a file was created, accessed and modified
_Date_Time_GetLocalTime | Retrieves the current local date and time
_Date_Time_GetSystemTime | Retrieves the current system date and time expressed in UTC
_Date_Time_GetSystemTimeAdjustment | Determines whether the system is applying periodic time adjustments
_Date_Time_GetSystemTimeAsFileTime | Retrieves the current system date and time expressed in UTC
_Date_Time_GetSystemTimes | Retrieves system timing information
_Date_Time_GetTickCount | Retrieves the number of milliseconds that have elapsed since Windows was started
_Date_Time_GetTimeZoneInformation | Retrieves the current time zone settings
_Date_Time_LocalFileTimeToFileTime | Converts a local file time to a file time based on UTC
_Date_Time_SetFileTime | Sets the date and time that a file was created, accessed and modified
_Date_Time_SetLocalTime | Sets the current local date and time
_Date_Time_SetSystemTime | Sets the current system time and date, expressed in UTC
_Date_Time_SetSystemTimeAdjustment | Enables or disables periodic time adjustments to the system's time of day clock
_Date_Time_SetTimeZoneInformation | Sets the current time zone settings
_Date_Time_SystemTimeToArray | Decode a system time to an array
_Date_Time_SystemTimeToDateStr | Decode a system time to a date string
_Date_Time_SystemTimeToDateTimeStr | Decode a system time to a date/time string
_Date_Time_SystemTimeToFileTime | Converts a system time to file time format
_Date_Time_SystemTimeToTimeStr | Decode a system time to a time string
_Date_Time_SystemTimeToTzSpecificLocalTime | Converts a UTC time to a specified time zone's corresponding local time
_Date_Time_TzSpecificLocalTimeToSystemTime | Converts a local time to a time in UTC
_DateAdd | Calculates a new date based on a given date and add an interval.
_DateDayOfWeek | Returns the name of the weekday, based on the specified day.
_DateDaysInMonth | Returns the number of days in a month, based on the specified month and year.
_DateDiff | Returns the difference between 2 dates, expressed in the type requested
_DateIsLeapYear | Checks a given year to see if it is a leap year.
_DateIsValid | Checks the given date to determine if it is a valid date.
_DateTimeFormat | Returns the date in the PC's regional settings format.
_DateTimeSplit | Split a string containing Date and Time into two separate Arrays.
_DateToDayOfWeek | Returns the weekdaynumber for a given date.
_DateToDayOfWeekISO | Returns the ISO weekdaynumber for a given date.
_DateToDayValue | Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.
_DateToMonth | Returns the name of the Month, based on the specified month number.
_DayValueToDate | Add the given days since noon 4713 BC January 1 and returns the Gregorian date.
_Now | Returns the current Date and Time in PC's format.
_NowCalc | Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.
_NowCalcDate | Returns the current Date in format YYYY/MM/DD.
_NowDate | Returns the current Date in the Pc's format.
_NowTime | Returns the current Time in the requested format.
_SetDate | Sets the current date of the system
_SetTime | Sets the current time of the system
_TicksToTime | Converts the specified tick amount to hours, minutes and seconds.
_TimeToTicks | Converts the specified hours, minutes, and seconds to ticks.
_WeekNumberISO | Calculate the weeknumber of a given date.


Function _Date_Time_CompareFileTime

Function Reference

_Date_Time_CompareFileTime

Compares two file times

#Include <Date.au3>
_Date_Time_CompareFileTime($pFileTime1, $pFileTime2)

Parameters

$pFileTime1 | Pointer to first $tagFILETIME structure
$pFileTime2 | Pointer to second $tagFILETIME structure

Return Value

Returns one of the following values:
-1 - First file time is earlier than second file time
0 - First file time is equal to second file time
1 - First file time is later than second file time

Remarks

None.

Related

$tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $pFileTime1, $tFileTime1, $pFileTime2, $tFileTime2

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Compare FAT Dates/Times
$tFileTime1 = _Date_Time_DosDateTimeToFileTime(0x3621, 0x11EF) ; 01/01/2007 02:15:30
$tFileTime2 = _Date_Time_DosDateTimeToFileTime(0x379F, 0x944A) ; 12/31/2007 18:34:20
$pFiletime1 = DllStructGetPtr($tFileTime1)
$pFiletime2 = DllStructGetPtr($tFileTime2)

MemoWrite("Result 1: " & _Date_Time_CompareFileTime($pFileTime1, $pFileTime2))
MemoWrite("Result 2: " & _Date_Time_CompareFileTime($pFileTime1, $pFileTime1))
MemoWrite("Result 3: " & _Date_Time_CompareFileTime($pFileTime2, $pFileTime1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSDateTimeToArray

Function Reference

_Date_Time_DOSDateTimeToArray

Decode a DOS date/time to an array

#Include <Date.au3>
_Date_Time_DOSDateTimeToArray($iDosDate, $iDosTime)

Parameters

$iDosDate | MS-DOS date, packed as follows: Bits 0- 4 Day of the month (1–31) Bits 5- 8 Month (1 = January, 2 = February, and so on) Bits 9-15 Year offset from 1980 (add 1980 to get actual year)
$iDosTime | MS-DOS date, packed as follows: Bits 0- 4 Second divided by 2 Bits 5-10 Minute (0–59) Bits 11-15 Hour (0–23 on a 24-hour clock)

Return Value

Returns an Array with the following format:
[0] - Month
[1] - Day
[2] - Year
[3] - Hour
[4] - Minute
[5] - Second

Remarks

None.

Related

_Date_Time_DOSDateToArray, _Date_Time_DOSTimeToArray

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT date/time
$aDate = _Date_Time_DOSDateTimeToArray(0x3621, 0x944a) ; 01/01/2007 18:34:20
MemoWrite("FAT date .: " & StringFormat("%02d/%02d/%04d", $aDate[0], $aDate[1], $aDate[2]))
MemoWrite("FAT time .: " & StringFormat("%02d:%02d:%02d", $aDate[3], $aDate[4], $aDate[5]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSDateTimeToFileTime

Function Reference

_Date_Time_DOSDateTimeToFileTime

Converts MS-DOS date and time values to a file time

#Include <Date.au3>
_Date_Time_DOSDateTimeToFileTime($iFatDate, $iFatTime)

Parameters

$iFatDate | The MS-DOS date, packed as follows: Bits 0- 4 Day of the month (1–31) Bits 5- 8 Month (1 = January, 2 = February, and so on) Bits 9-15 Year offset from 1980 (add 1980 to get actual year)
$iFatTime | Ths MS-DOS time, packed as follows: Bits 0- 4 Second divided by 2 Bits 5-10 Minute (0–59) Bits 11-15 Hour (0–23 on a 24-hour clock)

Return Value

Returns $tagFILETIME structure that receives the converted file time

Remarks

None.

Related

_Date_Time_FileTimeToDosDateTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $pFileTime1, $tFileTime1, $pFileTime2, $tFileTime2

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Compare FAT Dates/Times
$tFileTime1 = _Date_Time_DosDateTimeToFileTime(0x3621, 0x11EF) ; 01/01/2007 02:15:30
$tFileTime2 = _Date_Time_DosDateTimeToFileTime(0x379F, 0x944A) ; 12/31/2007 18:34:20
$pFiletime1 = DllStructGetPtr($tFileTime1)
$pFiletime2 = DllStructGetPtr($tFileTime2)

MemoWrite("Result 1: " & _Date_Time_CompareFileTime($pFileTime1, $pFileTime2))
MemoWrite("Result 2: " & _Date_Time_CompareFileTime($pFileTime1, $pFileTime1))
MemoWrite("Result 3: " & _Date_Time_CompareFileTime($pFileTime2, $pFileTime1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSDateTimeToStr

Function Reference

_Date_Time_DOSDateTimeToStr

Decode a DOS date to a string

#Include <Date.au3>
_Date_Time_DOSDateTimeToStr($iDosDate, $iDosTime)

Parameters

$iDosDate | MS-DOS date, packed as follows: Bits 0- 4 Day of the month (1–31) Bits 5- 8 Month (1 = January, 2 = February, and so on) Bits 9-15 Year offset from 1980 (add 1980 to get actual year)
$iDosTime | MS-DOS date, packed as follows: Bits 0- 4 Second divided by 2 Bits 5-10 Minute (0–59) Bits 11-15 Hour (0–23 on a 24-hour clock)

Return Value

Returns a Date/time string formatted as mm/dd/yyyy hh:mm:ss

Remarks

None.

Related

_Date_Time_DOSDateToStr, _Date_Time_DOSTimeToStr

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT date/time
$sDate = _Date_Time_DOSDateTimeToStr(0x3621, 0x944a) ; 01/01/2007 18:34:20
MemoWrite("FAT date/time .: " & $sDate)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSDateToArray

Function Reference

_Date_Time_DOSDateToArray

Decode a DOS date to an array

#Include <Date.au3>
_Date_Time_DOSDateToArray($iDosDate)

Parameters

$iDosDate MS-DOS date, packed as follows:
Bits 0- 4 Day of the month (1–31)
Bits 5- 8 Month (1 = January, 2 = February, and so on)
Bits 9-15 Year offset from 1980 (add 1980 to get actual year)

Return Value

Returns an Array with the following format:
[0] - Month
[1] - Day
[2] - Year

Remarks

None.

Related

_Date_Time_DOSTimeToArray, _Date_Time_DOSDateTimeToArray

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT date
$aDate = _Date_Time_DOSDateToArray(0x3621) ; 01/01/2007
MemoWrite("FAT date .: " & StringFormat("%02d/%02d/%04d", $aDate[0], $aDate[1], $aDate[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSDateToStr

Function Reference

_Date_Time_DOSDateToStr

Decode a DOS date to a string

#Include <Date.au3>
_Date_Time_DOSDateToStr($iDosDate)

Parameters

$iDosDate MS-DOS date, packed as follows:
Bits 0- 4 Day of the month (1–31)
Bits 5- 8 Month (1 = January, 2 = February, and so on)
Bits 9-15 Year offset from 1980 (add 1980 to get actual year)

Return Value

Returns a Date string formatted as mm/dd/yyyy

Remarks

None.

Related

_Date_Time_DOSTimeToStr, _Date_Time_DOSDateTimeToStr

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT date
$sDate = _Date_Time_DOSDateToStr(0x3621) ; 01/01/2007
MemoWrite("FAT date .: " & $sDate)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSTimeToArray

Function Reference

_Date_Time_DOSTimeToArray

Decode a DOS time to an array

#Include <Date.au3>
_Date_Time_DOSTimeToArray($iDosTime)

Parameters

$iDosTime MS-DOS date, packed as follows:
Bits 0- 4 Second divided by 2
Bits 5-10 Minute (0–59)
Bits 11-15 Hour (0–23 on a 24-hour clock)

Return Value

Returns an Array with the following format:
[0] - Hour
[1] - Minute
[2] - Second

Remarks

None.

Related

_Date_Time_DOSDateToArray, _Date_Time_DOSDateTimeToArray

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT time
$aDate = _Date_Time_DOSTimeToArray(0x944a) ; 18:34:20
MemoWrite("FAT time .: " & StringFormat("%02d:%02d:%02d", $aDate[0], $aDate[1], $aDate[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_DOSTimeToStr

Function Reference

_Date_Time_DOSTimeToStr

Decode a DOS time to a string

#Include <Date.au3>
_Date_Time_DOSTimeToStr($iDosTime)

Parameters

$iDosTime MS-DOS date, packed as follows:
Bits 0- 4 Second divided by 2
Bits 5-10 Minute (0–59)
Bits 11-15 Hour (0–23 on a 24-hour clock)

Return Value

Returns a Time string formatted as hh:mm:ss

Remarks

None.

Related

_Date_Time_DOSDateToStr, _Date_Time_DOSDateTimeToStr

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show FAT time
$sDate = _Date_Time_DOSTimeToStr(0x944a) ; 18:34:20
MemoWrite("FAT time .: " & $sDate)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_EncodeFileTime

Function Reference

_Date_Time_EncodeFileTime

Encodes and returns a $tagFILETIME structure

#Include <Date.au3>
_Date_Time_EncodeFileTime($iMonth, $iDay, $iYear [, $iHour = 0 [, $iMinute = 0 [, $iSecond = 0 [, $iMSeconds = 0]]]])

Parameters

$iMonth | Month
$iDay | Day
$iYear | Year
$iHour | [optional] Hour
$iMinute | [optional] Minute
$iSecond | [optional] Second
$iMSeconds | [optional] Milliseconds

Return Value

Returns $tagFILETIME structure

Remarks

None.

Related

_Date_Time_EncodeSystemTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a file time
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
MemoWrite("Current date/time .: " & _Date_Time_FileTimeToStr($tFile))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_EncodeSystemTime

Function Reference

_Date_Time_EncodeSystemTime

Encodes and returns a $tagSYSTEMTIME structure

#Include <Date.au3>
_Date_Time_EncodeSystemTime($iMonth, $iDay, $iYear [, $iHour = 0 [, $iMinute = 0 [, $iSecond = 0 [, $iMSeconds = 0]]]])

Parameters

$iMonth | Month
$iDay | Day
$iYear | Year
$iHour | [optional] Hour
$iMinute | [optional] Minute
$iSecond | [optional] Second
$iMSeconds | [optional] Milliseconds

Return Value

Returns $tagSYSTEMTIME structure

Remarks

None.

Related

_Date_Time_EncodeFileTime, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a system time
$tSystem = _Date_Time_EncodeSystemTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
MemoWrite("Current date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tSystem))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_FileTimeToArray

Function Reference

_Date_Time_FileTimeToArray

Decode a file time to an array

#Include <Date.au3>
_Date_Time_FileTimeToArray(ByRef $tFileTime)

Parameters

$tFileTime $tagFILETIME structure

Return Value

Returns an Array with the following format:
[0] - Month
[1] - Day
[2] - Year
[3] - Hour
[4] - Minutes
[5] - Seconds
[6] - Milliseconds
[7] - Day of week

Remarks

None.

Related

$tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $aFile, $sFile

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a file time
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$aFile = _Date_Time_FileTimeToArray($tFile)
$sFile = StringFormat("%02d/%02d/%04d %02d:%02d:%02d", $aFile[0], $aFile[1], $aFile[2], $aFile[3], $aFile[4], $aFile[5])
MemoWrite("Current date/time .: " & $sFile)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_FileTimeToDOSDateTime

Function Reference

_Date_Time_FileTimeToDOSDateTime

Converts MS-DOS date and time values to a file time

#Include <Date.au3>
_Date_Time_FileTimeToDOSDateTime($pFileTime)

Parameters

$pFileTime Pointer to a $tagFILETIME structure containing the file time to convert to MS-DOS format

Return Value

Returns an Array with the following format:
[0] - MS-DOS date, packed as follows:
Bits 0- 4 Day of the month (1–31)
Bits 5- 8 Month (1 = January, 2 = February, and so on)
Bits 9-15 Year offset from 1980 (add 1980 to get actual year)
[1] - MS-DOS time, packed as follows:
Bits 0- 4 Second divided by 2
Bits 5-10 Minute (0–59)
Bits 11-15 Hour (0–23 on a 24-hour clock)

Remarks

None.

Related

_Date_Time_FileTimeToLocalFileTime, _Date_Time_FileTimeToSystemTime, _Date_Time_DOSDateTimeToFileTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $aDOS

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a file time
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$aDOS = _Date_Time_FileTimeToDosDateTime(DllStructGetPtr($tFile))
MemoWrite("DOS date .: 0x" & Hex($aDOS[0], 4))
MemoWrite("DOS time .: 0x" & Hex($aDOS[1], 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_FileTimeToLocalFileTime

Function Reference

_Date_Time_FileTimeToLocalFileTime

Converts a file time based on the Coordinated Universal Time to a local file time

#Include <Date.au3>
_Date_Time_FileTimeToLocalFileTime($pFileTime)

Parameters

$pFileTime Pointer to a $tagFILETIME structure containing the UTC based file time to be converted into a
local file time.

Return Value

Returns $tagFILETIME structure that contains the converted local file time

Remarks

None.

Related

_Date_Time_FileTimeToDosDateTime, _Date_Time_FileTimeToSystemTime, _Date_Time_LocalFileTimeToFileTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $tLocal

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get system time
$tSystem = _Date_Time_GetSystemTime()
$tFile = _Date_Time_SystemTimeToFileTime(DllStructGetPtr($tSystem))
; --------------------------------------
$tLocal = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($tFile))
MemoWrite("Local file time .: " & _Date_Time_FileTimeToStr($tLocal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_FileTimeToStr

Function Reference

_Date_Time_FileTimeToStr

Decode a file time to a date/time string

#Include <Date.au3>
_Date_Time_FileTimeToStr(ByRef $tFileTime [, $bFmt = 0])

Parameters

$tFileTime | $tagFILETIME structure
$bFmt | [optional] 0 returns mm/dd/yyyy hh:mm:ss (Default) 1 returns yyyy/mm/dd hh:mm:ss

Return Value

Returns a Date/time string formatted according to $bFmt

Remarks

None.

Related

$tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a file time
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
MemoWrite("Current date/time .: " & _Date_Time_FileTimeToStr($tFile))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_FileTimeToSystemTime

Function Reference

_Date_Time_FileTimeToSystemTime

Converts a file time to system time format

#Include <Date.au3>
_Date_Time_FileTimeToSystemTime($pFileTime)

Parameters

$pFileTime Pointer to a $tagFILETIME structure containing the file time to convert to system date and time
format.

Return Value

Returns $tagSYSTEMTIME structure that contains the converted file time

Remarks

None.

Related

_Date_Time_FileTimeToDosDateTime, _Date_Time_FileTimeToLocalFileTime, $tagFILETIME, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Encode a file time
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$tSystem = _Date_Time_FileTimeToSystemTime(DllStructGetPtr($tFile))
MemoWrite("System file time .: " & _Date_Time_SystemTimeToDateTimeStr($tSystem))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetFileTime

Function Reference

_Date_Time_GetFileTime

Retrieves the date and time that a file was created, accessed and modified

#Include <Date.au3>
_Date_Time_GetFileTime($hFile)

Parameters

$hFile Handle to the file for which dates and times are to be retrieved. The file handle must have
been created using the CreateFile function with the GENERIC_READ access right.

Return Value

Returns an Array with the following format:
[0] - $tagFILETIME structure with the date and time the file was created
[1] - $tagFILETIME structure with the date and time the file was accessed
[2] - $tagFILETIME structure with the date and time the file was modified

Remarks

Not all file systems can record creation and last access times and not all file systems record them in the
same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution
of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime
function may not return the same file time information set using SetFileTime. NTFS delays updates to the last
access time for a file by up to one hour after the last access.

Related

_Date_Time_SetFileTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $tFile, $aTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create test file and set file times
$hFile = _WinAPI_CreateFile(@ScriptDir & "\Test.xyz", 1)
if $hFile = 0 then _WinAPI_ShowError("Unable to create file")
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$pFile = DllStructGetPtr($tFile)
_Date_Time_SetFileTime($hFile, $pFile, $pFile, $pFile)
_WinAPI_CloseHandle($hFile)

; Read file times
$hFile = _WinAPI_CreateFile(@ScriptDir & "\Test.xyz", 2)
if $hFile = 0 then _WinAPI_ShowError("Unable to open file")
$aTime = _Date_Time_GetFileTime($hFile)
_WinAPI_CloseHandle($hFile)

MemoWrite("Created ..: " & _Date_Time_FileTimeToStr($aTime[0]))
MemoWrite("Accessed .: " & _Date_Time_FileTimeToStr($aTime[1]))
MemoWrite("Modified .: " & _Date_Time_FileTimeToStr($aTime[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

FileDelete(@ScriptDir & "\Test.xyz")

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetLocalTime

Function Reference

_Date_Time_GetLocalTime

Retrieves the current local date and time

#Include <Date.au3>
_Date_Time_GetLocalTime()

Parameters

None.

Return Value

Returns $tagSYSTEMTIME structure with the current local date and time

Remarks

None.

Related

_Date_Time_SetLocalTime, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetLocalime" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tCur, $tNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show current local time
$tCur = _Date_Time_GetLocalTime()
MemoWrite("Current date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Set new local time
$tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)
If Not _Date_Time_SetLocalTime(DllStructGetPtr($tNew)) Then
MsgBox(4096, "Error", "System clock cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
$tNew = _Date_Time_GetLocalTime()
MemoWrite("New date/time .....: " & _Date_Time_SystemTimeToDateTimeStr($tNew))

; Reset local time
_Date_Time_SetLocalTime(DllStructGetPtr($tCur))

; Show current local time
$tCur = _Date_Time_GetLocalTime()
MemoWrite("Current date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetSystemTime

Function Reference

_Date_Time_GetSystemTime

Retrieves the current system date and time expressed in UTC

#Include <Date.au3>
_Date_Time_GetSystemTime()

Parameters

None.

Return Value

Returns $tagSYSTEMTIME structure with the current system date and time

Remarks

None.

Related

_Date_Time_SetSystemTime, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetSystemTime" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tCur, $tNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get current system time
$tCur = _Date_Time_GetSystemTime()
MemoWrite("Current system date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Set new system time
$tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)

If Not _Date_Time_SetSystemTime(DllStructGetPtr($tNew)) Then
MsgBox(4096, "Error", "System clock cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf

$tNew = _Date_Time_GetSystemTime()
MemoWrite("New system date/time .....: " & _Date_Time_SystemTimeToDateTimeStr($tNew))

; Restore system time
_Date_Time_SetSystemTime(DllStructGetPtr($tCur))

; Get current system time
$tCur = _Date_Time_GetSystemTime()
MemoWrite("Current system date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetSystemTimeAdjustment

Function Reference

_Date_Time_GetSystemTimeAdjustment

Determines whether the system is applying periodic time adjustments

#Include <Date.au3>
_Date_Time_GetSystemTimeAdjustment()

Parameters

None.

Return Value

Returns an Array with the following format:
[1] - The number of 100 nanosecond units added to the clock at each periodic time adjustment
[2] - The number of 100 nanosecond units between periodic time adjustments. This interval is the time period
between a system's clock interrupts. [3] - True indicates that periodic time adjustment is disabled. At each clock interrupt, the system merely
adds the interval between clock interrupts to the clock. If False, periodic time adjustment is being used to adjust the clock.

Remarks

None.

Related

_Date_Time_SetSystemTimeAdjustment

Example

#include <Date.au3>
#include <WinAPI.au3>

; Under Vista the Windows API "SetSystemTimeAdjustment" may be rejected due to system security

_Main()

Func _Main()
Local $aInfo

; Open the clock so we can watch the fun
Run("RunDll32.exe shell32.dll,Control_RunDLL timedate.cpl")
WinWaitActive("[CLASS:#32770]")

; Get current time adjustments
$aInfo = _Date_Time_GetSystemTimeAdjustment()

; Slow down clock
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] / 10, False) Then
MsgBox(4096, "Error", "System clock cannot be DOWN" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
MsgBox(4096, "Information", "Slowing down system clock", 2)

Sleep(5000)

; Speed up clock
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] * 10, False) Then
MsgBox(4096, "Error", "System clock cannot be UP" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
EndIf
MsgBox(4096, "Information", "Speeding up system clock", 2)

Sleep(5000)

; Reset time adjustment
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1], True) Then
MsgBox(4096, "Error", "System clock cannot be RESET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Else
MsgBox(4096, "Information", "System clock restored")
EndIf

EndFunc ;==>_Main


Function _Date_Time_GetSystemTimeAsFileTime

Function Reference

_Date_Time_GetSystemTimeAsFileTime

Retrieves the current system date and time expressed in UTC

#Include <Date.au3>
_Date_Time_GetSystemTimeAsFileTime()

Parameters

None.

Return Value

Returns $tagFILETIME structure with the current system date and time

Remarks

None.

Related

$tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get system time
$tTime = _Date_Time_GetSystemTimeAsFileTime()

MemoWrite("System time .: " & _Date_Time_FileTimeToStr($tTime))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetSystemTimes

Function Reference

_Date_Time_GetSystemTimes

Retrieves system timing information

#Include <Date.au3>
_Date_Time_GetSystemTimes()

Parameters

None.

Return Value

Returns an Array with the following format:
[0] - $tagFILETIME structure with the total system idle time
[1] - $tagFILETIME structure with the total system kernel mode time
[2] - $tagFILETIME structure with the total system user mode time

Remarks

Minimum OS - Windows XP/SP1, 2003

Related

$tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get system times
$aTime = _Date_Time_GetSystemTimes()

MemoWrite("Idle time ...: " & _Date_Time_FileTimeToStr($aTime[0]))
MemoWrite("System time .: " & _Date_Time_FileTimeToStr($aTime[1]))
MemoWrite("User time ...: " & _Date_Time_FileTimeToStr($aTime[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetTickCount

Function Reference

_Date_Time_GetTickCount

Retrieves the number of milliseconds that have elapsed since Windows was started

#Include <Date.au3>
_Date_Time_GetTickCount()

Parameters

None.

Return Value

Returns a Number of milliseconds that have elapsed since Windows was started

Remarks

The elapsed time is stored as a DWORD value. The time will wrap around to zero if Windows is run continuously for 49.7 days.

Related

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get tick count
MemoWrite("Tick count .: " & _Date_Time_GetTickCount())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_GetTimeZoneInformation

Function Reference

_Date_Time_GetTimeZoneInformation

Retrieves the current time zone settings

#Include <Date.au3>
_Date_Time_GetTimeZoneInformation()

Parameters

None.

Return Value

Returns an Array with the following format:
[0] - Daylight savings setting. Can be one of the following:
-1 - Failure
0 - Daylight savings time is not used in the current time zone
1 - Daylight savings time operating with standard time
2 - Daylight savings time operating with daylight savings time
[1] - The current bias for local time translation on this computer. The bias is the difference in minutes between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time use the following formula: UTC = local time + bias
[2] - The description for standard time
[3] - A $tagSYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs.
[4] - The bias value to be used during local time translations that occur during standard time. This value is added to the value of the Bias to form the bias used during standard time. In most time zones, this value is zero.
[5] - The description for daylight saving time
[6] - A $tagSYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs.
[7] - The bias value to be used during local time translations that occur during daylight saving time. This value is added to the value of the Bias member to form the bias used during daylight saving time. In most time zones this value is –60.

Remarks

In the $tagSYSTEMTIME structure, the wHour and wMinute members represent the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member indicating the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence during the month if that day of the week does not occur 5 times).

Using this notation, specify 02:00 on the first Sunday in April as follows: wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 02:00 on the last Thursday in October as follows: wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5.

Related

_Date_Time_SetTimeZoneInformation, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetTimeZoneInformation" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aOld, $aNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aOld,"Current")

; Set new time zone information
If Not _Date_Time_SetTimeZoneInformation ($aOld[1], "A3L CST", $aOld[3], $aOld[4], "A3L CDT", $aOld[6], $aOld[7]) Then
MsgBox(4096, "Error", "System timezone cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf

; Show new time zone information
$aNew = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aNew, "New")

; Reset original time zone information
_Date_Time_SetTimeZoneInformation ($aOld[1], $aOld[2], $aOld[3], $aOld[4], $aOld[5], $aOld[6], $aOld[7])

; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aOld, "Reset")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show time zone information
Func ShowTimeZoneInformation(ByRef $aInfo, $comment)
MemoWrite("******************* " & $comment & " *******************")
MemoWrite("Result ............: " & $aInfo[0])
MemoWrite("Current bias ......: " & $aInfo[1])
MemoWrite("Standard name .....: " & $aInfo[2])
MemoWrite("Standard date/time : " & _Date_Time_SystemTimeToDateTimeStr ($aInfo[3]))
MemoWrite("Standard bias......: " & $aInfo[4])
MemoWrite("Daylight name .....: " & $aInfo[5])
MemoWrite("Daylight date/time : " & _Date_Time_SystemTimeToDateTimeStr ($aInfo[6]))
MemoWrite("Daylight bias......: " & $aInfo[7])
EndFunc ;==>ShowTimeZoneInformation


Function _Date_Time_LocalFileTimeToFileTime

Function Reference

_Date_Time_LocalFileTimeToFileTime

Converts a local file time to a file time based on UTC

#Include <Date.au3>
_Date_Time_LocalFileTimeToFileTime($pLocalTime)

Parameters

$pLocalTime Pointer to a $tagFILETIME structure that specifies the local file time to be converted into a
UTC based file time.

Return Value

Returns $tagFILETIME structure with the converted UTC based file time

Remarks

This function uses the current settings for the time zone and daylight saving time. Therefore, if it is
daylight saving time, this function will take daylight saving time into account, even if the time you are
converting is in standard time.

Related

_Date_Time_FileTimeToLocalFileTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tTime, $tLocal

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show local date/time as UTC
$tTime = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$tLocal = _Date_Time_LocalFileTimeToFileTime(DllStructGetPtr($tTime))
MemoWrite("Local date/time .: " & _Date_Time_FileTimeToStr($tLocal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SetFileTime

Function Reference

_Date_Time_SetFileTime

Sets the date and time that a file was created, accessed and modified

#Include <Date.au3>
_Date_Time_SetFileTime($hFile, $pCreateTime, $pLastAccess, $pLastWrite)

Parameters

$hFile | Handle to the file. The file handle must have been created using the CreateFile function with the FILE_WRITE_ATTRIBUTES access right.
$pCreateTime | Pointer to a $tagFILETIME structure that contains the new date and time the file was created. This be 0 if the application does not need to set this information.
$pLastAccess | Pointer to a $tagFILETIME structure that contains the new date and time the file was last accessed. The last access time includes the last time the file was written to, read from, or (in the case of executable files) run. This can be 0 if the application does not need to set this information. To preserve the existing last access time for a file even after accessing a file, call SetFileTime with this parameter set to -1 before closing the file handle.
$pLastWrite | Pointer to a $tagFILETIME structure that contains the new date and time the file was last written to. This can be 0 if the application does not want to set this information.

Return Value

Success: | True
Failure: | False

Remarks

Not all file systems can record creation and last access times and not all file systems record them in the
same manner. For example, on FAT, create time has a resolution of 10 milliseconds, write time has a resolution
of 2 seconds, and access time has a resolution of 1 day (really, the access date). Therefore, the GetFileTime
function may not return the same file time information set using SetFileTime. NTFS delays updates to the last
access time for a file by up to one hour after the last access.

Related

_Date_Time_GetFileTime, $tagFILETIME

Example

#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $tFile, $aTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create test file and set file times
$hFile = _WinAPI_CreateFile(@ScriptDir & "\Test.xyz", 1)
if $hFile = 0 then _WinAPI_ShowError("Unable to create file")
$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC)
$pFile = DllStructGetPtr($tFile)
_Date_Time_SetFileTime($hFile, $pFile, $pFile, $pFile)
_WinAPI_CloseHandle($hFile)

; Read file times
$hFile = _WinAPI_CreateFile(@ScriptDir & "\Test.xyz", 2)
if $hFile = 0 then _WinAPI_ShowError("Unable to open file")
$aTime = _Date_Time_GetFileTime($hFile)
_WinAPI_CloseHandle($hFile)

MemoWrite("Created ..: " & _Date_Time_FileTimeToStr($aTime[0]))
MemoWrite("Accessed .: " & _Date_Time_FileTimeToStr($aTime[1]))
MemoWrite("Modified .: " & _Date_Time_FileTimeToStr($aTime[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

FileDelete(@ScriptDir & "\Test.xyz")

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SetLocalTime

Function Reference

_Date_Time_SetLocalTime

Sets the current local date and time

#Include <Date.au3>
_Date_Time_SetLocalTime($pSystemTime)

Parameters

$pSystemTime Pointer to a $tagSYSTEMTIME structure that contains the new local date and time

Return Value

Success: | True
Failure: | False

Remarks

The SetLocalTime function enables the SE_SYSTEMTIME_NAME privilege before changing the local time.

Related

_Date_Time_GetLocalTime, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetLocalTime" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tCur, $tNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show current local time
$tCur = _Date_Time_GetLocalTime()
MemoWrite("Current date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Set new local time
$tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)
If Not _Date_Time_SetLocalTime(DllStructGetPtr($tNew)) Then
MsgBox(4096, "Error", "System clock cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
$tNew = _Date_Time_GetLocalTime()
MemoWrite("New date/time .....: " & _Date_Time_SystemTimeToDateTimeStr($tNew))

; Reset local time
_Date_Time_SetLocalTime(DllStructGetPtr($tCur))

; Show current local time
$tCur = _Date_Time_GetLocalTime()
MemoWrite("Current date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SetSystemTime

Function Reference

_Date_Time_SetSystemTime

Sets the current system time and date, expressed in UTC

#Include <Date.au3>
_Date_Time_SetSystemTime($pSystemTime)

Parameters

$pSystemTime Pointer to a $tagSYSTEMTIME structure that contains the new system date and time

Return Value

Success: | True
Failure: | False

Remarks

The SetLocalTime function enables the SE_SYSTEMTIME_NAME privilege before changing the local time

Related

_Date_Time_GetSystemTime, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetSystemTime" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tCur, $tNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get current system time
$tCur = _Date_Time_GetSystemTime()
MemoWrite("Current system date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Set new system time
$tNew = _Date_Time_EncodeSystemTime(8, 19, @YEAR, 3, 10, 45)
If Not _Date_Time_SetSystemTime(DllStructGetPtr($tNew)) Then
MsgBox(4096, "Error", "System clock cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
$tNew = _Date_Time_GetSystemTime()
MemoWrite("New system date/time .....: " & _Date_Time_SystemTimeToDateTimeStr($tNew))

; Restore system time
_Date_Time_SetSystemTime(DllStructGetPtr($tCur))

; Get current system time
$tCur = _Date_Time_GetSystemTime()
MemoWrite("Current system date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tCur))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SetSystemTimeAdjustment

Function Reference

_Date_Time_SetSystemTimeAdjustment

Enables or disables periodic time adjustments to the system's time of day clock

#Include <Date.au3>
_Date_Time_SetSystemTimeAdjustment($iAdjustment, $fDisabled)

Parameters

$iAdjustment | The number of 100 nanosecond units added to the time of day clock at each clock interrupt if periodic time adjustment is enabled.
$fDisabled | A value of True specifies that periodic time adjustment is to be disabled. The system is free to adjust time of day using its own internal mechanisms. The system's internal adjustment mechanisms may cause the time-of-day clock to jump noticeably when adjustments are made. A value of False specifies that periodic time adjustment is to be enabled, and will be used to adjust the time of day clock. The system will not interfere with the time adjustment scheme, and will not attempt to synchronize time of day on its own. The system will add the value of iAdjustment to the time of day at each clock interrupt.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_Date_Time_GetSystemTimeAdjustment

Example

#include <Date.au3>
#include <WinAPI.au3>

; Under Vista the Windows API "SetSystemTimeAdjustment" may be rejected due to system security

_Main()

Func _Main()
Local $aInfo

; Open the clock so we can watch the fun
Run("RunDll32.exe shell32.dll,Control_RunDLL timedate.cpl")
WinWaitActive("[CLASS:#32770]")

; Get current time adjustments
$aInfo = _Date_Time_GetSystemTimeAdjustment()

; Slow down clock
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] / 10, False) Then
MsgBox(4096, "Error", "System clock cannot be DOWN" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf
MsgBox(4096, "Information", "Slowing down system clock", 2)

Sleep(5000)

; Speed up clock
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1] * 10, False) Then
MsgBox(4096, "Error", "System clock cannot be UP" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
EndIf
MsgBox(4096, "Information", "Speeding up system clock", 2)

Sleep(5000)

; Reset time adjustment
If Not _Date_Time_SetSystemTimeAdjustment($aInfo[1], True) Then
MsgBox(4096, "Error", "System clock cannot be RESET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Else
MsgBox(4096, "Information", "System clock restored")
EndIf

EndFunc ;==>_Main


Function _Date_Time_SetTimeZoneInformation

Function Reference

_Date_Time_SetTimeZoneInformation

Sets the current time zone settings

#Include <Date.au3>
_Date_Time_SetTimeZoneInformation($iBias, $sStdName, $tStdDate, $iStdBias, $sDayName, $tDayDate, $iDayBias)

Parameters

$iBias | The current bias for local time translation on this computer. The bias is the difference in minutes between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time use the following formula: UTC = local time + bias
$sStdName | The description for standard time
$tStdDate | A $tagSYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs.
$iStdBias | The bias value to be used during local time translations that occur during standard time. This value is added to the value of the Bias to form the bias used during standard time. In most time zones, this value is zero.
$sDayName | The description for daylight saving time
$tDayDate | A $tagSYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs.
$iDayBias | The bias value to be used during local time translation that occur during daylight saving time. This value is added to the value of the Bias member to form the bias used during daylight saving time. In most time zones this value is –60.

Return Value

Success: | True
Failure: | False

Remarks

To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurrence of the day of the week within the month (1 to 5, where 5 indicates the final occurrence during the month if that day of the week does not occur 5 times).

Using this notation, specify 02:00 on the first Sunday in April as follows: wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 02:00 on the last Thursday in October as follows: wHour = 2, wMonth = 10, wDayOfWeek = 4, wDay = 5.

Related

_Date_Time_GetTimeZoneInformation, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

; Under Vista the Windows API "SetTimeZoneInformation" may be rejected due to system security

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aOld, $aNew

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aOld,"Current")

; Set new time zone information
If Not _Date_Time_SetTimeZoneInformation ($aOld[1], "A3L CST", $aOld[3], $aOld[4], "A3L CDT", $aOld[6], $aOld[7]) Then
MsgBox(4096, "Error", "System time zone cannot be SET" & @CRLF & @CRLF & _WinAPI_GetLastErrorMessage())
Exit
EndIf

; Show new time zone information
$aNew = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aNew, "New")

; Reset original time zone information
_Date_Time_SetTimeZoneInformation ($aOld[1], $aOld[2], $aOld[3], $aOld[4], $aOld[5], $aOld[6], $aOld[7])

; Show current time zone information
$aOld = _Date_Time_GetTimeZoneInformation ()
ShowTimeZoneInformation($aOld, "Reset")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show time zone information
Func ShowTimeZoneInformation(ByRef $aInfo, $comment)
MemoWrite("******************* " & $comment & " *******************")
MemoWrite("Result ............: " & $aInfo[0])
MemoWrite("Current bias ......: " & $aInfo[1])
MemoWrite("Standard name .....: " & $aInfo[2])
MemoWrite("Standard date/time : " & _Date_Time_SystemTimeToDateTimeStr ($aInfo[3]))
MemoWrite("Standard bias......: " & $aInfo[4])
MemoWrite("Daylight name .....: " & $aInfo[5])
MemoWrite("Daylight date/time : " & _Date_Time_SystemTimeToDateTimeStr ($aInfo[6]))
MemoWrite("Daylight bias......: " & $aInfo[7])
EndFunc ;==>ShowTimeZoneInformation


Function _Date_Time_SystemTimeToArray

Function Reference

_Date_Time_SystemTimeToArray

Decode a system time to an array

#Include <Date.au3>
_Date_Time_SystemTimeToArray(ByRef $tSystemTime)

Parameters

$tSystemTime $tagSYSTEMTIME structure

Return Value

Returns an Array with the following format:
[0] - Month
[1] - Day
[2] - Year
[3] - Hour
[4] - Minutes
[5] - Seconds
[6] - Milliseconds
[7] - Day of week

Remarks

None.

Related

$tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tTime, $aTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get current system time
$tTime = _Date_Time_GetSystemTime()
$aTime = _Date_Time_SystemTimeToArray($tTime)
MemoWrite("Month ........: " & $aTime[0])
MemoWrite("Day ..........: " & $aTime[1])
MemoWrite("Year .........: " & $aTime[2])
MemoWrite("Hour .........: " & $aTime[3])
MemoWrite("Minute .......: " & $aTime[4])
MemoWrite("Second .......: " & $aTime[5])
MemoWrite("Milliseconds .: " & $aTime[6])
MemoWrite("Day of week ..: " & $aTime[7])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SystemTimeToDateStr

Function Reference

_Date_Time_SystemTimeToDateStr

Decode a system time to a date string

#Include <Date.au3>
_Date_Time_SystemTimeToDateStr(ByRef $tSystemTime [, $bFmt = 0])

Parameters

$tSystemTime | $tagSYSTEMTIME structure
$bFmt | [optional] 0 returns mm/dd/yyyy (Default) 1 returns yyyy/mm/dd

Return Value

Returns Date string formatted according to $bFmt

Remarks

None.

Related

_Date_Time_SystemTimeToTimeStr, _Date_Time_SystemTimeToDateTimeStr, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tDate

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get current system date
$tDate = _Date_Time_GetSystemTime()
MemoWrite("Current system date .: " & _Date_Time_SystemTimeToDateStr($tDate))
MemoWrite("Current system date .: " & _Date_Time_SystemTimeToDateStr($tDate, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SystemTimeToDateTimeStr

Function Reference

_Date_Time_SystemTimeToDateTimeStr

Decode a system time to a date/time string

#Include <Date.au3>
_Date_Time_SystemTimeToDateTimeStr(ByRef $tSystemTime [, $bFmt = 0])

Parameters

$tSystemTime | $tagSYSTEMTIME structure
$bFmt | [optional] 0 returns mm/dd/yyyy hh:mm:ss (Default) 1 returns yyyy/mm/dd hh:mm:ss

Return Value

Returns Date/time string formatted according to $bFmt

Remarks

None.

Related

_Date_Time_SystemTimeToDateStr, _Date_Time_SystemTimeToTimeStr, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tTime

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Show system date/time
$tTime = _Date_Time_GetSystemTime()
MemoWrite("System date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tTime))
MemoWrite("System date/time .: " & _Date_Time_SystemTimeToDateTimeStr($tTime, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SystemTimeToFileTime

Function Reference

_Date_Time_SystemTimeToFileTime

Converts a system time to file time format

#Include <Date.au3>
_Date_Time_SystemTimeToFileTime($pSystemTime)

Parameters

$pSystemTime Pointer to a $tagSYSTEMTIME structure to be converted.

Return Value

Returns $tagFILETIME array that contains the converted file time

Remarks

None.

Related

$tagFILETIME, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get system time
$tSystem = _Date_Time_GetSystemTime()
$tFile = _Date_Time_SystemTimeToFileTime(DllStructGetPtr($tSystem))
MemoWrite("File time .: " & _Date_Time_FileTimeToStr($tFile))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SystemTimeToTimeStr

Function Reference

_Date_Time_SystemTimeToTimeStr

Decode a system time to a time string

#Include <Date.au3>
_Date_Time_SystemTimeToTimeStr(ByRef $tSystemTime)

Parameters

$tSystemTime $tagSYSTEMTIME structure

Return Value

Returns a Time string formatted as hh:mm:ss

Remarks

None.

Related

_Date_Time_SystemTimeToDateStr, _Date_Time_SystemTimeToDateTimeStr, $tagSYSTEMTIME

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tFile, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get system time
$tSystem = _Date_Time_GetSystemTime()
$tFile = _Date_Time_SystemTimeToFileTime(DllStructGetPtr($tSystem))
MemoWrite("File time .: " & _Date_Time_FileTimeToStr($tFile))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_SystemTimeToTzSpecificLocalTime

Function Reference

_Date_Time_SystemTimeToTzSpecificLocalTime

Converts a UTC time to a specified time zone's corresponding local time

#Include <Date.au3>
_Date_Time_SystemTimeToTzSpecificLocalTime($pUTC [, $pTimeZone = 0])

Parameters

$pUTC | Pointer to a $tagSYSTEMTIME structure that specifies a time, in UTC. The function converts this time to the specified time zone's local time.
$pTimeZone | [optional] Pointer to a $tagTIME_ZONE_INFORMATION structure that specifies the time zone of interest. If 0, the function uses the currently active time zone.

Return Value

Returns $tagSYSTEMTIME containing the local time

Remarks

None.

Related

$tagSYSTEMTIME, $tagTIME_ZONE_INFORMATION

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tLocal, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Convert system time to local time
$tSystem = _Date_Time_GetSystemTime()
$tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem))
MemoWrite("System time to local time .: " & _Date_Time_SystemTimeToDateTimeStr($tLocal ))

$tLocal = _Date_Time_GetLocalTime()
$tSystem = _Date_Time_TzSpecificLocalTimeToSystemTime(DllStructGetPtr($tLocal))
MemoWrite("Local time to system time .: " & _Date_Time_SystemTimeToDateTimeStr($tSystem))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Date_Time_TzSpecificLocalTimeToSystemTime

Function Reference

_Date_Time_TzSpecificLocalTimeToSystemTime

Converts a local time to a time in UTC

#Include <Date.au3>
_Date_Time_TzSpecificLocalTimeToSystemTime($pLocalTime [, $pTimeZone = 0])

Parameters

$pLocalTime | Pointer to a $tagSYSTEMTIME structure that specifies a local time. The function converts this time to the corresponding UTC time.
$pTimeZone | [optional] Pointer to a $tagTIME_ZONE_INFORMATION structure that specifies the time zone of interest. If 0, the function uses the currently active time zone.

Return Value

Returns $tagSYSTEMTIME containing the time in UTC

Remarks

None.

Related

$tagSYSTEMTIME, $tagTIME_ZONE_INFORMATION

Example

#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $tLocal, $tSystem

; Create GUI
$hGUI = GUICreate("Time", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Convert system time to local time
$tSystem = _Date_Time_GetSystemTime()
$tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($tSystem))
MemoWrite("System time to local time .: " & _Date_Time_SystemTimeToDateTimeStr($tLocal ))

$tLocal = _Date_Time_GetLocalTime()
$tSystem = _Date_Time_TzSpecificLocalTimeToSystemTime(DllStructGetPtr($tLocal))
MemoWrite("Local time to system time .: " & _Date_Time_SystemTimeToDateTimeStr($tSystem))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _DateAdd

Function Reference

_DateAdd

Calculates a new date based on a given date and add an interval.

#Include <Date.au3>
_DateAdd($sType, $iValToAdd, $sDate)

Parameters

$sType | of one the following: D - Add number of days to the given date M - Add number of months to the given date Y - Add number of years to the given date w - Add number of Weeks to the given date h - Add number of hours to the given date n - Add number of minutes to the given date s - Add number of seconds to the given date
$iValToAdd | number to be added
$sDate | Input date in the format YYYY/MM/DD[ HH:MM:SS]

Return Value

Success: | Date newly calculated date.
Failure: | 0 and Set @error
@error: | 0 - No error
 | 1 - Invalid $sType
 | 2 - Invalid $iValToAdd
 | 3 - Invalid $sDate

Remarks

The function will not return an invalid date.
When 3 months are added to '2004/1/31' then the result will be '2004/04/30'.

Related

_DateDiff, _DateTimeSplit, _DateToDayOfWeek, _DateToDayOfWeekISO, _DateToDayValue, _DayValueToDate

Example

#include <Date.au3>

; Add 5 days to today
$sNewDate = _DateAdd( 'd',5, _NowCalcDate())
MsgBox( 4096, "", "Today + 5 days:" & $sNewDate )

; Subtract 2 weeks from today
$sNewDate = _DateAdd( 'w',-2, _NowCalcDate())
MsgBox( 4096, "", "Today minus 2 weeks: " & $sNewDate )

; Add 15 minutes to current time
$sNewDate = _DateAdd( 'n',15, _NowCalc())
MsgBox( 4096, "", "Current time +15 minutes: " & $sNewDate )

; Calculated eventlogdate which returns second since 1970/01/01 00:00:00
$sNewDate = _DateAdd( 's',1087497645, "1970/01/01 00:00:00")
MsgBox( 4096, "", "Date: " & $sNewDate )


Function _DateDayOfWeek

Function Reference

_DateDayOfWeek

Returns the name of the weekday, based on the specified day.

#Include <Date.au3>
_DateDayOfWeek($iDayNum [, $iShort = 0])

Parameters

$iDayNum | Day number (1 = Sunday, 7 = Saturday).
$iShort | [optional] Format: 0 - Long name of the weekday 1 - Abbreviated name of the weekday

Return Value

Success: | Weekday name
Failure: | A NULL string and sets @ERROR = 1

Remarks

This function returns English day names only.

Related

_DateDaysInMonth, _DateToDayOfWeek, _DateToDayOfWeekISO

Example

#include <Date.au3>

; Retrieve the long name
$sLongDayName = _DateDayOfWeek( @WDAY )

; Retrieve the abbreviated name
$sShortDayName = _DateDayOfWeek( @WDAY, 1 )

MsgBox( 4096, "Day of Week", "Today is: " & $sLongDayName & " (" & $sShortDayName & ")" )


Function _DateDaysInMonth

Function Reference

_DateDaysInMonth

Returns the number of days in a month, based on the specified month and year.

#Include <Date.au3>
_DateDaysInMonth($iYear, $iMonthNum)

Parameters

$iYear | 4-digit year.
$iMonthNum | Month number (1 = January, 12 = December).

Return Value

Success: | Returns the number of days in the month.
Failure: | Returns 0 and set @error
@error: | 0 - No error.
 | 1 - Invalid month number or year.

Remarks

None.

Related

_DateDayOfWeek

Example

#include <Date.au3>

$iDays = _DateDaysInMonth( @YEAR,@MON )
MsgBox( 4096, "Days in Month", "This month has " & String( $iDays ) & " days in it." )


Function _DateDiff

Function Reference

_DateDiff

Returns the difference between 2 dates, expressed in the type requested

#Include <Date.au3>
_DateDiff($sType, $sStartDate, $sEndDate)

Parameters

$sType | One of the following: D = Difference in days between the given dates M = Difference in months between the given dates Y = Difference in years between the given dates w = Difference in Weeks between the given dates h = Difference in hours between the given dates n = Difference in minutes between the given dates s = Difference in seconds between the given dates
$sStartDate | Input Start date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sEndDate | Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"

Return Value

Success: | Difference between the 2 dates.
Failure: | Returns 0 and set @error
@error: | 0 - No error
 | 1 - Invalid $sType
 | 2 - Invalid $sStartDate
 | 3 - Invalid $sEndDate

Remarks

None.

Related

_DateAdd, _DateTimeSplit, _DateToDayOfWeek, _DateToDayOfWeekISO, _DateToDayValue, _DayValueToDate

Example

#include <Date.au3>

; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00)
$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc )

; Calculated the number of Hours this year
$iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of Hours this year: " & $iDateCalc )


Function _DateIsLeapYear

Function Reference

_DateIsLeapYear

Checks a given year to see if it is a leap year.

#Include <Date.au3>
_DateIsLeapYear($iYear)

Parameters

$iYear The 4-digit year to check.

Return Value

Success: | Returns 1.
Failure: | Returns 0 if the year is not a leap year and Sets @error
@error: | 0 - No error.
 | 1 - Invalid year.

Remarks

None.

Related

Example

#include <Date.au3>

If _DateIsLeapYear( @YEAR ) Then
MsgBox( 4096, "Leap Year", "This year is a leap year." )
Else
MsgBox( 4096, "Leap Year", "This year is not a leap year." )
EndIf


Function _DateIsValid

Function Reference

_DateIsValid

Checks the given date to determine if it is a valid date.

#Include <Date.au3>
_DateIsValid($sDate)

Parameters

$sDate The date to be checked.

Return Value

Success: | Returns 1.
Failure: | Returns 0 if the specified date is not valid.

Remarks

This function takes a date input in one of the following formats:
"yyyy/mm/dd[ hh:mm[:ss]]" or "yyyy/mm/dd[Thh:mm[:ss]]"
"yyyy-mm-dd[ hh:mm[:ss]]" or "yyyy-mm-dd[Thh:mm[:ss]]"
"yyyy.mm.dd[ hh:mm[:ss]]" or "yyyy.mm.dd[Thh:mm[:ss]]"

Related

Example

#include <Date.au3>

$sDate = @YEAR & "/" & @MON & "/" & @MDAY

If _DateIsValid( $sDate ) Then
MsgBox( 4096, "Valid Date", "The specified date is valid." )
Else
MsgBox( 4096, "Valid Date", "The specified date is invalid." )
EndIf


Function _DateTimeFormat

Function Reference

_DateTimeFormat

Returns the date in the PC's regional settings format.

#Include <Date.au3>
_DateTimeFormat($sDate, $sType)

Parameters

$sDate | Input date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sType | one the following: 0 - Display a date and/or time. If there is a date part, display it as a short date. If there is a time part, display it as a long time. If present, both parts are displayed. 1 - Display a date using the long date format specified in your computer's regional settings. 2 - Display a date using the short date format specified in your computer's regional settings. 3 - Display a time using the time format specified in your computer's regional settings. 4 - Display a time using the 24-hour format (hh:mm). 5 - Display a time using the 24-hour format (hh:mm:ss).

Return Value

Success: | Returns date in proper format.
Failure: | 0 and Set @error
@error: | 0 - No error.
 | 1 - Invalid $sDate
 | 2 - Invalid $sType

Remarks

None.

Related

_NowDate, _NowTime

Example

#include <Date.au3>

; Show current date/time in the pc's format
MsgBox( 4096, "Pc Long format", _DateTimeFormat( _NowCalc(),1))
MsgBox( 4096, "Pc Short format", _DateTimeFormat( _NowCalc(),2))


Function _DateTimeSplit

Function Reference

_DateTimeSplit

Split a string containing Date and Time into two separate Arrays.

#Include <Date.au3>
_DateTimeSplit($sDate, ByRef $asDatePart, ByRef $iTimePart)

Parameters

$sDate | Any of these formats: "yyyy/mm/dd[ hh:mm[:ss]]" "yyyy/mm/dd[Thh:mm[:ss]]" "yyyy-mm-dd[ hh:mm[:ss]]" "yyyy-mm-dd[Thh:mm[:ss]]" "yyyy.mm.dd[ hh:mm[:ss]]" "yyyy.mm.dd[Thh:mm[:ss]]"
$asDatePart | array that contains the Date. $asDatePart[0] number of values returned
$iTimePart | array that contains the Time. $asTimePart[0] number of values returned

Return Value

Success: | Date and Time into two separate Arrays.
Failure: | 0 and Set @error
@error: | 0 - No error.
 | 1 - Invalid Input Date

Remarks

None.

Related

_DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

Dim $MyDate
Dim $MyTime
_DateTimeSplit("2005/01/01 14:30",$MyDate,$MyTime)

For $x = 1 to $MyDate[0]
MsgBox(0,$x,$MyDate[$x])
Next
For $x = 1 to $MyTime[0]
MsgBox(0,$x,$MyTime[$x])
Next


Function _DateToDayOfWeek

Function Reference

_DateToDayOfWeek

Returns the weekdaynumber for a given date.

#Include <Date.au3>
_DateToDayOfWeek($iYear, $iMonth, $iDay)

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns Day of the Week Range is 1 to 7 where 1=Sunday.
Failure: | 0 and Set @error
@error: | 0 - No error.
 | 1 - Invalid Input Date

Remarks

None.

Related

_DateToDayOfWeekISO, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

; Week day number for a given date
$iWeekday = _DateToDayOfWeek (@YEAR, @MON, @MDAY)
; Should be equal to @Wday
MsgBox(4096, "", "Todays WeekdayNumber is: " & $iWeekDay)
MsgBox(4096, "", "Today is a : " & _DateDayOfWeek($iWeekDay))


Function _DateToDayOfWeekISO

Function Reference

_DateToDayOfWeekISO

Returns the ISO weekdaynumber for a given date.

#Include <Date.au3>
_DateToDayOfWeekISO($iYear, $iMonth, $iDay)

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns Day of the Week Range is 0 to 6 where 0=Monday.
Failure: | 0 and Set @error
@error: | 0 - No error.
 | 1 - Invalid Input Date

Remarks

None.

Related

_DateToDayOfWeek, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>
; ISO Week day number for a given date 0=Monday - 6=Sunday
$iWeekday = _DateToDayOfWeekISO (@YEAR, @MON, @MDAY)
; NOT equal to @Wday
MsgBox(4096, "", "Todays ISO WeekdayNumber is: " & $iWeekDay)


Function _DateToDayValue

Function Reference

_DateToDayValue

Returns the daynumber since since noon 4713 BC January 1 for a given Gregorian date.

#Include <Date.au3>
_DateToDayValue($iYear, $iMonth, $iDay)

Parameters

$iYear | A valid year in format YYYY
$iMonth | A valid month in format MM
$iDay | A valid day in format DD

Return Value

Success: | Returns the Juliandate (days since noon 4713 BC January 1)
Failure: | 0 and set @error
@error: | 0 - No error
 | 1 - Invalid Input Date

Remarks

None.

Related

_DayValueToDate, _DateAdd, _DateDiff

Example

#include <Date.au3>

; Julian date of today.
$sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)

; 14 days ago calculation.
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D)
MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y)


Function _DateToMonth

Function Reference

_DateToMonth

Returns the name of the Month, based on the specified month number.

#Include <Date.au3>
_DateToMonth($iMonth [, $ishort = 0])

Parameters

$iMonth | Month number (1 = January, 12 = December).
$ishort | [optional] 0 - Long name of the Month. 1 - Abbreviated name of the Month.

Return Value

Success: | Returns the name of the given Month.
Failure: | empty string and Set @error
@error: | 0 - No error.
 | 1 - Invalid month number or format.

Remarks

This function returns English day names only.

Related

Example

#include <Date.au3>

; Retrieve the long name
$sLongMonthName = _DateToMonth(@MON)

; Retrieve the abbreviated name
$sShortMonthName = _DateToMonth(@MON, 1)

MsgBox(4096, "Month of Year", "The month is: " & $sLongMonthName & " (" & $sShortMonthName & ")")


Function _DayValueToDate

Function Reference

_DayValueToDate

Add the given days since noon 4713 BC January 1 and returns the Gregorian date.

#Include <Date.au3>
_DayValueToDate($iJulianDate, ByRef $iYear, ByRef $iMonth, ByRef $iDay)

Parameters

$iJulianDate | A valid number of days.
$iYear | will return the year in format YYYY
$iMonth | will return the month in format MM
$iDay | will return the day in format DD

Return Value

Success: | Returns the date calculated
Failure: | 0 and set @error
@error: | 0 - No error.
 | 1 - Invalid Input number of days.

Remarks

None.

Related

_DateToDayValue, _DateAdd, _DateDiff, _DateTimeSplit, _DateToDayOfWeek, _DateToDayOfWeekISO

Example

#include <Date.au3>

; Julian date of today.
$sJulDate = _DateToDayValue (@YEAR, @MON, @MDAY)
MsgBox(4096, "", "Todays Julian date is: " & $sJulDate)

; 14 days ago calculation.
Dim $Y, $M, $D
$sJulDate = _DayValueToDate ($sJulDate-14, $Y, $M, $D)
MsgBox(4096, "", "14 days ago:" & $M & "/" & $D & "/" & $Y & " (" & $sJulDate & ")")


Function _Now

Function Reference

_Now

Returns the current Date and Time in PC's format.

#Include <Date.au3>
_Now()

Parameters

None.

Return Value

Returns Current Date and Time in PC's format

Remarks

If Date format isn't found in the registry it returns the date in the mm/dd/yyyy format.
If Time format isn't found in the registry it returns the time in the hh:mm:ss format.

Related

_NowDate, _NowTime

Example

#include <Date.au3>

MsgBox( 4096, "", "Todays date/Time: " & _Now() )


Function _NowCalc

Function Reference

_NowCalc

Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS for use in date calculations.

#Include <Date.au3>
_NowCalc()

Parameters

None.

Return Value

Returns the current Date and Time in format YYYY/MM/DD HH:MM:SS

Remarks

None.

Related

_NowDate, _NowTime

Example

#include <Date.au3>

; Calculated the number of seconds since EPOCH (1970/01/01 00:00:00)
$iDateCalc = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of seconds since EPOCH: " & $iDateCalc )

; Calculated the number of Hours this year
$iDateCalc = _DateDiff( 'h',@YEAR & "/01/01 00:00:00",_NowCalc())
MsgBox( 4096, "", "Number of Hours this year: " & $iDateCalc )


Function _NowCalcDate

Function Reference

_NowCalcDate

Returns the current Date in format YYYY/MM/DD.

#Include <Date.au3>
_NowCalcDate()

Parameters

None.

Return Value

Returns the current Date in format YYYY/MM/DD

Remarks

None.

Related

_NowDate, _NowTime

Example

#include <Date.au3>
$Msg = "Test record"
FileWriteLine("Pgm.log",_NowCalcDate() & " :" & $Msg )


Function _NowDate

Function Reference

_NowDate

Returns the current Date in the Pc's format.

#Include <Date.au3>
_NowDate()

Parameters

None.

Return Value

Returns the current Date specified in your computer's regional settings.

Remarks

If your computer's regional settings is not accessible it returns the date in the "M/d/yyyy" format.

Related

_DateTimeFormat, _Now, _NowCalc, _NowCalcDate, _NowTime

Example

#include <Date.au3>
MsgBox(0,'',"The Date is:" & _NowDate())


Function _NowTime

Function Reference

_NowTime

Returns the current Time in the requested format.

#Include <Date.au3>
_NowTime([$sType = 3])

Parameters

$sType [optional] Default: 3 = Display a time using the time format specified in your computer's regional settings.
4 - Display a time using the 24-hour format (hh:mm).
5 - Display a time using the 24-hour format (hh:mm:ss).

Return Value

Returns the current TIME according to the time format used.

Remarks

If your computer's regional settings is not accessible it returns the time in the "h:mm:ss tt" format.

Related

_DateTimeFormat, _Now, _NowCalc, _NowCalcDate, _NowDate

Example

#include <Date.au3>
MsgBox(0,'',"The time is:" & _NowTime())


Function _SetDate

Function Reference

_SetDate

Sets the current date of the system

#Include <Date.au3>
_SetDate($iDay [, $iMonth = 0 [, $iYear = 0]])

Parameters

$iDay | Day of the month. Values: 1-31
$iMonth | [optional] month. Values: 1-12
$iYear | [optional] year. Values: > 0 (windows might restrict this further!!)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 0 - No error
 | 1 - Failure
@extended: | GetLastError()
 | Error code(s): http://msdn.microsoft.com/en-us/library/ms681381.aspx

Remarks

If the optional parameters (iMonth,iYear) are NOT defined, the function will not change the current value!

Related

_SetTime

Example

#include <Date.au3>

_SetDate(20) ; Set the current date to 20-xx-xxxx
_SetDate(20,10) ; Set the current date to 20-10-xxxx
_SetDate(20,10,2004) ; Set the current date to 20-10-2004


Function _SetTime

Function Reference

_SetTime

Sets the current time of the system

#Include <Date.au3>
_SetTime($iHour, $iMinute [, $iSecond = 0])

Parameters

$iHour | the hour. Values: 0-23
$iMinute | the minute. Values: 0-59
$iSecond | [optional] the seconds. Values: 0-59

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 0 - No error
 | 1 - Failure
@extended: | GetLastError()
 | Error code(s): http://msdn.microsoft.com/en-us/library/ms681381.aspx

Remarks

If the optional parameter (iSecond) is NOT defined, the function will not change the current value!

Related

_SetDate

Example

#include <Date.au3>

_SetTime(20,15) ; Set time to 20:15
_SetTime(20,15,30) ; Set time to 20:15:30


Function _TicksToTime

Function Reference

_TicksToTime

Converts the specified tick amount to hours, minutes and seconds.

#Include <Date.au3>
_TicksToTime($iTicks, ByRef $iHours, ByRef $iMins, ByRef $iSecs)

Parameters

$iTicks | Tick amount.
$iHours | Variable to store the hours.
$iMins | Variable to store the minutes.
$iSecs | Variable to store the seconds.

Return Value

Success: | 1
Failure: | 0
@Error: | 0 - No error.
 | 1 - $iTicks isn't an integer.

Remarks

None.

Related

_TimeToTicks

Example

; *** Demo to show a timer window
#include <GUIConstantsEx.au3>
#include <Date.au3>

Opt("TrayIconDebug", 1)

Opt("MustDeclareVars", 1)

Global $timer, $Secs, $Mins, $Hour, $Time

_Main()

Func _Main()
;Create GUI
GUICreate("Timer", 120, 50)
GUICtrlCreateLabel("00:00:00", 10, 10)
GUISetState()
;Start timer
$timer = TimerInit()
AdlibRegister("Timer", 50)
;
While 1
;FileWriteLine("debug.log",@min & ":" & @sec & " ==> before")
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
WEnd
EndFunc ;==>_Main
;
Func Timer()
_TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs)
Local $sTime = $Time ; save current time to be able to test and avoid flicker..
$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc ;==>Timer


Function _TimeToTicks

Function Reference

_TimeToTicks

Converts the specified hours, minutes, and seconds to ticks.

#Include <Date.au3>
_TimeToTicks([$iHours = @HOUR[, $iMins = @MIN[, $iSecs = @SEC]]])

Parameters

$iHours | [optional] The hours.
$iMins | [optional] The minutes.
$iSecs | [optional] The seconds.

Return Value

Success: | Returns the number of ticks.
Failure: | 0
@Error: | 0 - No error.
 | 1 - The specified hours, minutes, or seconds are not valid.

Remarks

None.

Related

_TicksToTime

Example

#include <Date.au3>
Global $Sec, $Min, $Hour, $Time
; calculate with time
$StartTicks = _TimeToTicks(@HOUR,@MIN,@SEC)
; calculate 45 minutes later
$EndTicks = $StartTicks + 45 * 60 * 1000
_TicksToTime($EndTicks,$Hour,$Min,$Sec)
MsgBox(262144,'' , 'New Time:' & $Hour & ":" & $Min & ":" & $Sec)


Function _WeekNumberISO

Function Reference

_WeekNumberISO

Calculate the weeknumber of a given date.

#Include <Date.au3>
_WeekNumberISO([$iYear = @YEAR[, $iMonth = @MON[, $iDay = @MDAY]]])

Parameters

$iYear | [optional] Year value (default = current year)
$iMonth | [optional] Month value (default = current month)
$iDay | [optional] Day value (default = current day)

Return Value

Success: | Returns week number of given date
Failure: | 0
@Error: | 0 - No error.
 | 1 - faulty parameters values
 | 99 - On non-acceptable weekstart value

Remarks

None.

Related

Example

#include <Date.au3>

MsgBox(0,"Todays weeknumber","Todays weeknumber is " & _WeekNumberISO())


User Defined Functions

Debug user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Debug.au3>.

User Defined Function | Description
_Assert | Display a message if assertion fails.
_DebugBugReportEnv | Outputs a string containing information for Bug report submission.
_DebugOut | Displays output on a debugging session started by _DebugSetup()
_DebugReport | Writes to a debugging session
_DebugReportEx | Writes to a debugging session a formatted message
_DebugReportVar | Writes to debugging session the content of a variable
_DebugSetup | Setups up a debug session using a specify reporting


Function _Assert

Function Reference

_Assert

Display a message if assertion fails.

#include <Debug.au3>
_Assert($sCondition [,$bExit = True [,$nCode = 0x7FFFFFFF [,$sLine = @ScriptLineNumber]]])

Parameters

$sCondition | The condition (expression quoted) that must evaluate to true.
$bExit | [optional] If true, the script is aborted.
$nCode | [optional] The exit code to use if the script is aborted.
$sLine | [optional] Displays the line number where the assertion failed. If this value is not changed, then the default value will show the correct line.

Return Value

The result of the condition (Only valid when not exiting).

Remarks

@error and @extended are not destroyed on return.

Related

None.

Example

#include <Debug.au3>

$sABC= ""
_Assert('$sABC > ""')


Function _DebugBugReportEnv

Function Reference

_DebugBugReportEnv

Outputs a string containing information for Bug report submission.

#include <Debug.au3>
_DebugBugReportEnv( )

Parameters

None.

Return Value

Returns a string containing all information needed to submit.

Remarks

Must be used to submit a Bug Report.

Related

None.

Example

#include <Debug.au3>

Msgbox(4096, "Bug Report Environment", _DebugBugReportEnv() )


Function _DebugOut

Function Reference

_DebugOut

Displays output on a debugging session started by _DebugSetup()

#include <Debug.au3>
_DebugOut ( $sOutput [, $bActivate] )

Parameters

$sOutput | The string (or other printable value) to be output to the debugging session.
$bActivate | [optional] Ignored, kept for backward compatibility.

Return Value

Success: | Returns 1, @Error and @Extended as before calling _DebugOut().
Failure: | Sets @Error and returns 0.
@Error: | 0 = No error.
 | 1 = $sOutput is an incompatible type.
 | 3 = _DebugSetup() did not run properly.

Remarks

Each time _DebugOut() is called, the output is put on its own line.

_DebugSetup() must be called before the first call of _DebugOut(), or it will return with @Error = 3.

Related

_DebugSetup

Example

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

AutoIt Version: 3.2.8.1
Author: David Nuttall

Script Function:
Base script to show functionality of Debug functions.

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

AutoItSetOption("MustDeclareVars", 1)

#include <Debug.au3>

_DebugSetup ("Check Excel")
For $i = 1 To 4
WinActivate("Microsoft Excel")
; interact with Excel
Send("{Down}")
_DebugOut ("Moved Mouse Down")
Next


Function _DebugReport

Function Reference

_DebugReport

Writes to a debugging session

#include <Debug.au3>
_DebugReport ( $sData [,$bLastError = False [,$bExit = False]])

Parameters

$sData | Data to be reported
$bLastError | [optional] True if GetLastErrorMessage() must be append to the data being reported
$bExit | [optional] True if the script must be terminated

Return Value

Success: | 1.
Failure: | 0.

Remarks

If no _DebugSetup() have been issued the function always returns.
@error of the caller is preserved.
@extended can be set to Windows API GetlastError() if $bLastError = True. Otherwise it is preserved.

Related

_DebugSetup

Example

AutoItSetOption("MustDeclareVars", 1)

#include <Debug.au3>

_DebugSetup ()

_DebugReport ("message1")
_DebugReport ("message2", True); with last error message appended


Function _DebugReportEx

Function Reference

_DebugReportEx

Writes to a debugging session a formatted message

#include <Debug.au3>
_DebugReportEx ( $sData [,$bLastError = False [,$bExit = False]])

Parameters

$sData | Data to be reported
$bLastError | [optional] True if GetLastErrorMessage() must be append to the data being reported
$bExit | [optional] True if the script must be terminated

Return Value

Success: | 1.
Failure: | 0.

Remarks

According to @error value the message will be formatted as follow:
0 - report "Bad return from FUNCTION in DLL".
1 - report "unable to open a dll"
3 - report "unable to find FUNCTION in DLL".

If $sData is does not contain a "|" or @error not as specified above the reported message will not be formated.
If no _DebugSetup() have been issued the function always returns.
@error of the caller is preserved.
@extended can be set to Windows API GetlastError() if $bLastError = True. Otherwise it is preserved.

Related

_DebugSetup

Example

AutoItSetOption("MustDeclareVars", 1)

#include <Debug.au3>

_DebugSetup ()

_DebugReport ("message1")

SomeUDF("anyfunction")
If @error Then _DebugReportEx ("user32|anyfunction", True); with last error message appended

Local $iRet = SomeUDF("CloseClipboard")
If @error Or $iRet = 0 Then _DebugReportEx ("user32|CloseClipboard")

_DebugReport("message2")

$iRet = SomeUDF("CloseClipboard")
If @error Or $iRet = 0 Then _DebugReportEx ("user32|CloseClipboard", False, True) ; Script will be terminated

_DebugReport("message3") ; will not be reported

Func SomeUDF($func)
Local $aResult = DllCall("user32.dll", "int", $func)
If @error Then Return SetError(@error, @extended, 0)
Return $aResult[0]
EndFunc


Function _DebugReportVar

Function Reference

_DebugReportVar

Writes to debugging session the content of a variable

#include <Debug.au3>
_DebugReportVar ($sVarname, $vVar [,$bErrExt = False])

Parameters

$sVarname | string representing name of the variable or a comment
$vVar | the variable to be reported
$bErrExt | [optional] True if @error and @extended must be also displayed

Return Value

None.

Remarks

If no _DebugSetup() have been issued the function always returns.
@error of the caller is preserved.

Related

_DebugSetup

Example

#include <Debug.au3>

_DebugSetup("_DebugReportVar examples", True)

Dim $Array2D[5][2]
For $r = 0 to Ubound($Array2D, 1) - 1
For $c = 0 to UBound($Array2D, 2) - 1
$Array2D[$r][$c] = $r & "," & $c
Next
Next
_DebugReportVar("Array2D", $Array2D)

Dim $Array[7] = [1, 1.1, "string", Binary(0x010203), Ptr(-1), False, Default]
_DebugReportVar("Array", $Array)

Dim $Array3D[5][2][10]
_DebugReportVar("Array3D", $Array3D)

$int = -1
_DebugReportVar("int", $int)

$int64 = 2^63
_DebugReportVar("int64", $int64)

$bool = True
_DebugReportVar("bool", $bool)

$float = 1.1
_DebugReportVar("float", $float)

$keyword = Default
_DebugReportVar("keyword", $keyword)

$string = "stringstring"
_DebugReportVar("string", $string)

$binary = Binary("0x0102030405060708")
_DebugReportVar("binary", $binary)

$binary = Binary("abcdefghij")
_DebugReportVar("binary", $binary)

$ptr = Ptr(0)
_DebugReportVar("ptr", $ptr)

$hwnd = WinActive("", "")
_DebugReportVar("hwnd", $hwnd)

$dllstruct = DllStructCreate("int")
_DebugReportVar("dllstruct", $dllstruct)

$obj = ObjCreate("shell.application")
_DebugReportVar("obj", $obj)


Function _DebugSetup

Function Reference

_DebugSetup

Setups up a debug session using a specify reporting

#include <Debug.au3>
_DebugSetup ( $sTitle = Default, $bBugReportInfos = False, $vReportType = 1, $sLogFile = "" )

Parameters

$sTitle | Title to be displayed on the report window. Default value is "AutoIt Debug Report".
$bBugReportInfos | Display BugReport infos. Default value is False.
$vReportType | 1 - Report Log Window (Default). 2 - ConsoleWrite. 3 - MsgBox. 4 - FileWrite into $sLogFile defines the filename. string - name of specific report function to be used.
$sLogFile | Name of the file if $vReportType = 4

Return Value

Success: | report type
Failure: | set @error
 | 1 if already called
 | 2 invalid report type
 | 3 invalid CallBack function

Remarks

If a specific reporting function is registered then on AutoIt exit it is called without parameter.

You can only start one debug session at a time in the running script.
You can debug several concurrent scripts using the same debugging session, just use the same $sTitle when calling _DebugSetup(). All _DebugOut() will go to the same debugging session.

Commenting out the _DebugSetup() call will effectively disable all the calls to _Debug...(), but you may want to remove the calls to all _Debug functions before making a release version of your script.

Related

_DebugOut, _DebugReport, _DebugReportEx, _DebugReportVar

Example

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

AutoIt Version: 3.2.8.1
Author: David Nuttall

Script Function:
Base script to show functionality of Debug functions.

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

AutoItSetOption("MustDeclareVars", 1)

#include <Debug.au3>

_DebugSetup ("Check Excel", True) ; start displaying debug environment
For $i = 1 To 4
WinActivate("Microsoft Excel")
; interact with Excel
Send("{Down}")
_DebugOut ("Moved Mouse Down") ; forces debug notepad window to take control
Next


User Defined Functions

Encryption user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Encryption.au3>.

User Defined Function | Description
_Crypt_Startup | Initialize the Crypt library
_Crypt_Shutdown | Uninitialize the Crypt library
_Crypt_DeriveKey | Creates a key from algorithm and password
_Crypt_DestroyKey | Frees the resources used by a key
_Crypt_EncryptData | Encrypts data using the supplied key
_Crypt_DecryptData | Decrypts data using the supplied key
_Crypt_HashData | Hash data with specified algorithm
_Crypt_HashFile | Hash a string with specified algorithm
_Crypt_EncryptFile | Encrypts a file with specified key and algorithm
_Crypt_DecryptFile | Decrypts a file with specified key and algorithm


Function _Crypt_Startup

Function Reference

_Crypt_Startup

Initialize the Crypt library

#Include <Crypt.au3>
_Crypt_Startup()

Parameters

None.

Return Value

Success | Returns True
 | Sets @error to 0
Failure | Returns False and sets @error:
 | 1 - Failed to open Advapi32.dll
 | 2 - Failed to aquire crypt context

Remarks

Calling this function is optional.
To provide backwards compatibility with Windows 2000 it will use the PROV_RSA_FULL provider for Win2000 and PROV_RSA_AES for windows xp and higher

Related

_Crypt_Shutdown

See Also

Search CryptAcquireContext in MSDN Library

Example

#include <Crypt.au3>

; Example showing usage of _Crypt_Startup:

$sTest="The quick brown fox jumps over the lazy dog"

; Testing Crypt library with startup and shutdown
_Crypt_Startup()
MsgBox(0,"MD5",$sTest&@CRLF&_Crypt_HashData($sTest,$CALG_MD5))
_Crypt_Shutdown()

; Test Without
MsgBox(0,"MD5",$sTest&@CRLF&_Crypt_HashData($sTest,$CALG_MD5))


Function _Crypt_Shutdown

Function Reference

_Crypt_Shutdown

Uninitialize the Crypt library

#Include <Crypt.au3>
_Crypt_Shutdown()

Parameters

None.

Return Value

None.

Remarks

Calling this function is only needed if _Crypt_Startup has been called

Related

_Crypt_Startup

See Also

Search CryptReleaseContext in MSDN Library

Example

#include <Crypt.au3>

; Example showing usage of _Crypt_Shutdown:

$sTest="The quick brown fox jumps over the lazy dog"

; Testing Crypt library with startup and shutdown
_Crypt_Startup()
MsgBox(0,"MD5",$sTest&@CRLF&_Crypt_HashData($sTest,$CALG_MD5))
_Crypt_Shutdown()

; Test Without
MsgBox(0,"MD5",$sTest&@CRLF&_Crypt_HashData($sTest,$CALG_MD5))


Function _Crypt_DeriveKey

Function Reference

_Crypt_DeriveKey

Creates a key from algorithm and password

#Include <Crypt.au3>
_Crypt_DeriveKey($vPassword, $iALG_ID [, $iHash_ALG_ID = $CALG_MD5 ] )

Parameters

$vPassword | Password to use
$iALG_ID | Encryption ID of algorithm to be used with the key
$iHash_ALG_ID | [optional] Id of the algo to hash the password with

Return Value

Success | Returns a handle to a cryptographic key,
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Failed to create hash object
 | 2 - Failed to hash password
 | 3 - Failed to generate key

Remarks

The key needs to be destroyed with _Crypt_DestroyKey.
The AES algorithm is not available on Windows 2000.

Related

_Crypt_DestroyKey, _Crypt_EncryptData, _Crypt_EncryptFile, _Crypt_DecryptData, _Crypt_DecryptFile

See Also

Search CryptDeriveKey in MSDN Library

Example

#include <Crypt.au3>

; Exa,ple of resuing a key using _Crypt_DeriveKey

Local $StringsToCrypt[6]=["Bluth","Sunny","AutoIt3","SciTe",42,"42"]
Local $Crypted[6]

; We don't need _Crypt_Startup since DeriveKey/DestroyKey handles it internally
$Key=_Crypt_DeriveKey("supersecretpassword",$CALG_RC4)

$DisplayStr=""

for $Word In $StringsToCrypt
$DisplayStr&=$Word&@TAB&" = "&_Crypt_EncryptData($Word,$Key,$CALG_USERKEY)&@CRLF
Next

MsgBox(0,"Crypt table",$DisplayStr)

_Crypt_DestroyKey($Key)


Function _Crypt_DestroyKey

Function Reference

_Crypt_DestroyKey

Frees the resources used by a key

#Include <Crypt.au3>
_Crypt_DestroyKey($hCryptKey)

Parameters

$hCryptKey Key to destroy

Return Value

Success | Returns true
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Destroying key failed

Remarks

Destroys a key previously created by _Crypt_DeriveKey

Related

_Crypt_DeriveKey

See Also

Search CryptDestroyKey in MSDN Library

Example

#include <Crypt.au3>

; Exa,ple of resuing a key using _Crypt_DeriveKey

Local $StringsToCrypt[6]=["Bluth","Sunny","AutoIt3","SciTe",42,"42"]
Local $Crypted[6]

; We don't need _Crypt_Startup since DeriveKey/DestroyKey handles it internally
$Key=_Crypt_DeriveKey("supersecretpassword",$CALG_RC4)

$DisplayStr=""

for $Word In $StringsToCrypt
$DisplayStr&=$Word&@TAB&" = "&_Crypt_EncryptData($Word,$Key,$CALG_USERKEY)&@CRLF
Next

MsgBox(0,"Crypt table",$DisplayStr)

_Crypt_DestroyKey($Key)


Function _Crypt_EncryptData

Function Reference

_Crypt_EncryptData

Encrypts data using the supplied key

#Include <Crypt.au3>
_Crypt_EncryptData($vData, $vCryptKey, $iALG_ID[, $fFinal = True])

Parameters

$vData | Data to encrypt/decrypt
$vCryptKey | Password or handle to a key if the CALG_USERKEY flag is specified
$iALG_ID | The algorithm to use
$fFinal | [optional] False if this is only a segment of the full data

Return Value

Success | Returns encrypted data
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Cannot create key
 | 2 - Failed to determine buffer
 | 3 - Failed to encrypt data

Remarks

Returns a binary string regardless of input

Related

_Crypt_DecryptData, _Crypt_DeriveKey, _Crypt_EncryptFile

See Also

Search CryptEncrypt in MSDN Library

Example

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Crypt.au3>
#include <WinAPI.au3>

; Example of realtime RC4 encryption

$hWnd=GUICreate("Realtime Encrypting",400,300,-1)
$hInputEdit=GUICtrlCreateEdit("",0,0,400,150,$ES_WANTRETURN)
$hOutputEdit=GUICtrlCreateEdit("",0,150,400,150,$ES_READONLY)
GUIRegisterMsg($WM_COMMAND,"WM_COMMAND")
GUISetState(@SW_SHOW)

; To optimize perfomance we start the library and create a key
_Crypt_Startup()
$hKey=_Crypt_DeriveKey("SomePassword",$CALG_RC4)

Do
$msg=GUIGetMsg()
Until $msg=$GUI_EVENT_close

_Crypt_DestroyKey($hKey)
_Crypt_Shutdown()

Func WM_COMMAND($hWinHandle,$iMsg,$wParam,$lParam)
; If something was changed in the input editbox
If _WinAPI_HiWord($wParam)=$EN_CHANGE And _WINAPI_LoWord($wParam)=$hInputEdit Then
$bEncrypted=_Crypt_EncryptData(GUICtrlRead($hInputEdit),$hKey,$CALG_USERKEY)
GUICtrlSetData($hOutputEdit,$bEncrypted)
EndIf
EndFunc


Function _Crypt_DecryptData

Function Reference

_Crypt_DecryptData

Decrypts data using the supplied key

#Include <Crypt.au3>
_Crypt_DecryptData($vData, $vCryptKey, $iALG_ID[, $fFinal = True])

Parameters

$vData | Data to decrypt
$vCryptKey | Password or handle to a key if the CALG_USERKEY flag is specified
$iALG_ID | The algorithm to use
$fFinal | [optional] False if this is only a segment of the full data

Return Value

Success | Returns decrypted data
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Cannot create key
 | 2 - Failed to decrypt data

Remarks

The decrypted data is always returned as a binary string even if the encrypted data is in fact a string (cast with BinaryToString)

Related

_Crypt_EncryptData, _Crypt_Derivekey

See Also

Search CryptDecrypt in MSDN Library

Example

#include <Crypt.au3>

; This example shows how to decrypt a string

Local Const $bEncrypted = Binary("0x040A0D2594CE1FFC8E4CE5BC14E8724B6B5900225EA8E45CF328" & _
"9D0D6A48E490E53FB66F39FF5CA967C5F6CD04D399AF09E18E7A91EEA32F7BBBB714DEC6865128CE3A" & _
"4F1BB826554B69B7AC96E8AAA639656F0323E34745167F4B72FF4984A1C4B81E1F66DDD9743B9C664406D76B52")

MsgBox(0, "Decrypted data", BinaryToString(_Crypt_DecryptData($bEncrypted, "once", $CALG_RC2)))


Function _Crypt_HashData

Function Reference

_Crypt_HashData

Hash data with specified algorithm

#Include <Crypt.au3>
_Crypt_HashData($vData, $iALG_ID [, $fFinal = True [, $hCryptHash = 0]])

Parameters

$vData | Data to hash
$iALG_ID | Hash ID to use
$fFinal | [optional] False if this is only a segment of the full data, also makes the function return a hash object instead of hash
$hCryptHash | [optional] Hash object returned from a previous call to _Crypt_HashData

Return Value

Success: | Returns hash or hash object if $fFinal=False
 | Sets @error to 0
Failure: | Returns -1 and sets @error:
 | 1 - Failed to create hash object
 | 2 - Failed to hash data
 | 3 - Failed to get hash size
 | 4 - Failed to get hash

Remarks

The hash digest will be returned as a binary string, the size is specified by the algorithm. To use this with segments of data set the fFinal flag to False for all non ending segments and use the returned hash object with all subsequent calls.

Related

_Crypt_HashFile

See Also

Search CryptHashData in MSDN Library

Example

#include <Crypt.au3>

; Example of hashing data and using it to authenticate password

; This is the MD5-hash of the correct password
$bPasswordHash="0xCE950A8D7D367B5CE038E636893B49DC"

$sPassword=InputBox("Login","Please type the correct password.","Yellow fruit that is popular among monkeys")

If _Crypt_HashData($sPassword,$CALG_MD5)=$bPasswordHash Then
MsgBox(64,"Access Granted","Password correct!")
Else
MsgBox(16,"Access Denied","You entered the wrong password!")
EndIf


Function _Crypt_HashFile

Function Reference

_Crypt_HashFile

Hash a string with specified algorithm

#Include <Crypt.au3>
_Crypt_HashFile($sFile, $iALG_ID)

Parameters

$sFile | Path to file to hash
$iALG_ID | Hash ID to use

Return Value

Success | Returns hash of file
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Failed to open file
 | 2 - Failed to hash final piece
 | 3 - Failed to get hash piece

Remarks

None.

Related

_Crypt_HashData

Example

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <Crypt.au3>

; Example of hashing files

; Create GUI
$hWnd=GUICreate("Hasher",370,60)
$hFileControl=GUICtrlCreateInput("",5,5,200,20)
$hBrowseButton=GUICtrlCreateButton("...",210,5,35,20)
$hHashCombo=GUICtrlCreateCombo("MD5",250,5,50,20)
GUICtrlSetData(-1,"MD2|MD4|SHA1")
$hCalcButton=GUICtrlCreateButton("Calculate",305,5,60,20)
$hHashLabel=GUICtrlCreateLabel("Hash Digest",5,35,365,20,$SS_CENTER)

GUISetState(@SW_SHOW)

_Crypt_Startup()

Do
$msg=GUIGetMsg()

Switch $msg
Case $hBrowseButton
$sFile=FileOpenDialog("Open file","","All files (*.*;)")
GUICtrlSetData($hFileControl,$sFile)

Case $hCalcButton
$iALG_ID=0
; What algorthm did the user choose?
Switch GUICtrlread($hHashCombo)
Case "MD2"
$iALG_ID=$CALG_MD2
Case "MD4"
$iALG_ID=$CALG_MD4
Case "MD5"
$iALG_ID=$CALG_MD5
Case "SHA1"
$iALG_ID=$CALG_SHA1
Case Else
MsgBox(16,"Error","Not a valid algorithm!")
ContinueLoop
EndSwitch
$sFile=GUICtrlRead($hFileControl)
If Not FileExists($sFile) Then
MsgBox(16,"Error","Invalid file")
ContinueLoop
EndIf
$bDigest=_Crypt_HashFile($sFile,$iALG_ID)
GUICtrlSetData($hHashLabel,$bDigest)

Case $GUI_EVENT_CLOSE
ExitLoop

EndSwitch
Until False

_Crypt_Shutdown()


Function _Crypt_EncryptFile

Function Reference

_Crypt_EncryptFile

Encrypts a file with specified key and algorithm

#Include <Crypt.au3>
_Crypt_EncryptFile($sSourceFile, $sDestinationFile, $vCryptKey, $iALG_ID)

Parameters

$sSourceFile | File to process
$sDestinationFile | File to save the processed file
$vCryptKey | Password or handle to a key if the CALG_USERKEY flag is specified
$iALG_ID | The algorithm to use

Return Value

Success | True
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Failed to create key
 | 2 - Failed to open source file
 | 3 - Failed to open destination file
 | 4 - Failed to encrypt final piece
 | 5 - Failed to encrypt piece

Remarks

The the output file can be larger than the input file depending on the algorithm.

Related

_Crypt_EncryptData, _Crypt_DecryptFile, _Crypt_DeriveKey

Example

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

$hWnd = GUICreate("File Encrypter", 234, 178, 260, 238)
$InFileLabel = GUICtrlCreateLabel("Input file", 8, 0, 44, 17)
$InFileInput = GUICtrlCreateInput("", 8, 16, 169, 21)
$OutFileLabel = GUICtrlCreateLabel("Output file", 8, 48, 52, 17)
$OutFileInput = GUICtrlCreateInput("", 8, 64, 169, 21)
$InFileButton = GUICtrlCreateButton("...", 184, 16, 35, 20, $WS_GROUP)
$OutFileButton = GUICtrlCreateButton("...", 184, 64, 35, 20, $WS_GROUP)
$AlgoLabel = GUICtrlCreateLabel("Algorithm", 8, 96, 47, 17)
$AlgoCombo = GUICtrlCreateCombo("RC4", 8, 112, 65, 25)
GUICtrlSetData(-1, "3DES|AES 128|AES 192|AES 256|DES|RC2")
$PasswordLabel = GUICtrlCreateLabel("Password", 88, 96, 50, 17)
$PasswordInput = GUICtrlCreateInput("", 88, 112, 129, 21)
$EncryptButton = GUICtrlCreateButton("Encrypt File", 8, 144, 211, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

Global $Increase=0

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $InFileButton
$file = FileOpenDialog("Input File", "", "All files (*.*;)")
If $file <> "" Then GUICtrlSetData($InFileInput, $file)
Case $OutFileButton
$file = FileSaveDialog("Output file", "", "Any file (*.*;)")
If $file <> "" Then GUICtrlSetData($OutFileInput, $file)

Case $EncryptButton
$infile = GUICtrlRead($InFileInput)
If Not FileExists($infile) Then
MsgBox(16, "Error", "Input file doesn't exists!")
ContinueLoop
EndIf

$outfile=GUICtrlRead($OutFileInput)
If $outfile="" Then
MsgBox(16,"Error","Please input a output file")
ContinueLoop
EndIf

$algo = 0
Switch GUICtrlRead($AlgoCombo)
Case "3DES"
$algo = $CALG_3DES
Case "DES"
$algo = $CALG_DES
Case "RC2"
$algo = $CALG_RC2
Case "RC4"
$algo = $CALG_RC4
Case "AES 128"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_128
Case "AES 192"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_192
Case "AES 256"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_256
EndSwitch
$password=GUICtrlRead($PasswordInput)
If $password="" Then
MsgBox(16,"Error","Please input a password")
ContinueLoop
EndIf

AdlibRegister("Update",333)
$success=_Crypt_EncryptFile($infile,$outfile,$password,$algo)
If $success Then
MsgBox(0,"Success","Operation succeeded")
Else
Switch @error
Case 1
MsgBox(16,"Fail","Failed to create key")
Case 2
MsgBox(16,"Fail","Couldn't open source file")
Case 3
MsgBox(16,"Fail","Couldn't open destination file")
Case 4 or 5
MsgBox(16,"Fail","Encryption error")
EndSwitch
EndIf

AdlibUnRegister("Update")
WinSetTitle($hWnd,"","File Encrypter")
EndSwitch
WEnd

Func Update()
Switch Mod($Increase,4)
Case 0
WinSetTitle($hWnd,"","Processing... |")
Case 1
WinSetTitle($hWnd,"","Processing... /")
Case 2
WinSetTitle($hWnd,"","Processing... —")
Case 3
WinSetTitle($hWnd,"","Processing... \")
EndSwitch

$Increase+=1
EndFunc ;==>Update


Function _Crypt_DecryptFile

Function Reference

_Crypt_DecryptFile

Decrypts a file with specified key and algorithm

#Include <Crypt.au3>
_Crypt_DecryptFile($sSourceFile, $sDestinationFile, $vCryptKey, $iALG_ID)

Parameters

$sSourceFile | File to process
$sDestinationFile | File to save the processed file
$vCryptKey | Password or handle to a key if the CALG_USERKEY flag is specified
$iALG_ID | The algorithm to use

Return Value

Success | True
 | Sets @error to 0
Failure | Returns -1 and sets @error:
 | 1 - Failed to create key
 | 2 - Failed to open source file
 | 3 - Failed to open destination file
 | 4 - Failed to decrypt final piece
 | 5 - Failed to decrypt piece

Remarks

None.

Related

_Crypt_EncryptFile, _Crypt_DeriveKey

Example

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

$hWnd = GUICreate("File Decrypter", 234, 178, 260, 238)
$InFileLabel = GUICtrlCreateLabel("Input file", 8, 0, 44, 17)
$InFileInput = GUICtrlCreateInput("", 8, 16, 169, 21)
$OutFileLabel = GUICtrlCreateLabel("Output file", 8, 48, 52, 17)
$OutFileInput = GUICtrlCreateInput("", 8, 64, 169, 21)
$InFileButton = GUICtrlCreateButton("...", 184, 16, 35, 20, $WS_GROUP)
$OutFileButton = GUICtrlCreateButton("...", 184, 64, 35, 20, $WS_GROUP)
$AlgoLabel = GUICtrlCreateLabel("Algorithm", 8, 96, 47, 17)
$AlgoCombo = GUICtrlCreateCombo("RC4", 8, 112, 65, 25)
GUICtrlSetData(-1, "3DES|AES 128|AES 192|AES 256|DES|RC2")
$PasswordLabel = GUICtrlCreateLabel("Password", 88, 96, 50, 17)
$PasswordInput = GUICtrlCreateInput("", 88, 112, 129, 21)
$EncryptButton = GUICtrlCreateButton("Encrypt File", 8, 144, 211, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

Global $Increase=0

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $InFileButton
$file = FileOpenDialog("Input File", "", "All files (*.*;)")
If $file <> "" Then GUICtrlSetData($InFileInput, $file)
Case $OutFileButton
$file = FileSaveDialog("Output file", "", "Any file (*.*;)")
If $file <> "" Then GUICtrlSetData($OutFileInput, $file)

Case $EncryptButton
$infile = GUICtrlRead($InFileInput)
If Not FileExists($infile) Then
MsgBox(16, "Error", "Input file doesn't exists!")
ContinueLoop
EndIf

$outfile=GUICtrlRead($OutFileInput)
If $outfile="" Then
MsgBox(16,"Error","Please input a output file")
ContinueLoop
EndIf

$algo = 0
Switch GUICtrlRead($AlgoCombo)
Case "3DES"
$algo = $CALG_3DES
Case "DES"
$algo = $CALG_DES
Case "RC2"
$algo = $CALG_RC2
Case "RC4"
$algo = $CALG_RC4
Case "AES 128"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_128
Case "AES_192"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_192
Case "AES_256"
If @OSVersion = "WIN_2000" Then
MsgBox(16, "Error", "Sorry, this algorithm is not available on this system!")
ContinueLoop
EndIf
$algo = $CALG_AES_256
EndSwitch
$password=GUICtrlRead($PasswordInput)
If $password="" Then
MsgBox(16,"Error","Please input a password")
ContinueLoop
EndIf

AdlibRegister("Update",333)
$success=_Crypt_DecryptFile($infile,$outfile,$password,$algo)
If $success Then
MsgBox(0,"Success","Operation succeeded")
Else
Switch @error
Case 1
MsgBox(16,"Fail","Failed to create key")
Case 2
MsgBox(16,"Fail","Couldn't open source file")
Case 3
MsgBox(16,"Fail","Couldn't open destination file")
Case 4 or 5
MsgBox(16,"Fail","Encryption error")
EndSwitch
EndIf

AdlibUnRegister("Update")
WinSetTitle($hWnd,"","File Decrypter")
EndSwitch
WEnd

Func Update()
Switch Mod($Increase,4)
Case 0
WinSetTitle($hWnd,"","Processing... |")
Case 1
WinSetTitle($hWnd,"","Processing... /")
Case 2
WinSetTitle($hWnd,"","Processing... —")
Case 3
WinSetTitle($hWnd,"","Processing... \")
EndSwitch

$Increase+=1
EndFunc ;==>Update


User Defined Functions

EventLog user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <EventLog.au3>.

User Defined Function | Description
_EventLog__Backup | Saves the event log to a backup file
_EventLog__Clear | Clears the event log
_EventLog__Close | Closes a read handle to the event log
_EventLog__Count | Retrieves the number of records in the event log
_EventLog__DeregisterSource | Closes a write handle to the event log
_EventLog__Full | Retrieves whether the event log is full
_EventLog__Notify | Enables an application to receive event notifications
_EventLog__Oldest | Retrieves the absolute record number of the oldest record in the event log
_EventLog__Open | Opens a handle to the event log
_EventLog__OpenBackup | Opens a handle to a backup event log
_EventLog__Read | Reads an entry from the event log
_EventLog__RegisterSource | Retrieves a registered handle to the specified event log
_EventLog__Report | Writes an entry at the end of the specified event log


Function _EventLog__Backup

Function Reference

_EventLog__Backup

Saves the event log to a backup file

#Include <EventLog.au3>
_EventLog__Backup($hEventLog, $sFileName)

Parameters

$hEventLog | Handle to the event log
$sFileName | The name of the backup file

Return Value

Success: | True
Failure: | False

Remarks

The function does not clear the event log. The function fails if the user does not have the SE_BACKUP_NAME
privilege.

Related

_EventLog__OpenBackup

Example

#include <EventLog.au3>

_Main()

Func _Main()
Local $hEventLog

$hEventLog = _EventLog__Open ("", "Application")
_EventLog__Backup ($hEventLog, "C:\EventLog.bak")
_EventLog__Close ($hEventLog)
EndFunc ;==>_Main


Function _EventLog__Clear

Function Reference

_EventLog__Clear

Clears the event log

#Include <EventLog.au3>
_EventLog__Clear($hEventLog, $sFileName)

Parameters

$hEventLog | Handle to the event log
$sFileName | The name of the backup file. If the name is blank, the current event log is not backed up.

Return Value

Success: | True
Failure: | False

Remarks

This function fails if the event log is empty or a file already exists with the same name as sFileName. After
this function returns, any handles that reference the cleared event log cannot be used to read the log.

Related

_EventLog__Open

Example

#include <EventLog.au3>

_Main()

Func _Main()
Local $hEventLog

$hEventLog = _EventLog__Open("", "Application")
_EventLog__Clear($hEventLog, "C:\EventLog.bak")
_EventLog__Close ($hEventLog)

EndFunc ;==>_Main


Function _EventLog__Close

Function Reference

_EventLog__Close

Closes a read handle to the event log

#Include <EventLog.au3>
_EventLog__Close($hEventLog)

Parameters

$hEventLog Handle to the event log

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_EventLog__Open, _EventLog__Notify, _EventLog__OpenBackup, _EventLog__Read, _EventLog__Report

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open ("", "Application")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__Count

Function Reference

_EventLog__Count

Retrieves the number of records in the event log

#Include <EventLog.au3>
_EventLog__Count($hEventLog)

Parameters

$hEventLog A handle to the event log

Return Value

Success: | Number of records in the event log
Failure: | -1

Remarks

The oldest record in an event log is not necessarily record number 1. To determine the record number of the
oldest record in an event log, use the _EventLog__Oldest function.

Related

_EventLog__Oldest, _EventLog__Full

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open ("", "Application")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__DeregisterSource

Function Reference

_EventLog__DeregisterSource

Closes a write handle to the event log

#Include <EventLog.au3>
_EventLog__DeregisterSource($hEventLog)

Parameters

$hEventLog A handle to the event log

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_EventLog__RegisterSource, _EventLog__Notify


Function _EventLog__Full

Function Reference

_EventLog__Full

Retrieves whether the event log is full

#Include <EventLog.au3>
_EventLog__Full($hEventLog)

Parameters

$hEventLog A handle to the event log

Return Value

Success: | True: Event log is full
Failure: | False: Event log is not full

Remarks

None.

Related

_EventLog__Count, _EventLog__Oldest

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open ("", "Application")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__Notify

Function Reference

_EventLog__Notify

Enables an application to receive event notifications

#Include <EventLog.au3>
_EventLog__Notify($hEventLog, $hEvent)

Parameters

$hEventLog | A handle to the event log
$hEvent | A handle to a manual-reset event object

Return Value

Success: | True
Failure: | False

Remarks

This function does not work with remote handles. If the hEventLog parameter is the handle to an event log on a
remote computer, this function returns zero, and GetLastError returns ERROR_INVALID_HANDLE. When an event is
written to the log specified by hEventLog, the system uses the PulseEvent function to set the event specified
by the hEvent parameter to the signaled state. If the thread is not waiting on the event when the system calls
PulseEvent, the thread will not receive the notification. Therefore, you should create a separate thread to
wait for notifications. Note that the system calls PulseEvent no more than once every five seconds. Therefore,
even if more than one event log change occurs within a five second interval, you will only receive one
notification. The system will continue to notify you of changes until you close the handle to the event log.
To close the event log, use the _EventLog__Close or _EventLog__DeregisterSource function.

Related

_EventLog__Close, _EventLog__DeregisterSource

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>
#include <WinAPI.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI, $hEvent, $iResult

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set up event
$hEventLog = _EventLog__Open ("", "Security")
$hEvent = _WinAPI_CreateEvent (0, False, False, "")
_EventLog__Notify ($hEventLog, $hEvent)

; Wait for new event to occur
MemoWrite("Waiting for new event")
$iResult = _WinAPI_WaitForSingleObject ($hEvent)
_WinAPI_CloseHandle ($hEvent)
_EventLog__Close ($hEventLog)

; Write results
If $iResult = -1 Then
MemoWrite("Wait failed")
Else
MemoWrite("New event occurred")
EndIf

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__Oldest

Function Reference

_EventLog__Oldest

Retrieves the absolute record number of the oldest record in the event log

#Include <EventLog.au3>
_EventLog__Oldest($hEventLog)

Parameters

$hEventLog A handle to the event log

Return Value

Success: | Absolute record number of the oldest record in the event log
Failure: | 0

Remarks

The oldest record in an event log is not necessarily record number 1

Related

_EventLog__Count, _EventLog__Full

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open ("", "Application")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__Open

Function Reference

_EventLog__Open

Opens a handle to the event log

#Include <EventLog.au3>
_EventLog__Open($sServerName, $sSourceName)

Parameters

$sServerName | The UNC name of the server on where the event log will be opened. If blank, the operation is performed on the local computer.
$sSourceName | The name of the log

Return Value

Success: | The handle to the event log
Failure: | 0

Remarks

To close the handle to the event log, use the _EventLog__Close function

Related

_EventLog__Close, _EventLog__Clear, _EventLog__Read, _EventLog__Report

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open ("", "Application")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__OpenBackup

Function Reference

_EventLog__OpenBackup

Opens a handle to a backup event log

#Include <EventLog.au3>
_EventLog__OpenBackup($sServerName, $sFileName)

Parameters

$sServerName | The UNC name of the server on where the event log will be opened. If blank, the operation is performed on the local computer.
$sFileName | The name of the backup file

Return Value

Success: | The handle to the backup event log
Failure: | 0

Remarks

If the backup filename specifies a remote server, $sServerName must be blank

Related

_EventLog__Close, _EventLog__Backup

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hEventLog = _EventLog__Open("", "Application")
_EventLog__Backup($hEventLog, "C:\EventLog.bak")
_EventLog__Close($hEventLog)

$hEventLog = _EventLog__OpenBackup("", "C:\EventLog.bak")
MemoWrite("Log full ........: " & _EventLog__Full ($hEventLog))
MemoWrite("Log record count : " & _EventLog__Count ($hEventLog))
MemoWrite("Log oldest record: " & _EventLog__Oldest ($hEventLog))
_EventLog__Close ($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__Read

Function Reference

_EventLog__Read

Reads an entry from the event log

#Include <EventLog.au3>
_EventLog__Read($hEventLog [, $fRead = True [, $fForward = True [, $iOffset = 0]]])

Parameters

$hEventLog | A handle to the event log
$fRead | [optional] If True, operation proceeds sequentially from the last call to this function using this handle. If False, the read will operation proceeds from the record specified by the $iOffset parameter.
$fForward | [optional] If True, the log is read in date order. If False, the log is read in reverse date order.
$iOffset | [optional] The number of the event record at which the read operation should start. This parameter is ignored if fRead is True.

Return Value

Success: | Array with the following format:
 | [ 0] - True
 | [ 1] - Number of the record
 | [ 2] - Date at which this entry was submitted
 | [ 3] - Time at which this entry was submitted
 | [ 4] - Date at which this entry was received to be written to the log
 | [ 5] - Time at which this entry was received to be written to the log
 | [ 6] - Event identifier
 | [ 7] - Event type. This can be one of the following values:
 | 1 - Error event
 | 2 - Warning event
 | 4 - Information event
 | 8 - Success audit event
 | 16 - Failure audit event
 | [ 8] - Event type string
 | [ 9] - Event category
 | [10] - Event source
 | [11] - Computer name
 | [12] - Username
 | [13] - Event description
 | [14] - Event data array
Failure: | Array[0] = False

Remarks

When this function returns successfully, the read position in the event log is adjusted by the number of
records read. Though multiple records can be read, this function returns one record at a time for sanity sake.

Related

_EventLog__Close, _EventLog__Open

Example

#include <GuiConstantsEx.au3>
#include <EventLog.au3>

Global $iMemo

_Main()

Func _Main()
Local $hEventLog, $hGUI, $aEvent

; Create GUI
$hGUI = GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Read most current event record
$hEventLog = _EventLog__Open("", "Application")
$aEvent = _EventLog__Read($hEventLog, True, False) ; read last event
;~ $hEventLog = _EventLog__Open("", "System")
;~ $aEvent = _EventLog__Read($hEventLog)
;~ $aEvent = _EventLog__Read($hEventLog, True, False)
MemoWrite("Result ............: " & $aEvent[ 0])
MemoWrite("Record number .....: " & $aEvent[ 1])
MemoWrite("Submitted .........: " & $aEvent[ 2] & " " & $aEvent[ 3])
MemoWrite("Generated .........: " & $aEvent[ 4] & " " & $aEvent[ 5])
MemoWrite("Event ID ..........: " & $aEvent[ 6])
MemoWrite("Type ..............: " & $aEvent[ 8])
MemoWrite("Category ..........: " & $aEvent[ 9])
MemoWrite("Source ............: " & $aEvent[10])
MemoWrite("Computer ..........: " & $aEvent[11])
MemoWrite("Username ..........: " & $aEvent[12])
MemoWrite("Description .......: " & $aEvent[13])
_EventLog__Close($hEventLog)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _EventLog__RegisterSource

Function Reference

_EventLog__RegisterSource

Retrieves a registered handle to the specified event log

#Include <EventLog.au3>
_EventLog__RegisterSource($sServerName, $sSourceName)

Parameters

$sServerName | The UNC name of the server on where the event log will be opened. If blank, the operation is performed on the local computer.
$sSourceName | The name of the event source whose handle is to be retrieved. The source name must be a subkey of a log under the Eventlog registry key.

Return Value

Success: | The handle to an event log
Failure: | 0

Remarks

If the source name cannot be found, the event logging service uses the Application log; it does not create a
new source. Events are reported for the source, however, there are no message and category message files
specified for looking up descriptions of the event identifiers for the source. To close the handle to the
event log, use the DeregisterEventSource function.

Related

_EventLog__DeregisterSource


Function _EventLog__Report

Function Reference

_EventLog__Report

Writes an entry at the end of the specified event log

#Include <EventLog.au3>
_EventLog__Report($hEventLog, $iType, $iCategory, $iEventID, $sUserName, $sDesc, $aData)

Parameters

$hEventLog | A handle to the event log. As of Windows XP SP2, this cannot be a handle to the Security log.
$iType | Event type. This can be one of the following values: 0 - Success event 1 - Error event 2 - Warning event 4 - Information event 8 - Success audit event 16 - Failue audit event
$iCategory | The event category. This is source specific information the category can have any value.
$iEventID | The event identifier. The event identifier specifies the entry in the message file associated with the event source.
$sUserName | User name for the event. This can be blank to indicate that no name is required.
$sDesc | Event description
$aData | Data array formated as follows: [0] - Number of bytes in array [1] - Byte 1 [2] - Byte 2 [n] - Byte n

Return Value

Success: | True
Failure: | False

Remarks

This function is used to log an event. The entry is written to the end of the configured log for the source
identified by the hEventLog parameter. This function adds the time, the entry's length, and the offsets before
storing the entry in the log.

Related

_EventLog__Close, _EventLog__Open

Example

#include <EventLog.au3>

_Main()

Func _Main()
Local $hEventLog, $aData[4]=[3, 1, 2, 3]

$hEventLog = _EventLog__Open("", "Application")
_EventLog__Report($hEventLog, 4, 0, 2, "Administrator", "AutoIt3 generated event", $aData)
_EventLog__Close ($hEventLog)

EndFunc ;==>_Main


User Defined Functions

Excel user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Excel.au3>.

User Defined Function | Description
_ExcelBookAttach | Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.
_ExcelBookClose | Closes the active workbook and removes the specified Excel object.
_ExcelBookNew | Creates new workbook and returns its object identifier.
_ExcelBookOpen | Opens an existing workbook and returns its object identifier.
_ExcelBookSave | Saves the active workbook of the specified Excel object.
_ExcelBookSaveAs | Saves the active workbook of the specified Excel object with a new filename and/or type.
_ExcelColumnDelete | Delete a number of columns from the active worksheet.
_ExcelColumnInsert | Insert a number of columns into the active worksheet.
_ExcelFontSetProperties | Set the bold, italic, and underline font properties of a range in an Excel object.
_ExcelHorizontalAlignSet | Set the horizontal alignment of each cell in a range.
_ExcelHyperlinkInsert | Inserts a hyperlink into the active page.
_ExcelNumberFormat | Applies the specified formatting to the cells in the specified R1C1 Range.
_ExcelReadArray | Create an array from a row or column of the active worksheet.
_ExcelReadCell | Read information from the active worksheet of the specified Excel object.
_ExcelReadSheetToArray | Create a 2D array from the rows/columns of the active worksheet.
_ExcelRowDelete | Delete a number of rows from the active worksheet.
_ExcelRowInsert | Insert a number of rows into the active worksheet.
_ExcelSheetActivate | Activate the specified sheet by string name or by number.
_ExcelSheetAddNew | Add new sheet to workbook - optionally with a name.
_ExcelSheetDelete | Delete the specified sheet by string name or by number.
_ExcelSheetList | Return a list of all sheets in workbook, by name, as an array.
_ExcelSheetMove | Move the specified sheet before another specified sheet.
_ExcelSheetNameGet | Return the name of the active sheet.
_ExcelSheetNameSet | Set the name of the active sheet.
_ExcelWriteArray | Write an array to a row or column on the active worksheet of the specified Excel object.
_ExcelWriteCell | Write information to a cell on the active worksheet of the specified Excel object.
_ExcelWriteFormula | Write a formula to a cell on the active worksheet of the specified Excel object.
_ExcelWriteSheetFromArray | Writes a 2D array to the active worksheet


Function _ExcelBookAttach

Function Reference

_ExcelBookAttach

Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.

#Include <Excel.au3>
_ExcelBookAttach($s_string [, $s_mode = "FilePath"])

Parameters

$s_string | String to search for
$s_mode | [[optional] specifies search mode: FileName - Name of the open workbook FilePath - (Default) Full path to the open workbook Title - Title of the Excel window

Return Value

Success: | Returns an object variable pointing to the Excel.Application, workbook object
Failure: | Returns 0 and sets @ERROR = 1

Remarks

None.

Related

_ExcelBookNew, _ExcelBookOpen

Example

; **************************************************************************************************************
; Example 1 - Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.
; **************************************************************************************************************
#include <Excel.au3>
#include <File.au3>

$sFilePath = @TempDir & "\Temp.xls"
If Not _FileCreate($sFilePath) Then ;Create an .XLS file to attach to
MsgBox(4096, "Error", " Error Creating File - " & @error)
EndIf

_ExcelBookOpen($sFilePath)
$oExcel = _ExcelBookAttach($sFilePath) ;with Default Settings ($s_mode = "FilePath" ==> Full path to the open workbook)
_ExcelWriteCell($oExcel, "If you can read this, then Success!", 1, 1) ;Write to the Cell
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

; **************************************************************************************************************
; Example 2 - Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.
; **************************************************************************************************************
#include <Excel.au3>
#include <File.au3>

$sFilePath = @TempDir & "\Temp.xls"
If Not _FileCreate($sFilePath) Then ;Create an .XLS file to attach to
MsgBox(4096, "Error", " Error Creating File - " & @error)
EndIf

_ExcelBookOpen($sFilePath)
$oExcel = _ExcelBookAttach("Temp.xls", "FileName") ;with $s_mode = "FileName" ==> Name of the open workbook
_ExcelWriteCell($oExcel, "If you can read this, then Success!", 1, 1) ;Write to the Cell
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

; **************************************************************************************************************
; Example 3 - Attach to the first existing instance of Microsoft Excel where the search string matches based on the selected mode.
; **************************************************************************************************************
#include <Excel.au3>
#include <File.au3>

$sFilePath = @TempDir & "\Temp.xls"
If Not _FileCreate($sFilePath) Then ;Create an .XLS file to attach to
MsgBox(4096, "Error", " Error Creating File - " & @error)
EndIf

_ExcelBookOpen($sFilePath)
$oExcel = _ExcelBookAttach("Microsoft Excel - Temp.xls", "Title") ;with $s_mode = "Title" ==> Title of the Excel window
_ExcelWriteCell($oExcel, "If you can read this, then Success!", 1, 1) ;Write to the Cell
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes


Function _ExcelBookClose

Function Reference

_ExcelBookClose

Closes the active workbook and removes the specified Excel object.

#Include <Excel.au3>
_ExcelBookClose($oExcel [, $fSave = 1 [, $fAlerts = 0]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$fSave | [optional] Flag for saving the file before closing (0=no save, 1=save) (default = 1)
$fAlerts | [optional] Flag for disabling/enabling Excel message alerts (0=disable, 1=enable) (default = 0)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 - Specified object does not exist
 | 2 - File exists, overwrite flag not set

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Open a new Excel Window and Close it, with default parameters
; *****************************************************************
#include <Excel.au3>
$oExcel = _ExcelBookNew() ; Example 1 - Create a Microsoft Excel window
_ExcelBookClose($oExcel) ;By default, this method Saves the file under the "My Documents" folder

; ***************************************************************
; Example 2 - Open a new Excel Window and Close it, with default parameters
; *****************************************************************
#include <Excel.au3>
$oExcel = _ExcelBookNew() ; Example 1 - Create a Microsoft Excel window
_ExcelBookClose($oExcel, 0) ;This method will either: 1) Close the file, or 2) if a change has been made to the Excel Window, then Prompt the user

; ***************************************************************
; Example 3 - Open a new Excel Window and Close it, with default parameters
; *****************************************************************
#include <Excel.au3>
$oExcel = _ExcelBookNew() ; Example 1 - Create a Microsoft Excel window
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes


Function _ExcelBookNew

Function Reference

_ExcelBookNew

Creates new workbook and returns its object identifier.

#Include <Excel.au3>
_ExcelBookNew([$fVisible = 1])

Parameters

$fVisible [optional] Flag, whether to show or hide the workbook (0=not visible, 1=visible)

Return Value

Success: | Returns new object identifier
Failure: | Returns 0 and set @error
@error: | 1 - Unable to create the Excel COM object
 | 2 - $fVisible parameter is not a number

Remarks

None.

Related

_ExcelBookAttach

Example

; *******************************************************
; Example 1 - Create a Microsoft Excel window and open an .xls file
; *******************************************************
#include <Excel.au3>
$oExcel = _ExcelBookNew()


Function _ExcelBookOpen

Function Reference

_ExcelBookOpen

Opens an existing workbook and returns its object identifier.

#Include <Excel.au3>
_ExcelBookOpen($sFilePath [, $fVisible = 1 [, $fReadOnly = False [, $sPassword = "" [, $sWritePassword = ""]]]])

Parameters

$sFilePath | Path and filename of the file to be opened
$fVisible | [optional] Flag, whether to show or hide the workbook (0=not visible, 1=visible) (default=1)
$fReadOnly | [optional] Flag, whether to open the workbook as read-only (True or False) (default=False)
$sPassword | [optional] The password that was used to read-protect the workbook, if any (default is none)
$sWritePassword | [optional] The password that was used to write-protect the workbook, if any (default is none)

Return Value

Success: | Returns new object identifier
Failure: | 0 and set @error
@error: | 1 - Unable to create the object
 | 2 - File does not exist

Remarks

None

Related

_ExcelBookAttach

Example

; ***************************************************************
; Example 1 - Open an existing workbook and returns its object identifier.
; *****************************************************************

#include <Excel.au3>

$sFilePath1 = @ScriptDir & "\Test1.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)

If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf


Function _ExcelBookSave

Function Reference

_ExcelBookSave

Saves the active workbook of the specified Excel object.

#Include <Excel.au3>
_ExcelBookSave($oExcel [, $fAlerts = 0])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$fAlerts | [optional] Flag for disabling/enabling Excel message alerts (0=disable, 1=enable) (default = 0)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 - Specified object does not exist
 | 2 - File exists, overwrite flag not set

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Open a New workbook and returns its object identifier. Then Save the file without any alerts.
; *****************************************************************

#include <Excel.au3>

$oExcel = _ExcelBookNew()

_ExcelBookSave($oExcel) ;Save File With No Alerts
If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)


Function _ExcelBookSaveAs

Function Reference

_ExcelBookSaveAs

Saves the active workbook of the specified Excel object with a new filename and/or type.

#Include <Excel.au3>
_ExcelBookSaveAs($oExcel, $sFilePath [, $sType = "xls" [, $fAlerts = 0 [, $fOverWrite = 0 [, $sPassword = "" [, $sWritePassword = "" [, $iAccessMode = 1 [, $iConflictResolution = 2]]]]]]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sFilePath | Path and filename of the file to be read
$sType | [optional] Excel writable filetype string = "xls|csv|txt|template|html", default "xls"
$fAlerts | [optional] Flag for disabling/enabling Excel message alerts (0=disable, 1=enable)
$fOverWrite | [optional] Flag for overwriting the file, if it already exists (0=no, 1=yes)
$sPassword | [optional] The string password to protect the sheet with; if blank, no password will be used (default = blank)
$sWritePassword | [optional] The string write-access password to protect the sheet with; if blank, no password will be used (default = blank)
$iAccessMode | [optional] The document sharing mode to assign to the workbook:
$xlNoChange | [optional] Leaves the sharing mode as it is (default) (numeric value = 1)
$xlExclusive | [optional] Disables sharing on the workbook (numeric value = 3)
$xlShared | [optional] Enable sharing on the workbook (numeric value = 2)
$iConflictResolution | [optional] For shared documents, how to resolve sharing conflicts:
$xlUserResolution | [optional] Pop up a dialog box asking the user how to resolve (numeric value = 1)
$xlLocalSessionChanges | [optional] The local user's changes are always accepted (default) (numeric value = 2)
$xlOtherSessionChanges | [optional] The local user's changes are always rejected (numeric value = 3)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 - Specified object does not exist
 | 2 - Invalid filetype string
 | 3 - File exists, overwrite flag not set

Remarks

You can only SaveAs back to the same working path the workbook was originally opened from at this time
(not applicable to newly created, unsaved books).

Related

Example

; ***************************************************************
; Example 1 - Open an existing workbook and returns its object identifier. Then SaveAs the file under a new name, without any alerts.
; *****************************************************************
#include <Excel.au3>

$sFilePath1 = @ScriptDir & "\Test1.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)

If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf

_ExcelBookSaveAs($oExcel, @ScriptDir & "\SaveAsExample", "xls")
If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

; ***************************************************************
; Example 2 - Open an existing workbook and returns its object identifier. Then SaveAs the file under a new name, without any alerts.
; Overwrite File if it exists, and protect the file using the password option. Then Open the File to show the Password Protection
; *****************************************************************
#include <Excel.au3>

$sFilePath1 = @ScriptDir & "\Test1.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)

;Show any errors that might occur when Opening the File
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf

_ExcelBookSaveAs($oExcel, @ScriptDir & "\SaveAsExample2", "xls", 0, 1, "ReadOnly") ;Save the File as 'SaveAsExample2.xls"
If Not @error Then MsgBox(0, "Success", "File was Saved!", 3)
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

$oExcel = _ExcelBookOpen(@ScriptDir & "\SaveAsExample2.xls", 1, False) ;Open The previous File to show the password protection


Function _ExcelColumnDelete

Function Reference

_ExcelColumnDelete

Delete a number of columns from the active worksheet.

#Include <Excel.au3>
_ExcelColumnDelete($oExcel, $iColumn [, $iNumCols = 1])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iColumn | The specified column number to delete
$iNumCols | [optional] The number of columns to delete

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 1 - Specified object does not exist
 | 2 - Specified column is invalid

Remarks

This function will shift left all columns after the deleted columns(s)

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Delete 1 Column, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, 1, $i) ;Write to the Cell Horizontally using values 1 to 5
Next

ToolTip("Deleting Column Soon...")
Sleep(3500)

_ExcelColumnDelete($oExcel, 1, 1) ;Delete Column 1 and only delete 1 column

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Delete some columns, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, 1, $i) ;Write to the Cell Horizontally using values 1 to 5
Next

ToolTip("Deleting Columns Soon...")
Sleep(3500)

_ExcelColumnDelete($oExcel, 3, 2) ;Delete Columns starting at column 3, and delete 2 columns

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelColumnInsert

Function Reference

_ExcelColumnInsert

Insert a number of columns into the active worksheet.

#Include <Excel.au3>
_ExcelColumnInsert($oExcel, $iColumn [, $iNumCols = 1])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iColumn | The specified column number to begin insertion
$iNumCols | [optional] The number of columns to insert

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 1 - Specified object does not exist
 | 2 - Specified column is invalid

Remarks

This function will shift right all columns after the inserted columns(s)

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Insert 1 column, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

ToolTip("Inserting Column(s) Soon...")
Sleep(3500) ;Pause to let user view action

_ExcelColumnInsert($oExcel, 1, 1) ;Insert 1 Column at column 1

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Insert columns, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

; We can fill-up some cells using a simple loop and random Numbers
For $i = 1 To 10
For $j = 1 To 10
_ExcelWriteCell($oExcel, Round(Random(1, 100), 0), $i, $j) ;Round off some random numbers to file
Next
Next

ToolTip("Inserting Column(s) Soon...")
Sleep(3500) ;Pause to let user view action

_ExcelColumnInsert($oExcel, 2, 3) ;Insert 3 Columns at column 2

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelFontSetProperties

Function Reference

_ExcelFontSetProperties

Set the bold, italic, and underline font properties of a range in an Excel object.

#Include <Excel.au3>
_ExcelFontSetProperties($oExcel, $sRangeOrRowStart [, $iColStart = 1 [, $iRowEnd = 1 [, $iColEnd = 1 [, $fBold = False [, $fItalic = False [, $fUnderline = False]]]]]])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sRangeOrRowStart | Either an A1 range, or an integer row number to start from if using R1C1
$iColStart | [optional] The starting column for the number format(left) (default=1)
$iRowEnd | [optional] The ending row for the number format (bottom) (default=1)
$iColEnd | [optional] The ending column for the number format (right) (default=1)
$fBold | [optional] Bold flag: TRUE=Bold, FALSE=No Bold (remove bold type)
$fItalic | [optional] Italic flag: TRUE=Italic, FALSE=No Italic (remove italic type)
$fUnderline | [optional] Underline flag: TRUE=Underline, FALSE=No Underline (remove underline type)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 1 - Specified object does not exist
 | 2 - Starting row or column invalid
 | 3 - Ending row or column invalid
@extended: | 0 - Row invalid
 | 1 - Column invalid

Remarks

None

Related

Example

; *****************************************************************
; Example 1 - After opening a workbook and returning its object identifier: Sets the Font Properties in a range.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
Local $sRangeOrRowStart = 1, $iColStart = 1, $iRowEnd = 10, $iColEnd = 10
Local $fBold, $fItalic, $fUnderline, $i = 1

; We can fill-up some cells using a simple loop and random Numbers
For $i = 1 To 10
For $j = 1 To 10
_ExcelWriteCell($oExcel, Round(Random(1, 100), 0), $i, $j) ;Round off some random numbers to file
Next
Next

MsgBox(0, "_ExcelHorizontalAlignSet", "Notice the Font Properties, This will go through all the Possible Combinations" & @CRLF & "Press OK to Continue")

$i = 1
_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: : " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, True, True, True)
ToolTip("New Font Setting: " & $i)
$i += 1
Sleep(2500)

_ExcelFontSetProperties($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, False, False, False)
ToolTip("New Font Setting: " & $i)

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelHorizontalAlignSet

Function Reference

_ExcelHorizontalAlignSet

Set the horizontal alignment of each cell in a range.

#Include <Excel.au3>
_ExcelHorizontalAlignSet($oExcel, $sRangeOrRowStart [, $iColStart = 1 [, $iRowEnd = 1 [, $iColEnd = 1 [, $sHorizAlign = "left"]]]])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sRangeOrRowStart | Either an A1 range, or an integer row number to start from if using R1C1
$iColStart | [optional] The starting column for the number format(left) (default=1)
$iRowEnd | [optional] The ending row for the number format (bottom) (default=1)
$iColEnd | [optional] The ending column for the number format (right) (default=1)
$sHorizAlign | [optional] Horizontal alignment ("left"|"center"|"right") (default="left")

Return Value

Success: | 1
Failure: | 0 and sets @error on errors:
@error: | 1 - Specified object does not exist
 | 2 - Starting row or column invalid
 | 3 - Ending row or column invalid
@extended: | 0 - Row invalid
 | 1 - Column invalid

Remarks

None

Related

Example

; *****************************************************************
; Example 1 - After opening a workbook and returning its object identifier: Sets the horizontal alignment of each cell in a range.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
Local $sRangeOrRowStart = 1, $iColStart = 1, $iRowEnd = 10, $iColEnd = 10, $sHorizAlign = "left"

; We can fill-up some cells using a simple loop and random Numbers
For $i = 1 To 10
For $j = 1 To 10
_ExcelWriteCell($oExcel, Round(Random(1, 100), 0), $i, $j) ;Round off some random numbers to file
Next
Next

MsgBox(0, "_ExcelHorizontalAlignSet", "Notice the Alignment" & @CRLF & "Press OK to Continue")

_ExcelHorizontalAlignSet($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, $sHorizAlign)
MsgBox(0, "_ExcelHorizontalAlignSet", "Alignment should be 'left'")

$sHorizAlign = "center"
_ExcelHorizontalAlignSet($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, $sHorizAlign)
MsgBox(0, "_ExcelHorizontalAlignSet", "Alignment should be 'center'")

$sHorizAlign = "right"
_ExcelHorizontalAlignSet($oExcel, $sRangeOrRowStart, $iColStart, $iRowEnd, $iColEnd, $sHorizAlign)
MsgBox(0, "_ExcelHorizontalAlignSet", "Alignment should be 'right'")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelHyperlinkInsert

Function Reference

_ExcelHyperlinkInsert

Inserts a hyperlink into the active page.

#Include <Excel.au3>
_ExcelHyperlinkInsert($oExcel, $sLinkText, $sAddress, $sScreenTip, $sRangeOrRow [, $iColumn = 1])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sLinkText | The text to display the hyperlink as
$sAddress | The URL to link to, as a string
$sScreenTip | The popup screen tip, as a string
$sRangeOrRow | The range in A1 format, or a row number for R1C1 format
$iColumn | [optional] The specified column number for R1C1 format (default = 1)

Return Value

Success: | 1
Failure: | 0 and sets @error on errors:
@error: | 1 - Specified object does not exist
 | 2 - Row or column invalid
@extended: | 0 - Row invalid
 | 1 - Column invalid

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Write a Hyperlink to a Cell, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$sLinkText = "AutoIt Website" ;Text Viewed in the Cell, equivalent to OuterText
$sAddress = "http://www.AutoItScript.com" ;Actual Link, equivalent to href
$sScreenTip = "AutoIt is Awesome! And Don't You Forget it!" ;The Screen Tip that Appears on MouseOver
_ExcelHyperlinkInsert($oExcel, $sLinkText, $sAddress, $sScreenTip, 1, 2) ;Insert At Row 1 Column 2

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelNumberFormat

Function Reference

_ExcelNumberFormat

Applies the specified formatting to the cells in the specified R1C1 Range.

#Include <Excel.au3>
_ExcelNumberFormat($oExcel, $sFormat, $sRangeOrRowStart [, $iColStart = 1 [, $iRowEnd = 1 [, $iColEnd = 1]]])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sFormat | The formatting string to apply to the specified range (see Notes below)
$sRangeOrRowStart | Either an A1 range, or an integer row number to start from if using R1C1
$iColStart | [optional] The starting column for the number format(left)
$iRowEnd | [optional] The ending row for the number format (bottom)
$iColEnd | [optional] The ending column for the number format (right)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Starting row or column invalid
 | 3 - Ending row or column invalid
@extended: | 0 - Row invalid
 | 1 - Column invalid

Remarks

For more information about possible formatting strings that can be used with this command, consult the book:
"Programming Excel With VBA and .NET," by Steven Saunders and Jeff Webb, ISBN: 978-0-59-600766-9

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Format Numbers, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

; We can fill-up some cells using a simple loop and random Numbers
For $y = 1 To 10
For $x = 1 To 10
_ExcelWriteCell($oExcel, Random(1000, 10000), $x, $y) ;Some random numbers to file
Next
Next

$sFormat = "$#,##0.00" ;Format String tells _ExcelNumberFormat to make it a $ currency
_ExcelNumberFormat($oExcel, $sFormat, 1, 1, 5, 5) ;Start on Row 1, Start on Column 1, End on Row 5, End on Column 5

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Format Numbers, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
Local $aFormatExamples[5] = ["Format Examples", "General", "hh:mm:ss", "$#,##0.00", "[Red]($#,##0.00)"] ;Array to Create Headers

For $i = 0 To UBound($aFormatExamples) - 1 ;Use loop to write headers
_ExcelWriteCell($oExcel, $aFormatExamples[$i], 1, $i + 1) ; +1 to $i so that 0-base index and row match
Next

; We can fill-up some cells using a simple loop and random Numbers
For $y = 2 To 5 ;Start on Column 2
For $x = 2 To 10
_ExcelWriteCell($oExcel, Random(1000, 10000), $x, $y) ;Some random numbers to file
Next
Next

ToolTip("Formatting Column(s) Soon...")
Sleep(3500) ;Pause to let user view action

; We can format using a simple loop
; Each Column will have a differnt type of Format
For $i = 1 To UBound($aFormatExamples) - 1
_ExcelNumberFormat($oExcel, $aFormatExamples[$i], 2, $i, 11, $i)
Next

$oExcel.Columns.AutoFit ;AutoFits the Columns for better viewing
$oExcel.Rows.AutoFit ;AutoFits the Rows for better viewing

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelReadArray

Function Reference

_ExcelReadArray

Create an array from a row or column of the active worksheet.

#Include <Excel.au3>
_ExcelReadArray($oExcel, $iStartRow, $iStartColumn, $iNumCells [, $iDirection = 0 [, $iIndexBase = 0]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iStartRow | The table row to start reading the array from
$iStartColumn | The table column to start reading the array from
$iNumCells | The number of cells to read into the array
$iDirection | [optional] The direction of the cells to read into array (0=right, 1=down)
$iIndexBase | [optional] Specify whether array created is to have index base of either 0 or 1

Return Value

Success: | an array with the specified cell contents
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Parameter out of range
 | 3 - Invalid number of cells
 | 4 - Invalid direction parameter
@extended: | 0 - Row out of range
 | 1 - Column out of range

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Read the cells into an array, display array,
; then Save and Close file.
; *****************************************************************

#include <Excel.au3>
#include <Array.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, Asc($i), 1, $i + 2) ;Write to the Cell Horizontally, using Asc just to use different values for reading purposes
Next

$aArray1 = _ExcelReadArray($oExcel, 1, 1, 5, 1) ;Direction is Vertical
$aArray2 = _ExcelReadArray($oExcel, 1, 3, 5) ;Direction is Horizontal
_ArrayDisplay($aArray2, "Horizontal")
_ArrayDisplay($aArray1, "Vertical")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelReadCell

Function Reference

_ExcelReadCell

Read information from the active worksheet of the specified Excel object.

#Include <Excel.au3>
_ExcelReadCell($oExcel, $sRangeOrRow [, $iColumn = 1])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sRangeOrRow | Either an A1 range, or an integer row number to read from if using R1C1
$iColumn | [optional] The column to read from if using R1C1 (default = 1)

Return Value

Success: | the data from the specified cell
Failure: | 0 and sets @error
@error: | 0 _ No error
 | 1 - Specified object does not exist
 | 2 - Specified parameter is incorrect
@extended: | 0 - Row out of valid range
 | 1 - Column out of valid range

Remarks

This function will only read one cell per call - if the specified range spans
multiple cells, only the content of the top left cell will be returned.

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell after opening a workbook and returning its object identifier. Read the cell, then Save and Close file.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelWriteCell($oExcel, "I Wrote to This Cell", 1, 1) ;Write to the Cell
$sCellValue = _ExcelReadCell($oExcel, 1, 1)
MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Read the cells, then Save and Close file.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell
Next

For $i = 1 To 5 ;Loop
$sCellValue = _ExcelReadCell($oExcel, $i, 1)
MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
Next

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelReadSheetToArray

Function Reference

_ExcelReadSheetToArray

Create a 2D array from the rows/columns of the active worksheet.

#Include <Excel.au3>
_ExcelReadSheetToArray($oExcel [, $iStartRow = 1 [, $iStartColumn = 1 [, $iRowCnt = 0 [, $iColCnt = 0 [, $iColShift = False]]]]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iStartRow | [optional] Row number to start reading, defaults to 1 (first row)
$iStartColumn | [optional] Column number to start reading, defaults to 1 (first column)
$iRowCnt | [optional] Count of rows to read, defaults to 0 (all)
$iColCnt | [optional] Count of columns to read, defaults to 0 (all)
$iColShift | [optional] Determines if the Array returned, from Excel, will begin in the 0-index base or 1-index base Column. False by Default to match R1C1 values.

Return Value

Success: | a 2D array with the specified cell contents by [$row][$col]
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Start parameter out of range
 | 3 - Count parameter out of range
@extended: | 0 - Row count out of range
 | 1 - Column count out of range

Remarks

Returned array has row count in [0][0] and column count in [0][1].
Except for the counts above, row 0 and col 0 of the returned array are empty, as actual
cell data starts at [1][1] to match R1C1 numbers.
By default the entire sheet is returned.
If the sheet is empty [0][0] and [0][1] both = 0.

Related

Example

; ******************************************************************************************
; Example 1 - After opening a workbook and returning its object identifier,
; Fill some cells and Read the Values into an Array, using various paramaters.
; ******************************************************************************************

#include <Excel.au3>
#include <Array.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

; We can fill-up some cells using a simple loop and random Numbers
For $y = 1 To 10 ;Start on Column 1
For $x = 1 To 15
_ExcelWriteCell($oExcel, Round(Random(1000, 10000), 0), $x, $y) ;Some random numbers to file
Next
Next

$aArray = _ExcelReadSheetToArray($oExcel) ;Using Default Parameters
_ArrayDisplay($aArray, "Array using Default Parameters")

$aArray = _ExcelReadSheetToArray($oExcel, 2) ;Starting on the 2nd Row
_ArrayDisplay($aArray, "Starting on the 2nd Row")

$aArray = _ExcelReadSheetToArray($oExcel, 1, 2) ;Starting on the 2nd Column
_ArrayDisplay($aArray, "Starting on the 2nd Column")

$aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 5) ;Read 5 Rows
_ArrayDisplay($aArray, "Read 5 Rows")

$aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2) ;Read 2 Columns
_ArrayDisplay($aArray, "Read 2 Columns")

$aArray = _ExcelReadSheetToArray($oExcel, 2, 3, 4, 5) ;Starting on the 2nd Row, 3rd Column, Read 4 Rows and 5 Columns
_ArrayDisplay($aArray, "Starting on the 2nd Row, 3rd Column, Read 4 Rows and 5 Columns")

$aArray = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 0, True) ;Using Default Parameters, except Shifting Column (True)
_ArrayDisplay($aArray, "Array with Column shifting")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelRowDelete

Function Reference

_ExcelRowDelete

Delete a number of rows from the active worksheet.

#Include <Excel.au3>
_ExcelRowDelete($oExcel, $iRow [, $iNumRows = 1])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iRow | The specified row number to delete
$iNumRows | [optional] The number of rows to delete

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Specified row is invalid

Remarks

This function will shift upward all rows after the deleted row(s)

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Delete 1 row, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

ToolTip("Deleting Rows Soon...")
Sleep(3500)

_ExcelRowDelete($oExcel, 1, 1) ;Delete Row 1 and only delete 1 Row

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Delete some rows, then Save and Close file.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ; Open new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

ToolTip("Deleting Rows Soon...")
Sleep(3500)

_ExcelRowDelete($oExcel, 3, 2) ;Delete Rows starting at row 3, and delete 2 Rows

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelRowInsert

Function Reference

_ExcelRowInsert

Insert a number of rows into the active worksheet.

#Include <Excel.au3>
_ExcelRowInsert($oExcel, $iRow [, $iNumRows = 1])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iRow | The row position for insertion
$iNumRows | [optional] The number of rows to insert

Return Value

@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Specified row postion is invalid

Remarks

This function will shift downward all rows before the inserted row(s)

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Insert 1 row, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

ToolTip("Inserting Row(s) Soon...")
Sleep(3500) ;Pause to let user view action

_ExcelRowInsert($oExcel, 1, 1) ;Insert 1 Row at row 1

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Insert rows, then Save and Close file.
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 5 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell Vertically using values 1 to 5
Next

ToolTip("Inserting Row(s) Soon...")
Sleep(3500)

_ExcelRowInsert($oExcel, 2, 3) ;Insert 3 Rows at row 2

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetActivate

Function Reference

_ExcelSheetActivate

Activate the specified sheet by string name or by number.

#Include <Excel.au3>
_ExcelSheetActivate($oExcel, $vSheet)

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$vSheet | The sheet to activate, either by string name or by number

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Specified sheet number does not exist
 | 3 - Specified sheet name does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Activate a Sheet by using the string value of the Sheet Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetActivate($oExcel, "Sheet2")

MsgBox(0, "Exiting", "Notice How Sheet2 is Active and not Sheet1" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Activate a Sheet by using the Index Value the Sheet
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetActivate($oExcel, 2)

MsgBox(0, "Exiting", "Notice How Sheet2 is Active and not Sheet1" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Activate a Sheet by using the Index Value the Sheet
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$iNumberOfWorksheets = $oExcel.Worksheets.Count

MsgBox(0, "", $oExcel.Worksheets.Count)
_ExcelSheetActivate($oExcel, 2)

MsgBox(0, "Exiting", "Notice How Sheet2 is Active and not Sheet1" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetAddNew

Function Reference

_ExcelSheetAddNew

Add new sheet to workbook - optionally with a name.

#Include <Excel.au3>
_ExcelSheetAddNew($oExcel [, $sName = ""])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sName | [optional] The name of the sheet to create (default follows standard Excel new sheet convention)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Add a New Sheet
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetAddNew($oExcel, "New Sheet Example")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetDelete

Function Reference

_ExcelSheetDelete

Delete the specified sheet by string name or by number.

#Include <Excel.au3>
_ExcelSheetDelete($oExcel, $vSheet [, $fAlerts = False])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$vSheet | The sheet to delete, either by string name or by number
$fAlerts | [optional] Allow modal alerts (True or False) (default=False)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Specified sheet number does not exist
 | 3 - Specified sheet name does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Delete a Worksheet by String Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetDelete($oExcel, "Sheet1") ;Delete Sheet by string name of SheetName

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Delete a Worksheet by Index
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetDelete($oExcel, 1) ;Delete Sheet by index of SheetName

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetList

Function Reference

_ExcelSheetList

Return a list of all sheets in workbook, by name, as an array.

#Include <Excel.au3>
_ExcelSheetList($oExcel)

Parameters

$oExcel An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()

Return Value

Success: | an array of the sheet names in the workbook (the zero index stores the sheet count)
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, create and display an array of all the Sheet Names in the workbook
; *****************************************************************
#include <Excel.au3>
#include <Array.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$aArray = _ExcelSheetList($oExcel)
_ArrayDisplay($aArray, "All The WorkSheets In this WorkBook")

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, create an array of all the Sheet Names in the workbook
; and Activate each Sheet by String Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$aArray = _ExcelSheetList($oExcel)

For $i = $aArray[0] To 1 Step -1 ;Work backwards through loop
_ExcelSheetActivate($oExcel, $aArray[$i]) ;Using the String Name returned in the Array Elements
MsgBox(0, "ActiveSheet", "The Active Sheet should be:" & @CRLF & $aArray[$i])
Next

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 3 - After opening a workbook and returning its object identifier, create an array of all the Sheet Names in the workbook
; and Activate each Sheet by Index
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$aArray = _ExcelSheetList($oExcel)

For $i = $aArray[0] To 1 Step -1 ;Work backwards through loop
_ExcelSheetActivate($oExcel, $i) ;Using the Index of the Array
MsgBox(0, "ActiveSheet", "The Active Sheet should be:" & @CRLF & $aArray[$i])
Next

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 4 - After opening a workbook and returning its object identifier, create an array of all the Sheet Names in the workbook
; and Activate each Sheet by Index. On each sheet Write the array to the worksheet and put in some random numbers
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

$aArray = _ExcelSheetList($oExcel)

For $i = $aArray[0] To 1 Step -1 ;Work backwards through loop
_ExcelSheetActivate($oExcel, $i) ;Using the Index of the Array
_ExcelWriteArray($oExcel, 1, 1, $aArray, 1) ;Write the Array to the Active Worksheet
; We can fill-up some cells using a simple loop and random Numbers
For $y = 2 To 10
For $x = 2 To 10
_ExcelWriteCell($oExcel, Round(Random(1000, 10000), 0), $x, $y) ;Some random numbers to file
Next
Next
MsgBox(0, "ActiveSheet", "The Active Sheet should be:" & @CRLF & $aArray[$i])
Next

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetMove

Function Reference

_ExcelSheetMove

Move the specified sheet before another specified sheet.

#Include <Excel.au3>
_ExcelSheetMove($oExcel, $vMoveSheet [, $vRelativeSheet = 1 [, $fBefore = True]])

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$vMoveSheet | The name or number of the sheet to move (a string or integer)
$vRelativeSheet | [optional] The moved sheet will be placed before or after this sheet (a string or integer, defaults to first sheet)
$fBefore | [optional] The moved sheet will be placed before the relative sheet if true, after it if false (True or False) (default=True)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Specified sheet number to move does not exist
 | 3 - Specified sheet name to move does not exist
 | 4 - Specified relative sheet number does not exist
 | 5 - Specified relative sheet name does not exist

Remarks

None

Related

Example

; *****************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Move a Sheet by using the Index Value the Sheet
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
_ExcelSheetMove($oExcel, 2) ;Move the 2nd sheet to the first position (integer/index based)
MsgBox(0, "Exiting", "Notice How Sheet2 is in the 1st Position" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; *****************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Move a Sheet by referencing the Worksheet String Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
_ExcelSheetMove($oExcel, "Sheet2") ;Move the 2nd sheet to the first position (string/name based)
MsgBox(0, "Exiting", "Notice How Sheet2 is in the 1st Position" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 3 - After opening a workbook and returning its object identifier, Move a Sheet by using the Index Value the Sheet
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
;Add some sheets, and do Some arranging
$sSheetName4 = "Sheet4"
$sSheetName5 = "Sheet5"
_ExcelSheetAddNew($oExcel, $sSheetName4) ;Add another sheet
_ExcelSheetMove($oExcel, $sSheetName4, 4, False) ;Move $sSheetName4 to the 4th position (false puts it after the relative sheet)

_ExcelSheetAddNew($oExcel, $sSheetName5) ;Add another sheet
_ExcelSheetMove($oExcel, $sSheetName5, 5, False) ;Move $sSheetName4 5th position (false puts it after the relative sheet)

MsgBox(0, "Show", "Take note of the order of the Worksheets" & @CRLF & @CRLF & "Press OK to Continue")

_ExcelSheetMove($oExcel, $sSheetName5, "Sheet3", True) ;Move the 5th sheet to the relative before position of the sheet named: 'Sheet3'
MsgBox(0, "Exiting", "'" & $sSheetName5 & "'" & " when the $fBefore paramter is True (Relative to 'Sheet3')" & @CRLF & @CRLF & "Press OK to Continue")
_ExcelSheetMove($oExcel, $sSheetName5, "Sheet3", False) ;Move the 5th sheet to the relative before position of the sheet named: 'Sheet3'
MsgBox(0, "Exiting", "'" & $sSheetName5 & "'" & " when the $fBefore paramter is False (Relative to 'Sheet3')" & @CRLF & @CRLF & "Now Press OK to Save File and Exit")

_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetNameGet

Function Reference

_ExcelSheetNameGet

Return the name of the active sheet.

#Include <Excel.au3>
_ExcelSheetNameGet($oExcel)

Parameters

$oExcel An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()

Return Value

Success: | the name of the active sheet (string)
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Return the Active Sheet Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

MsgBox(0, "Sheet Name", "The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Add a New Sheet and Return the Active Sheet Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

MsgBox(0, "Sheet Name", "The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))

_ExcelSheetAddNew($oExcel, "New Sheet Example") ;Add a New Sheet

MsgBox(0, "Sheet Name", "Now The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelSheetNameSet

Function Reference

_ExcelSheetNameSet

Set the name of the active sheet.

#Include <Excel.au3>
_ExcelSheetNameSet($oExcel, $sSheetName)

Parameters

$oExcel | An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sSheetName | The new name for the sheet

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier, Set the Active Sheet Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelSheetNameSet($oExcel, "Example") ;Rename Active Sheet

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - After opening a workbook and returning its object identifier, Display the Active Sheet Name, change it and Display New Name
; *****************************************************************
#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

MsgBox(0, "Sheet Name", "The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))

_ExcelSheetNameSet($oExcel, "Example") ;Rename Active Sheet

MsgBox(0, "Sheet Name", "Now The Current Active Sheet Name Is:" & @CRLF & _ExcelSheetNameGet($oExcel))

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelWriteArray

Function Reference

_ExcelWriteArray

Write an array to a row or column on the active worksheet of the specified Excel object.

#Include <Excel.au3>
_ExcelWriteArray($oExcel, $iStartRow, $iStartColumn, $aArray [, $iDirection = 0 [, $iIndexBase = 0]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$iStartRow | The table row to start writing the array to
$iStartColumn | The table column to start writing the array to
$aArray | The array to write into the sheet
$iDirection | [optional] The direction to write the array (0=right, 1=down)
$iIndexBase | [optional] Specify an array index base of either 0 or 1

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Parameter out of range
 | 3 - Array doesn't exist / variable is not an array
 | 4 - Invalid direction parameter
@extended: | 0 - Row out of range
 | 1 - Column out of range

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier. Declare an Array, then input the Array
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

;Declare the Array
Local $aArray[5] = ["LocoDarwin", "Jon", "big_daddy", "DaleHolm", "GaryFrost"]

_ExcelWriteArray($oExcel, 1, 1, $aArray) ; Write the Array Horizontally
_ExcelWriteArray($oExcel, 5, 1, $aArray, 1) ; Write the Array Vertically, starting on the 5th Row

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelWriteCell

Function Reference

_ExcelWriteCell

Write information to a cell on the active worksheet of the specified Excel object.

#Include <Excel.au3>
_ExcelWriteCell($oExcel, $sValue, $sRangeOrRow [, $iColumn = 1])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sValue | Value to be written
$sRangeOrRow | Either an A1 range, or an integer row number to write to if using R1C1
$iColumn | [optional] The column to write to if using R1C1 (default = 1)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 _ No error
 | 1 - Specified object does not exist
 | 2 - Parameter out of range
@extended: | 0 - Row out of range
 | 1 - Column out of range

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell after opening a workbook and returning its object identifier. Then Save and Close file
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelWriteCell($oExcel, "I Wrote to This Cell", 1, 1) ;Write to the Cell

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 2 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Then Save and Close file.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 20 ;Loop
_ExcelWriteCell($oExcel, "I Wrote to This Cell", $i, 1) ;Write to the Cell
Next

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out

; ***************************************************************
; Example 3 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Then enters Forumulas using _ExcelWriteCell
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 1 To 20 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell
Next

_ExcelWriteCell($oExcel, "=Average(A:A)", 1, 2) ;Uses A1 referencing, not R1C1
_ExcelWriteCell($oExcel, "=Average(A1:A20)", 1, 3) ;Write formula another way Uses A1 referencing, not R1C1

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelWriteFormula

Function Reference

_ExcelWriteFormula

Write a formula to a cell on the active worksheet of the specified Excel object.

#Include <Excel.au3>
_ExcelWriteFormula($oExcel, $sFormula, $sRangeOrRow [, $iColumn = 1])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$sFormula | Formula to be written
$sRangeOrRow | Either an A1 range, or an integer row number to write to if using R1C1
$iColumn | [optional] The column to write to if using R1C1 (default = 1)

Return Value

Success: | 1
Failure: | 0 and sets @error
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Parameter out of range
@extended: | 0 - Row out of range
 | 1 - Column out of range

Remarks

None

Related

Example

; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Then enters a Forumula.
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

For $i = 0 To 20 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell
Next

_ExcelWriteFormula($oExcel, "=Average(R1C1:R20C1)", 1, 2) ;Uses R1C1 referencing

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


Function _ExcelWriteSheetFromArray

Function Reference

_ExcelWriteSheetFromArray

Writes a 2D array to the active worksheet

#Include <Excel.au3>
_ExcelWriteSheetFromArray($oExcel, ByRef $aArray [, $iStartRow = 1 [, $iStartColumn = 1 [, $iRowBase = 1 [, $iColBase = 1]]]])

Parameters

$oExcel | Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew()
$aArray | The array ByRef to write data from (array is not modified)
$iStartRow | [optional] The table row to start writing the array to, default is 1
$iStartColumn | [optional] The table column to start writing the array to, default is 1
$iRowBase | [optional] array index base for rows, default is 1
$iColBase | [optional] array index base for columns, default is 1

Return Value

Success: | 1
Failure: | 0 and sets @error on errors:
@error: | 0 - No error
 | 1 - Specified object does not exist
 | 2 - Parameter out of range
 | 3 - Array invalid
 | 4 - Base index out of range
@extended: | 0 - Row out of range
 | 1 - Col out of range

Remarks

Default base indexes in the array are both = 1, so first cell written is from $aArray[1][1].

Related

Example

; ***************************************************************
; Example 1 - After opening a workbook and returning its object identifier. Declare a 2-D Array, then input the Array
; *****************************************************************

#include <Excel.au3>

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

;Declare the Array
Local $aArray[5][2] = [["LocoDarwin", 1],["Jon", 2],["big_daddy", 3],["DaleHolm", 4],["GaryFrost", 5]] ;0-Base Array
_ExcelWriteSheetFromArray($oExcel, $aArray, 1, 1, 0, 0) ;0-Base Array parameters

MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "\Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out


User Defined Functions

File user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <File.au3>.

User Defined Function | Description
_FileCountLines | Returns the number of lines in the specified file.
_FileCreate | Creates or zero's out the length of the file specified.
_FileListToArray | Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)
_FilePrint | Prints a plain text file.
_FileReadToArray | Reads the specified file into an array.
_FileWriteFromArray | Writes Array records to the specified file.
_FileWriteLog | Writes current date,time and the specified text to a log file.
_FileWriteToLine | Writes text to a specific line in a file.
_PathFull | Creates a path based on the relative path you provide. The newly created absolute path is returned
_PathGetRelative | Returns the relative path to a directory
_PathMake | Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.
_PathSplit | Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.
_ReplaceStringInFile | Replaces a string with another string in the given text file (binary won't work!)
_TempFile | Generate a name for a temporary file. The file is guaranteed not to exist yet.


Function _FileCountLines

Function Reference

_FileCountLines

Returns the number of lines in the specified file.

#Include <File.au3>
_FileCountLines($sFilePath)

Parameters

$sFilePath Path and filename of the file to be read

Return Value

Success: | number of lines in the file.
Failure: | 0 and set @error
@Error: | 1 = File cannot be opened or found.

Remarks

It does not count a final @LF as a line.

Related

Example

#include <file.au3>
$CountLines = _FileCountLines("error.log")
MsgBox(64, "Error log recordcount", "There are " & $CountLines & " in the error.log.")
Exit


Function _FileCreate

Function Reference

_FileCreate

Creates or zero's out the length of the file specified.

#Include <File.au3>
_FileCreate($sFilePath)

Parameters

$sFilePath Path and filename of the file to be created.

Return Value

Success: | 1
Failure: | 0 an set @error
@Error: | 1 = Error opening specified file
 | 2 = File could not be written to

Remarks

None.

Related

FileOpen

Example

#include <File.au3>
If Not _FileCreate("error.log") Then
MsgBox(4096,"Error", " Error Creating/Resetting log. error:" & @error)
EndIf


Function _FileListToArray

Function Reference

_FileListToArray

Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch)

#Include <File.au3>
_FileListToArray($sPath [, $sFilter = "*" [, $iFlag = 0]])

Parameters

$sPath | Path to generate filelist for.
$sFilter | [optional] the filter to use, default is *. Search the Autoit3 helpfile for the word "WildCards" For details.
$iFlag | [optional] specifies whether to return files folders or both $iFlag=0(Default) Return both files and folders $iFlag=1 Return files only $iFlag=2 Return Folders only

Return Value

Success: | an Array, see remarks
Failure: | 0
@Error: | 1 = Path not found or invalid
 | 2 = Invalid $sFilter
 | 3 = Invalid $iFlag
 | 4 = No File(s) Found

Remarks

The array returned is one-dimensional and is made up as follows:
$array[0] = Number of Files\Folders returned
$array[1] = 1st File\Folder
$array[2] = 2nd File\Folder
$array[3] = 3rd File\Folder
$array[n] = nth File\Folder

Related

Example

#Include <File.au3>
#Include <Array.au3>

$FileList=_FileListToArray(@DesktopDir)
If @Error=1 Then
MsgBox (0,"","No Folders Found.")
Exit
EndIf
If @Error=4 Then
MsgBox (0,"","No Files Found.")
Exit
EndIf
_ArrayDisplay($FileList,"$FileList")


Function _FilePrint

Function Reference

_FilePrint

Prints a plain text file.

#Include <File.au3>
_FilePrint($s_File [, $i_Show = @SW_HIDE])

Parameters

$s_File | The file to print.
$i_Show | [optional] The state of the window. (default = @SW_HIDE)

Return Value

Success: | 1
Failure: | 0 and sets @error according to the global constants list.

Remarks

Uses the ShellExecute function of shell32.dll.

Related

Example

#include <File.au3>

$file = FileOpenDialog("Print File", "", "Text Documents (*.txt)", 1)
If @error Then Exit

$print = _FilePrint($file)
If $print Then
MsgBox(0, "Print", "The file was printed.")
Else
MsgBox(0, "Print", "Error: " & @error & @CRLF & "The file was not printed.")
EndIf


Function _FileReadToArray

Function Reference

_FileReadToArray

Reads the specified file into an array.

#Include <File.au3>
_FileReadToArray($sFilePath, ByRef $aArray)

Parameters

$sFilePath | Path and filename of the file to be read.
$aArray | The array to store the contents of the file.

Return Value

Success: | 1
Failure: | 0 and set @error
@Error: | 1 = Error opening specified file
 | 2 = Unable to Split the file

Remarks

$aArray[0] will contain the number of records read into the array.

Related

_FileWriteFromArray

Example

#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("error.log",$aRecords) Then
MsgBox(4096,"Error", " Error reading log to Array error:" & @error)
Exit
EndIf
For $x = 1 to $aRecords[0]
Msgbox(0,'Record:' & $x, $aRecords[$x])
Next


Function _FileWriteFromArray

Function Reference

_FileWriteFromArray

Writes Array records to the specified file.

#Include <File.au3>
_FileWriteFromArray($File, $a_Array [, $i_Base = 0 [, $i_UBound = 0]])

Parameters

$File | String path of the file to write to, or a file handle returned from FileOpen().
$a_Array | The array to be written to the file.
$i_Base | [optional] Start Array index to read, normally set to 0 or 1. Default=0
$i_Ubound | [optional] Set to the last record you want to write to the File. default=0 - whole array.

Return Value

Success: | 1
Failure: | 0 and set @error
@Error: | 1 = Error opening specified file
 | 2 = Input is not an Array
 | 3 = Error writing to file

Remarks

If a string path is provided, the file is overwritten and closed.
To use other write modes, like append or Unicode formats, open the file with FileOpen() first and pass the file handle instead.
If a file handle is passed, the file will still be open after writing.

Related

_FileReadToArray

Example

#include<File.au3>

$avCommon = _FileListToArray(@CommonFilesDir)
$avUser = _FileListToArray(@UserProfileDir)
$sFile = @ScriptDir & "\Test.txt"

; Write first array to file by string file name
_FileWriteFromArray($sFile, $avCommon, 1)

; Open file and append second array
$hFile = FileOpen($sFile, 1) ; 1 = append
_FileWriteFromArray($hFile, $avUser, 1)
FileClose($hFile)

; Display results
Run("notepad.exe " & $sFile)


Function _FileWriteLog

Function Reference

_FileWriteLog

Writes current date,time and the specified text to a log file.

#Include <File.au3>
_FileWriteLog($sLogPath, $sLogMsg [, $iFlag = -1])

Parameters

$sLogPath | Path and filename of the file to be written to
$sLogMsg | Message to be written to the log file
$iFlag | [optional] Flag that defines if $sLogMsg will be written to the end of file, or to the begining. If $iFlag = -1 (default) $sLogMsg will be written to the end of file. If $iFlag <> -1 $sLogMsg will be written to begining of file.

Return Value

Success: | 1
Failure: | 0 and set @error
@Error: | 1 = Error opening specified file
 | 2 = File could not be written to

Remarks

None.

Related

FileOpen

Example

#include <file.au3>
;
_FileWriteLog(@ScriptDir & "\my.log","Text 1")
;
_FileWriteLog(@ScriptDir & "\my.log","Text 2")


Function _FileWriteToLine

Function Reference

_FileWriteToLine

Writes text to a specific line in a file.

#Include <File.au3>
_FileWriteToLine($sFile, $iLine, $sText [, $fOverWrite = 0])

Parameters

$sFile | The file to write to
$iLine | The line number to write to
$sText | The text to write
$fOverWrite | [optional] If set to 1 will overwrite the old line If set to 0 will not overwrite

Return Value

Success: | 1
Failure: | 0 and set @error
@Error: | 1 = File has less lines than $iLine
 | 2 = File does not exist
 | 3 = Error when opening file
 | 4 = $iLine is invalid
 | 5 = $fOverWrite is invalid
 | 6 = $sText is invalid

Remarks

If _FileWriteToLine is called with $fOverWrite as 1 and $sText as "", it will delete the line.

Related

Example

#include <File.au3>
;Example: Write to line 3 of c:\test.txt REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my replacement for line 3", 1)
;Example: Write to line 3 of c:\test.txt NOT REPLACING line 3
_FileWriteToLine("c:\test.txt", 3, "my insertion", 0)


Function _PathFull

Function Reference

_PathFull

Creates a path based on the relative path you provide. The newly created absolute path is returned

#Include <File.au3>
_PathFull($sRelativePath)

Parameters

$sRelativePath The relative path to be created

Return Value

Returns the newly created absolute path.

Remarks

None.

Related

_PathMake, _PathSplit, DirCreate, FileChangeDir

Example

#include <file.au3>
$TestPath = _PathFull(@ScriptDir & "..\..\test")
MsgBox(0,"demo _PathFull",@ScriptDir & @lf & $TestPath)


Function _PathGetRelative

Function Reference

_PathGetRelative

Returns the relative path to a directory

#Include <File.au3>
_PathGetRelative($sFrom, $sTo)

Parameters

$sFrom | Path to the source directory
$sTo | Path to the destination file or directory

Return Value

Success: | Relative path to the destination.
Failure: | Returns the destination and set @error
@error: | 1 - $sFrom equlas $sTo
 | 2 - Root drives of $sFrom and $sTo are different, a relative path is impossible.

Remarks

The returned path will not have a trailing "\", even if it is a root
drive returned after a failure.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <File.au3>

_Main()

Func _Main()
Local $from, $to, $path
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir")

$from = @ScriptDir
ConsoleWrite("Source Path: " & $from & @CRLF)
$to = $sFile & "\autoit3.exe"
ConsoleWrite("Dest Path: " & $to & @CRLF)
$path = _PathGetRelative($from, $to)
If @error Then
ConsoleWrite("Error: " & @error & @CRLF)
ConsoleWrite("Path: " & $path & @CRLF)
Else
ConsoleWrite("Relative Path: " & $path & @CRLF)
ConsoleWrite("Resolved Path: " & _PathFull($from & "\" & $path) & @CRLF)
EndIf

EndFunc ;==>_Main


Function _PathMake

Function Reference

_PathMake

Creates a path from drive, directory, file name and file extension parts. Not all parts must be passed.

#Include <File.au3>
_PathMake($szDrive, $szDir, $szFName, $szExt)

Parameters

$szDrive | Drive (Can be UNC). If it's a drive letter, a : is automatically appended
$szDir | Directory. A trailing slash is added if not found (No preceeding slash is added)
$szFName | The name of the file
$szExt | The file extension. A period is supplied if not found in the extension

Return Value

Returns the string containing the full path

Remarks

The path will still be built with what is passed. This doesn't check the validity of the path created, it could contain characters which are invalid on your filesystem.

Related

_PathFull, _PathSplit, DirCreate, FileChangeDir

Example

#include <file.au3>
;
$TestPath = _PathMake( "c:", "\temp", "boot", "ini")
MsgBox(0,"demo _PathMake",$TestPath)


Function _PathSplit

Function Reference

_PathSplit

Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing.

#Include <File.au3>
_PathSplit($szPath, ByRef $szDrive, ByRef $szDir, ByRef $szFName, ByRef $szExt)

Parameters

$szPath | The path to be split (Can contain a UNC server or drive letter)
$szDrive | String to hold the drive
$szDir | String to hold the directory
$szFName | String to hold the file name
$szExt | String to hold the file extension

Return Value

Returns an array with 5 elements where 0 = original path, 1 = drive, 2 = directory, 3 = filename, 4 = extension

Remarks

This function does not take a command line string. It works on paths, not paths with arguments.

Related

_PathFull, _PathMake

Example

#include <file.au3>
#include <array.au3>
Dim $szDrive, $szDir, $szFName, $szExt
$TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt)
_ArrayDisplay($TestPath,"Demo _PathSplit()")


Function _ReplaceStringInFile

Function Reference

_ReplaceStringInFile

Replaces a string with another string in the given text file (binary won't work!)

#Include <File.au3>
_ReplaceStringInFile($szFileName, $szSearchString, $szReplaceString [, $fCaseness = 0 [, $fOccurance = 1]])

Parameters

$szFileName | name of the file to open. ATTENTION !! Needs the FULL path, not just the name returned by eg. FileFindNextFile
$szSearchString | The string we want to replace in the file
$szReplaceString | The string we want as a replacement for $szSearchString
$fCaseness | [optional] 0 = Not Case sensitive (default), 1 = Case sensitive, case does matter
$fOccurance | [optional] 0 = Only first found is replaced, 1 = ALL occurrences are replaced (default)

Return Value

Success: | Returns the number of occurrences of $szSearchString we found
Failure: | Returns -1 and sets @error
@error: | 1 - Cannot open file
 | 2 - Cannot open temp file
 | 3 - Cannot write to temp file
 | 4 - Cannot delete original file
 | 5 - Cannot rename/move temp file
 | 6 - ReadOnly Attribute set.

Remarks

None.

Related

Example

#include <File.au3>

$find = "BEFORE"
$replace = "AFTER"

$filename = "C:\_ReplaceStringInFile.test"

$msg = "Hello Test " & $find & " Hello Test" & @CRLF
$msg &= "Hello Test" & @CRLF
$msg &= @CRLF
$msg &= $find

FileWrite($filename, $msg )

msgbox(0,"BEFORE",$msg)

$retval = _ReplaceStringInFile($filename,$find,$replace)
if $retval = -1 then
msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $filename & " Error: " & @error)
exit
else
msgbox(0, "INFO", "Found " & $retval & " occurances of the pattern: " & $find & " in the file: " & $filename)
endif

$msg = FileRead($filename, 1000)
msgbox(0,"AFTER",$msg)
FileDelete($filename)


Function _TempFile

Function Reference

_TempFile

Generate a name for a temporary file. The file is guaranteed not to exist yet.

#Include <File.au3>
_TempFile([$s_DirectoryName = @TempDir [, $s_FilePrefix = "~" [, $s_FileExtension = ".tmp" [, $i_RandomLength = 7]]]])

Parameters

$s_DirectoryName | [optional] Name of directory for filename, defaults to the users %TEMP% directory
$s_FilePrefix | [optional] File prefixname, defaults to "~"
$s_FileExtension | [optional] File extenstion, defaults to ".tmp"
$i_RandomLength | [optional] Number of characters to use to generate a unique name, defaults to 7

Return Value

Returns a Filename of a temporary file which does not exist

Remarks

None.

Related

Example

#include <File.au3>

Dim $s_TempFile, $s_FileName

; generate unique filename in @TempDir
$s_TempFile = _TempFile()

; generate unique filename in given directory and starting with tst_
$s_FileName = _TempFile("C:\", "tst_", ".txt", 7)

MsgBox(4096, "Info", "Names suitable for new temporary file : " & @LF & $s_TempFile & @LF & $s_FileName)

Exit


User Defined Functions

FTPEx user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <FTPEx.au3>.

User Defined Function | Description
_FTP_Close | Closes the _FTP_Open session.
_FTP_Command | Sends a command to an FTP server.
_FTP_Connect | Connects to an FTP server.
_FTP_DecodeInternetStatus | Decode a received Internet Status.
_FTP_DirCreate | Makes an Directory on an FTP server.
_FTP_DirDelete | Delete's an Directory on an FTP server.
_FTP_DirGetCurrent | Get Current Directory on an FTP server.
_FTP_DirPutContents | Puts an folder on an FTP server. Recursivley if selected.
_FTP_DirSetCurrent | Set Current Directory on an FTP server.
_FTP_FileClose | Closes the Handle returned by _FTP_FileOpen.
_FTP_FileDelete | Delete an file from an FTP server.
_FTP_FileGet | Get file from a FTP server.
_FTP_FileGetSize | Gets filesize of a file on the FTP server.
_FTP_FileOpen | Initiates access to a remote file on an FTP server for reading or writing.
_FTP_FilePut | Puts an file on an FTP server.
_FTP_FileRead | Reads data from a handle opened by _FTP_FileOpen()
_FTP_FileRename | Renames an file on an FTP server.
_FTP_FileTimeLoHiToStr | Closes the _FTP_Open session.
_FTP_FindFileClose | Delete FindFile Handle.
_FTP_FindFileFirst | Find First File on an FTP server.
_FTP_FindFileNext | Find Next File on an FTP server.
_FTP_GetLastResponseInfo | Retrieves the last error description or server response on the thread calling this function.
_FTP_ListToArray | Get Filenames, Directories or Both of current remote directory.
_FTP_ListToArray2D | Get Filenames and filesizes of current remote directory.
_FTP_ListToArrayEx | Get names, sizes, attributes aand times of files/dir of current remote directory.
_FTP_Open | Opens an FTP session.
_FTP_ProgressDownload | Downloads a file in Binary Mode and shows a Progress window or by Calling a User defined Function.
_FTP_ProgressUpload | Uploads a file in Binary Mode and shows a Progress window or by Calling a User defined Function
_FTP_SetStatusCallback | Registers callback function that WinINet functions can call as progress is made during an operation.


Function _FTP_Close

Function Reference

_FTP_Close

Closes the _FTP_Open session.

#Include <FTPEx.au3>
_FTP_Close($l_InternetSession)

Parameters

$l_InternetSession as returned by _FTP_Open()

Return Value

Success: | 1
Failure: | 0

Remarks

None.

Related

_FTP_Open

See Also

Search InternetCloseHandle in MSDN Library

Example

#include <FTPEx.au3>

$Open = _FTP_Open('MyFTP Control')
; ...
$Ftpc = _FTP_Close($Open)


Function _FTP_Command

Function Reference

_FTP_Command

Sends a command to an FTP server.

#Include <FTPEx.au3>
_FTP_Command($l_FTPSession, $s_FTPCommand [, $l_Flags = 0x00000001 [, $l_ExpectResponse = 0 [, $l_Context = 0]]])

Parameters

$l_FTPSession | as returned by _FTP_Connect()
$s_FTPCommand | Command string to send to FTP Server
$l_Flags | [optional] $FTP_TRANSFER_TYPE_ASCII or $FTP_TRANSFER_TYPE_BINARY
$l_ExpectResponse | [optional] Data socket for response in Async mode. See remarks.
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | Returns an identifier.
Failure: | 0 and sets @ERROR.

Remarks

Command Examples: depends on server syntax/
The following is for Binary transfer, ASCII transfer, Passive transfer mode (used with firewalls) 'type I' 'type A' 'pasv'

If $l_ExpectResponse is set to TRUE, a pointer to a handle that is created if a valid data socket is opened is returned in @extended.

Related

_FTP_Connect, _FTP_SetStatusCallback

See Also

Search FtpCommand in MSDN Library


Function _FTP_Connect

Function Reference

_FTP_Connect

Connects to an FTP server.

#Include <FTPEx.au3>
_FTP_Connect($l_InternetSession, $s_ServerName, $s_Username, $s_Password [, $i_Passive = 0 [, $i_ServerPort = 0 [, $l_Service = 1 [, $l_Flags = 0 [, $l_Context = 0]]]]])

Parameters

$l_InternetSession | as returned by _FTP_Open()
$s_ServerName | Server name/ip.
$s_Username | Username.
$s_Password | Password.
$i_Passive | [optional] Passive mode.
$i_ServerPort | [optional] Server port ( 0 is default (21) )
$l_Service | [optional] I dont got a clue what this does.
$l_Flags | [optional] Special flags.
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | Returns an identifier
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_Open, _FTP_SetStatusCallback, _FTP_Command, _FTP_DirCreate, _FTP_DirDelete, _FTP_DirGetCurrent, _FTP_DirPutContents, _FTP_DirSetCurrent, _FTP_FileDelete, _FTP_FileGet, _FTP_FileGetSize, _FTP_FilePut, _FTP_FileRename, _FTP_ListToArray, _FTP_ListToArray2D, _FTP_ListToArrayEx

See Also

Search InternetConnect in MSDN Library

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)
; ...
$Ftpc = _FTP_Close($Open)


Function _FTP_DecodeInternetStatus

Function Reference

_FTP_DecodeInternetStatus

Decode a received Internet Status.

#Include <FTPEx.au3>
_FTP_DecodeInternetStatus($dwInternetStatus)

Parameters

$dwInternetStatus Internet status

Return Value

Returns an sTring

Remarks

None.

Related

_FTP_SetStatusCallback

Example

#include <FTPEx.au3>
#include <Debug.au3>

_DebugSetup( StringTrimRight(@ScriptName,4) &' example', True)

$server = 'ftp.mozilla.org'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Callback = _FTP_SetStatusCallback($Open, 'FTPStatusCallbackHandler')

$Conn = _FTP_Connect($Open, $server, $username, $pass, 0, $INTERNET_DEFAULT_FTP_PORT, $INTERNET_SERVICE_FTP, 0, $Callback)

$Ftpc = _FTP_Close($Open)

Func FTPStatusCallbackHandler($hInternet, $dwContent, $dwInternetStatus, $lpvStatusInformation, $dwStatusInformationLength)
If $dwInternetStatus = $INTERNET_STATUS_REQUEST_SENT Or $dwInternetStatus = $INTERNET_STATUS_RESPONSE_RECEIVED Then
Local $Size, $iBytesRead
$Size = DllStructCreate('dword')
_WinAPI_ReadProcessMemory(_WinAPI_GetCurrentProcess(), $lpvStatusInformation, DllStructGetPtr($Size), $dwStatusInformationLength, $iBytesRead)
_DebugOut(_FTP_DecodeInternetStatus($dwInternetStatus) & ' | Size = ' & DllStructGetData($Size, 1) & ' Bytes Bytes read = ' & $iBytesRead )
Else
_DebugOut(_FTP_DecodeInternetStatus($dwInternetStatus) )
EndIf
EndFunc ;==>_InternetStatusCallback


Function _FTP_DirCreate

Function Reference

_FTP_DirCreate

Makes an Directory on an FTP server.

#Include <FTPEx.au3>
_FTP_DirCreate($l_FTPSession, $s_Remote)

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_Remote | The Directory to Create.

Return Value

Success: | 1
Failure: | 0

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpCreateDirectory in MSDN Library


Function _FTP_DirDelete

Function Reference

_FTP_DirDelete

Delete's an Directory on an FTP server.

#Include <FTPEx.au3>
_FTP_DirDelete($l_FTPSession, $s_Remote)

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_Remote | The Directory to deleted.

Return Value

Success: | 1
Failure: | 0

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpRemoveDirectory in MSDN Library


Function _FTP_DirGetCurrent

Function Reference

_FTP_DirGetCurrent

Get Current Directory on an FTP server.

#Include <FTPEx.au3>
_FTP_DirGetCurrent($l_FTPSession)

Parameters

$l_FTPSession as returned by _FTP_Connect().

Return Value

Success: | Directory Name
Failure: | 0 and set @error

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpGetCurrentDirectory in MSDN Library


Function _FTP_DirPutContents

Function Reference

_FTP_DirPutContents

Puts an folder on an FTP server. Recursivley if selected.

#Include <FTPEx.au3>
_FTP_DirPutContents($l_InternetSession, $s_LocalFolder, $s_RemoteFolder, $b_RecursivePut [, $l_Context])

Parameters

$l_InternetSession | as returned by _FTP_Connect().
$s_LocalFolder | The local folder i.e. "c:\temp".
$s_RemoteFolder | The remote folder i.e. '/website/home'.
$b_RecursivePut | Recurse through sub-dirs. 0=Non recursive, 1=Recursive
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | Directory Name
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_Connect, _FTP_SetStatusCallback


Function _FTP_DirSetCurrent

Function Reference

_FTP_DirSetCurrent

Set Current Directory on an FTP server.

#Include <FTPEx.au3>
_FTP_DirSetCurrent($l_FTPSession, $s_Remote)

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_Remote | The Directory to be set.

Return Value

Success: | Directory Name
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpSetCurrentDirectory in MSDN Library


Function _FTP_FileClose

Function Reference

_FTP_FileClose

Closes the Handle returned by _FTP_FileOpen.

#Include <FTPEx.au3>
_FTP_FileClose($l_InternetSession)

Parameters

$l_InternetSession as returned by _FTP_FileOpen()

Return Value

Success: | 1
Failure: | 0 and sets @error to non-zero

Remarks

None.

Related

_FTP_FileOpen

See Also

Search InternetCloseHandle in MSDN Library


Function _FTP_FileDelete

Function Reference

_FTP_FileDelete

Delete an file from an FTP server.

#Include <FTPEx.au3>
_FTP_FileDelete($l_FTPSession, $s_RemoteFile)

Parameters

$l_FTPSession | as returned by _FTP_Connect()
$s_RemoteFile | The remote Location for the file.

Return Value

Success: | 1
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpDeleteFile in MSDN Library


Function _FTP_FileGet

Function Reference

_FTP_FileGet

Get file from a FTP server.

#Include <FTPEx.au3>
_FTP_FileGet($l_FTPSession, $s_RemoteFile, $s_LocalFile [, $fFailIfExists = False, [ $dwFlagsAndAttributes = 0 [, $l_Flags = 0 [, $l_Context = 0]]]])

Parameters

$l_FTPSession | as returned by _FTP_Connect()
$s_RemoteFile | The remote Location for the file.
$s_LocalFile | The local file.
$fFailIfExists | [optional] True: do not overwrite existing (default = False).
$dwFlagsAndAttributes | [optional] File attributes for the new file.
$l_Flags | [optional] as in _FTP_FileOpen().
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | 1
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_Connect, _FTP_FileOpen, _FTP_SetStatusCallback

See Also

Search FtpGetFile in MSDN Library


Function _FTP_FileGetSize

Function Reference

_FTP_FileGetSize

Gets filesize of a file on the FTP server.

#Include <FTPEx.au3>
_FTP_FileGetSize($l_FTPSession, $s_FileName)

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_FileName | The file name.

Return Value

Success: | returns filesize as an uint64.
Failure: | sets @error non-zero

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpGetFileSize in MSDN Library

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

Local $h_Handle
$aFile = _FTP_FindFileFirst($Conn, "/pub/software/programming/pcre/", $h_Handle)
ConsoleWrite('$Filename = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$dirset=_FTP_DirSetCurrent($Conn, "/pub/software/programming/pcre/")
ConsoleWrite('$dirset = ' & $dirset & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$FileSize = _FTP_FileGetSize($Conn, $aFile[10])
ConsoleWrite('$Filename = ' & $aFile[10] & ' size = ' & $FileSize & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

Local $Err, $Message
$FileSize = _FTP_GetLastResponseInfo($Err, $Message) ; error = Contrib: Not a regular file
ConsoleWrite('$Message = ' & $Message & ' err = ' & $Err & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$aFile = _FTP_FindFileNext($h_Handle)
ConsoleWrite('$FilenameNext1 = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$FileSize = _FTP_FileGetSize($Conn, $aFile[10])
ConsoleWrite('$FilenameNext1 = ' & $aFile[10] & ' size = ' & $FileSize & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$FileSize = _FTP_GetLastResponseInfo($Err, $Message) ; no error
ConsoleWrite('$Message = ' & $Message & ' err = ' & $Err & ' -> Error code: ' & @error & ' extended: ' & @extended & @crlf)

$FindClose = _FTP_FindFileClose($h_Handle)

$Ftpc = _FTP_Close($Open)


Function _FTP_FileOpen

Function Reference

_FTP_FileOpen

Initiates access to a remote file on an FTP server for reading or writing.

#Include <FTPEx.au3>
_FTP_FileOpen($hConnect, $lpszFileName [, $dwAccess = 0x80000000 [, $dwFlags = 2 [, $dwContext = 0]]])

Parameters

$hConnect | as returned by _FTP_Connect().
$lpszFileName | String of the ftp file to open.
$dwAccess | [optional] The Local attribute (default $GENERIC_READ).
$dwFlags [optional] Specify the conditions under which the transfers occur. The application should select one transfer type and any of the flags that indicate how the caching of the file will be controlled.

The transfer type can be one of the following values:
$FTP_TRANSFER_TYPE_ASCII - Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
$FTP_TRANSFER_TYPE_BINARY - Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.
$FTP_TRANSFER_TYPE_UNKNOWN - Defaults to $FTP_TRANSFER_TYPE_BINARY.
$INTERNET_FLAG_TRANSFER_ASCII - Transfers the file as ASCII.
$INTERNET_FLAG_TRANSFER_BINARY - Transfers the file as binary.

The following values are used to control the caching of the file. The application can use one or more of these values:
$INTERNET_FLAG_HYPERLINK - Forces a reload if there was no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network.
$INTERNET_FLAG_NEED_FILE - Causes a temporary file to be created if the file cannot be cached.
$INTERNET_FLAG_RELOAD - Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.
$INTERNET_FLAG_RESYNCHRONIZE - Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP and Gopher resources are reloaded.
$dwContext [optional] A variable that contains the application-defined value that associates this search with any application data.
This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | Returns the handle to ftp file for read/write with _FTP_FileRead()
Failure: | 0 and sets @error to non-zero

Remarks

None.

Related

_FTP_FileClose, _FTP_FileRead, _FTP_SetStatusCallback, _FTP_FileGet, _FTP_FilePut

See Also

Search FtpOpenFile in MSDN Library


Function _FTP_FilePut

Function Reference

_FTP_FilePut

Puts an file on an FTP server.

#Include <FTPEx.au3>
_FTP_FilePut($l_FTPSession, $s_LocalFile, $s_RemoteFile [, $l_Flags = 0 [, $l_Context = 0]])

Parameters

$l_FTPSession | as returned by _FTP_Connect()
$s_LocalFile | The local file.
$s_RemoteFile | The remote Location for the file.
$l_Flags [optional] Specify the conditions under which the transfers occur. The application should select one transfer type and any of the flags that indicate how the caching of the file will be controlled.

The transfer type can be one of the following values:
$FTP_TRANSFER_TYPE_ASCII - Transfers the file using FTP's ASCII (Type A) transfer method. Control and formatting information is converted to local equivalents.
$FTP_TRANSFER_TYPE_BINARY - Transfers the file using FTP's Image (Type I) transfer method. The file is transferred exactly as it exists with no changes. This is the default transfer method.
$FTP_TRANSFER_TYPE_UNKNOWN - Defaults to $FTP_TRANSFER_TYPE_BINARY.
$INTERNET_FLAG_TRANSFER_ASCII - Transfers the file as ASCII.
$INTERNET_FLAG_TRANSFER_BINARY - Transfers the file as binary.

The following values are used to control the caching of the file. The application can use one or more of these values:
$INTERNET_FLAG_HYPERLINK - Forces a reload if there was no Expires time and no LastModified time returned from the server when determining whether to reload the item from the network.
$INTERNET_FLAG_NEED_FILE - Causes a temporary file to be created if the file cannot be cached.
$INTERNET_FLAG_RELOAD - Forces a download of the requested file, object, or directory listing from the origin server, not from the cache.
$INTERNET_FLAG_RESYNCHRONIZE - Reloads HTTP resources if the resource has been modified since the last time it was downloaded. All FTP and Gopher resources are reloaded.
$l_Context [optional] A variable that contains the application-defined value that associates this search with any application data.
This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | 1
Failure: | 0 and sets @ERROR

Remarks

Both $s_LocalFile and $s_RemoteFile may be partial or fully qualified names relative to the current directory.

Related

_FTP_Connect, _FTP_FileOpen, _FTP_SetStatusCallback

See Also

Search FtpPutFile in MSDN Library


Function _FTP_FileRead

Function Reference

_FTP_FileRead

Reads data from a handle opened by _FTP_FileOpen()

#Include <FTPEx.au3>
_FTP_FileRead($h_File, $dwNumberOfBytesToRead)

Parameters

$h_File | Handle returned by _FTP_FileOpen() to the ftp file.
$dwNumberOfBytesToRead | Number of bytes to read.

Return Value

Success: | Returns the binary/string read.
Failure: | 0 and Sets @error
@error: | -1 for end-of-file
 | non-zero for other errors.

Remarks

None.

Related

_FTP_FileOpen

See Also

Search InternetReadFile in MSDN Library


Function _FTP_FileRename

Function Reference

_FTP_FileRename

Renames an file on an FTP server.

#Include <FTPEx.au3>
_FTP_FileRename($l_FTPSession, $s_Existing, $s_New)

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_Existing | The old file name.
$s_New | The new file name.

Return Value

Success: | 1
Failure: | 0 and sets @error to non-zero

Remarks

None.

Related

_FTP_Connect

See Also

Search FtpRenameFile in MSDN Library


Function _FTP_FileTimeLoHiToStr

Function Reference

_FTP_FileTimeLoHiToStr

Closes the _FTP_Open session.

#Include <FTPEx.au3>
_FTP_FileTimeLoHiToStr($LoDWORD, $HiDWORD [, $bFmt = 0])

Parameters

$LoDWORD | FileTime Low
$HiDWORD | File Time Hi
$bFmt | [optional] 0 returns mm/dd/yyyy hh:mm:ss (Default) 1 returns yyyy/mm/dd hh:mm:ss

Return Value

Success: | DateTime according to $bFmt
Failure: | "" (empty String)

Remarks

None.

Related


Function _FTP_FindFileClose

Function Reference

_FTP_FindFileClose

Delete FindFile Handle.

#Include <FTPEx.au3>
_FTP_FindFileClose($h_Handle)

Parameters

$h_Handle as returned by _FTP_FindFileFirst()

Return Value

Success: | 1
Failure: | 0 and sets @ERROR

Remarks

None.

Related

_FTP_FindFileFirst, _FTP_FindFileNext

See Also

Search InternetCloseHandle in MSDN Library

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

Local $h_Handle
$aFile = _FTP_FindFileFirst($Conn, "/pub/software/programming/pcre/", $h_Handle)

$FindClose = _FTP_FindFileClose($h_Handle)
ConsoleWrite('$FindClose = ' & $FindClose & ' -> Error code: ' & @error & @crlf)

$Ftpc = _FTP_Close($Open)


Function _FTP_FindFileFirst

Function Reference

_FTP_FindFileFirst

Find First File on an FTP server.

#Include <FTPEx.au3>
_FTP_FindFileFirst($l_FTPSession, $s_RemotePath, ByRef $h_Handle [, $l_Flags = 0 [, $l_Context = 0]])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_RemotePath | path to be used when searching the file.
$h_Handle | returns Handle to be used in _FTP_FindFileNext() or _FTP_FindFileClose().
$l_Flags | [optional] see remarks.
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | an array, see remarks.
Failure: | 0 and sets @ERROR

Remarks

If successfull a return array:
[0] - Number of elements
[1] - File Attributes
[2] - Creation Time Low
[3] - Creation Time Hi
[4] - Access Time Low
[5] - Access Time Hi
[6] - Last Write Low
[7] - Last Write Hi
[8] - File Size High
[9] - File Size Low
[10] - File Name
[11] - Altername

$l_Flags can be a combination of $INTERNET_FLAG_HYPERLINK, $INTERNET_FLAG_NEED_FILE, $INTERNET_FLAG_NO_CACHE_WRITE, $INTERNET_FLAG_RELOAD, $INTERNET_FLAG_RESYNCHRONIZE

Related

_FTP_FindFileNext, _FTP_FindFileClose, _FTP_SetStatusCallback

See Also

Search FtpFindFirstFile in MSDN Library

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

Local $h_Handle
$aFile = _FTP_FindFileFirst($Conn, "/pub/software/programming/pcre/", $h_Handle)
ConsoleWrite('$Filename = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & @crlf)

$FindClose = _FTP_FindFileClose($h_Handle)

$Ftpc = _FTP_Close($Open)


Function _FTP_FindFileNext

Function Reference

_FTP_FindFileNext

Find Next File on an FTP server.

#Include <FTPEx.au3>
_FTP_FindFileNext($h_Handle)

Parameters

$h_Handle Handle as returned by _FTP_FindFileFirst().

Return Value

Success: | an array, see remarks.
Failure: | 0 and sets @ERROR

Remarks

If successfull a return array:
[0] - Number of elements
[1] - File Attributes
[2] - Creation Time Low
[3] - Creation Time Hi
[4] - Access Time Low
[5] - Access Time Hi
[6] - Last Write Low
[7] - Last Write Hi
[8] - File Size High
[9] - File Size Low
[10] - File Name
[11] - Altername

Related

_FTP_FindFileFirst, _FTP_FindFileClose

See Also

Search InternetFindNextFile in MSDN Library

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

Local $h_Handle
$aFile = _FTP_FindFileFirst($Conn, "/pub/software/programming/pcre/", $h_Handle)
ConsoleWrite('$Filename = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & @crlf)

$aFile = _FTP_FindFileNext($h_Handle)
ConsoleWrite('$FilenameNext1 = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & @crlf)

$aFile = _FTP_FindFileNext($h_Handle)
ConsoleWrite('$FilenameNext2 = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & @crlf)

$aFile = _FTP_FindFileNext($h_Handle)
ConsoleWrite('$FilenameNext3 = ' & $aFile[10] & ' attribute = ' & $aFile[1] & ' -> Error code: ' & @error & @crlf)

$FindClose = _FTP_FindFileClose($h_Handle)
$Ftpc = _FTP_Close($Open)


Function _FTP_GetLastResponseInfo

Function Reference

_FTP_GetLastResponseInfo

Retrieves the last error description or server response on the thread calling this function.

#Include <FTPEx.au3>
_FTP_GetLastResponseInfo(ByRef $dwError, ByRef $szMessage)

Parameters

$dwError | returns an error message pertaining to the operation that failed.
$szMessage | returns the error text.

Return Value

Success: | 1
Failure: | 0 and sets @error

Remarks

None.

Related

None.

See Also

Search InternetGetLastResponseInfo in MSDN Library

Example


Function _FTP_ListToArray

Function Reference

_FTP_ListToArray

Get Filenames, Directories or Both of current remote directory.

#Include <FTPEx.au3>
_Ftp_ListToArray($l_FTPSession [, $Return_Type = 0 [, $l_Flags = 0 [, $l_Context]]])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$Return_type | [optional] 0 = Both Files and Directories, 1 = Directories, 2 = Files.
$l_Flags | [optional] see _FTP_FindFileFirst().
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | An array containing the names. Array[0] contain the number of found entries.
Failure: | Array[0] = 0

Remarks

None.

Related

_FTP_Connect, _FTP_SetStatusCallback

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

$aFile = _FTP_ListToArray($Conn, 2)
ConsoleWrite('$NbFound = ' & $aFile[0] & ' -> Error code: ' & @error & @crlf)
ConsoleWrite('$Filename = ' & $aFile[1] & @crlf)

$Ftpc = _FTP_Close($Open)


Function _FTP_ListToArray2D

Function Reference

_FTP_ListToArray2D

Get Filenames and filesizes of current remote directory.

#Include <FTPEx.au3>
_Ftp_ListToArray2D($l_FTPSession [, $Return_Type = 0 [, $l_Flags = 0 [, $l_Context]]])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$Return_type | [optional] 0 = Both Files and Directories, 1 = Directories, 2 = Files.
$l_Flags | [optional] see _FTP_FindFileFirst().
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | 2D Array with names and size. Array[0][0] contain the number of found entries.
Failure: | Array[0][0] = 0

Remarks

Array[0][0] = number of found entries

Array[x][0] Filename
Array[x][1] Filesize

Related

_FTP_Connect, _FTP_SetStatusCallback

Example

#include <FTPEx.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

$aFile = _FTP_ListToArray2D($Conn, 0)
ConsoleWrite('$Filename = ' & $aFile[0][0] & ' -> Error code: ' & @error & @crlf)
ConsoleWrite('$Filename = ' & $aFile[1][0] & ' size = ' & $aFile[1][1] & @error & @crlf)
ConsoleWrite('$Filename = ' & $aFile[2][0] & ' size = ' & $aFile[2][1] & @crlf)

$Ftpc = _FTP_Close($Open)


Function _FTP_ListToArrayEx

Function Reference

_FTP_ListToArrayEx

Get names, sizes, attributes aand times of files/dir of current remote directory.

#Include <FTPEx.au3>
_FTP_ListToArrayEx($l_FTPSession [, $Return_Type = 0 [, $l_Flags = 0 [, $b_Fmt = 1 [, $l_Context]]]])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$Return_type | [optional] 0 = Both Files and Directories, 1 = Directories, 2 = Files.
$l_Flags | [optional] see _FTP_FindFileFirst().
$b_Fmt | [optional] type on the date strings : 1 = yyyy/mm/dd, 0 = mm/dd/yyyy.
$l_Context | [optional] A variable that contains the application-defined value that associates this search with any application data. This is only used if the application has already called _FTP_SetStatusCallback() to set up a status callback function.

Return Value

Success: | returns a 2D Array, see remarks.
Failure: | Array[0][0] = 0.

Remarks

Array[0][0] = number of found entries

Array[x][0] Filename
Array[x][1] Filesize
Array[x][2] FileAttribute
Array[x][3] File Modification datetime
Array[x][4] File Creation datetime
Array[x][5] File Access datetime

Related

_FTP_Connect, _FTP_SetStatusCallback

Example

#include <FTPEx.au3>
#include <Array.au3>

$server = 'ftp.csx.cam.ac.uk'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

$aFile = _FTP_ListToArrayEx($Conn, 0)
_ArrayDisplay($aFile)

$Ftpc = _FTP_Close($Open)


Function _FTP_Open

Function Reference

_FTP_Open

Opens an FTP session.

#Include <FTPEx.au3>
_FTP_Open($s_Agent[, $l_AccessType = 1 [, $s_ProxyName = '' [, $s_ProxyBypass = '' [, $l_Flags = 0]]]] )

Parameters

$s_Agent | Random name. ( like "myftp" )
$l_AccessType | [optional] Set if proxy is used.
$s_ProxyName | [optional] ProxyName.
$s_ProxyBypass | [optional] ProxyByPasses's.
$l_Flags | [optional] See remarks.

Return Value

Success: | Handle to internet session to be used in _FTP_Connect().
Failure: | 0 and sets @ERROR.

Remarks

Values for $l_AccessType
$INTERNET_OPEN_TYPE_DIRECT -> no proxy
$INTERNET_OPEN_TYPE_PRECONFIG -> Retrieves the proxy or direct configuration from the registry.
$INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY -> Retrieves the proxy or direct configuration from the registry and prevents the use of a startup Microsoft JScript or Internet Setup (INS) file.
$INTERNET_OPEN_TYPE_PROXY -> Passes requests to the proxy unless a proxy bypass list is supplied and the name to be resolved bypasses the proxy. Then no proxy is used.

Values for $l_Flags
$INTERNET_FLAG_ASYNC -> Makes only asynchronous requests on handles descended from the handle returned from this function.
$INTERNET_FLAG_FROM_CACHE -> Does not make network requests. All entities are returned from the cache. If the requested item is not in the cache, a suitable error, such as ERROR_FILE_NOT_FOUND, is returned.

Related

_FTP_Connect, _FTP_Close, _FTP_SetStatusCallback

See Also

Search InternetOpen in MSDN Library

Example

#include <FTPEx.au3>

$Open = _FTP_Open('MyFTP Control')
; ...
$Ftpc = _FTP_Close($Open)


Function _FTP_ProgressDownload

Function Reference

_FTP_ProgressDownload

Downloads a file in Binary Mode and shows a Progress window or by Calling a User defined Function.

#Include <FTPEx.au3>
_FTP_ProgressDownload($l_FTPSession, $s_LocalFile, $s_RemoteFile [, $FunctionToCall = ""])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_LocalFile | The local file to create.
$s_RemoteFile | The remote source file.
$FunctionToCall | [optional] A function which can update a Progressbar and react on UserInput like Click on Abort or Close App. (More info in the end of this comment)

Return Value

Success: | 1
Failure: | 0 and sets @error:
@error: | -1 - Local file couldn't be created
 | -3 - Open RemoteFile failed
 | -4 - Read from Remotefile failed
 | -5 - Close RemoteFile failed
 | -6 - Download aborted by PercentageFunc and Return of Called Function

Remarks

Information about $FunctionToCall:
Parameter: $Percentage - The Percentage of Progress
Return Values: Continue Download - 1
Abort Download - 0 Or negative
These Return Values are returned by _FTP_ProgressDownload(), too,
so you can react on different Actions like Aborting by User, closing App or TimeOut of whatever
Examples:
Func _UpdateProgress($Percentage)
ProgressSet($percent,$percent &"%")
If _IsPressed("77") Then Return 0 ; Abort on F8
Return 1 ; bei 1 Fortsetzten
Endfunc

Func _UpdateProgress($Percentage)
GUICtrlSetData($ProgressBarCtrl,$percent)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Return -1 ; _FTP_DownloadProgress Aborts with -1, so you can exit you app afterwards
Case $Btn_Cancel
Return 0 ; Just Cancel, without special Return value
EndSwitch
Return 1 ; Otherwise contine Download
Endfunc

Related


Function _FTP_ProgressUpload

Function Reference

_FTP_ProgressUpload

Uploads a file in Binary Mode and shows a Progress window or by Calling a User defined Function

#Include <FTPEx.au3>
_FTP_ProgressUpload($l_FTPSession, $s_LocalFile, $s_RemoteFile [, $FunctionToCall = ""])

Parameters

$l_FTPSession | as returned by _FTP_Connect().
$s_LocalFile | The local file to create.
$s_RemoteFile | The remote source file.
$FunctionToCall | [optional] A function which can update a Progressbar and react on UserInput like Click on Abort or Close App. (More info in the end of this comment)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | -3 - Create File failed
 | -4 - Write to file failed
 | -5 - Close File failed
 | -6 - Download aborted by PercentageFunc and Return of Called Function

Remarks

Information about $FunctionToCall:
Parameter: $Percentage - The Percentage of Progress
Return Values: Continue Download - 1
Abort Download - 0 Or negative
These Return Values are returned by _FTP_ProgressUpload(), too,
so you can react on different Actions like Aborting by User, closing App or TimeOut of whatever
Examples:
Func _UpdateProgress($Percentage)
ProgressSet($percent,$percent &"%")
If _IsPressed("77") Then Return 0 ; Abort on F8
Return 1 ; Continue upload
Endfunc

Func _UpdateProgress($Percentage)
GUICtrlSetData($ProgressBarCtrl,$percent)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Return -1 ; _FTP_UploadProgress Aborts with -1, so you can exit you app afterwards
Case $Btn_Cancel
Return 0 ; Just Cancel, without special Return value
EndSwitch
Return 1 ; Otherwise contine Upload
Endfunc

Related

None.


Function _FTP_SetStatusCallback

Function Reference

_FTP_SetStatusCallback

Registers callback function that WinINet functions can call as progress is made during an operation.

#Include <FTPEx.au3>
_FTP_SetStatusCallback ( $l_InternetSession, $sFunctionName)

Parameters

$l_InternetSession | as returned by _FTP_Open()
$sFunctionName | the name of the User Defined Function to call.

Return Value

Success: | Pointer to callback function
Failure: | 0 and sets @error to non-zero

Remarks

The callback function is called with the following parameters (see InternetStatusCallback Windows API):
$hInternet, $dwContent, $dwInternetStatus, $lpvStatusInformation, $dwStatusInformationLength

Related

_FTP_Open, _FTP_FileOpen, _FTP_Command, _FTP_Connect, _FTP_DirPutContents, _FTP_FileGet, _FTP_FilePut, _FTP_FindFileFirst, _FTP_ListToArray, _FTP_ListToArray2D, _FTP_ListToArrayEx, _FTP_DecodeInternetStatus

See Also

Search InternetSetStatusCallback in MSDN Library

Example

#include <FTPEx.au3>
#include <Debug.au3>

_DebugSetup( StringTrimRight(@ScriptName,4) &' example', True)

$server = 'ftp.mozilla.org'
$username = ''
$pass = ''

$Open = _FTP_Open('MyFTP Control')
$Callback = _FTP_SetStatusCallback($Open, 'FTPStatusCallbackHandler')

$Conn = _FTP_Connect($Open, $server, $username, $pass, 0, $INTERNET_DEFAULT_FTP_PORT, $INTERNET_SERVICE_FTP, 0, $Callback)

$Ftpc = _FTP_Close($Open)

Func FTPStatusCallbackHandler($hInternet, $dwContent, $dwInternetStatus, $lpvStatusInformation, $dwStatusInformationLength)
If $dwInternetStatus = $INTERNET_STATUS_REQUEST_SENT Or $dwInternetStatus = $INTERNET_STATUS_RESPONSE_RECEIVED Then
Local $Size, $iBytesRead
$Size = DllStructCreate('dword')
_WinAPI_ReadProcessMemory(_WinAPI_GetCurrentProcess(), $lpvStatusInformation, DllStructGetPtr($Size), $dwStatusInformationLength, $iBytesRead)
_DebugOut(_FTP_DecodeInternetStatus($dwInternetStatus) & ' | Size = ' & DllStructGetData($Size, 1) & ' Bytes Bytes read = ' & $iBytesRead )
Else
_DebugOut(_FTP_DecodeInternetStatus($dwInternetStatus) )
EndIf
EndFunc ;==>_InternetStatusCallback


User Defined Functions

GDIPlus user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GDIPlus.au3>.

User Defined Function | Description
_GDIPlus_ArrowCapCreate | Creates an adjustable arrow line cap with the specified height and width
_GDIPlus_ArrowCapDispose | Release an adjustable arrow line cap object
_GDIPlus_ArrowCapGetFillState | Determines whether the arrow cap is filled
_GDIPlus_ArrowCapGetHeight | Gets the height of the arrow cap
_GDIPlus_ArrowCapGetMiddleInset | Gets the value of the inset
_GDIPlus_ArrowCapGetWidth | Gets the width of the arrow cap
_GDIPlus_ArrowCapSetFillState | Sets whether the arrow cap is filled
_GDIPlus_ArrowCapSetHeight | Sets the height of the arrow cap
_GDIPlus_ArrowCapSetMiddleInset | Gets the value of the inset
_GDIPlus_ArrowCapSetWidth | Sets the width of the arrow cap
_GDIPlus_BitmapCloneArea | Create a clone of a Bitmap object from the coordinates and format specified
_GDIPlus_BitmapCreateFromFile | Create a Bitmap object from file
_GDIPlus_BitmapCreateFromGraphics | Creates a Bitmap object based on a Graphics object, a width, and a height
_GDIPlus_BitmapCreateFromHBITMAP | Create a Bitmap object from a bitmap handle
_GDIPlus_BitmapCreateHBITMAPFromBitmap | Create a handle to a bitmap from a bitmap object
_GDIPlus_BitmapDispose | Release a bitmap object
_GDIPlus_BitmapLockBits | Locks a portion of a bitmap for reading or writing
_GDIPlus_BitmapUnlockBits | Unlocks a portion of a bitmap that was locked by _GDIPlus_BitmapLockBits
_GDIPlus_BrushClone | Clone a Brush object
_GDIPlus_BrushCreateSolid | Create a solid Brush object
_GDIPlus_BrushDispose | Release a Brush object
_GDIPlus_BrushGetSolidColor | Get the color of a Solid Brush object
_GDIPlus_BrushGetType | Retrieve the type of Brush object
_GDIPlus_BrushSetSolidColor | Set the color of a Solid Brush object
_GDIPlus_CustomLineCapDispose | Release a custom line cap object
_GDIPlus_Decoders | Get an array of information about the available image decoders
_GDIPlus_DecodersGetCount | Get the number of available image decoders
_GDIPlus_DecodersGetSize | Get the total size of the structure that is returned by _GDIPlus_GetImageDecoders
_GDIPlus_DrawImagePoints | Draws an image at a specified location.
_GDIPlus_Encoders | Get an array of information about the available image encoders
_GDIPlus_EncodersGetCLSID | Return the encoder CLSID for a specific image file type
_GDIPlus_EncodersGetCount | Get the number of available image encoders
_GDIPlus_EncodersGetParamList | Get the parameter list for a specified image encoder
_GDIPlus_EncodersGetParamListSize | Get the size of the parameter list for a specified image encoder
_GDIPlus_EncodersGetSize | Get the total size of the structure that is returned by _GDIPlus_GetImageEncoders
_GDIPlus_FontCreate | Create a Font object
_GDIPlus_FontDispose | Release a Font object
_GDIPlus_FontFamilyCreate | Create a Font Family object
_GDIPlus_FontFamilyDispose | Release a Font Family object
_GDIPlus_GraphicsClear | Clears a Graphics object to a specified color
_GDIPlus_GraphicsCreateFromHDC | Create a Graphics object from a device contect (DC)
_GDIPlus_GraphicsCreateFromHWND | Create a Graphics object from a window handle
_GDIPlus_GraphicsDispose | Release a Graphics object
_GDIPlus_GraphicsDrawArc | Draw an arc
_GDIPlus_GraphicsDrawBezier | Draw a bezier spline
_GDIPlus_GraphicsDrawClosedCurve | Draw a closed cardinal spline
_GDIPlus_GraphicsDrawCurve | Draw a cardinal spline
_GDIPlus_GraphicsDrawEllipse | Draw an ellipse
_GDIPlus_GraphicsDrawImage | Draw an Image object
_GDIPlus_GraphicsDrawImageRect | Draws an image at a specified location
_GDIPlus_GraphicsDrawImageRectRect | Draw an Image object
_GDIPlus_GraphicsDrawLine | Draw a line
_GDIPlus_GraphicsDrawPie | Draw a pie
_GDIPlus_GraphicsDrawPolygon | Draw a polygon
_GDIPlus_GraphicsDrawRect | Draw a rectangle
_GDIPlus_GraphicsDrawString | Draw a string
_GDIPlus_GraphicsDrawStringEx | Draw a string
_GDIPlus_GraphicsFillClosedCurve | Fill a closed cardinal spline
_GDIPlus_GraphicsFillEllipse | Fill an ellipse
_GDIPlus_GraphicsFillPie | Fill a pie
_GDIPlus_GraphicsFillPolygon | Fill a polygon
_GDIPlus_GraphicsFillRect | Fill a rectangle
_GDIPlus_GraphicsGetDC | Gets a handle to the device context of the Graphics object
_GDIPlus_GraphicsGetSmoothingMode | Gets the graphics object rendering quality
_GDIPlus_GraphicsMeasureString | Measures the size of a string
_GDIPlus_GraphicsReleaseDC | Releases the device context of the Graphics object
_GDIPlus_GraphicsSetSmoothingMode | Sets the graphics object rendering quality
_GDIPlus_GraphicsSetTransform | Sets the world transformation for a graphics object
_GDIPlus_ImageDispose | Release an image object
_GDIPlus_ImageGetFlags | Returns enumeration of pixel data attributes contained in an image
_GDIPlus_ImageGetGraphicsContext | Get the graphics context of the image
_GDIPlus_ImageGetHeight | Get the image height
_GDIPlus_ImageGetHorizontalResolution | Returns horizontal resolution in DPI (pixels per inch) of an image
_GDIPlus_ImageGetPixelFormat | Returns pixel format of an image: Bits per pixel, Alpha channels, RGB, Grayscale, Indexed etc.
_GDIPlus_ImageGetRawFormat | Returns file format GUID and image format name of an image
_GDIPlus_ImageGetType | Returns type (bitmap or metafile) of an image
_GDIPlus_ImageGetVerticalResolution | Returns horizontal resolution in DPI (pixels per inch) of an image
_GDIPlus_ImageGetWidth | Get the image width
_GDIPlus_ImageLoadFromFile | Create an image object based on a file
_GDIPlus_ImageSaveToFile | Save an image to file
_GDIPlus_ImageSaveToFileEx | Save an image to file
_GDIPlus_MatrixCreate | Creates and initializes a Matrix object that represents the identity matrix
_GDIPlus_MatrixDispose | Release a matrix object
_GDIPlus_MatrixRotate | Updates a matrix with the product of itself and a rotation matrix
_GDIPlus_MatrixScale | Updates a matrix with the product of itself and a scaling matrix
_GDIPlus_MatrixTranslate | Updates a matrix with the product of itself and a translation matrix
_GDIPlus_ParamAdd | Add a value to an enocder parameter list
_GDIPlus_ParamInit | Initialize an encoder parameter list
_GDIPlus_PenCreate | Create a pen object
_GDIPlus_PenDispose | Release a pen object
_GDIPlus_PenGetAlignment | Gets the pen alignment
_GDIPlus_PenGetColor | Gets the pen color
_GDIPlus_PenGetCustomEndCap | Gets the custom end cap for the pen
_GDIPlus_PenGetDashCap | Gets the pen dash cap style
_GDIPlus_PenGetDashStyle | Gets the pen dash style
_GDIPlus_PenGetEndCap | Gets the pen end cap
_GDIPlus_PenGetWidth | Retrieve the width of a pen
_GDIPlus_PenSetAlignment | Sets the pen alignment
_GDIPlus_PenSetColor | Sets the pen color
_GDIPlus_PenSetCustomEndCap | Sets the custom end cap for the pen
_GDIPlus_PenSetDashCap | Sets the pen dash cap style
_GDIPlus_PenSetDashStyle | Sets the pen dash style
_GDIPlus_PenSetEndCap | Sets the pen end cap
_GDIPlus_PenSetWidth | Sets the width of a pen
_GDIPlus_RectFCreate | Create a $tagGDIPRECTF structure
_GDIPlus_Shutdown | Clean up resources used by Microsoft Windows GDI+
_GDIPlus_Startup | Initialize Microsoft Windows GDI+
_GDIPlus_StringFormatCreate | Create a String Format object
_GDIPlus_StringFormatDispose | Release a String Format object
_GDIPlus_StringFormatSetAlign | Sets the text alignment of a string format object


Function _GDIPlus_ArrowCapCreate

Function Reference

_GDIPlus_ArrowCapCreate

Creates an adjustable arrow line cap with the specified height and width

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapCreate($fHeight, $fWidth[, $bFilled = True])

Parameters

$fHeight | Specifies the length, in units, of the arrow from its base to its point
$fWidth | Specifies the distance, in units, between the corners of the base of the arrow
$bFilled | [optional] Fill flag: True - Arrow will be filled False - Arrow will not be filled

Return Value

Success: | Returns a handle to a new ArrowCap object
Failure: | 0

Remarks

After you are done with the object, call _GDIPlus_ArrowCapDispose to release the object resources

Related

_GDIPlus_ArrowCapDispose

See Also

Search GdipCreateAdjustableArrowCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 2)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap: 0x" & Hex(_GDIPlus_PenGetCustomEndCap ($hPen)))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)
_GDIPlus_PenSetWidth ($hPen, 4)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapDispose

Function Reference

_GDIPlus_ArrowCapDispose

Release an adjustable arrow line cap object

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapDispose($hCap)

Parameters

$hCap Handle to a adjustable arrow line cap object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ArrowCapCreate

See Also

Search GdipDeleteCustomLineCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 2)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap: 0x" & Hex(_GDIPlus_PenGetCustomEndCap ($hPen)))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)
_GDIPlus_PenSetWidth ($hPen, 4)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapGetFillState

Function Reference

_GDIPlus_ArrowCapGetFillState

Determines whether the arrow cap is filled

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapGetFillState($hArrowCap)

Parameters

$hArrowCap Handle to a ArrowCap object

Return Value

True: | Arrow cap is filled
False: | Arrow cap is not filled or if error then @error is set

Remarks

None.

Related

_GDIPlus_ArrowCapSetFillState

See Also

Search GdipGetAdjustableArrowCapFillState in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (4, 6)

; Show fill state
MsgBox(4096, "Information", "Fill state: " & _GDIPlus_ArrowCapGetFillState($hEndCap))

; Draw arrow 1
_GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine($hGraphic, 10, 130, 390, 130, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetFillState($hEndCap, False)
_GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine($hGraphic, 10, 160, 390, 160, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapGetHeight

Function Reference

_GDIPlus_ArrowCapGetHeight

Gets the height of the arrow cap

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapGetHeight($hArrowCap)

Parameters

$hArrowCap Handle to a ArrowCap object

Return Value

Success: | Returns the height of the arrow cap
Failure: | 0

Remarks

The height is the distance from the base of the arrow to its vertex

Related

_GDIPlus_ArrowCapSetHeight

See Also

Search GdipGetAdjustableArrowCapHeight in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Draw arrow 1
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetHeight ($hEndCap, _GDIPlus_ArrowCapGetHeight ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
_GDIPlus_ArrowCapSetHeight ($hEndCap, _GDIPlus_ArrowCapGetHeight ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapGetMiddleInset

Function Reference

_GDIPlus_ArrowCapGetMiddleInset

Gets the value of the inset

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapGetMiddleInset($hArrowCap)

Parameters

$hArrowCap Handle to a ArrowCap object

Return Value

Success: | Inset value
Failure: | 0

Remarks

The middle inset is the number of units that the midpoint of the base shifts towards the vertex. A middle
inset of zero results in no shift (the base is a straight line, giving the arrow a triangular shape). A
positive (greater than zero) middle inset results in a shift the specified number of units toward the vertex
(the base is an arrow shape that points toward the vertex, giving the arrow cap a V-shape). A negative (less
than zero) middle inset results in a shift the specified number of units away from the vertex (the base
becomes an arrow shape that points away from the vertex, giving the arrow either a diamond shape (if the
absolute value of the middle inset is equal to the height) or distorted diamond shape. If the middle inset is
equal to or greater than the height of the arrow cap, the cap does not appear at all. The value of the middle
inset affects the arrow cap only if the arrow cap is filled.

Related

_GDIPlus_ArrowCapSetMiddleInset

See Also

Search GdipGetAdjustableArrowCapMiddleInset in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap, $iInset

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)

; Draw arrow 1
$iInset = 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
$iInset = _GDIPlus_ArrowCapGetMiddleInset ($hEndCap) + 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
$iInset = _GDIPlus_ArrowCapGetMiddleInset ($hEndCap) + 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapGetWidth

Function Reference

_GDIPlus_ArrowCapGetWidth

Gets the width of the arrow cap

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapGetWidth($hArrowCap)

Parameters

$hArrowCap Handle to a ArrowCap object

Return Value

Success: | Returns the width of the arrow cap
Failure: | 0

Remarks

The width is the distance between the endpoints of the base of the arrow

Related

_GDIPlus_ArrowCapSetWidth

See Also

Search GdipGetAdjustableArrowCapWidth in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Draw arrow 1
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetWidth ($hEndCap, _GDIPlus_ArrowCapGetWidth ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
_GDIPlus_ArrowCapSetWidth ($hEndCap, _GDIPlus_ArrowCapGetWidth ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 190, 390, 190, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapSetFillState

Function Reference

_GDIPlus_ArrowCapSetFillState

Sets whether the arrow cap is filled

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapSetFillState($hArrowCap, $bFilled = True)

Parameters

$hArrowCap | Handle to a ArrowCap object
$bFilled | Fill state: True - Arrow cap is filled False - Arrow cap is not filled

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ArrowCapGetFillState

See Also

Search GdipSetAdjustableArrowCapFillState in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (4, 6)

; Show fill state
MsgBox(4096, "Information", "Fill state: " & _GDIPlus_ArrowCapGetFillState($hEndCap))

; Draw arrow 1
_GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine($hGraphic, 10, 130, 390, 130, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetFillState($hEndCap, False)
_GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine($hGraphic, 10, 160, 390, 160, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapSetHeight

Function Reference

_GDIPlus_ArrowCapSetHeight

Sets the height of the arrow cap

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapSetHeight($hArrowCap, $fHeight)

Parameters

$hArrowCap | Handle to a ArrowCap object
$fHeight | Specifies the length, in units, of the arrow from its base to its point

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ArrowCapGetHeight

See Also

Search GdipSetAdjustableArrowCapHeight in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Draw arrow 1
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetHeight ($hEndCap, _GDIPlus_ArrowCapGetHeight ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
_GDIPlus_ArrowCapSetHeight ($hEndCap, _GDIPlus_ArrowCapGetHeight ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapSetMiddleInset

Function Reference

_GDIPlus_ArrowCapSetMiddleInset

Gets the value of the inset

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapSetMiddleInset($hArrowCap, $fInset)

Parameters

$hArrowCap | Handle to a ArrowCap object
$fInset | Inset value

Return Value

Success: | True
Failure: | False

Remarks

The middle inset is the number of units that the midpoint of the base shifts towards the vertex. A middle
inset of zero results in no shift (the base is a straight line, giving the arrow a triangular shape). A
positive (greater than zero) middle inset results in a shift the specified number of units toward the vertex
(the base is an arrow shape that points toward the vertex, giving the arrow cap a V-shape). A negative (less
than zero) middle inset results in a shift the specified number of units away from the vertex (the base
becomes an arrow shape that points away from the vertex, giving the arrow either a diamond shape (if the
absolute value of the middle inset is equal to the height) or distorted diamond shape. If the middle inset is
equal to or greater than the height of the arrow cap, the cap does not appear at all. The value of the middle
inset affects the arrow cap only if the arrow cap is filled.

Related

_GDIPlus_ArrowCapGetMiddleInset

See Also

Search GdipSetAdjustableArrowCapMiddleInset in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap, $iInset

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)

; Draw arrow 1
$iInset = 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
$iInset = _GDIPlus_ArrowCapGetMiddleInset ($hEndCap) + 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
$iInset = _GDIPlus_ArrowCapGetMiddleInset ($hEndCap) + 0.5
_GDIPlus_ArrowCapSetMiddleInset ($hEndCap, $iInset)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 180, 390, 180, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_ArrowCapSetWidth

Function Reference

_GDIPlus_ArrowCapSetWidth

Sets the width of the arrow cap

#Include <GDIPlus.au3>
_GDIPlus_ArrowCapSetWidth($hArrowCap, $fWidth)

Parameters

$hArrowCap | Handle to a ArrowCap object
$fWidth | Specifies the width, in units, of the arrow between the endpoints of the base of the arrow

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ArrowCapGetWidth

See Also

Search GdipSetAdjustableArrowCapWidth in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Draw arrow 1
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)

; Draw arrow 2
_GDIPlus_ArrowCapSetWidth ($hEndCap, _GDIPlus_ArrowCapGetWidth ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Draw arrow 3
_GDIPlus_ArrowCapSetWidth ($hEndCap, _GDIPlus_ArrowCapGetWidth ($hEndCap) + 2)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 190, 390, 190, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_ArrowCapDispose ($hEndCap)
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()
EndFunc ;==>_Main


Function _GDIPlus_BitmapCloneArea

Function Reference

_GDIPlus_BitmapCloneArea

Create a clone of a Bitmap object from the coordinates and format specified

#Include <GDIPlus.au3>
_GDIPlus_BitmapCloneArea($hBmp, $iLeft, $iTop, $iWidth, $iHeight[, $iFormat = 0x00021808])

Parameters

$hBmp | Handle to a Bitmap object
$iLeft | X coordinate of upper left corner of the rectangle to copy
$iTop | Y coordinate of upper left corner of the rectangle to copy
$iWidth | The width of the rectangle that specifies the portion of this bitmap to copy
$iHeight | The height of the rectangle that specifies the portion of this bitmap to copy
$iFormat [optional] Pixel format for the new bitmap:
$GDIP_PXF01INDEXED = 1 bit per pixel, indexed
$GDIP_PXF04INDEXED = 4 bits per pixel, indexed
$GDIP_PXF08INDEXED = 8 bits per pixel, indexed
$GDIP_PXF16GRAYSCALE = 16 bits per pixel, grayscale
$GDIP_PXF16RGB555 = 16 bits per pixel; 5 bits for each RGB component
$GDIP_PXF16RGB565 = 16 bits per pixel; 5 bits for red, 6 bits for green and 5 bits blue
$GDIP_PXF16ARGB1555 = 16 bits per pixel; 1 bit for alpha and 5 bits for each RGB component
$GDIP_PXF24RGB = 24 bits per pixel; 8 bits for each RGB component
$GDIP_PXF32RGB = 32 bits per pixel; 8 bits for each RGB component. No alpha component.
$GDIP_PXF32ARGB = 32 bits per pixel; 8 bits for each RGB and alpha component
$GDIP_PXF32PARGB = 32 bits per pixel; 8 bits for each RGB and alpha component, pre-mulitiplied
$GDIP_PXF48RGB = 48 bits per pixel; 16 bits for each RGB component
$GDIP_PXF64ARGB = 64 bits per pixel; 16 bits for each RGB and alpha component
$GDIP_PXF64PARGB = 64 bits per pixel; 16 bits for each RGB and alpha component, pre-multiplied

Return Value

Success: | Returns a handle to a new Bitmap object
Failure: | 0

Remarks

When you are done with the Bitmap object, call _GDIPlus_BitmapDispose to release the resources

Related

_GDIPlus_BitmapDispose, _GDIPlus_ImageGetPixelFormat

See Also

Search GdipCloneBitmapAreaI in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hClone, $hImage, $iX, $iY

; Initialize GDI+ library
_GDIPlus_StartUp ()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture ("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Create 24 bit bitmap clone
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

; Clean up resources
_GDIPlus_ImageDispose ($hClone)
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_BitmapCreateFromFile

Function Reference

_GDIPlus_BitmapCreateFromFile

Create a Bitmap object from file

#Include <GDIPlus.au3>
_GDIPlus_BitmapCreateFromFile($sFileName)

Parameters

$sFileName Path to a bitmap file

Return Value

Success: | Handle to a Bitmap object
Failure: | 0

Remarks

When you are done with the Bitmap object, call _GDIPlus_BitmapDispose to release the resources

Related

_WinAPI_DeleteObject

See Also

Search GdipCreateBitmapFromFile in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hBMP, $hBitmap, $hGraphic, $hImage, $iX, $iY, $hClone

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture 32 bit bitmap
$hBMP = _ScreenCapture_Capture ("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)

; Create 24 bit bitmap clone
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

; Clean up resources
_GDIPlus_BitmapDispose ($hClone)
_GDIPlus_BitmapDispose($hImage)
_WinAPI_DeleteObject ($hBMP)

; Draw bitmap to GUI
$hBitmap = _GDIPlus_BitmapCreateFromFile (@MyDocumentsDir & "\GDIPlus_Image.bmp")
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 0, 0)

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_BitmapDispose ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GDIPlus_BitmapCreateFromGraphics

Function Reference

_GDIPlus_BitmapCreateFromGraphics

Creates a Bitmap object based on a Graphics object, a width, and a height

#Include <GDIPlus.au3>
_GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)

Parameters

$iWidth | Specifies the width, in pixels, of the bitmap
$iHeight | Specifies the height, in pixels, of the bitmap
$hGraphics | Handle to a Graphics object

Return Value

Success: | Handle to a Bitmap object
Failure: | 0

Remarks

When you are done with the Bitmap object, call _GDIPlus_BitmapDispose to release the resources

Related

_WinAPI_DeleteObject

See Also

Search GdipCreateBitmapFromGraphics in MSDN Library


Function _GDIPlus_BitmapCreateFromHBITMAP

Function Reference

_GDIPlus_BitmapCreateFromHBITMAP

Create a Bitmap object from a bitmap handle

#Include <GDIPlus.au3>
_GDIPlus_BitmapCreateFromHBITMAP($hBmp[, $hPal = 0])

Parameters

$hBmp | Handle to a HBITMAP
$hPal | [optional] Handle to a HPALETTE

Return Value

Success: | Handle to a Bitmap object
Failure: | 0

Remarks

When you are done with the Bitmap object, call _GDIPlus_BitmapDispose to release the resources

Related

_WinAPI_DeleteObject

See Also

Search GdipCreateBitmapFromHBITMAP in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hBMP, $hBitmap, $hGraphic

; Capture upper left corner of screen
$hBMP = _ScreenCapture_Capture ("", 0, 0, 400, 300)

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Draw bitmap to GUI
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 0, 0)

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_BitmapDispose ($hBitmap)
_WinAPI_DeleteObject ($hBMP)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GDIPlus_BitmapCreateHBITMAPFromBitmap

Function Reference

_GDIPlus_BitmapCreateHBITMAPFromBitmap

Create a handle to a bitmap from a bitmap object

#Include <GDIPlus.au3>
_GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap[, $iARGB = 0xFF000000])

Parameters

$hBitmap | Handle to a bitmap object
$iARGB | [optional] Color object that specifies the background color

Return Value

Success: | Handle to a HBITMAP
Failure: | 0

Remarks

When you are done with the Bitmap object, call _WinAPI_DeleteObject to release the resources

Related

_WinAPI_DeleteObject

See Also

Search GdipCreateHBITMAPFromBitmap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBMP, $hImage, $iX, $iY, $hClone

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture 32 bit bitmap
$hBMP = _ScreenCapture_Capture ("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)

; Create 24 bit bitmap clone
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @TempDir & "\GDIPlus_Image.bmp")

; Clean up resources
_GDIPlus_BitmapDispose ($hClone)
_GDIPlus_BitmapDispose ($hImage)
_WinAPI_DeleteObject ($hBMP)

; Load image
$hImage = _GDIPlus_ImageLoadFromFile (@TempDir & "\GDIPlus_Image.bmp")
$hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap ($hImage)

; Save bitmap to file
_ScreenCapture_SaveImage (@TempDir & "\Image.bmp", $hBMP, True) ; True -> $hBMP destroyed

; Clean up resource
_GDIPlus_ImageDispose ($hImage)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_BitmapDispose

Function Reference

_GDIPlus_BitmapDispose

Release a bitmap object

#Include <GDIPlus.au3>
_GDIPlus_BitmapDispose($hBitmap)

Parameters

$hBitmap Handle to a bitmap object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDisposeImage in MSDN Library


Function _GDIPlus_BitmapLockBits

Function Reference

_GDIPlus_BitmapLockBits

Locks a portion of a bitmap for reading or writing

#Include <GDIPlus.au3>
_GDIPlus_BitmapLockBits($hBitmap, $iLeft, $iTop, $iWidth, $iHeight [ , $iFlags = $GDIP_ILMREAD [, $iFormat = $GDIP_PXF32RGB ]])

Parameters

$hBitmap | Handle to a bitmap object
$iLeft | X coordinate of the upper-left corner of the rectangle to lock
$iTop | Y coordinate of the upper-left corner of the rectangle to lock
$iWidth | The width of the rectangle to lock
$iHeight | The height of the rectangle to lock
$iFlags | [optional] Set of flags that specify whether the locked portion of the bitmap is available for reading or for writing and whether the caller has already allocated a buffer. Can be a combination of the following: $GDIP_ILMREAD - A portion of the image is locked for reading $GDIP_ILMWRITE - A portion of the image is locked for writing $GDIP_ILMUSERINPUTBUF - The buffer is allocated by the user
$iFormat | [optional] Specifies the format of the pixel data in the temporary buffer. Can be one of the following: $GDIP_PXF01INDEXED - 1 bpp, indexed $GDIP_PXF04INDEXED - 4 bpp, indexed $GDIP_PXF08INDEXED - 8 bpp, indexed $GDIP_PXF16GRAYSCALE - 16 bpp, grayscale $GDIP_PXF16RGB555 - 16 bpp; 5 bits for each RGB $GDIP_PXF16RGB565 - 16 bpp; 5 bits red, 6 bits green, and 5 bits blue $GDIP_PXF16ARGB1555 - 16 bpp; 1 bit for alpha and 5 bits for each RGB component $GDIP_PXF24RGB - 24 bpp; 8 bits for each RGB $GDIP_PXF32RGB - 32 bpp; 8 bits for each RGB. No alpha. $GDIP_PXF32ARGB - 32 bpp; 8 bits for each RGB and alpha $GDIP_PXF32PARGB - 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied

Return Value

Success: | $tagGDIPBITMAPDATA structure
Failure: | @error is set

Remarks

When you are done with the locked portion, call _GDIPlus_BitmapUnlockBits to release the locked region

Related

_WinAPI_DeleteObject, _GDIPlus_ImageGetPixelFormat

See Also

Search GdipBitmapLockBits in MSDN Library


Function _GDIPlus_BitmapUnlockBits

Function Reference

_GDIPlus_BitmapUnlockBits

Unlocks a portion of a bitmap that was locked by _GDIPlus_BitmapLockBits

#Include <GDIPlus.au3>
_GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData)

Parameters

$hBitmap | Handle to a bitmap object
$tBitmapData | $tagGDIPBITMAPDATA structure previously passed to _GDIPlus_BitmapLockBits

Return Value

Success: | True
Failure: | False

Remarks

When you are done with the locked portion, call _GDIPlus_BitmapUnlockBits to release the locked region

Related

_WinAPI_DeleteObject

See Also

Search GdipBitmapUnlockBits in MSDN Library


Function _GDIPlus_BrushClone

Function Reference

_GDIPlus_BrushClone

Clone a Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushClone($hBrush)

Parameters

$hBrush Handle to a Brush object

Return Value

Success: | Handle to a new Brush object
Failure: | 0

Remarks

When you are done with the Brush object, call _GDIPlus_BrushDispose to release the resources

Related

_GDIPlus_BrushDispose

See Also

Search GdipCloneBrush in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBrush1, $hBrush2

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create brushes
_GDIPlus_Startup ()
$hBrush1 = _GDIPlus_BrushCreateSolid ()
$hBrush2 = _GDIPlus_BrushClone ($hBrush1)

; Show brush information
MemoWrite("Brush 1 handle : 0x" & Hex($hBrush1))
MemoWrite("Brush 1 type ..: " & _GDIPlus_BrushGetType ($hBrush1))
MemoWrite("Brush 2 handle : 0x" & Hex($hBrush2))
MemoWrite("Brush 2 type ..: " & _GDIPlus_BrushGetType ($hBrush2))

; Clean up resources
_GDIPlus_BrushDispose ($hBrush2)
_GDIPlus_BrushDispose ($hBrush1)
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_BrushCreateSolid

Function Reference

_GDIPlus_BrushCreateSolid

Create a solid Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushCreateSolid([$iARGB = 0xFF000000])

Parameters

$iARGB [optional] Alpha, Red, Green and Blue components of brush

Return Value

Success: | Handle to a solid Brush object
Failure: | 0

Remarks

When you are done with the Brush object, call _GDIPlus_BrushDispose to release the resources

Related

_GDIPlus_BrushDispose

See Also

Search GdipCreateSolidFill in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBrush1, $hBrush2

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create brushes
_GDIPlus_Startup ()
$hBrush1 = _GDIPlus_BrushCreateSolid ()
$hBrush2 = _GDIPlus_BrushClone ($hBrush1)

; Show brush information
MemoWrite("Brush 1 handle : 0x" & Hex($hBrush1))
MemoWrite("Brush 1 type ..: " & _GDIPlus_BrushGetType ($hBrush1))
MemoWrite("Brush 2 handle : 0x" & Hex($hBrush2))
MemoWrite("Brush 2 type ..: " & _GDIPlus_BrushGetType ($hBrush2))

; Clean up resources
_GDIPlus_BrushDispose ($hBrush2)
_GDIPlus_BrushDispose ($hBrush1)
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_BrushDispose

Function Reference

_GDIPlus_BrushDispose

Release a Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushDispose($hBrush)

Parameters

$hBrush Handle to a Brush object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_BrushCreateSolid, _GDIPlus_BrushClone

See Also

Search GdipDeleteBrush in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBrush1, $hBrush2

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create brushes
_GDIPlus_Startup ()
$hBrush1 = _GDIPlus_BrushCreateSolid ()
$hBrush2 = _GDIPlus_BrushClone ($hBrush1)

; Show brush information
MemoWrite("Brush 1 handle : 0x" & Hex($hBrush1))
MemoWrite("Brush 1 type ..: " & _GDIPlus_BrushGetType ($hBrush1))
MemoWrite("Brush 2 handle : 0x" & Hex($hBrush2))
MemoWrite("Brush 2 type ..: " & _GDIPlus_BrushGetType ($hBrush2))

; Clean up resources
_GDIPlus_BrushDispose ($hBrush2)
_GDIPlus_BrushDispose ($hBrush1)
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_BrushGetSolidColor

Function Reference

_GDIPlus_BrushGetSolidColor

Get the color of a Solid Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushGetSolidColor($hBrush, [$iARGB = 0xFF000000])

Parameters

$hBrush | Handle to a Brush object
$iARGB | [optional] The color of the brush.

Return Value

Success: | Brush color
Failure: | -1 and @error is set

Remarks

None.

Related

See Also

Search GdipGetSolidFillColor in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $Label1, $label2, $hGraphic, $hBrush1, $iClr1, $iClr2

; Create GUI
$hGUI = GUICreate("GDI+", 345, 150)
$Label1 = GUICtrlCreateLabel("", 2, 2, 150, 20)
$label2 = GUICtrlCreateLabel("", 202, 2, 150, 20)
GUISetState()
Sleep(100)

; Start GDIPlus
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

; Create solid brush
$hBrush1 = _GDIPlus_BrushCreateSolid()

; Get solid brush color
$iClr1 = _GDIPlus_BrushGetSolidColor($hBrush1)

; Draw some graphics with the original brush color
_GDIPlus_GraphicsFillEllipse($hGraphic, 25, 25, 100, 100, $hBrush1)

; Set new brush color (0xFFFF0000 = Red)
_GDIPlus_BrushSetSolidColor($hBrush1, 0xFFFF0000)

; Get new solid brush color
$iClr2 = _GDIPlus_BrushGetSolidColor($hBrush1)

; Draw some graphics with the new brush color
_GDIPlus_GraphicsFillRect($hGraphic, 220, 25, 100, 100, $hBrush1)

; Write original brush color to Label1
GUICtrlSetData($Label1, "Brush orignal color: " & Hex($iClr1))

; Write the new brush color to Label2
GUICtrlSetData($label2, "Brush new color: " & Hex($iClr2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()

EndFunc ;==>_Main


Function _GDIPlus_BrushGetType

Function Reference

_GDIPlus_BrushGetType

Retrieve the type of Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushGetType($hBrush)

Parameters

$hBrush Handle to a Brush object

Return Value

Success: | Brush type:
 | 0 - Solid color
 | 1 - Hatch fill
 | 2 - Texture fill
 | 3 - Path gradient
 | 4 - Linear gradient
Failure: | -1 and @error is set

Remarks

None.

Related

See Also

Search GdipGetBrushType in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBrush1, $hBrush2

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create brushes
_GDIPlus_Startup ()
$hBrush1 = _GDIPlus_BrushCreateSolid ()
$hBrush2 = _GDIPlus_BrushClone ($hBrush1)

; Show brush information
MemoWrite("Brush 1 handle : 0x" & Hex($hBrush1))
MemoWrite("Brush 1 type ..: " & _GDIPlus_BrushGetType ($hBrush1))
MemoWrite("Brush 2 handle : 0x" & Hex($hBrush2))
MemoWrite("Brush 2 type ..: " & _GDIPlus_BrushGetType ($hBrush2))

; Clean up resources
_GDIPlus_BrushDispose ($hBrush2)
_GDIPlus_BrushDispose ($hBrush1)
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_BrushSetSolidColor

Function Reference

_GDIPlus_BrushSetSolidColor

Set the color of a Solid Brush object

#Include <GDIPlus.au3>
_GDIPlus_BrushSetSolidColor($hBrush, [$iARGB = 0xFF000000])

Parameters

$hBrush | Handle to a Brush object
$iARGB | [optional] Alpha, Red, Green and Blue components of brush

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipSetSolidFillColor in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $Label1, $label2, $hGraphic, $hBrush1, $iClr1, $iClr2

; Create GUI
$hGUI = GUICreate("GDI+", 345, 150)
$Label1 = GUICtrlCreateLabel("", 2, 2, 150, 20)
$label2 = GUICtrlCreateLabel("", 202, 2, 150, 20)
GUISetState()
Sleep(100)

; Start GDIPlus
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

; Create solid brush
$hBrush1 = _GDIPlus_BrushCreateSolid()

; Get solid brush original color
$iClr1 = _GDIPlus_BrushGetSolidColor($hBrush1)

; Draw some graphics with the original brush color
_GDIPlus_GraphicsFillEllipse($hGraphic, 25, 25, 100, 100, $hBrush1)

; Set new brush color (0xFFFF0000 = Red)
_GDIPlus_BrushSetSolidColor($hBrush1, 0xFFFF0000)

; Get solid brush new color
$iClr2 = _GDIPlus_BrushGetSolidColor($hBrush1)

; Draw some graphics with the new brush color
_GDIPlus_GraphicsFillRect($hGraphic, 220, 25, 100, 100, $hBrush1)

; Write original brush color to Label1
GUICtrlSetData($Label1, "Brush orignal color: " & Hex($iClr1))

; Write the new brush color to Label2
GUICtrlSetData($label2, "Brush new color: " & Hex($iClr2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_BrushDispose($hBrush1)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()

EndFunc ;==>_Main


Function _GDIPlus_CustomLineCapDispose

Function Reference

_GDIPlus_CustomLineCapDispose

Release a custom line cap object

#Include <GDIPlus.au3>
_GDIPlus_CustomLineCapDispose($hCap)

Parameters

$hCap Handle to a custom line cap object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDeleteCustomLineCap in MSDN Library


Function _GDIPlus_Decoders

Function Reference

_GDIPlus_Decoders

Get an array of information about the available image decoders

#Include <GDIPlus.au3>
_GDIPlus_Decoders()

Parameters

None.

Return Value

Success: | Array with the following format:
 | [0][ 0] - Number of decoders
 | [1][ 1] - Codec identifier
 | [1][ 2] - File format identifier
 | [1][ 3] - Codec name
 | [1][ 4] - Dll in which the code resides
 | [1][ 5] - The name of the file format used by the codec
 | [1][ 6] - Filename extensions associated with the codec
 | [1][ 7] - The mime type of the codec
 | [1][ 8] - Combination of $GDIP_ICF flags
 | [1][ 9] - The version of the codec
 | [1][10] - The number of signatures used by the file format
 | [1][11] - The number of bytes in each signature
 | [1][12] - Pointer to the pattern for each signature
 | [1][13] - Pointer to the mask for each signature
Failure: | @error is set

Remarks

None.

Related

_GDIPlus_Encoders

See Also

Search GdipGetImageDecoders in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_DecodersGetCount

Function Reference

_GDIPlus_DecodersGetCount

Get the number of available image decoders

#Include <GDIPlus.au3>
_GDIPlus_DecodersGetCount()

Parameters

None.

Return Value

Success: | Number of image decoders
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_DecodersGetSize

See Also

Search GdipGetImageDecodersSize in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Show number of decoders/encoders
MemoWrite("Decoder count : " & _GDIPlus_DecodersGetCount());
MemoWrite("Decoder size .: " & _GDIPlus_DecodersGetSize());
MemoWrite("Encoder count : " & _GDIPlus_EncodersGetCount());
MemoWrite("Encoder size .: " & _GDIPlus_EncodersGetSize());

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_DecodersGetSize

Function Reference

_GDIPlus_DecodersGetSize

Get the total size of the structure that is returned by _GDIPlus_GetImageDecoders

#Include <GDIPlus.au3>
_GDIPlus_DecodersGetSize()

Parameters

None.

Return Value

Success: | Total size, in bytes
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_DecodersGetCount

See Also

Search GdipGetImageDecodersSize in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Show number of decoders/encoders
MemoWrite("Decoder count : " & _GDIPlus_DecodersGetCount());
MemoWrite("Decoder size .: " & _GDIPlus_DecodersGetSize());
MemoWrite("Encoder count : " & _GDIPlus_EncodersGetCount());
MemoWrite("Encoder size .: " & _GDIPlus_EncodersGetSize());

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_DrawImagePoints

Function Reference

_GDIPlus_DrawImagePoints

Draws an image at a specified location.

#Include <GDIPlus.au3>
_GDIPlus_DrawImagePoints($hGraphic, $hImage, $nULX, $nULY, $nURX, $nURY, $nLLX, $nLLY[, $count = 3])

Parameters

$hGraphic | Handle to a Graphics object
$hImage | Handle to an Image object
$nULX | The X coordinate of the upper left corner of the source image
$nULY | The Y coordinate of the upper left corner of the source image
$nURX | The X coordinate of the upper right corner of the source image
$nURY | The Y coordinate of the upper right corner of the source image
$nLLX | The X coordinate of the lower left corner of the source image
$nLLY | The Y coordinate of the lower left corner of the source image
$count | [optional] Specifies the number of points (x,y)'s in the structure.

Return Value

Success: | True
Failure: | False

Remarks

The value of the count parameter must equal 3 to specify the coordinates of
the upper-left corner, upper-right corner, and lower-left corner of the
parallelogram. The coordinate of the lower-right corner, the width, and the
height of the image, are calculated using the three given coordinates.
The image is scaled to fit the parallelogram.

Related

See Also

Search GdipDrawImagePoints in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

_GDIPlus_DrawImagePoints($hGraphic, $hImage2, 100, 100, 600, 170, 130, 570)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect($hGraphic, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_WinAPI_DeleteObject($hBitmap1)
_WinAPI_DeleteObject($hBitmap2)

; Shut down GDI+ library
_GDIPlus_Shutdown()

EndFunc ;==>_Main


Function _GDIPlus_Encoders

Function Reference

_GDIPlus_Encoders

Get an array of information about the available image encoders

#Include <GDIPlus.au3>
_GDIPlus_Encoders()

Parameters

None.

Return Value

Success: | Array with the following format:
 | [0][ 0] - Number of decoders
 | [1][ 1] - Codec identifier
 | [1][ 2] - File format identifier
 | [1][ 3] - Codec name
 | [1][ 4] - Dll in which the code resides
 | [1][ 5] - The name of the file format used by the codec
 | [1][ 6] - Filename extensions associated with the codec
 | [1][ 7] - The mime type of the codec
 | [1][ 8] - Combination of $GDIP_ICF flags
 | [1][ 9] - The version of the codec
 | [1][10] - The number of signatures used by the file format
 | [1][11] - The number of bytes in each signature
 | [1][12] - Pointer to the pattern for each signature
 | [1][13] - Pointer to the mask for each signature
Failure: | @error is set

Remarks

None.

Related

_GDIPlus_Decoders

See Also

Search GdipGetImageEncoders in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_EncodersGetCLSID

Function Reference

_GDIPlus_EncodersGetCLSID

Return the encoder CLSID for a specific image file type

#Include <GDIPlus.au3>
_GDIPlus_EncodersGetCLSID($sFileExt)

Parameters

$sFileExt File extension to search for (BMP, JPG, TIF, etc.)

Return Value

Success: | CLSID of the encoder in string format
Failure: | Blank string

Remarks

None.

Related

See Also

Search GdipGetImageEncoders in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_EncodersGetCount

Function Reference

_GDIPlus_EncodersGetCount

Get the number of available image encoders

#Include <GDIPlus.au3>
_GDIPlus_EncodersGetCount()

Parameters

None.

Return Value

Success: | Number of image encoders
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_EncodersGetSize

See Also

Search GdipGetImageEncodersSize in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Show number of decoders/encoders
MemoWrite("Decoder count : " & _GDIPlus_DecodersGetCount());
MemoWrite("Decoder size .: " & _GDIPlus_DecodersGetSize());
MemoWrite("Encoder count : " & _GDIPlus_EncodersGetCount());
MemoWrite("Encoder size .: " & _GDIPlus_EncodersGetSize());

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_EncodersGetParamList

Function Reference

_GDIPlus_EncodersGetParamList

Get the parameter list for a specified image encoder

#Include <GDIPlus.au3>
_GDIPlus_EncodersGetParamList($hImage, $sEncoder)

Parameters

$hImage | Handle to an image object
$sEncoder | GUID string of encoder to be used

Return Value

Success: | $tagGDIPPENCODERPARAMS structure
Failure: | 0

Remarks

None.

Related

_GDIPlus_EncodersGetParamListSize, $tagGDIPENCODERPARAMS

See Also

Search GdipGetEncoderParameterList in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_EncodersGetParamListSize

Function Reference

_GDIPlus_EncodersGetParamListSize

Get the size of the parameter list for a specified image encoder

#Include <GDIPlus.au3>
_GDIPlus_EncodersGetParamListSize($hImage, $sEncoder)

Parameters

$hImage | Handle to an image object
$sEncoder | GUID string of encoder to be used

Return Value

Success: | Size, in bytes, of the parameter list
Failure: | 0

Remarks

None.

Related

_GDIPlus_EncodersGetParamList

See Also

Search GdipGetEncoderParameterListSize in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_EncodersGetSize

Function Reference

_GDIPlus_EncodersGetSize

Get the total size of the structure that is returned by _GDIPlus_GetImageEncoders

#Include <GDIPlus.au3>
_GDIPlus_EncodersGetSize()

Parameters

None.

Return Value

Success: | Total size, in bytes
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_EncodersGetCount

See Also

Search GdipGetImageEncodersSize in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Show number of decoders/encoders
MemoWrite("Decoder count : " & _GDIPlus_DecodersGetCount());
MemoWrite("Decoder size .: " & _GDIPlus_DecodersGetSize());
MemoWrite("Encoder count : " & _GDIPlus_EncodersGetCount());
MemoWrite("Encoder size .: " & _GDIPlus_EncodersGetSize());

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_FontCreate

Function Reference

_GDIPlus_FontCreate

Create a Font object

#Include <GDIPlus.au3>
_GDIPlus_FontCreate($hFamily, $fSize[, $iStyle = 0[, $iUnit = 3]])

Parameters

$hFamily | Handle to a Font Family object
$fSize | The size of the font measured in the units specified in the $iUnit parameter
$iStyle | [optional] The style of the typeface. Can be a combination of the following: 0 - Normal weight or thickness of the typeface 1 - Bold typeface 2 - Italic typeface 4 - Underline 8 - Strikethrough
$iUnit | [optional] Unit of measurement for the font size: 0 - World coordinates, a nonphysical unit 1 - Display units 2 - A unit is 1 pixel 3 - A unit is 1 point or 1/72 inch 4 - A unit is 1 inch 5 - A unit is 1/300 inch 6 - A unit is 1 millimeter

Return Value

Success: | Handle to a Font object
Failure: | 0

Remarks

When you are done with the Font object, call _GDIPlus_FontDispose to release the resources

Related

_GDIPlus_FontDispose

See Also

Search GdipCreateFont in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_FontDispose

Function Reference

_GDIPlus_FontDispose

Release a Font object

#Include <GDIPlus.au3>
_GDIPlus_FontDispose($hFont)

Parameters

$hFont Handle to a Font object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_FontCreate

See Also

Search GdipDeleteFont in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_FontFamilyCreate

Function Reference

_GDIPlus_FontFamilyCreate

Create a Font Family object

#Include <GDIPlus.au3>
_GDIPlus_FontFamilyCreate($sFamily)

Parameters

$sFamily Name of the Font Family

Return Value

Success: | Handle to a Font Family object
Failure: | 0

Remarks

When you are done with the Font Family object, call _GDIPlus_FontFamilyDispose to release the resources

Related

_GDIPlus_FontFamilyDispose

See Also

Search GdipCreateFontFamilyFromName in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_FontFamilyDispose

Function Reference

_GDIPlus_FontFamilyDispose

Release a Font Family object

#Include <GDIPlus.au3>
_GDIPlus_FontFamilyDispose($hFamily)

Parameters

$hFamily Handle to a Font Family object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_FontFamilyCreate

See Also

Search GdipDeleteFontFamily in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsClear

Function Reference

_GDIPlus_GraphicsClear

Clears a Graphics object to a specified color

#Include <GDIPlus.au3>
_GDIPlus_GraphicsClear($hGraphics[, $iARGB = 0xFF000000])

Parameters

$hGraphics | Handle to a Graphics object
$iARGB | [optional] Alpha, Red, Green and Blue components of color

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipGraphicsClear in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hImage, $hGraphic

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture screen region
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Clear the screen capture to solid blue
$hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage)
_GDIPlus_GraphicsClear ($hGraphic)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsCreateFromHDC

Function Reference

_GDIPlus_GraphicsCreateFromHDC

Create a Graphics object from a device contect (DC)

#Include <GDIPlus.au3>
_GDIPlus_GraphicsCreateFromHDC($hDC)

Parameters

$hDC Device context

Return Value

Success: | Handle to a Graphics object
Failure: | 0

Remarks

When you are done with the Graphics object, call _GDIPlus_GraphicsDispose to release the resources

Related

_GDIPlus_GraphicsDispose

See Also

Search GdipCreateFromHDC in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout, $hDC

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
$hDC = _WinAPI_GetWindowDC($hGUI)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHDC ($hDC)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_WinAPI_ReleaseDC($hGUI, $hDC)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsCreateFromHWND

Function Reference

_GDIPlus_GraphicsCreateFromHWND

Create a Graphics object from a window handle

#Include <GDIPlus.au3>
_GDIPlus_GraphicsCreateFromHWND($hWnd)

Parameters

$hWnd Handle to a window

Return Value

Success: | Handle to a Graphics object
Failure: | 0

Remarks

When you are done with the Graphics object, call _GDIPlus_GraphicsDispose to release the resources

Related

_GDIPlus_GraphicsDispose

See Also

Search GdipCreateFromHWND in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDispose

Function Reference

_GDIPlus_GraphicsDispose

Release a Graphics object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDispose($hGraphics)

Parameters

$hGraphics Handle to a Graphics object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_GraphicsCreateFromHDC, _GDIPlus_GraphicsCreateFromHWND

See Also

Search GdipDeleteGraphics in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0x7F00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawArc

Function Reference

_GDIPlus_GraphicsDrawArc

Draw an arc

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawArc($hGraphics, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the arc
$iY | The Y coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the arc
$iWidth | The width of the rectangle that bounds the ellipse in which to draw the arc
$iHeight | The height of the rectangle that bounds the ellipse in which to draw the arc
$fStartAngle | The angle between the X axis and the starting point of the arc
$fSweepAngle | The angle between the starting and ending points of the arc
$hPen | [optional] Handle to a pen object that is used to draw the arc. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawArcI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw arcs
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawArc ($hGraphic, 160, 100, 10, 10, 180, 360)
_GDIPlus_GraphicsDrawArc ($hGraphic, 180, 100, 10, 10, 180, 360)
_GDIPlus_GraphicsDrawArc ($hGraphic, 160, 104, 30, 30, 160, -140)
_GDIPlus_GraphicsDrawArc ($hGraphic, 140, 80, 70, 70, 180, 360)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawBezier

Function Reference

_GDIPlus_GraphicsDrawBezier

Draw a bezier spline

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawBezier($hGraphics, $iX1, $iY1, $iX2, $iY2, $iX3, $iY3, $iX4, $iY4[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$hPen | Handle to a pen object that is used to draw the arc
$iX1 | X coordinate of the starting point
$iY1 | Y coordinate of the starting point
$iX2 | X coordinate of the first control point
$iY2 | Y coordinate of the first control point
$iX3 | X coordinate of the second control point
$iY3 | Y coordinate of the second control point
$iX4 | X coordinate of the ending point
$iY4 | Y coordinate of the ending point
$hPen | [optional] Handle to a pen object that is used to draw the bezier. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

A Bezier spline does not pass through its control points. The control points act as magnets, pulling the curve
in certain directions to influence the way the spline bends.

Related

See Also

Search GdipDrawBezierI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a Bezier curve
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)

_GDIPlus_GraphicsDrawBezier ($hGraphic, 50, 50, 100, 5, 125, 25, 250, 50)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawClosedCurve

Function Reference

_GDIPlus_GraphicsDrawClosedCurve

Draw a closed cardinal spline

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawClosedCurve($hGraphics, $aPoints[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$aPoints | Array that specifies the points of the curve: [0][0] - Number of points [1][0] - Point 1 X position [1][1] - Point 1 Y position [2][0] - Point 2 X position [2][1] - Point 2 Y position [n][0] - Point n X position [n][1] - Point n Y position
$hPen | [optional] Handle to a pen object that is used to draw the spline. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

In a closed cardinal spline, the curve continues through the last point in the points array and connects with
the first point in the array. The array of points must contain a minimum of three elements.

Related

See Also

Search GdipDrawClosedCurveI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $aPoints[8][2]

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a cardinal spline
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)

$aPoints[0][0] = 7
$aPoints[1][0] = 50
$aPoints[1][1] = 50
$aPoints[2][0] = 100
$aPoints[2][1] = 25
$aPoints[3][0] = 200
$aPoints[3][1] = 5
$aPoints[4][0] = 250
$aPoints[4][1] = 50
$aPoints[5][0] = 300
$aPoints[5][1] = 100
$aPoints[6][0] = 350
$aPoints[6][1] = 200
$aPoints[7][0] = 250
$aPoints[7][1] = 250

_GDIPlus_GraphicsDrawClosedCurve ($hGraphic, $aPoints)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawCurve

Function Reference

_GDIPlus_GraphicsDrawCurve

Draw a cardinal spline

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawCurve($hGraphics, $aPoints[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$aPoints | Array that specifies the points of the curve: [0][0] - Number of points [1][0] - Point 1 X position [1][1] - Point 1 Y position [2][0] - Point 2 X position [2][1] - Point 2 Y position [n][0] - Point n X position [n][1] - Point n Y position
$hPen | [optional] Handle to a pen object that is used to draw the spline. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

A segment is defined as a curve that connects two consecutive points in the cardinal spline. The ending point
of each segment is the starting point for the next.

Related

See Also

Search GdipDrawCurveI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $aPoints[5][2]

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a cardinal spline
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)

$aPoints[0][0] = 4
$aPoints[1][0] = 0
$aPoints[1][1] = 100
$aPoints[2][0] = 50
$aPoints[2][1] = 50
$aPoints[3][0] = 100
$aPoints[3][1] = 100
$aPoints[4][0] = 150
$aPoints[4][1] = 50

_GDIPlus_GraphicsDrawCurve ($hGraphic, $aPoints)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawEllipse

Function Reference

_GDIPlus_GraphicsDrawEllipse

Draw an ellipse

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawEllipse($hGraphics, $iX, $iY, $iWidth, $iHeight[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle that bounds the ellipse
$iY | The Y coordinate of the upper left corner of the rectangle that bounds the ellipse
$iWidth | The width of the rectangle that bounds the ellipse
$iHeight | The height of the rectangle that bounds the ellipse
$hPen | [optional] Handle to a pen object that is used to draw the arc. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawEllipseI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw an ellipse
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawEllipse ($hGraphic, 130, 100, 140, 70)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawImage

Function Reference

_GDIPlus_GraphicsDrawImage

Draw an Image object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawImage($hGraphics, $hImage, $iX, $iY)

Parameters

$hGraphics | Handle to a Graphics object
$hImage | Handle to an Image object
$iX | The X coordinate of the upper left corner of the rendered image
$iY | The Y coordinate of the upper left corner of the rendered image

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawImageI in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture ("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hImage2, 100, 100)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect ($hGraphic, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose ($hImage1)
_GDIPlus_ImageDispose ($hImage2)
_WinAPI_DeleteObject ($hBitmap1)
_WinAPI_DeleteObject ($hBitmap2)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawImageRect

Function Reference

_GDIPlus_GraphicsDrawImageRect

Draws an image at a specified location

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, $iX, $iY, $iW, $iH )

Parameters

$hGraphics | Handle to a Graphics object
$hImage | Handle to an Image object
$iX | The X coordinate of the upper left corner of the rendered image
$iY | The Y coordinate of the upper left corner of the rendered image
$iW | Specifies the width of the destination rectangle at which to draw the image
$iH | Specifies the height of the destination rectangle at which to draw the image

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawImageRectI in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture ("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1)
_GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 100, 100, 400, 300)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect ($hGraphic, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose ($hImage1)
_GDIPlus_ImageDispose ($hImage2)
_WinAPI_DeleteObject ($hBitmap1)
_WinAPI_DeleteObject ($hBitmap2)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawImageRectRect

Function Reference

_GDIPlus_GraphicsDrawImageRectRect

Draw an Image object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth, $iSrcHeight, $iDstX, $iDstY, $iDstWidth, $iDstHeight[, $iUnit = 2])

Parameters

$hGraphics | Handle to a Graphics object
$hImage | Handle to an Image object
$iSrcX | The X coordinate of the upper left corner of the source image
$iSrcY | The Y coordinate of the upper left corner of the source image
$iSrcWidth | Width of the source image
$iSrcHeight | Height of the source image
$iDstX | The X coordinate of the upper left corner of the destination image
$iDstY | The Y coordinate of the upper left corner of the destination image
$iDstWidth | Width of the destination image
$iDstHeight | Height of the destination image
$iUnit | [optional] Specifies the unit of measure for the image

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawImageRectRectI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI1, $hGUI2, $hImage, $hGraphic1, $hGraphic2

; Capture top left corner of the screen
_ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg", 0, 0, 400, 300)

; Create a GUI for the original image
$hGUI1 = GUICreate("Original", 400, 300, 0, 0)
GUISetState()

; Create a GUI for the zoomed image
$hGUI2 = GUICreate("Zoomed", 400, 300, 0, 400)
GUISetState()

; Initialize GDI+ library and load image
_GDIPlus_Startup ()
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Draw original image
$hGraphic1 = _GDIPlus_GraphicsCreateFromHWND ($hGUI1)
_GDIPlus_GraphicsDrawImage ($hGraphic1, $hImage, 0, 0)

; Draw 2x zoomed image
$hGraphic2 = _GDIPlus_GraphicsCreateFromHWND ($hGUI2)
_GDIPlus_GraphicsDrawImageRectRect ($hGraphic2, $hImage, 0, 0, 200, 200, 0, 0, 400, 300)

; Release resources
_GDIPlus_GraphicsDispose ($hGraphic1)
_GDIPlus_GraphicsDispose ($hGraphic2)
_GDIPlus_ImageDispose ($hImage)
_GDIPlus_Shutdown ()

; Clean up screen shot file
FileDelete(@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawLine

Function Reference

_GDIPlus_GraphicsDrawLine

Draw a line

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawLine($hGraphics, $iX1, $iY1, $iX2, $iY2[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX1 | The X coordinate of the starting point of the line
$iY1 | The Y coordinate of the starting point of the line
$iX2 | The X coordinate of the ending point of the line
$iY2 | The Y coordinate of the ending point of the line
$hPen | [optional] Handle to a pen object that is used to draw the arc. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawLineI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw line
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate ()
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawPie

Function Reference

_GDIPlus_GraphicsDrawPie

Draw a pie

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the pie
$iY | The Y coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the pie
$iWidth | The width of the rectangle that bounds the ellipse in which to draw the pie
$iHeight | The height of the rectangle that bounds the ellipse in which to draw the pie
$fStartAngle | The angle, in degrees, between the X axis and the starting point of the arc that defines the pie. A positive value specifies clockwise rotation.
$fSweepAngle | The angle, in degrees, between the starting and ending points of the arc that defines the pie. A positive value specifies clockwise rotation.
$hPen | [optional] Handle to a pen object that is used to draw the arc. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawPieI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a pie
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawPie ($hGraphic, 150, 80, 100, 100, 45, 90)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawPolygon

Function Reference

_GDIPlus_GraphicsDrawPolygon

Draw a polygon

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawPolygon($hGraphics, $aPoints[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$aPoints | Array that specify the vertices of the polygon: [0][0] - Number of vertices [1][0] - Vertice 1 X position [1][1] - Vertice 1 Y position [2][0] - Vertice 2 X position [2][1] - Vertice 2 Y position [n][0] - Vertice n X position [n][1] - Vertice n Y position
$hPen | [optional] Handle to a pen object that is used to draw the polygon. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: | True
Failure: | False

Remarks

If the first and last points are not identical, a line is drawn between them to close the polygon

Related

See Also

Search GdipDrawPolygonI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $aPoints[4][2]

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a polygon
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)

$aPoints[0][0] = 3
$aPoints[1][0] = 150
$aPoints[1][1] = 150
$aPoints[2][0] = 200
$aPoints[2][1] = 100
$aPoints[3][0] = 250
$aPoints[3][1] = 150

_GDIPlus_GraphicsDrawPolygon ($hGraphic, $aPoints)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawRect

Function Reference

_GDIPlus_GraphicsDrawRect

Draw a rectangle

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawRect($hGraphics, $iX, $iY, $iWidth, $iHeight[, $hPen = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle
$iY | The Y coordinate of the upper left corner of the rectangle
$iWidth | The width of the rectangle
$iHeight | The height of the rectangle
$hPen | [optional] Handle to a pen object that is used to draw the rectangle. If 0, a solid black pen with a width of 1 will be used

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDrawRectangleI in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphics

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture ("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)

; Draw one image in another
$hGraphics = _GDIPlus_ImageGetGraphicsContext ($hImage1)
_GDIPlus_GraphicsDrawImage ($hGraphics, $hImage2, 100, 100)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect ($hGraphics, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose ($hImage1)
_GDIPlus_ImageDispose ($hImage2)
_WinAPI_DeleteObject ($hBitmap1)
_WinAPI_DeleteObject ($hBitmap2)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawString

Function Reference

_GDIPlus_GraphicsDrawString

Draw a string

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawString($hGraphics, $sString, $nX, $nY[, $sFont = "Arial"[, $fSize = 10[, $iFormat = 0]]])

Parameters

$hGraphics | Handle to a Graphics object
$sString | String to be drawn
$nX | X coordinate where the string will be drawn
$nY | Y coordinate where the string will be drawn
$sFont | [optional] Name of the font to use for drawing
$fSize | [optional] Font size to use for drawing
$iFormat | [optional] Format flags. Can be one or more of the following: 0x0001 - Specifies that reading order is right to left 0x0002 - Specifies that individual lines of text are drawn vertically on the display device 0x0004 - Specifies that parts of characters are allowed to overhang the string's layout rectangle 0x0020 - Specifies that Unicode layout control characters are displayed with a representative character 0x0400 - Specifies that an alternate font is used for characters that are not supported in the requested font 0x0800 - Specifies that the space at the end of each line is included in a string measurement 0x1000 - Specifies that the wrapping of text to the next line is disabled 0x2000 - Specifies that only entire lines are laid out in the layout rectangle 0x4000 - Specifies that characters overhanging the layout rectangle and text extending outside the layout rectangle are allowed to show

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_GraphicsDrawStringEx

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawString ($hGraphic, "Hello world", 140, 110)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsDrawStringEx

Function Reference

_GDIPlus_GraphicsDrawStringEx

Draw a string

#Include <GDIPlus.au3>
_GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $tLayout, $hFormat, $hBrush)

Parameters

$hGraphics | Handle to a Graphics object
$sString | String to be drawn
$hFont | Handle to the font to use to draw the string
$tLayout | $tagGDIPRECTF structure that bounds the string
$hFormat | Handle to the string format to draw the string
$hBrush | Handle to the brush to draw the string

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_GraphicsDrawString, $tagGDIPRECTF

See Also

Search GdipDrawString in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout
Local $sString = "Hello world", $aInfo

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $sString, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsFillClosedCurve

Function Reference

_GDIPlus_GraphicsFillClosedCurve

Fill a closed cardinal spline

#Include <GDIPlus.au3>
_GDIPlus_GraphicsFillClosedCurve($hGraphics, $aPoints[, $hBrush = 0])

Parameters

$hGraphics | Handle to a Graphics object
$aPoints | Array that specifies the points of the curve: [0][0] - Number of points [1][0] - Point 1 X position [1][1] - Point 1 Y position [2][0] - Point 2 X position [2][1] - Point 2 Y position [n][0] - Point n X position [n][1] - Point n Y position
$hBrush | [optional] Handle to a brush object that is used to fill the ellipse. If 0, a black brush will be used.

Return Value

Success: | True
Failure: | False

Remarks

In a closed cardinal spline, the curve continues through the last point in the points array and connects with
the first point in the array. The array of points must contain a minimum of three elements.

Related

See Also

Search GdipFillClosedCurveI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $aPoints[8][2]

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Fill a cardinal spline
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)

$aPoints[0][0] = 7
$aPoints[1][0] = 50
$aPoints[1][1] = 50
$aPoints[2][0] = 100
$aPoints[2][1] = 25
$aPoints[3][0] = 200
$aPoints[3][1] = 5
$aPoints[4][0] = 250
$aPoints[4][1] = 50
$aPoints[5][0] = 300
$aPoints[5][1] = 100
$aPoints[6][0] = 350
$aPoints[6][1] = 200
$aPoints[7][0] = 250
$aPoints[7][1] = 250

_GDIPlus_GraphicsFillClosedCurve ($hGraphic, $aPoints)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsFillEllipse

Function Reference

_GDIPlus_GraphicsFillEllipse

Fill an ellipse

#Include <GDIPlus.au3>
_GDIPlus_GraphicsFillEllipse($hGraphics, $iX, $iY, $iWidth, $iHeight[, $hBrush = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle that bounds the ellipse
$iY | The Y coordinate of the upper left corner of the rectangle that bounds the ellipse
$iWidth | The width of the rectangle that bounds the ellipse
$iHeight | The height of the rectangle that bounds the ellipse
$hBrush | [optional] Handle to a brush object that is used to fill the ellipse. If 0, a black brush will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipFillEllipseI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw an ellipse
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsFillEllipse ($hGraphic, 130, 100, 140, 70)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsFillPie

Function Reference

_GDIPlus_GraphicsFillPie

Fill a pie

#Include <GDIPlus.au3>
_GDIPlus_GraphicsFillPie($hGraphics, $iX, $iY, $iWidth, $iHeight, $fStartAngle, $fSweepAngle[, $hBrush = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the pie
$iY | The Y coordinate of the upper left corner of the rectangle that bounds the ellipse in which to draw the pie
$iWidth | The width of the rectangle that bounds the ellipse in which to draw the pie
$iHeight | The height of the rectangle that bounds the ellipse in which to draw the pie
$fStartAngle | The angle, in degrees, between the X axis and the starting point of the arc that defines the pie. A positive value specifies clockwise rotation.
$fSweepAngle | The angle, in degrees, between the starting and ending points of the arc that defines the pie. A positive value specifies clockwise rotation.
$hBrush | [optional] Handle to a brush object that is used to fill the pie. If 0, a black brush will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipFillPieI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Fill a pie
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsFillPie($hGraphic, 150, 80, 100, 100, 45, 90)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsFillPolygon

Function Reference

_GDIPlus_GraphicsFillPolygon

Fill a polygon

#Include <GDIPlus.au3>
_GDIPlus_GraphicsFillPolygon($hGraphics, $aPoints[, $hBrush = 0])

Parameters

$hGraphics | Handle to a Graphics object
$aPoints | Array that specify the vertices of the polygon: [0][0] - Number of vertices [1][0] - Vertice 1 X position [1][1] - Vertice 1 Y position [2][0] - Vertice 2 X position [2][1] - Vertice 2 Y position [n][0] - Vertice n X position [n][1] - Vertice n Y position
$hBrush | [optional] Handle to a brush object that is used to fill the polygon.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipFillPolygonI in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $aPoints[4][2]

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a polygon
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

$aPoints[0][0] = 3
$aPoints[1][0] = 150
$aPoints[1][1] = 150
$aPoints[2][0] = 200
$aPoints[2][1] = 100
$aPoints[3][0] = 250
$aPoints[3][1] = 150

MsgBox(4096, "Information", "Fill Polygon")

_GDIPlus_GraphicsFillPolygon($hGraphic, $aPoints)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsFillRect

Function Reference

_GDIPlus_GraphicsFillRect

Fill a rectangle

#Include <GDIPlus.au3>
_GDIPlus_GraphicsFillRect($hGraphics, $iX, $iY, $iWidth, $iHeight[, $hBrush = 0])

Parameters

$hGraphics | Handle to a Graphics object
$iX | The X coordinate of the upper left corner of the rectangle
$iY | The Y coordinate of the upper left corner of the rectangle
$iWidth | The width of the rectangle
$iHeight | The height of the rectangle
$hBrush | [optional] Handle to a brush object that is used to fill the rectangle. If 0, a black brush will be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipFillRectangleI in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Fill a rectangle
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsFillRect($hGraphic, 10, 10, 100, 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsGetDC

Function Reference

_GDIPlus_GraphicsGetDC

Gets a handle to the device context of the Graphics object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsGetDC($hGraphics)

Parameters

$hGraphics Handle to a Graphics object

Return Value

Success: | DC of the Graphics object
Failure: | 0

Remarks

Each call to the _GDIPlus_GraphicsGetDC should be paired with a call to the _GDIPlus_GraphicsReleaseDC. Do not call
any methods of the Graphics object between the calls.

Related

_GDIPlus_GraphicsReleaseDC

See Also

Search GdipGetDC in MSDN Library


Function _GDIPlus_GraphicsGetSmoothingMode

Function Reference

_GDIPlus_GraphicsGetSmoothingMode

Gets the graphics object rendering quality

#Include <GDIPlus.au3>
_GDIPlus_GraphicsGetSmoothingMode($hGraphics)

Parameters

$hGraphics Handle to a Graphics object

Return Value

Success: | Smoothing mode. Can be one of the following:
 | 0 - Smoothing is not applied
 | 1 - Smoothing is applied using an 8 X 4 box filter
 | 2 - Smoothing is applied using an 8 X 8 box filter
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_GraphicsSetSmoothingMode

See Also

Search GdipGetSmoothingMode in MSDN Library


Function _GDIPlus_GraphicsMeasureString

Function Reference

_GDIPlus_GraphicsMeasureString

Measures the size of a string

#Include <GDIPlus.au3>
_GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat)

Parameters

$hGraphics | Handle to a Graphics object
$sString | String to be drawn
$hFont | Handle to the font to use to draw the string
$tLayout | $tagGDIPRECTF structure that bounds the string
$hFormat | Handle to the string format to draw the string

Return Value

Success: | Array with the following format
 | [0] - $tagGDIPRECTF structure that receives the rectangle that bounds the string
 | [1] - The number of characters that actually fit into the layout rectangle
 | [2] - The number of lines that fit into the layout rectangle
Failure: | 0

Remarks

None.

Related

$tagGDIPRECTF

See Also

Search GdipMeasureString in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout, $aInfo
Local $sString = "Hello world"

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString ($hGraphic, $sString, $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_Shutdown ()

EndFunc ;==>_Main


Function _GDIPlus_GraphicsReleaseDC

Function Reference

_GDIPlus_GraphicsReleaseDC

Releases the device context of the Graphics object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsReleaseDC($hGraphics, $hDC)

Parameters

$hGraphics | Handle to a Graphics object
$hDC | Handle to the Graphics device context

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_GraphicsGetDC

See Also

Search GdipReleaseDC in MSDN Library


Function _GDIPlus_GraphicsSetSmoothingMode

Function Reference

_GDIPlus_GraphicsSetSmoothingMode

Sets the graphics object rendering quality

#Include <GDIPlus.au3>
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $iSmooth)

Parameters

$hGraphics | Handle to a Graphics object
$iSmooth | Smoothing mode: 0 - Smoothing is not applied 1 - Smoothing is applied using an 8 X 4 box filter 2 - Smoothing is applied using an 8 X 8 box filter

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_GraphicsGetSmoothingMode

See Also

Search GdipSetSmoothingMode in MSDN Library


Function _GDIPlus_GraphicsSetTransform

Function Reference

_GDIPlus_GraphicsSetTransform

Sets the world transformation for a graphics object

#Include <GDIPlus.au3>
_GDIPlus_GraphicsSetTransform($hGraphics, $hMatrix)

Parameters

$hGraphics | Handle to a Graphics object
$hMatrix | Handle to a Matrix object that specifies the world transformation

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipSetWorldTransform in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

$width = _GDIPlus_ImageGetWidth($hImage2)
$height = _GDIPlus_ImageGetHeight($hImage2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

;DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
DrawInsert($hGraphic, $hImage2, 350, 100, 0, $width + 2, $height + 2, 0xFFFF8000, 2)
DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4)
DrawInsert($hGraphic, $hImage2, 310, 30, 35, $width + 4, $height + 4, 0xFFFF00FF, 4)
DrawInsert($hGraphic, $hImage2, 320, 790, -35, $width, $height)

; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_WinAPI_DeleteObject($hBitmap1)
_WinAPI_DeleteObject($hBitmap2)
; Shut down GDI+ library
_GDIPlus_Shutdown()

EndFunc ;==>_Main

; #FUNCTION# ==================================================================================================
;Name...........: DrawInsert
; Description ...: Draw one image in another
; Syntax.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
; inserts Graphics $hImage2 into $hGraphic
; Parameters ....: $hGraphics - Handle to a Graphics object
; $hImage - Handle to an Image object to be inserted
; $iX - The X coordinate of the upper left corner of the inserted image
; $iY - The Y coordinate of the upper left corner of the inserted image
; $iWidth - The width of the rectangle Border around insert
; $iHeight - The height of the rectangle Border around insert
; $iARGB - Alpha, Red, Green and Blue components of pen color - Border colour
; $nWidth - The width of the pen measured in the units specified in the $iUnit parameter - Border Width

; Return values .: Success - True
; Failure - False
;==================================================================================================
Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
Local $hMatrix, $hPen2

;Rotation Matrix
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixRotate($hMatrix, $nAngle, "False")
_GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY)

;get pen + color
$hPen2 = _GDIPlus_PenCreate($iARGB, $nWidth)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2)

; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PenDispose($hPen2)
Return 1
EndFunc ;==>DrawInsert


Function _GDIPlus_ImageDispose

Function Reference

_GDIPlus_ImageDispose

Release an image object

#Include <GDIPlus.au3>
_GDIPlus_ImageDispose($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipDisposeImage in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo, $aEncoder, $hImage

_Main()

Func _Main()
Local $hGUI, $hBitmap

; Create GUI
$hGUI = GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Create an image to use for paramater lists
$hBitmap = _ScreenCapture_Capture ("", 0, 0, 1, 1)
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Show encoder parameters
$aEncoder = _GDIPlus_Encoders ()
ShowEncoder("Encoder")

; Show decoder parameters
$aEncoder = _GDIPlus_Decoders ()
ShowEncoder("Decoder")

; Clean up resources
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Show encoder information
Func ShowEncoder($sTitle)
Local $iI, $iJ, $iK, $sCLSID, $tData, $tParam, $tParams

For $iI = 1 To $aEncoder[0][0]
$sCLSID = _GDIPlus_EncodersGetCLSID ($aEncoder[$iI][5])
MemoWrite("Image " & $sTitle & " " & $iI)
MemoWrite(" Codec GUID ............: " & $aEncoder[$iI][ 1])
MemoWrite(" File format GUID ......: " & $aEncoder[$iI][ 2])
MemoWrite(" Codec name ............: " & $aEncoder[$iI][ 3])
MemoWrite(" Codec Dll file name ...: " & $aEncoder[$iI][ 4])
MemoWrite(" Codec file format .....: " & $aEncoder[$iI][ 5])
MemoWrite(" File name extensions ..: " & $aEncoder[$iI][ 6])
MemoWrite(" Mime type .............: " & $aEncoder[$iI][ 7])
MemoWrite(" Flags .................: 0x" & Hex($aEncoder[$iI][ 8]))
MemoWrite(" Version ...............: " & $aEncoder[$iI][ 9])
MemoWrite(" Signature count .......: " & $aEncoder[$iI][10])
MemoWrite(" Signature size ........: " & $aEncoder[$iI][11])
MemoWrite(" Signature pattern ptr .: 0x" & Hex($aEncoder[$iI][12]))
MemoWrite(" Signature mask ptr ....: 0x" & Hex($aEncoder[$iI][13]))
MemoWrite(" Paramater list size ...: " & _GDIPlus_EncodersGetParamListSize ($hImage, $sCLSID))
MemoWrite()

$tParams = _GDIPlus_EncodersGetParamList ($hImage, $sCLSID)
If @error Then ContinueLoop

For $iJ = 0 To DllStructGetData($tParams, "Count") - 1
MemoWrite(" Image " & $sTitle & " Parameter " & $iJ)
$tParam = DllStructCreate($tagGDIPENCODERPARAM, DllStructGetPtr($tParams, "Params") + ($iJ * 28))
MemoWrite(" Parameter GUID ......: " & _WinAPI_StringFromGUID (DllStructGetPtr($tParam, "GUID")))
MemoWrite(" Number of values ....: " & DllStructGetData($tParam, "Count"))
MemoWrite(" Parameter type.......: " & DllStructGetData($tParam, "Type"))
MemoWrite(" Parameter pointer ...: 0x" & Hex(DllStructGetData($tParam, "Values")))
Switch DllStructGetData($tParam, "Type")
Case 4
$tData = DllStructCreate("int Data[" & DllStructGetData($tParam, "Count") & "]", DllStructGetData($tParam, "Values"))
For $iK = 1 To DllStructGetData($tParam, "Count")
MemoWrite(" Value .............: " & DllStructGetData($tData, 1, $iK))
Next
Case 6
$tData = DllStructCreate("int Low;int High", DllStructGetData($tParam, "Values"))
MemoWrite(" Low range .........: " & DllStructGetData($tData, "Low"))
MemoWrite(" High range ........: " & DllStructGetData($tData, "High"))
EndSwitch
MemoWrite()
Next
Next
EndFunc ;==>ShowEncoder


Function _GDIPlus_ImageGetFlags

Function Reference

_GDIPlus_ImageGetFlags

Returns enumeration of pixel data attributes contained in an image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetFlags($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Array with the following format
 | [0] - - Integer flag set of pixel data attributes
 | [1] - - String of pixel data attributes separated by delimiter "|"
Failure: | Returns empty array and @error is set, @extended set to error location
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors
Use BitAND on returned integer flag set with GdipGetImageFlags constants

Related

_GDIPlus_ImageGetPixelFormat

See Also

Search GdipGetImageFlags in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage, $aRet

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; Show enumeration of pixel data attributes for screen capture
$aRet = _GDIPlus_ImageGetFlags($hImage)
$aRet[1] = @CRLF & StringReplace($aRet[1], "|", @CRLF)
MemoWrite("Image pixel data attributes of screen capture: " & $aRet[1]);
MemoWrite();
MemoWrite("Image flag set of pixel data attributes: " & $aRet[0]);
MemoWrite();

; Save screen capture bitmap to file
_GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Load screen capture bitmap from file
$hImage = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Show enumeration of pixel data attributes for saved file
$aRet = _GDIPlus_ImageGetFlags($hImage)
$aRet[1] = @CRLF & StringReplace($aRet[1], "|", @CRLF)
MemoWrite("Image pixel data attributes of saved file: " & $aRet[1]);
MemoWrite();
MemoWrite("Image flag set of pixel data attributes: " & $aRet[0]);

; Clean up resources
_GDIPlus_ImageDispose($hImage)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetGraphicsContext

Function Reference

_GDIPlus_ImageGetGraphicsContext

Get the graphics context of the image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetGraphicsContext($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Handle to a Graphics object
Failure: | -1 and @error is set

Remarks

None.

Related

See Also

Search GdipGetImageGraphicsContext in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphics

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture ("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)

; Draw one image in another
$hGraphics = _GDIPlus_ImageGetGraphicsContext ($hImage1)
_GDIPlus_GraphicsDrawImage ($hGraphics, $hImage2, 100, 100)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect ($hGraphics, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageDispose ($hImage1)
_GDIPlus_ImageDispose ($hImage2)
_WinAPI_DeleteObject ($hBitmap1)
_WinAPI_DeleteObject ($hBitmap2)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ImageGetHeight

Function Reference

_GDIPlus_ImageGetHeight

Get the image height

#Include <GDIPlus.au3>
_GDIPlus_ImageGetHeight($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Image height, in pixels
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_ImageGetWidth

See Also

Search GdipGetImageHeight in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hClone, $hImage, $iX, $iY

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture ("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Create 24 bit bitmap clone
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

; Clean up resources
_GDIPlus_ImageDispose ($hClone)
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ImageGetHorizontalResolution

Function Reference

_GDIPlus_ImageGetHorizontalResolution

Returns horizontal resolution in DPI (pixels per inch) of an image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetHorizontalResolution($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Integer of DPI (pixels per inch)
Failure: | Returns 0 and @error is set
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors

Related

_GDIPlus_ImageGetVerticalResolution

See Also

Search GdipGetImageHorizontalResolution in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; Show horizontal resolution in DPI (dots per inch) of image
MemoWrite("HorizontalResolution DPI : " & _GDIPlus_ImageGetHorizontalResolution($hImage));

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetPixelFormat

Function Reference

_GDIPlus_ImageGetPixelFormat

Returns pixel format of an image: Bits per pixel, Alpha channels, RGB, Grayscale, Indexed etc.

#Include <GDIPlus.au3>
_GDIPlus_ImageGetPixelFormat($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Array with the following format
 | [0] - - Integer of pixel format constant
 | [1] - - String of pixel format
Failure: | Returns empty array and @error is set, @extended set to error location
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors

Related

_GDIPlus_ImageGetFlags, _GDIPlus_BitmapLockBits, _GDIPlus_BitmapCloneArea

See Also

Search GdipGetImagePixelFormat in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage, $aRet

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; Show pixel format for screen capture
$aRet = _GDIPlus_ImageGetPixelFormat($hImage)
MemoWrite("Image pixel format of screen capture: " & $aRet[1]);
MemoWrite("Image pixel format constant: " & $aRet[0]);
MemoWrite();

; Save screen capture bitmap to file
_GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Load screen capture bitmap from file
$hImage = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Show pixel format for saved file
$aRet = _GDIPlus_ImageGetPixelFormat($hImage)
MemoWrite("Image pixel format of saved file: " & $aRet[1]);
MemoWrite("Image pixel format constant: " & $aRet[0]);

; Clean up resources
_GDIPlus_ImageDispose($hImage)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetRawFormat

Function Reference

_GDIPlus_ImageGetRawFormat

Returns file format GUID and image format name of an image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetRawFormat($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Array with the following format
 | [0] - - String of file format GUID
 | [1] - - String of image format name
Failure: | Returns empty array and @error is set, @extended set to error location
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors

Related

_GDIPlus_ImageGetType

See Also

Search GdipGetImageRawFormat in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage, $aRet

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; Show image format for screen capture
$aRet = _GDIPlus_ImageGetRawFormat($hImage)
MemoWrite("Image format of screen capture: " & $aRet[1]);
MemoWrite("GUID: " & $aRet[0]);
MemoWrite();

; Save screen capture bitmap to file
_GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Load screen capture bitmap from file
$hImage = _GDIPlus_ImageLoadFromFile(@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Show image format for saved file
$aRet = _GDIPlus_ImageGetRawFormat($hImage)
MemoWrite("Image format of saved file: " & $aRet[1]);
MemoWrite("GUID: " & $aRet[0]);

; Clean up resources
_GDIPlus_ImageDispose($hImage)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetType

Function Reference

_GDIPlus_ImageGetType

Returns type (bitmap or metafile) of an image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetType($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Integer of image type
 | $GDIP_IMAGETYPE_UNKNOWN - Non bitmap file or not identified as bitmap by GDI+
 | $GDIP_IMAGETYPE_BITMAP - Bitmap types: BMP, PNG, GIF, JPEG, TIFF, ICO, EXIF
 | $GDIP_IMAGETYPE_METAFILE - Metafile types: EMF, WMF
Failure: | Returns -1 and @error is set
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors

Related

_GDIPlus_ImageGetRawFormat

See Also

Search GdipGetImageType in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage, $iImageType, $sImageType

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

$iImageType = _GDIPlus_ImageGetType($hImage)
Switch $iImageType
Case $GDIP_IMAGETYPE_UNKNOWN
$sImageType = "Unrecognized bitmap format or not image file"
Case $GDIP_IMAGETYPE_BITMAP ; BMP, PNG, GIF, JPEG, TIFF, ICO, EXIF
$sImageType = "Bitmap"
Case $GDIP_IMAGETYPE_METAFILE ; EMF, WMF
$sImageType = "Metafile"
EndSwitch

; Show image type: Unidentified = 0, Bitmap = 1, Metafile = 2)
MemoWrite("Image type: " & $sImageType);

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetVerticalResolution

Function Reference

_GDIPlus_ImageGetVerticalResolution

Returns horizontal resolution in DPI (pixels per inch) of an image

#Include <GDIPlus.au3>
_GDIPlus_ImageGetVerticalResolution($hImage)

Parameters

$hImage Handle to an image object

Return Value

Success: | Integer of DPI (pixels per inch)
Failure: | Returns 0 and @error is set
@error: | 0 - No error.
 | 10 - Invalid image handle

Remarks

@error 4 relies on GDI+ UDF return of -1 or 0 instead of image handle for errors

Related

_GDIPlus_ImageGetHorizontalResolution

See Also

Search GdipGetImageVerticalResolution in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hBitmap, $hImage

; Create GUI
GUICreate("GDI+", 600, 400)
$iMemo = GUICtrlCreateEdit("", 2, 2, 596, 396, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

; Show vertical resolution in DPI (dots per inch) of image
MemoWrite("VerticalResolution DPI : " & _GDIPlus_ImageGetVerticalResolution($hImage));

; Clean up resources
_GDIPlus_ImageDispose($hImage)
_WinAPI_DeleteObject($hBitmap)

; Shut down GDI+ library
_GDIPlus_Shutdown()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage = '')
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GDIPlus_ImageGetWidth

Function Reference

_GDIPlus_ImageGetWidth

Get the image width

#Include <GDIPlus.au3>
_GDIPlus_ImageGetWidth($hImage)

Parameters

$hImage Handle to am image object

Return Value

Success: | Image width, in pixels
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_ImageGetHeight

See Also

Search GdipGetImageWidth in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hClone, $hImage, $iX, $iY

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture 32 bit bitmap
$hBitmap = _ScreenCapture_Capture ("")
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)

; Create 24 bit bitmap clone
$iX = _GDIPlus_ImageGetWidth ($hImage)
$iY = _GDIPlus_ImageGetHeight ($hImage)
$hClone = _GDIPlus_BitmapCloneArea ($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

; Save bitmap to file
_GDIPlus_ImageSaveToFile ($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

; Clean up resources
_GDIPlus_ImageDispose ($hClone)
_GDIPlus_ImageDispose ($hImage)
_WinAPI_DeleteObject ($hBitmap)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ImageLoadFromFile

Function Reference

_GDIPlus_ImageLoadFromFile

Create an image object based on a file

#Include <GDIPlus.au3>
_GDIPlus_ImageLoadFromFile($sFileName)

Parameters

$sFileName Fully qualified image file name

Return Value

Success: | Handle to the new image object
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_ImageSaveToFile, _GDIPlus_ImageSaveToFileEx

See Also

Search GdipLoadImageFromFile in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hImage, $sCLSID, $tData, $tParams

; Screen Capture
_ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Initialize GDI+ library
_GDIPlus_Startup ()

; Load image
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Get JPEG encoder CLSID
$sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

; Set up parameters for 90 degree rotation
$tData = DllStructCreate("int Data")
DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
$tParams = _GDIPlus_ParamInit (1)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

; Save image with rotation
_GDIPlus_ImageSaveToFileEx ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams))

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ImageSaveToFile

Function Reference

_GDIPlus_ImageSaveToFile

Save an image to file

#Include <GDIPlus.au3>
_GDIPlus_ImageSaveToFile($hImage, $sFileName)

Parameters

$hImage | Handle to an image object
$sFileName | Fully qualified image file name

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ImageLoadFromFile, _GDIPlus_ImageSaveToFileEx

See Also

Search GdipSaveImageToFile in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphics

; Initialize GDI+ library
_GDIPlus_Startup ()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture ("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture ("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap2)

; Draw one image in another
$hGraphics = _GDIPlus_ImageGetGraphicsContext ($hImage1)
_GDIPlus_GraphicsDrawImage ($hGraphics, $hImage2, 100, 100)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect ($hGraphics, 100, 100, 400, 300)

; Save resultant image
_GDIPlus_ImageSaveToFile ($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose ($hImage1)
_GDIPlus_ImageDispose ($hImage2)
_WinAPI_DeleteObject ($hBitmap1)
_WinAPI_DeleteObject ($hBitmap2)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ImageSaveToFileEx

Function Reference

_GDIPlus_ImageSaveToFileEx

Save an image to file

#Include <GDIPlus.au3>
_GDIPlus_ImageSaveToFileEx($hImage, $sFileName, $sEncoder[, $pParams = 0])

Parameters

$hImage | Handle to an image object
$sFileName | Fully qualified image file name
$sEncoder | GUID string of encoder to be used
$pParams | [optional] Pointer to a $tagGDIPPENCODERPARAMS structure

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_ImageLoadFromFile, _GDIPlus_ImageSaveToFile, $tagGDIPPENCODERPARAMS

See Also

Search GdipSaveImageToFile in MSDN Library

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hImage, $sCLSID, $tData, $tParams

; Capture screen
_ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Initialize GDI+ library
_GDIPlus_Startup ()

; Load image
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Get JPEG encoder CLSID
$sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

; Set up parameters for 90 degree rotation
$tData = DllStructCreate("int Data")
DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
$tParams = _GDIPlus_ParamInit (1)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

; Save image with rotation
_GDIPlus_ImageSaveToFileEx ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams))

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_MatrixCreate

Function Reference

_GDIPlus_MatrixCreate

Creates and initializes a Matrix object that represents the identity matrix

#Include <GDIPlus.au3>
_GDIPlus_MatrixCreate()

Parameters

None.

Return Value

Success: | Handle to a Matrix object
Failure: | 0

Remarks

When you are done with the matrix, call _GDIPlus_MatrixDispose to release the resources

Related

_GDIPlus_MatrixDispose

See Also

Search GdipCreateMatrix in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

$width = _GDIPlus_ImageGetWidth($hImage2)
$height = _GDIPlus_ImageGetHeight($hImage2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

;DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
DrawInsert($hGraphic, $hImage2, 350, 100, 0, $width + 2, $height + 2, 0xFFFF8000, 2)
DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4)
DrawInsert($hGraphic, $hImage2, 310, 30, 35, $width + 4, $height + 4, 0xFFFF00FF, 4)
DrawInsert($hGraphic, $hImage2, 320, 790, -35, $width, $height)

; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_WinAPI_DeleteObject($hBitmap1)
_WinAPI_DeleteObject($hBitmap2)
; Shut down GDI+ library
_GDIPlus_Shutdown()

EndFunc ;==>_Main

; #FUNCTION# ==================================================================================================
;Name...........: DrawInsert
; Description ...: Draw one image in another
; Syntax.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
; inserts Graphics $hImage2 into $hGraphic
; Parameters ....: $hGraphics - Handle to a Graphics object
; $hImage - Handle to an Image object to be inserted
; $iX - The X coordinate of the upper left corner of the inserted image
; $iY - The Y coordinate of the upper left corner of the inserted image
; $iWidth - The width of the rectangle Border around insert
; $iHeight - The height of the rectangle Border around insert
; $iARGB - Alpha, Red, Green and Blue components of pen color - Border colour
; $nWidth - The width of the pen measured in the units specified in the $iUnit parameter - Border Width

; Return values .: Success - True
; Failure - False
;==================================================================================================
Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
Local $hMatrix, $hPen2

;Rotation Matrix
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixRotate($hMatrix, $nAngle, "False")
_GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY)

;get pen + color
$hPen2 = _GDIPlus_PenCreate($iARGB, $nWidth)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2)

; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PenDispose($hPen2)
Return 1
EndFunc ;==>DrawInsert


Function _GDIPlus_MatrixDispose

Function Reference

_GDIPlus_MatrixDispose

Release a matrix object

#Include <GDIPlus.au3>
_GDIPlus_MatrixDispose($hMatrix)

Parameters

$hMatrix Handle to a Matrix object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_MatrixCreate

See Also

Search GdipDeleteMatrix in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

$width = _GDIPlus_ImageGetWidth($hImage2)
$height = _GDIPlus_ImageGetHeight($hImage2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

;DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
DrawInsert($hGraphic, $hImage2, 350, 100, 0, $width + 2, $height + 2, 0xFFFF8000, 2)
DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4)
DrawInsert($hGraphic, $hImage2, 310, 30, 35, $width + 4, $height + 4, 0xFFFF00FF, 4)
DrawInsert($hGraphic, $hImage2, 320, 790, -35, $width, $height)

; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_WinAPI_DeleteObject($hBitmap1)
_WinAPI_DeleteObject($hBitmap2)
; Shut down GDI+ library
_GDIPlus_Shutdown()

EndFunc ;==>_Main

; #FUNCTION# ==================================================================================================
;Name...........: DrawInsert
; Description ...: Draw one image in another
; Syntax.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
; inserts Graphics $hImage2 into $hGraphic
; Parameters ....: $hGraphics - Handle to a Graphics object
; $hImage - Handle to an Image object to be inserted
; $iX - The X coordinate of the upper left corner of the inserted image
; $iY - The Y coordinate of the upper left corner of the inserted image
; $iWidth - The width of the rectangle Border around insert
; $iHeight - The height of the rectangle Border around insert
; $iARGB - Alpha, Red, Green and Blue components of pen color - Border colour
; $nWidth - The width of the pen measured in the units specified in the $iUnit parameter - Border Width

; Return values .: Success - True
; Failure - False
;==================================================================================================
Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
Local $hMatrix, $hPen2

;Rotation Matrix
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixRotate($hMatrix, $nAngle, "False")
_GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY)

;get pen + color
$hPen2 = _GDIPlus_PenCreate($iARGB, $nWidth)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2)

; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PenDispose($hPen2)
Return 1
EndFunc ;==>DrawInsert


Function _GDIPlus_MatrixRotate

Function Reference

_GDIPlus_MatrixRotate

Updates a matrix with the product of itself and a rotation matrix

#Include <GDIPlus.au3>
_GDIPlus_MatrixRotate($hMatrix, $fAngle[, $bAppend = False])

Parameters

$hMatrix | Handle to a Matrix object
$fAngle | The angle of rotation in degrees. Positive values specify clockwise rotation.
$bAppend | [optional] Specifies the order of the multiplication: True - Specifies that the rotation matrix is on the left False - Specifies that the rotation matrix is on the right

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipRotateMatrix in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $width, $height

; Initialize GDI+ library
_GDIPlus_Startup()

; Capture full screen
$hBitmap1 = _ScreenCapture_Capture("")
$hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1)

; Capture screen region
$hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300)
$hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2)

$width = _GDIPlus_ImageGetWidth($hImage2)
$height = _GDIPlus_ImageGetHeight($hImage2)

; Draw one image in another
$hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1)

;DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
DrawInsert($hGraphic, $hImage2, 350, 100, 0, $width + 2, $height + 2, 0xFFFF8000, 2)
DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4)
DrawInsert($hGraphic, $hImage2, 310, 30, 35, $width + 4, $height + 4, 0xFFFF00FF, 4)
DrawInsert($hGraphic, $hImage2, 320, 790, -35, $width, $height)

; Save resultant image
_GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg")

; Clean up resources
_GDIPlus_ImageDispose($hImage1)
_GDIPlus_ImageDispose($hImage2)
_WinAPI_DeleteObject($hBitmap1)
_WinAPI_DeleteObject($hBitmap2)
; Shut down GDI+ library
_GDIPlus_Shutdown()

EndFunc ;==>_Main

; #FUNCTION# ==================================================================================================
;Name...........: DrawInsert
; Description ...: Draw one image in another
; Syntax.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
; inserts Graphics $hImage2 into $hGraphic
; Parameters ....: $hGraphics - Handle to a Graphics object
; $hImage - Handle to an Image object to be inserted
; $iX - The X coordinate of the upper left corner of the inserted image
; $iY - The Y coordinate of the upper left corner of the inserted image
; $iWidth - The width of the rectangle Border around insert
; $iHeight - The height of the rectangle Border around insert
; $iARGB - Alpha, Red, Green and Blue components of pen color - Border colour
; $nWidth - The width of the pen measured in the units specified in the $iUnit parameter - Border Width

; Return values .: Success - True
; Failure - False
;==================================================================================================
Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $nAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $nWidth = 1)
Local $hMatrix, $hPen2

;Rotation Matrix
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixRotate($hMatrix, $nAngle, "False")
_GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix)

_GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY)

;get pen + color
$hPen2 = _GDIPlus_PenCreate($iARGB, $nWidth)

; Draw a frame around the inserted image
_GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2)

; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PenDispose($hPen2)
Return 1
EndFunc ;==>DrawInsert


Function _GDIPlus_MatrixScale

Function Reference

_GDIPlus_MatrixScale

Updates a matrix with the product of itself and a scaling matrix

#Include <GDIPlus.au3>
_GDIPlus_MatrixScale($hMatrix, $fScaleX, $fScaleY[, $bOrder = False])

Parameters

$hMatrix | Handle to a Matrix object
$fScaleX | Multiplyier to scale the x-axis
$fScaleY | Multiplyier to scale the y-axis
$bOrder | [optional] Specifies the order of the multiplication: True - Specifies that the scaling matrix is on the left False - Specifies that the scaling matrix is on the right

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipScaleMatrix in MSDN Library

Example

#include <GUIConstants.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

; Create GUI
$hWnd = GUICreate("GDI+ Example", 500, 500)
GUISetState()

; Start GDI+
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

; Take Screenshot at bottom left of screen
$hScreenCap_hBitmap = _ScreenCapture_Capture("", 0, @DesktopHeight - 500, 500, @DesktopHeight)
$hScreenCap_Bitmap = _GDIPlus_BitmapCreateFromHBITMAP($hScreenCap_hBitmap)

$hMatrix = _GDIPlus_MatrixCreate()
; Scale the matrix by 2 (everything will get 2x larger)
_GDIPlus_MatrixScale($hMatrix, 2.0, 2.0)

_GDIPlus_GraphicsSetTransform($hGraphics, $hMatrix)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hScreenCap_Bitmap, 0, 0, 500, 500)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_WinAPI_DeleteObject($hScreenCap_hBitmap)
_GDIPlus_BitmapDispose($hScreenCap_Bitmap)
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()


Function _GDIPlus_MatrixTranslate

Function Reference

_GDIPlus_MatrixTranslate

Updates a matrix with the product of itself and a translation matrix

#Include <GDIPlus.au3>
_GDIPlus_MatrixTranslate($hMatrix, $fOffsetX, $fOffsetY[, $bAppend = False])

Parameters

$hMatrix | Handle to a Matrix object
$fOffsetX | Amount of pixels to add along the x-axis
$fOffsetY | Amount of pixels to add along the y-axis
$bAppend | [optional] Specifies the order of the multiplication: True - Specifies that the translation matrix is on the left False - Specifies that the translation matrix is on the right

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search GdipTranslateMatrix in MSDN Library

Example

#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

; Create GUI
$hWnd = GUICreate("GDI+ Example", 400, 300)
GUISetState()

; Start GDI+
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)

$hMatrix = _GDIPlus_MatrixCreate()
; Move the matrix half the width and helf the height towards the center
_GDIPlus_MatrixTranslate($hMatrix, 200, 150)
_GDIPlus_MatrixRotate($hMatrix, 45)
_GDIPlus_GraphicsSetTransform($hGraphics, $hMatrix)

$hPen = _GDIPlus_PenCreate(0xFF00FF00, 10)

_GDIPlus_GraphicsClear($hGraphics)
; Draw around upper left corner of the GUI, but since we have translated the matrix the object will appear at the center of GUI
_GDIPlus_GraphicsDrawRect($hGraphics, -50, -50, 100, 100, $hPen)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose($hPen)
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()


Function _GDIPlus_ParamAdd

Function Reference

_GDIPlus_ParamAdd

Add a value to an enocder parameter list

#Include <GDIPlus.au3>
_GDIPlus_ParamAdd(ByRef $tParams, $sGUID, $iCount, $iType, $pValues)

Parameters

$tParams | $tagGDIPPENCODERPARAMS structure returned from _GDIPlus_ParamInit
$sGUID | Encoder parameter GUID. Can be one of the following: $GDIP_EPGCHROMINANCETABLE - Chrominance table settings $GDIP_EPGCOLORDEPTH - Color depth settings $GDIP_EPGCOMPRESSION - Compression settings $GDIP_EPGLUMINANCETABLE - Luminance table settings $GDIP_EPGQUALITY - Quality settings $GDIP_EPGRENDERMETHOD - Render method settings $GDIP_EPGSAVEFLAG - Save flag settings $GDIP_EPGSCANMETHOD - Scan mode settings $GDIP_EPGTRANSFORMATION - Transformation settings $GDIP_EPGVERSION - Software version settings
$iCount | Number of elements in the $pValues array
$iType | Encoder parameter value type. Can be one of the following: $GDIP_EPTBYTE - 8 bit unsigned integer $GDIP_EPTASCII - Null terminated character string $GDIP_EPTSHORT - 16 bit unsigned integer $GDIP_EPTLONG - 32 bit unsigned integer $GDIP_EPTRATIONAL - Two longs (numerator, denomintor) $GDIP_EPTLONGRANGE - Two longs (low, high) $GDIP_EPTUNDEFINED - Array of bytes of any type $GDIP_EPTRATIONALRANGE - Two ratationals (low, high)
$pValues | Pointer to an array of values. Each value has the type specified by the $iType data member.

Return Value

None.

Remarks

None.

Related

_GDIPlus_ParamInit, $tagGDIPPENCODERPARAMS

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hImage, $sCLSID, $tData, $tParams

; Capture screen
_ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Initialize GDI+ library
_GDIPlus_Startup ()

; Load image
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Get JPEG encoder CLSID
$sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

; Set up parameters for 90 degree rotation
$tData = DllStructCreate("int Data")
DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
$tParams = _GDIPlus_ParamInit (1)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

; Save image with rotation
_GDIPlus_ImageSaveToFileEx ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams))

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_ParamInit

Function Reference

_GDIPlus_ParamInit

Initialize an encoder parameter list

#Include <GDIPlus.au3>
_GDIPlus_ParamInit($iCount)

Parameters

$iCount The total number of parameters that the list will contain

Return Value

Success: | $tagGDIPPENCODERPARAMS structure
Failure: | 0

Remarks

In order to pass parameters to any of the encoder functions, you must use an encoder parameter list. This
function is used to initialize an encoder parameter list that can then be passed to _GDIPlus_Param add to add the
actual parameters.

Related

_GDIPlus_ParamAdd, $tagGDIPPENCODERPARAMS

Example

#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hBitmap, $hImage, $sCLSID, $tData, $tParams

; Capture screen
_ScreenCapture_Capture (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Initialize GDI+ library
_GDIPlus_Startup ()

; Load image
$hImage = _GDIPlus_ImageLoadFromFile (@MyDocumentsDir & "\GDIPlus_Image.jpg")

; Get JPEG encoder CLSID
$sCLSID = _GDIPlus_EncodersGetCLSID ("JPG")

; Set up parameters for 90 degree rotation
$tData = DllStructCreate("int Data")
DllStructSetData($tData, "Data", $GDIP_EVTTRANSFORMROTATE90)
$tParams = _GDIPlus_ParamInit (1)
_GDIPlus_ParamAdd ($tParams, $GDIP_EPGTRANSFORMATION, 1, $GDIP_EPTLONG, DllStructGetPtr($tData, "Data"))

; Save image with rotation
_GDIPlus_ImageSaveToFileEx ($hImage, @MyDocumentsDir & "\GDIPlus_Image2.jpg", $sCLSID, DllStructGetPtr($tParams))

; Shut down GDI+ library
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenCreate

Function Reference

_GDIPlus_PenCreate

Create a pen object

#Include <GDIPlus.au3>
_GDIPlus_PenCreate([$iARGB = 0xFF000000[, $nWidth = 1[, $iUnit = 2]]])

Parameters

$iARGB | [optional] Alpha, Red, Green and Blue components of pen color
$nWidth | [optional] The width of the pen measured in the units specified in the $iUnit parameter
$iUnit | [optional] Unit of measurement for the pen size: 0 - World coordinates, a nonphysical unit 1 - Display units 2 - A unit is 1 pixel 3 - A unit is 1 point or 1/72 inch 4 - A unit is 1 inch 5 - A unit is 1/300 inch 6 - A unit is 1 millimeter

Return Value

Success: | Handle to a pen object
Failure: | 0

Remarks

When you are done with the pen, call _GDIPlus_PenDispose to release the resources

Related

_GDIPlus_PenDispose

See Also

Search GdipCreatePen1 in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw line
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate ()
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenDispose

Function Reference

_GDIPlus_PenDispose

Release a pen object

#Include <GDIPlus.au3>
_GDIPlus_PenDispose($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenCreate

See Also

Search GdipDeletePen in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw line
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate ()
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetAlignment

Function Reference

_GDIPlus_PenGetAlignment

Gets the pen alignment

#Include <GDIPlus.au3>
_GDIPlus_PenGetAlignment($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Alignment type:
 | 0 - Specifies that the pen is aligned on the center of the line that is drawn
 | 1 - Specifies, when drawing a polygon, that the pen is aligned on the inside of the edge of the polygon
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetAlignment

See Also

Search GdipGetPenMode in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
_GDIPlus_PenSetEndCap ($hPen, $GDIP_LINECAPARROWANCHOR)
_GDIPlus_PenSetAlignment ($hPen, 1)

; Show pen alignment
MsgBox(4096, "Information", "Pen alignment: " & _GDIPlus_PenGetAlignment ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 130, 390, 130, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 170, 390, 170, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetColor

Function Reference

_GDIPlus_PenGetColor

Gets the pen color

#Include <GDIPlus.au3>
_GDIPlus_PenGetColor($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Pen color
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetColor

See Also

Search GdipGetPenColor in MSDN Library


Function _GDIPlus_PenGetCustomEndCap

Function Reference

_GDIPlus_PenGetCustomEndCap

Gets the custom end cap for the pen

#Include <GDIPlus.au3>
_GDIPlus_PenGetCustomEndCap($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Handle to a CustomLineCap object that specifies the pen custom end cap
Failure: | 0

Remarks

None.

Related

_GDIPlus_PenSetCustomEndCap

See Also

Search GdipGetPenCustomEndCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap: " & _GDIPlus_PenGetCustomEndCap ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 200, 390, 200, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetDashCap

Function Reference

_GDIPlus_PenGetDashCap

Gets the pen dash cap style

#Include <GDIPlus.au3>
_GDIPlus_PenGetDashCap($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Dash cap style:
 | $GDIP_DASHCAPFLAT - A square cap that squares off both ends of each dash
 | $GDIP_DASHCAPROUND - A circular cap that rounds off both ends of each dash
 | $GDIP_DASHCAPTRIANGLE - A triangular cap that points both ends of each dash
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetDashCap

See Also

Search GdipGetPenDashCap197819 in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetDashStyle ($hPen, $GDIP_DASHSTYLEDASHDOT)
_GDIPlus_PenSetDashCap ($hPen, $GDIP_DASHCAPTRIANGLE)

; Show pen dash cap
MsgBox(4096, "Information", "Pen dash cap: " & _GDIPlus_PenGetDashCap ($hPen))

; Draw line
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetDashStyle

Function Reference

_GDIPlus_PenGetDashStyle

Gets the pen dash style

#Include <GDIPlus.au3>
_GDIPlus_PenGetDashStyle($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Dash style:
 | $GDIP_DASHSTYLESOLID - A solid line
 | $GDIP_DASHSTYLEDASH - A dashed line
 | $GDIP_DASHSTYLEDOT - A dotted line
 | $GDIP_DASHSTYLEDASHDOT - An alternating dash-dot line
 | $GDIP_DASHSTYLEDASHDOTDOT - An alternating dash-dot-dot line
 | $GDIP_DASHSTYLECUSTOM - A a user-defined, custom dashed line
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetDashStyle

See Also

Search GdipGetPenDashStyle in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetDashStyle ($hPen, $GDIP_DASHSTYLEDASHDOT)

; Show pen dash style
MsgBox(4096, "Information", "Pen dash style: " & _GDIPlus_PenGetDashStyle ($hPen))

; Draw line
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetEndCap

Function Reference

_GDIPlus_PenGetEndCap

Gets the pen end cap

#Include <GDIPlus.au3>
_GDIPlus_PenGetEndCap($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | End cap type:
 | $GDIP_LINECAPFLAT - Specifies a flat cap
 | $GDIP_LINECAPSQUARE - Specifies a square cap
 | $GDIP_LINECAPROUND - Specifies a circular cap
 | $GDIP_LINECAPTRIANGLE - Specifies a triangular cap
 | $GDIP_LINECAPNOANCHOR - Specifies that the line ends are not anchored
 | $GDIP_LINECAPSQUAREANCHOR - Specifies that the line ends are anchored with a square
 | $GDIP_LINECAPROUNDANCHOR - Specifies that the line ends are anchored with a circle
 | $GDIP_LINECAPDIAMONDANCHOR - Specifies that the line ends are anchored with a diamond
 | $GDIP_LINECAPARROWANCHOR - Specifies that the line ends are anchored with arrowheads
 | $GDIP_LINECAPCUSTOM - Specifies that the line ends are made from a CustomLineCap
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetEndCap

See Also

Search GdipGetPenEndCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetEndCap($hPen, $GDIP_LINECAPARROWANCHOR)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap type: " & _GDIPlus_PenGetEndCap ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 130, 390, 130, $hPen)
_GDIPlus_PenSetWidth($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 170, 390, 170, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenGetWidth

Function Reference

_GDIPlus_PenGetWidth

Retrieve the width of a pen

#Include <GDIPlus.au3>
_GDIPlus_PenGetWidth($hPen)

Parameters

$hPen Handle to a pen object

Return Value

Success: | Width of pen
Failure: | -1 and @error is set

Remarks

None.

Related

_GDIPlus_PenSetWidth

See Also

Search GdipGetPenWidth in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw line
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetWidth($hPen, 4)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 10, 390, 10, $hPen)

; Show pen width
MsgBox(4096, "Information", "Pen Width: " & _GDIPlus_PenGetWidth ($hPen))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetAlignment

Function Reference

_GDIPlus_PenSetAlignment

Sets the pen alignment

#Include <GDIPlus.au3>
_GDIPlus_PenSetAlignment($hPen[, $iAlignment = 0])

Parameters

$hPen | Handle to a pen object
$iAlignment | [optional] Pen alignment. Can be one of the following: 0 - Specifies that the pen is aligned on the center of the line that is drawn 1 - Specifies, when drawing a polygon, that the pen is aligned on the inside of the edge of the polygon

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetAlignment

See Also

Search GdipSetPenMode in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
_GDIPlus_PenSetEndCap ($hPen, $GDIP_LINECAPARROWANCHOR)
_GDIPlus_PenSetAlignment ($hPen, 1)

; Show pen alignment
MsgBox(4096, "Information", "Pen alignment: " & _GDIPlus_PenGetAlignment ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 130, 390, 130, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 170, 390, 170, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetColor

Function Reference

_GDIPlus_PenSetColor

Sets the pen color

#Include <GDIPlus.au3>
_GDIPlus_PenSetColor($hPen, $iARGB)

Parameters

$hPen | Handle to a pen object
$iARGB | Alpha, Red, Green and Blue components of pen color

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetColor

See Also

Search GdipSetPenColor in MSDN Library


Function _GDIPlus_PenSetCustomEndCap

Function Reference

_GDIPlus_PenSetCustomEndCap

Sets the custom end cap for the pen

#Include <GDIPlus.au3>
_GDIPlus_PenSetCustomEndCap($hPen, $hEndCap)

Parameters

$hPen | Handle to a pen object
$hEndCap | Handle to a CustomLineCap object that specifies the pen custom end cap

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetCustomEndCap

See Also

Search GdipSetPenCustomEndCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen, $hEndCap

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 4)
$hEndCap = _GDIPlus_ArrowCapCreate (3, 6)
_GDIPlus_PenSetCustomEndCap ($hPen, $hEndCap)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap: " & _GDIPlus_PenGetCustomEndCap ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 120, 390, 120, $hPen)
_GDIPlus_PenSetWidth ($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth ($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 200, 390, 200, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetDashCap

Function Reference

_GDIPlus_PenSetDashCap

Sets the pen dash cap style

#Include <GDIPlus.au3>
_GDIPlus_PenSetDashCap($hPen[, $iDash = 0])

Parameters

$hPen | Handle to a pen object
$iDash | [optional] Dash cap style. Can be one of the following: $GDIP_DASHCAPFLAT - A square cap that squares off both ends of each dash $GDIP_DASHCAPROUND - A circular cap that rounds off both ends of each dash $GDIP_DASHCAPTRIANGLE - A triangular cap that points both ends of each dash

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetDashCap

See Also

Search GdipSetPenDashCap197819 in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetDashStyle ($hPen, $GDIP_DASHSTYLEDASHDOT)
_GDIPlus_PenSetDashCap ($hPen, $GDIP_DASHCAPTRIANGLE)

; Show pen dash cap
MsgBox(4096, "Information", "Pen dash cap: " & _GDIPlus_PenGetDashCap ($hPen))

; Draw line
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetDashStyle

Function Reference

_GDIPlus_PenSetDashStyle

Sets the pen dash style

#Include <GDIPlus.au3>
_GDIPlus_PenSetDashStyle($hPen[, $iStyle = 0])

Parameters

$hPen | Handle to a pen object
$iStyle | [optional] Dash style. Can be one of the following: $GDIP_DASHSTYLESOLID - A solid line $GDIP_DASHSTYLEDASH - A dashed line $GDIP_DASHSTYLEDOT - A dotted line $GDIP_DASHSTYLEDASHDOT - An alternating dash-dot line $GDIP_DASHSTYLEDASHDOTDOT - An alternating dash-dot-dot line $GDIP_DASHSTYLECUSTOM - A a user-defined, custom dashed line

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetDashStyle

See Also

Search GdipSetPenDashStyle in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetDashStyle ($hPen, $GDIP_DASHSTYLEDASHDOT)

; Show pen dash style
MsgBox(4096, "Information", "Pen dash style: " & _GDIPlus_PenGetDashStyle ($hPen))

; Draw line
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetEndCap

Function Reference

_GDIPlus_PenSetEndCap

Sets the pen end cap

#Include <GDIPlus.au3>
_GDIPlus_PenSetEndCap($hPen, $iEndCap)

Parameters

$hPen | Handle to a pen object
$iEndCap | End cap type. Can be one of the following: $GDIP_LINECAPFLAT - Specifies a flat cap $GDIP_LINECAPSQUARE - Specifies a square cap $GDIP_LINECAPROUND - Specifies a circular cap $GDIP_LINECAPTRIANGLE - Specifies a triangular cap $GDIP_LINECAPNOANCHOR - Specifies that the line ends are not anchored $GDIP_LINECAPSQUAREANCHOR - Specifies that the line ends are anchored with a square $GDIP_LINECAPROUNDANCHOR - Specifies that the line ends are anchored with a circle $GDIP_LINECAPDIAMONDANCHOR - Specifies that the line ends are anchored with a diamond $GDIP_LINECAPARROWANCHOR - Specifies that the line ends are anchored with arrowheads $GDIP_LINECAPCUSTOM - Specifies that the line ends are made from a CustomLineCap

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetEndCap

See Also

Search GdipSetPenEndCap in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Create resources
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetEndCap($hPen, $GDIP_LINECAPARROWANCHOR)

; Show pen end cap
MsgBox(4096, "Information", "Pen end cap type: " & _GDIPlus_PenGetEndCap ($hPen))

; Draw arrows
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 130, 390, 130, $hPen)
_GDIPlus_PenSetWidth($hPen, 6)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 150, 390, 150, $hPen)
_GDIPlus_PenSetWidth($hPen, 8)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 170, 390, 170, $hPen)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_PenSetWidth

Function Reference

_GDIPlus_PenSetWidth

Sets the width of a pen

#Include <GDIPlus.au3>
_GDIPlus_PenSetWidth($hPen, $fWidth)

Parameters

$hPen | Handle to a pen object
$fWidth | Width of pen

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GDIPlus_PenGetWidth

See Also

Search GdipSetPenWidth in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hPen

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw line
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hPen = _GDIPlus_PenCreate (0xFF000000, 8)
_GDIPlus_PenSetWidth($hPen, 4)
_GDIPlus_GraphicsDrawLine ($hGraphic, 10, 10, 390, 10, $hPen)

; Show pen width
MsgBox(4096, "Information", "Pen Width: " & _GDIPlus_PenGetWidth ($hPen))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_PenDispose ($hPen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_RectFCreate

Function Reference

_GDIPlus_RectFCreate

Create a $tagGDIPRECTF structure

#Include <GDIPlus.au3>
_GDIPlus_RectFCreate([$nX = 0[, $nY = 0[, $nWidth = 0[, $nHeight = 0]]]])

Parameters

$nX | [optional] X coordinate of upper left hand corner of rectangle
$nY | [optional] Y coordinate of upper left hand corner of rectangle
$nWidth | [optional] Rectangle width
$nHeight | [optional] Rectangle height

Return Value

Returns a $tagGDIPRECTF structure

Remarks

None.

Related

$tagGDIPRECTF

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)

_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_Shutdown

Function Reference

_GDIPlus_Shutdown

Clean up resources used by Microsoft Windows GDI+

#Include <GDIPlus.au3>
_GDIPlus_Shutdown()

Parameters

None.

Return Value

Success: | True
Failure: | False

Remarks

You must dispose of all of your GDI+ objects before you call _GDIPlus_Shutdown

Related

_GDIPlus_Startup

See Also

Search GdiplusShutdown in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hBMP, $hBitmap, $hGraphic

; Capture upper left corner of screen
$hBMP = _ScreenCapture_Capture ("", 0, 0, 400, 300)

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Draw bitmap to GUI
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 0, 0)

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ImageDispose ($hBitmap)
_WinAPI_DeleteObject ($hBMP)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GDIPlus_Startup

Function Reference

_GDIPlus_Startup

Initialize Microsoft Windows GDI+

#Include <GDIPlus.au3>
_GDIPlus_Startup()

Parameters

None.

Return Value

Success: | True
Failure: | False

Remarks

Call _GDIPlus_Startup before you create any GDI+ objects. GDI+ requires a redistributable for applications that
run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems.

Related

_GDIPlus_Shutdown

See Also

Search GdiplusStartup in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hBMP, $hBitmap, $hGraphic

; Capture upper left corner of screen
$hBMP = _ScreenCapture_Capture ("", 0, 0, 400, 300)

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Initialize GDI+ library
_GDIPlus_Startup ()

; Draw bitmap to GUI
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
_GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 0, 0)

; Clean up resources
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ImageDispose ($hBitmap)
_WinAPI_DeleteObject ($hBMP)

; Shut down GDI+ library
_GDIPlus_ShutDown ()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GDIPlus_StringFormatCreate

Function Reference

_GDIPlus_StringFormatCreate

Create a String Format object

#Include <GDIPlus.au3>
_GDIPlus_StringFormatCreate([$iFormat = 0[, $iLangID = 0]])

Parameters

$iFormat | [optional] Format flags. Can be one or more of the following: 0x0001 - Specifies that reading order is right to left 0x0002 - Specifies that individual lines of text are drawn vertically on the display device 0x0004 - Specifies that parts of characters are allowed to overhang the string's layout rectangle 0x0020 - Specifies that Unicode layout control characters are displayed with a representative character 0x0400 - Specifies that an alternate font is used for characters that are not supported in the requested font 0x0800 - Specifies that the space at the end of each line is included in a string measurement 0x1000 - Specifies that the wrapping of text to the next line is disabled 0x2000 - Specifies that only entire lines are laid out in the layout rectangle 0x4000 - Specifies that characters overhanging the layout rectangle and text extending outside the layout rectangle are allowed to show
$iLangID | [optional] The language to use

Return Value

Success: | Handle to a string format object
Failure: | 0

Remarks

When you are done with the String Format object, call _GDIPlus_StringFormatDispose to release the resources

Related

_GDIPlus_StringFormatDispose, _GDIPlus_StringFormatSetAlign

See Also

Search GdipCreateStringFormat in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)

_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_StringFormatDispose

Function Reference

_GDIPlus_StringFormatDispose

Release a String Format object

#Include <GDIPlus.au3>
_GDIPlus_StringFormatDispose($hFormat)

Parameters

$hFormat Handle to a String Format object

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GDIPlus_StringFormatCreate

See Also

Search GdipDeleteStringFormat in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GDIPlus.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout

; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState()

; Draw a string
_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$hBrush = _GDIPlus_BrushCreateSolid (0xFF00007F)
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Arial")
$hFont = _GDIPlus_FontCreate ($hFamily, 12, 2)
$tLayout = _GDIPlus_RectFCreate (140, 110, 100, 20)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, "Hello world", $hFont, $tLayout, $hFormat, $hBrush)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Clean up resources
_GDIPlus_FontDispose ($hFont)
_GDIPlus_FontFamilyDispose ($hFamily)
_GDIPlus_StringFormatDispose ($hFormat)
_GDIPlus_BrushDispose ($hBrush)

_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_ShutDown ()

EndFunc ;==>_Main


Function _GDIPlus_StringFormatSetAlign

Function Reference

_GDIPlus_StringFormatSetAlign

Sets the text alignment of a string format object

#Include <GDIPlus.au3>
_GDIPlus_StringFormatSetAlign($hStringFormat,$iFlag)

Parameters

$hStringFormat | The string format object which is aligned
$iFlag | The alignment can be one of the following: 0 - The text is aligned to the left 1 - The text is centered 2 - The text is aligned to the right

Return Value

Success: | 1
Failure: | 0 and @error=1

Remarks

None.

Related

_GDIPlus_StringFormatCreate

See Also

Search GdipSetStringFormatAlign in MSDN Library

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

$hWnd = GUICreate("GDI+ Example", 400, 300)
GUISetState()

_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
_GDIPlus_GraphicsClear($hGraphics)

$hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 36)
$hLayout = _GDIPlus_RectFCreate(0, 0, 400, 300)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
_GDIPlus_GraphicsDrawStringEx($hGraphics, "AutoIt Rocks", $hFont, $hLayout, $hStringFormat, $hBrush)

Do
$msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()


User Defined Functions

GuiAVI user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiAVI.au3>.

User Defined Function | Description
_GUICtrlAVI_Close | Closes an AVI clip
_GUICtrlAVI_Create | Creates an AVI control
_GUICtrlAVI_Destroy | Delete the control
_GUICtrlAVI_IsPlaying | Checks whether an Audio-Video Interleaved (AVI) clip is playing
_GUICtrlAVI_Open | Opens an AVI clip and displays its first frame in an animation control
_GUICtrlAVI_OpenEx | Opens an AVI clip and displays its first frame in an animation control
_GUICtrlAVI_Play | Plays an AVI clip in an animation control
_GUICtrlAVI_Seek | Directs an AVI control to display a particular frame of an AVI clip
_GUICtrlAVI_Show | Show/Hide the AVI control
_GUICtrlAVI_Stop | Stops playing an AVI clip


Function _GUICtrlAVI_Close

Function Reference

_GUICtrlAVI_Close

Closes an AVI clip

#Include <GuiAVI.au3>
_GUICtrlAVI_Close($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlAVI_Open

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Main()

Func _Main()
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"

; Create GUI
$hGUI = GUICreate("(External) AVI Close", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, $sFile, -1, 10, 10)
GUISetState()

; Play the sample AutoIt AVI
_GUICtrlAVI_Play($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_Create

Function Reference

_GUICtrlAVI_Create

Creates an AVI control

#Include <GuiAVI.au3>
_GUICtrlAVI_Create($hWnd[, $sFile = ""[, $subfileid = -1[, $iX = 0[, $iY = 0[, $iWidth = 0[, $iHeight = 0[, $iStyle = 0x00000006[, $iExStyle = 0x00000000]]]]]]]])

Parameters

$hWnd | Handle to parent or owner window
$sFile | [optional] The filename of the video. Only .avi files are supported
$subfileid | [optional] id of the subfile to be used.
$iX | [optional] Horizontal position of the control
$iY | [optional] Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control styles: $ACS_CENTER - Centers the animation in the animation control's window $ACS_TRANSPARENT - Creates the control with a transparent background $ACS_AUTOPLAY - Starts playing the animation as soon as the AVI clip is opened $ACS_TIMER - The control plays the clip without creating a thread
 | Default: $ACS_TRANSPARENT, $ACS_AUTOPLAY Forced : $WS_CHILD, $WS_VISIBLE
$iExStyle | [optional] Control external styles

Return Value

Success: | Handle of the animation control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlAVI_Destroy

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Example1()
_Example2()

Func _Example1()
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"

; Create GUI
$hGUI = GUICreate("(External 1) AVI Create", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, $sFile, -1, 10, 10)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Play the sample AutoIt AVI
_GUICtrlAVI_Play ($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close ($hAVI)

GUIDelete()
EndFunc ;==>_Example1

Func _Example2()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(External 2) AVI Create", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, @SystemDir & "\Shell32.dll", 150, 10, 10)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Play the sample AutoIt AVI
_GUICtrlAVI_Play ($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close ($hAVI)

GUIDelete()
EndFunc ;==>_Example2

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
Case $hAVI
Switch $iCode
Case $ACN_START ; Notifies an animation control's parent window that the associated AVI clip has started playing
_DebugPrint("$ACN_START" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $ACN_STOP ; Notifies the parent window of an animation control that the associated AVI clip has stopped playing
_DebugPrint("$ACN_STOP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlAVI_Destroy

Function Reference

_GUICtrlAVI_Destroy

Delete the control

#Include <GuiAVI.au3>
_GUICtrlAVI_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on AVI Control created with _GUICtrlAVI_Create

Related

_GUICtrlAVI_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Main()

Func _Main()
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"

; Create GUI
$hGUI = GUICreate("(External) AVI Destroy", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, "", -1, 10, 10)
GUISetState()

; Play the sample AutoIt AVI
_GUICtrlAVI_Open ($hAVI, $sFile)

; Play the sample AutoIt AVI
_GUICtrlAVI_Play($hAVI)

Sleep(3000)

; Stop AVI clip after 3 seconds
_GUICtrlAVI_Stop ($hAVI)

; Close AVI clip
_GUICtrlAVI_Close ($hAVI)

MsgBox(4160, "Information", "Destroy AVI Control")
_GUICtrlAVI_Destroy ($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_IsPlaying

Function Reference

_GUICtrlAVI_IsPlaying

Checks whether an Audio-Video Interleaved (AVI) clip is playing

#Include <GuiAVI.au3>
_GUICtrlAVI_IsPlaying($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

Minimum OS: Windows Vista

Related

See Also

Search ACM_ISPLAYING in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI, $iMemo

_Main()

Func _Main()
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"
Local $btn_StartStop

; Create GUI
$hGUI = GUICreate("(External) AVI Open", 300, 200)
$hAVI = _GUICtrlAVI_Create($hGUI, "", -1, 10, 10)
$btn_StartStop = GUICtrlCreateButton("Start", 50, 10, 75, 25)
$iMemo = GUICtrlCreateEdit("", 10, 50, 276, 144, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Play the sample AutoIt AVI
_GUICtrlAVI_Open($hAVI, $sFile)

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $btn_StartStop
If GUICtrlRead($btn_StartStop) = "Start" Then
_GUICtrlAVI_Play($hAVI)
GUICtrlSetData($btn_StartStop, "Stop")
Else
_GUICtrlAVI_Stop($hAVI)
GUICtrlSetData($btn_StartStop, "Start")
EndIf
MemoWrite("Is Playing: " & _GUICtrlAVI_IsPlaying($hAVI))

Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlAVI_Open

Function Reference

_GUICtrlAVI_Open

Opens an AVI clip and displays its first frame in an animation control

#Include <GuiAVI.au3>
_GUICtrlAVI_Open($hWnd, $sFileName)

Parameters

$hWnd | Handle to the control
$sFileName | Fully qualified path to the AVI file

Return Value

Success: True
Failure: False

Remarks

You can only open silent AVI clips

Related

_GUICtrlAVI_Close, _GUICtrlAVI_OpenEx

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Main()

Func _Main()
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"

; Create GUI
$hGUI = GUICreate("(External) AVI Open", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, "", -1, 10, 10)
GUISetState()

; Play the sample AutoIt AVI
_GUICtrlAVI_Open($hAVI, $sFile)

; Play the sample AutoIt AVI
_GUICtrlAVI_Play($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_OpenEx

Function Reference

_GUICtrlAVI_OpenEx

Opens an AVI clip and displays its first frame in an animation control

#Include <GuiAVI.au3>
_GUICtrlAVI_OpenEx($hWnd, $sFileName, $iResourceID)

Parameters

$hWnd | Handle to the control
$sFileName | Fully qualified path to resource file
$iResourceID | AVI resource identifier

Return Value

Success: True
Failure: False

Remarks

You can only open silent AVI clips

Related

_GUICtrlAVI_Open

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(External) AVI OpenEx", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, "", -1, 10, 10)
GUISetState()

; Play the sample AutoIt AVI
_GUICtrlAVI_OpenEx($hAVI, @SystemDir & "\Shell32.dll", 150)

; Play the sample AutoIt AVI
_GUICtrlAVI_Play($hAVI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_Play

Function Reference

_GUICtrlAVI_Play

Plays an AVI clip in an animation control

#Include <GuiAVI.au3>
_GUICtrlAVI_Play($hWnd[, $iFrom = 0[, $iTo = -1[, $iRepeat = -1]]])

Parameters

$hWnd | Handle to the control
$iFrom | [optional] Zero based index of the frame where playing begins. The value must be less than 65,536. A value of 0 means begin with the first frame in the clip.
$iTo | [optional] Zero based index of the frame where playing ends. The value must be less than 65,536. A value of -1 means end with the last frame in the clip.
$iRepeat | [optional] Number of times to replay the AVI clip. A value of -1 means replay the clip indefinitely.

Return Value

Success: | True
Failure: | False

Remarks

The control plays the clip in the background while the thread continues executing

Related

_GUICtrlAVI_Stop, _GUICtrlAVI_Seek

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Example_Internal()
_Example_External()

Func _Example_Internal()
Local $hGUI, $btn_start, $btn_stop

; Create GUI
$hGUI = GUICreate("(Internal) AVI Play", 300, 200)
$hAVI = GUICtrlCreateAvi (@SystemDir & "\shell32.dll",160, 10,10)
$btn_start = GUICtrlCreateButton ("start",50,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",150,150,70,22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main

Func _Example_External()
Local $hGUI, $btn_start, $btn_stop

; Create GUI
$hGUI = GUICreate("(External) AVI Play", 300, 200)
$hAVI = _GUICtrlAVI_Create ($hGUI, @SystemDir & "\Shell32.dll", 160, 10, 10)
$btn_start = GUICtrlCreateButton ("start",50,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",150,150,70,22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_Seek

Function Reference

_GUICtrlAVI_Seek

Directs an AVI control to display a particular frame of an AVI clip

#Include <GuiAVI.au3>
_GUICtrlAVI_Seek($hWnd, $iFrame)

Parameters

$hWnd | Handle to the control
$iFrame | Zero based index of the frame to display

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlAVI_Play

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Example_Internal()
_Example_External()

Func _Example_Internal()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(Internal) AVI Seek", 300, 100)
$hAVI = GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 160, 10, 10)
GUISetState()

; Loop until user exits
Do
Sleep(100)
; Seek to a random frame in the AVI Clip
_GUICtrlAVI_Seek ($hAVI, Random(1, 30, 1))
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close ($hAVI)

GUIDelete()
EndFunc ;==>_Main

Func _Example_External()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(External) AVI Seek", 300, 100)
$hAVI = _GUICtrlAVI_Create ($hGUI, @SystemDir & "\Shell32.dll", 160, 10, 10)
GUISetState()

; Loop until user exits
Do
Sleep(100)
; Seek to a random frame in the AVI Clip
_GUICtrlAVI_Seek ($hAVI, Random(1, 30, 1))
Until GUIGetMsg() = $GUI_EVENT_CLOSE

; Close AVI clip
_GUICtrlAVI_Close ($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_Show

Function Reference

_GUICtrlAVI_Show

Show/Hide the AVI control

#Include <GuiAVI.au3>
_GUICtrlAVI_Show($hWnd, $iState)

Parameters

$hWnd | Handle to the control
$iState | State of the AVI, can be the following values:

Return Value

True: The control was previously visible
False: The control was previously hidden

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Example_Internal()
_Example_External()

Func _Example_Internal()
Local $hGUI, $btn_start, $btn_stop, $btn_show

; Create GUI
$hGUI = GUICreate("(Internal) AVI Play", 350, 200)
$hAVI = GUICtrlCreateAvi (@SystemDir & "\shell32.dll",160, 10,10)
$btn_start = GUICtrlCreateButton ("start",25,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",125,150,70,22)
$btn_show = GUICtrlCreateButton("hide", 225, 150, 70, 22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
Case $btn_show
If GUICtrlRead($btn_show) = "hide" Then
_GUICtrlAVI_Show($hAVI, @SW_HIDE)
GUICtrlSetData($btn_show, "show")
Else
_GUICtrlAVI_Show($hAVI, @SW_SHOW)
GUICtrlSetData($btn_show, "hide")
EndIf
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main

Func _Example_External()
Local $hGUI, $btn_start, $btn_stop, $btn_show

; Create GUI
$hGUI = GUICreate("(External) AVI Play", 350, 200)
$hAVI = _GUICtrlAVI_Create ($hGUI, @SystemDir & "\Shell32.dll", 160, 10, 10)
$btn_start = GUICtrlCreateButton ("start",25,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",125,150,70,22)
$btn_show = GUICtrlCreateButton("hide", 225, 150, 70, 22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
Case $btn_show
If GUICtrlRead($btn_show) = "hide" Then
_GUICtrlAVI_Show($hAVI, @SW_HIDE)
GUICtrlSetData($btn_show, "show")
Else
_GUICtrlAVI_Show($hAVI, @SW_SHOW)
GUICtrlSetData($btn_show, "hide")
EndIf
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlAVI_Stop

Function Reference

_GUICtrlAVI_Stop

Stops playing an AVI clip

#Include <GuiAVI.au3>
_GUICtrlAVI_Stop($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlAVI_Play

Example

#include <GuiConstantsEx.au3>
#include <GuiAVI.au3>

Opt('MustDeclareVars', 1)

$Debug_AVI = False ; Check ClassName being passed to AVI functions, set to True and use a handle to another control to see it work

Global $hAVI

_Example_Internal()
_Example_External()

Func _Example_Internal()
Local $hGUI, $btn_start, $btn_stop

; Create GUI
$hGUI = GUICreate("(Internal) AVI Stop", 300, 200)
$hAVI = GUICtrlCreateAvi (@SystemDir & "\shell32.dll",160, 10,10)
$btn_start = GUICtrlCreateButton ("start",50,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",150,150,70,22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main

Func _Example_External()
Local $hGUI, $btn_start, $btn_stop

; Create GUI
$hGUI = GUICreate("(External) AVI Stop", 300, 200)
$hAVI = _GUICtrlAVI_Create ($hGUI, @SystemDir & "\Shell32.dll", 160, 10, 10)
$btn_start = GUICtrlCreateButton ("start",50,150,70,22)
$btn_stop = GUICtrlCreateButton ("stop",150,150,70,22)
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_start
; Play part of the AVI clip
_GUICtrlAVI_Play($hAVI)
Case $btn_stop
; Stop AVI clip
_GUICtrlAVI_Stop($hAVI)
EndSwitch
WEnd

; Close AVI clip
_GUICtrlAVI_Close($hAVI)

GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiButton user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiButton.au3>.

User Defined Function | Description
_GUICtrlButton_Click | Simulates the user clicking a button
_GUICtrlButton_Create | Creates a Button control
_GUICtrlButton_Destroy | Delete the Button control
_GUICtrlButton_Enable | Enables or disables mouse and keyboard input to the specified button
_GUICtrlButton_GetCheck | Gets the check state of a radio button or check box
_GUICtrlButton_GetFocus | Retrieves if the button has keyboard focus
_GUICtrlButton_GetIdealSize | Gets the size of the button that best fits its text and image, if an image list is present
_GUICtrlButton_GetImage | Retrieves a handle to the image (icon or bitmap) associated with the button
_GUICtrlButton_GetImageList | Retrieves an array that describes the image list assigned to a button control
_GUICtrlButton_GetNote | Gets the text of the note associated with the Command Link button
_GUICtrlButton_GetNoteLength | Gets the length of the note text that may be displayed in the description for a command link button
_GUICtrlButton_GetSplitInfo | Gets information for a split button control
_GUICtrlButton_GetState | Determines the state of a button or check box
_GUICtrlButton_GetText | Retrieve the text of the button
_GUICtrlButton_GetTextMargin | Gets the margins used to draw text in a button control
_GUICtrlButton_SetCheck | Sets the check state of a radio button or check box
_GUICtrlButton_SetDontClick | Sets the state of $BST_DONTCLICK flag on a button
_GUICtrlButton_SetFocus | Sets the keyboard focus to the specified button
_GUICtrlButton_SetImage | Sets the check state of a radio button or check box
_GUICtrlButton_SetImageList | Assigns an image list to a button control
_GUICtrlButton_SetNote | Sets the text of the note associated with a command link button
_GUICtrlButton_SetShield | Sets the elevation required state for a specified button or command link to display an elevated icon
_GUICtrlButton_SetSize | Sets the size of the button
_GUICtrlButton_SetSplitInfo | Gets information for a split button control
_GUICtrlButton_SetState | Sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it.
_GUICtrlButton_SetStyle | Sets the style of a button
_GUICtrlButton_SetText | Sets the text of the button
_GUICtrlButton_SetTextMargin | Sets the margins for drawing text in a button control
_GUICtrlButton_Show | Show/Hide button


Function _GUICtrlButton_Click

Function Reference

_GUICtrlButton_Click

Simulates the user clicking a button

#Include <GuiButton.au3>
_GUICtrlButton_Click($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

If the button is in a dialog box and the dialog box is not active, the _GUICtrlButton_Click might fail.
To ensure success in this situation, call the WinActivate function to activate the dialog box before sending
the _GUICtrlButton_Click to the button.

Related

See Also

Search BM_CLICK in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>

Opt("MustDeclareVars", 1)

Global $btn[6], $iMemo, $iRand

HotKeySet("!b", "Clickit")

_Main()

Func _Main()
Local $y = 70

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 376, 374, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

MemoWrite("Press Alt+b to Click Button")

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 100, 50)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 100, 50)
$y += 60
Next

$iRand = Random(0, 5, 1)
_GUICtrlButton_SetText($btn[$iRand], "New Text" & $iRand + 1)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn[$iRand]
MemoWrite(_GUICtrlButton_GetText($btn[$iRand]) & " Clicked")
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

Func Clickit()
$iRand = Random(0, 5, 1)
_GUICtrlButton_Click($btn[$iRand])
EndFunc ;==>Clickit

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_Create

Function Reference

_GUICtrlButton_Create

Creates a Button control

#Include <GuiButton.au3>
_GUICtrlButton_Create($hWnd, $sText, $iX, $iY, $iWidth, $iHeight[, $iStyle = -1[, $iExStyle = -1]])

Parameters

$hWnd | Handle to parent or owner window
$sText | Text to add to Button
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | Control width
$iHeight | Control height
$iStyle [optional] Control style:
$BS_AUTO3STATE - Creates a three-state check box in which the state cycles through selected, unavailable, and cleared each time the user selects the check box.
$BS_AUTOCHECKBOX - Creates a check box in which the check state switches between selected and cleared each time the user selects the check box.
$BS_AUTORADIOBUTTON - Same as a radio button, except that when the user selects it, the button automatically highlights itself and removes the selection from any other radio buttons with the same style in the same group.
$BS_FLAT - Specifies that the button is two-dimensional; it does not use the default shading to create a 3-D image.
$BS_GROUPBOX - Creates a rectangle in which other buttons can be grouped. Any text associated with this style is displayed in the rectangle’s upper-left corner.
$BS_PUSHLIKE - Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.
$BS_DEFPUSHBUTTON - Creates a push button with a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely option, or default.
$BS_BOTTOM - Places the text at the bottom of the button rectangle.
$BS_CENTER - Centers the text horizontally in the button rectangle.
$BS_LEFT - Left-aligns the text in the button rectangle on the right side of the check box.
$BS_MULTILINE - Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.
$BS_RIGHT - Right-aligns text in the button rectangle on the right side of the check box.
$BS_RIGHTBUTTON - Positions a check box square on the right side of the button rectangle.
$BS_TOP - Places text at the top of the button rectangle.
$BS_VCENTER - Vertically centers text in the button rectangle.
$BS_ICON - Specifies that the button displays an icon.
$BS_BITMAP - Specifies that the button displays a bitmap.
$BS_NOTIFY - Enables a button to send BN_KILLFOCUS and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style. To get BN_DBLCLK notification messages, the button must have the BS_RADIOBUTTON or BS_OWNERDRAW style.
Vista Sytles:
$BS_SPLITBUTTON - Creates a split button. A split button has a drop down arrow
$BS_DEFSPLITBUTTON - Creates a split button that behaves like a $BS_PUSHBUTTON style button, but also has a distinctive appearance.
$BS_COMMANDLINK - Creates a command link button
$BS_DEFCOMMANDLINK - Creates a command link button that behaves like a $BS_PUSHBUTTON style button.
Default: ( -1) : none
Forced : $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE, $BS_NOTIFY
$iExStyle | [optional] Control extended style. These correspond to the standard $WS_EX_ constants.

Return Value

Success: | Handle to the Button control
Failure: | 0

Remarks

Above constants require ButtonConstants.au3

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlButton_Destroy

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $btn, $rdo, $chk, $iMemo

; Note the controlId from these buttons can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 90, 50)

$rdo = _GUICtrlButton_Create($hGUI, "Radio1", 10, 60, 90, 50, $BS_AUTORADIOBUTTON)

$chk = _GUICtrlButton_Create($hGUI, "Check1", 10, 120, 90, 50, $BS_AUTO3STATE)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

MemoWrite("$btn handle: " & $btn)
MemoWrite("$rdo handle: " & $rdo)
MemoWrite("$chk handle: " & $chk & @CRLF)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg, $wParam
Local Const $BCN_HOTITEMCHANGE = -1249
Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam)
Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code")
Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom")
Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom")
Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags")
Local $sText = ""

Switch $nNotifyCode
Case $BCN_HOTITEMCHANGE ; Win XP and Above
If BitAND($dwFlags, 0x10) = 0x10 Then
$sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF

ElseIf BitAND($dwFlags, 0x20) = 0x20 Then
$sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF
EndIf
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_NOTIFY - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

; React on a button click
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
Local $hCtrl = $lParam
Local $sText = ""

Switch $hCtrl
Case $btn, $rdo, $chk
Switch $nNotifyCode
Case $BN_CLICKED
$sText = "$BN_CLICKED" & @CRLF
Case $BN_PAINT
$sText = "$BN_PAINT" & @CRLF
Case $BN_PUSHED, $BN_HILITE
$sText = "$BN_PUSHED, $BN_HILITE" & @CRLF
Case $BN_UNPUSHED, $BN_UNHILITE
$sText = "$BN_UNPUSHED" & @CRLF
Case $BN_DISABLE
$sText = "$BN_DISABLE" & @CRLF
Case $BN_DBLCLK, $BN_DOUBLECLICKED
$sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF
Case $BN_SETFOCUS
$sText = "$BN_SETFOCUS" & @CRLF
Case $BN_KILLFOCUS
$sText = "$BN_KILLFOCUS" & @CRLF
EndSwitch
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_COMMAND - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Return 0 ; Only workout clicking on the button
EndSwitch
; Proceed the default Autoit3 internal message commands.
; You also can complete let the line out.
; !!! But only 'Return' (without any value) will not proceed
; the default Autoit3-message in the future !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND


Function _GUICtrlButton_Destroy

Function Reference

_GUICtrlButton_Destroy

Delete the Button control

#Include <GuiButton.au3>
_GUICtrlButton_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Edit created with _GUICtrlButton_Create

Related

_GUICtrlButton_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $btn, $rdo, $chk

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 90, 50)

$rdo = _GUICtrlButton_Create($hGUI, "Radio1", 10, 60, 90, 50, BitOR($BS_AUTORADIOBUTTON, $BS_NOTIFY))

$chk = _GUICtrlButton_Create($hGUI, "Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))

GUISetState()

MemoWrite("$btn handle: " & $btn)
MemoWrite("$rdo handle: " & $rdo)
MemoWrite("$chk handle: " & $chk & @CRLF)

MsgBox(4096, "Information", "About to Destroy Buttons")

Send("^{END}")

MemoWrite("Destroyed $btn: " & _GUICtrlButton_Destroy($btn))
MemoWrite("Destroyed $rdo: " & _GUICtrlButton_Destroy($rdo))
MemoWrite("Destroyed $chk: " & _GUICtrlButton_Destroy($chk) & @CRLF)

MemoWrite("$btn handle: " & $btn)
MemoWrite("$rdo handle: " & $rdo)
MemoWrite("$chk handle: " & $chk & @CRLF)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_Enable

Function Reference

_GUICtrlButton_Enable

Enables or disables mouse and keyboard input to the specified button

#Include <GuiButton.au3>
_GUICtrlButton_Enable($hWnd[, $fEnable = True])

Parameters

$hWnd | Handle to the control
$fEnable | [optional] Specifies whether to enable or disable the button: True - The button is enabled False - The button is disabled

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)

$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

GUISetState()

MemoWrite("Disabled Button: " & _GUICtrlButton_Enable($rdo2, False))
Sleep(1000)
MemoWrite("Enabled Button: " & _GUICtrlButton_Enable($rdo2))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $rdo
MemoWrite("Clicked $rdo")
Case $rdo2
MemoWrite("Clicked $rdo2")
Case $chk
MemoWrite("Clicked $chk")
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetCheck

Function Reference

_GUICtrlButton_GetCheck

Gets the check state of a radio button or check box

#Include <GuiButton.au3>
_GUICtrlButton_GetCheck($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The return value from a button created with the $BS_AUTOCHECKBOX, $BS_AUTORADIOBUTTON,
 | $BS_AUTO3STATE, $BS_CHECKBOX, $BS_RADIOBUTTON, or $BS_3STATE style can be one of the following:
 | $BST_CHECKED - Button is checked.
 | $BST_INDETERMINATE - Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style).
 | $BST_UNCHECKED Button is cleared
Failure: | 0

Remarks

If the button has a style other than those listed, the return value is zero.

Related

_GUICtrlButton_GetState, _GUICtrlButton_SetCheck

See Also

Search BM_GETCHECK in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)
_GUICtrlButton_SetFocus($rdo2) ; set focus, shows this doesn't affect _GUICtrlButton_GetCheck

$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

GUISetState()

MemoWrite("$rdo checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo)) & @CRLF)
MemoWrite("$rdo2 checked status: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo2)) & @CRLF)
MemoWrite("$chk checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($chk)) & @CRLF)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainCheckState($iState)
Switch $iState
Case $BST_CHECKED
Return "Button is checked."
Case $BST_INDETERMINATE
Return "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)."
Case $BST_UNCHECKED
Return "Button is cleared"
EndSwitch
EndFunc ;==>_ExplainCheckState


Function _GUICtrlButton_GetFocus

Function Reference

_GUICtrlButton_GetFocus

Retrieves if the button has keyboard focus

#Include <GuiButton.au3>
_GUICtrlButton_GetFocus($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Button has focus
False: Button does not have focus

Remarks

None.

Related

_GUICtrlButton_SetFocus

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)
_GUICtrlButton_SetFocus($rdo)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)

$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

GUISetState()

MemoWrite(StringFormat("$rdo focus status.: %s", _GUICtrlButton_GetFocus($rdo)))
MemoWrite(StringFormat("$rdo2 focus status: %s", _GUICtrlButton_GetFocus($rdo2)))
MemoWrite(StringFormat("$chk focus status.: %s", _GUICtrlButton_GetFocus($chk)))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainCheckState($iState)
Switch $iState
Case $BST_CHECKED
Return "Button is checked."
Case $BST_INDETERMINATE
Return "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)."
Case $BST_UNCHECKED
Return "Button is cleared"
EndSwitch
EndFunc ;==>_ExplainCheckState


Function _GUICtrlButton_GetIdealSize

Function Reference

_GUICtrlButton_GetIdealSize

Gets the size of the button that best fits its text and image, if an image list is present

#Include <GuiButton.au3>
_GUICtrlButton_GetIdealSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array containing the following:
[0] - Ideal width
[1] - Ideal height

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlButton_SetSize

See Also

Search BCM_GETIDEALSIZE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $btn, $aIdealSize

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next

$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn, $hImage)

GUISetState()

$aIdealSize = _GUICtrlButton_GetIdealSize($btn)
MemoWrite("Button1 Ideal width: " & $aIdealSize[0] & " height: " & $aIdealSize[1])

Sleep(3000)

MemoWrite(StringFormat("Set Size: %s", _GUICtrlButton_SetSize($btn, $aIdealSize[0], $aIdealSize[1])))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetImage

Function Reference

_GUICtrlButton_GetImage

Retrieves a handle to the image (icon or bitmap) associated with the button

#Include <GuiButton.au3>
_GUICtrlButton_GetImage($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the image
Failure: 0

Remarks

None.

Related

_GUICtrlButton_SetImage

See Also

Search BM_GETIMAGE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $btn, $chk, $rdo, $Msg
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images"

GUICreate("Buttons", 300, 300)
$iMemo = GUICtrlCreateEdit("", 2, 60, 296, 236, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn = GUICtrlCreateButton("Button1", 10, 10, 40, 40, $BS_BITMAP)
_GUICtrlButton_SetImage($btn, $sPath & "\blue.bmp")

$chk = GUICtrlCreateCheckbox("Check1", 60, 10, 50, 32, $BS_ICON)
_GUICtrlButton_SetImage($chk, "shell32.dll", 14, True)

$rdo = GUICtrlCreateRadio("Radio1", 120, 10, 50, 32, $BS_ICON)
_GUICtrlButton_SetImage($rdo, "shell32.dll", 21, True)

MemoWrite("Button1 Image Handle: " & _GUICtrlButton_GetImage($btn))
MemoWrite("Check1 Image Handle: " & _GUICtrlButton_GetImage($chk))
MemoWrite("Radio1 Image Handle: " & _GUICtrlButton_GetImage($rdo))

While 1
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetImageList

Function Reference

_GUICtrlButton_GetImageList

Retrieves an array that describes the image list assigned to a button control

#Include <GuiButton.au3>
_GUICtrlButton_GetImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array containing the following:
[0] - Image list handle
[1] - Left margin of the icon
[2] - Top margin of the icon
[3] - Right margin of the icon
[4] - Bottom margin of the icon
[5] - Specifies the alignment. This will be one of the following values:
0 - Image aligned with the left margin.
1 - Image aligned with the right margin.
2 - Image aligned with the top margin.
3 - Image aligned with the bottom margin.
4 - Image centered.

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlButton_SetImageList

See Also

Search BCM_GETIMAGELIST in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $y = 70, $iIcon = 125, $btn[6], $aImageListInfo

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 376, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn[0], $hImage)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
_GUICtrlButton_SetImageList($btn[$x], _GetImageListHandle("shell32.dll", $iIcon + $x, True), $x)
$y += 60
Next

For $x = 0 To 5
$aImageListInfo = _GUICtrlButton_GetImageList($btn[$x])
MemoWrite("Button" & $x + 1 & " Imagelist Info" & @CRLF & "--------------------------------")
MemoWrite("Image list handle........: " & $aImageListInfo[0])
MemoWrite("Left margin of the icon..: " & $aImageListInfo[1])
MemoWrite("Top margin of the icon...: " & $aImageListInfo[2])
MemoWrite("Right margin of the icon.: " & $aImageListInfo[3])
MemoWrite("Bottom margin of the icon: " & $aImageListInfo[4])
MemoWrite("Alignment: " & _ExplainAlignment($aImageListInfo[5]))
MemoWrite("--------------------------------" & @CRLF)
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; using image list to set 1 image and have text on button
Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
Local $iSize = 16
If $fLarge Then $iSize = 32

Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)
If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then
_GUIImageList_AddBitmap($hImage, $sFile)
Else
_GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)
EndIf
Return $hImage
EndFunc ;==>_GetImageListHandle

Func _ExplainAlignment($iAlign)
Switch $iAlign
Case 0
Return "Image aligned with the left margin."
Case 1
Return "Image aligned with the right margin."
Case 2
Return "Image aligned with the top margin."
Case 3
Return "Image aligned with the bottom margin."
Case 4
Return "Image centered."
EndSwitch
EndFunc ;==>_ExplainAlignment


Function _GUICtrlButton_GetNote

Function Reference

_GUICtrlButton_GetNote

Gets the text of the note associated with the Command Link button

#Include <GuiButton.au3>
_GUICtrlButton_GetNote($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Text associated with the Command Link Button
Failure: ""

Remarks

This function works only with the $BS_COMMANDLINK and $BS_DEFCOMMANDLINK button styles

Minimum Operating Systems: Windows Vista

Related

_GUICtrlButton_SetNote, _GUICtrlButton_GetNoteLength

See Also

Search BCM_GETNOTE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo

; Note the controlId from these button(s) can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 65, 390, 325, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 160, 40, BitOR($BS_COMMANDLINK, $BS_DEFPUSHBUTTON, $BS_PUSHLIKE))
_GUICtrlButton_SetNote($btn, "This is a test of Vista")

GUISetState()

MemoWrite("Note: " & _GUICtrlButton_GetNote($btn))
MemoWrite("Note Length: " & _GUICtrlButton_GetNoteLength($btn))
MemoWrite("Button Text: " & _GUICtrlButton_GetText($btn))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetNoteLength

Function Reference

_GUICtrlButton_GetNoteLength

Gets the length of the note text that may be displayed in the description for a command link button

#Include <GuiButton.au3>
_GUICtrlButton_GetNoteLength($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns the length of the note text in WCHARs—not including any terminating NULL WCHAR
Failure: 0

Remarks

This function works only with the $BS_COMMANDLINK and $BS_DEFCOMMANDLINK button styles

Minimum Operating Systems: Windows Vista

Related

_GUICtrlButton_GetNote, _GUICtrlButton_SetNote

See Also

Search BCM_GETNOTELENGTH in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo

; Note the controlId from these button(s) can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 65, 390, 325, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 160, 40, BitOR($BS_COMMANDLINK, $BS_DEFPUSHBUTTON, $BS_PUSHLIKE))
_GUICtrlButton_SetNote($btn, "This is a test of Vista")

GUISetState()

MemoWrite("Note: " & _GUICtrlButton_GetNote($btn))
MemoWrite("Note Length: " & _GUICtrlButton_GetNoteLength($btn))
MemoWrite("Button Text: " & _GUICtrlButton_GetText($btn))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetSplitInfo

Function Reference

_GUICtrlButton_GetSplitInfo

Gets information for a split button control

#Include <GuiButton.au3>
_GUICtrlButton_GetSplitInfo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns array of the following
[0] - A handle to the image list
[1] - The split button style, can be one or more of the following:
$BCSS_ALIGNLEFT - Align the image or glyph horizontally with the left margin
$BCSS_IMAGE - Draw an icon image as the glyph
$BCSS_NOSPLIT - No split
$BCSS_STRETCH - Stretch glyph, but try to retain aspect ratio
[2] - Width of the glyph
[3] - Height of the glyph

Remarks

This function works only with the $BS_SPLITBUTTON and $BS_DEFSPLITBUTTON button styles

Minimum Operating Systems: Windows Vista

Related

_GUICtrlButton_SetSplitInfo

See Also

Search BCM_GETSPLITINFO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo, $btn2

; Note the controlId from these buttons can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI, $aInfo

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 100, 390, 284, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Split Button", 10, 10, 120, 30, $BS_SPLITBUTTON)
_GUICtrlButton_SetSplitInfo($btn)
$btn2 = _GUICtrlButton_Create($hGUI, "Split Button 2", 10, 50, 120, 30, $BS_SPLITBUTTON)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

$aInfo = _GUICtrlButton_GetSplitInfo($btn)
MemoWrite("Split Info" & @LF & "----------------")
For $x = 0 To 3
MemoWrite("$ainfo[" & $x & "] = " & $aInfo[$x])
Next
MemoWrite("Split Info" & @LF & "----------------")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg, $wParam
Local Const $BCN_HOTITEMCHANGE = -1249
Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam)
Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code")
Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom")
Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom")
Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags")
Local $sText = ""

Switch $nNotifyCode
Case $BCN_HOTITEMCHANGE ; Win XP and Above
If BitAND($dwFlags, 0x10) = 0x10 Then
$sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF

ElseIf BitAND($dwFlags, 0x20) = 0x20 Then
$sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF
EndIf
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_NOTIFY - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Case $BCN_DROPDOWN
MemoWrite("$BCN_DROPDOWN")
_Popup_Menu($hCtrl)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _Popup_Menu($hCtrl)
Local $hMenu
Local Enum $idOpen = 1000, $idSave, $idInfo
$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo)
Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hCtrl, -1, -1, 1, 1, 2)
Case $idOpen
MemoWrite("Open - Selected")
Case $idSave
MemoWrite("Save - Selected")
Case $idInfo
MemoWrite("Info - Selected")
EndSwitch
_GUICtrlMenu_DestroyMenu($hMenu)
EndFunc ;==>_Popup_Menu

; React on a button click
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
Local $hCtrl = $lParam
Local $sText = ""

Switch $hCtrl
Case $btn, $btn2
Switch $nNotifyCode
Case $BN_CLICKED
$sText = "$BN_CLICKED" & @CRLF
Case $BN_PAINT
$sText = "$BN_PAINT" & @CRLF
Case $BN_PUSHED, $BN_HILITE
$sText = "$BN_PUSHED, $BN_HILITE" & @CRLF
Case $BN_UNPUSHED, $BN_UNHILITE
$sText = "$BN_UNPUSHED" & @CRLF
Case $BN_DISABLE
$sText = "$BN_DISABLE" & @CRLF
Case $BN_DBLCLK, $BN_DOUBLECLICKED
$sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF
Case $BN_SETFOCUS
$sText = "$BN_SETFOCUS" & @CRLF
Case $BN_KILLFOCUS
$sText = "$BN_KILLFOCUS" & @CRLF
EndSwitch
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_COMMAND - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Return 0 ; Only workout clicking on the button
EndSwitch
; Proceed the default Autoit3 internal message commands.
; You also can complete let the line out.
; !!! But only 'Return' (without any value) will not proceed
; the default Autoit3-message in the future !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND


Function _GUICtrlButton_GetState

Function Reference

_GUICtrlButton_GetState

Determines the state of a button or check box

#Include <GuiButton.au3>
_GUICtrlButton_GetState($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The current state of the button. You can use the following values to extract information about the state:
$BST_CHECKED - Indicates the button is checked.
$BST_FOCUS - Specifies the focus state. A nonzero value indicates that the button has the keyboard focus.
$BST_INDETERMINATE - Indicates the button is grayed because the state of the button is indeterminate.
This value applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style.
$BST_PUSHED - Specifies the highlight state. A nonzero value indicates that the button is highlighted.
A button is automatically highlighted when the user positions the cursor over it and presses and holds the
left mouse button. The highlighting is removed when the user releases the mouse button.
$BST_UNCHECKED - Indicates the button is cleared. Same as a return value of zero.

Remarks

None.

Related

_GUICtrlButton_SetState, _GUICtrlButton_GetCheck, _GUICtrlButton_SetCheck

See Also

Search BM_GETSTATE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk, $chk2, $chk3, $btn, $btn2

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 25)
_GUICtrlButton_SetState($btn)

$btn2 = GUICtrlCreateButton("Button2", 10, 60, 90, 25)

$rdo = GUICtrlCreateRadio("Radio1", 10, 110, 90, 25)
_GUICtrlButton_SetFocus($rdo)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 170, 90, 25)
_GUICtrlButton_SetCheck($rdo2)

$chk = GUICtrlCreateCheckbox("Check1", 10, 230, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

$chk2 = GUICtrlCreateCheckbox("Check2", 10, 290, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))

$chk3 = GUICtrlCreateCheckbox("Check3", 10, 350, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk3, $BST_CHECKED)

GUISetState()

MemoWrite("Button1 status:" & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($btn), True))
MemoWrite("Button2 status:" & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($btn2), True))
MemoWrite("Radio1 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($rdo)))
MemoWrite("Radio2 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($rdo2)))
MemoWrite("Check1 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk)))
MemoWrite("Check2 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk2)))
MemoWrite("Check3 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk3)))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainState($iState, $fPushButton = False)
Local $sText = ""
If Not $fPushButton And Not $iState Then Return _
@CRLF & "Indicates the button is cleared. Same as a return value of zero." & @CRLF
If BitAND($iState, $BST_CHECKED) = $BST_CHECKED Then _
$sText &= @CRLF & "Indicates the button is checked." & @CRLF
If BitAND($iState, $BST_FOCUS) = $BST_FOCUS Then _
$sText &= @CRLF & "Specifies the focus state. A nonzero value indicates that the button has the keyboard focus." & @CRLF
If BitAND($iState, $BST_INDETERMINATE) = $BST_INDETERMINATE Then _
$sText &= @CRLF & "Indicates the button is grayed because the state of the button is indeterminate." & @CRLF
If $fPushButton Then
If BitAND($iState, $BST_PUSHED) = $BST_PUSHED Then
$sText &= @CRLF & "Specifies the highlight state." & @CRLF
Else
$sText &= @CRLF & "Specifies not highlighted state." & @CRLF
EndIf
EndIf
Return $sText
EndFunc ;==>_ExplainState


Function _GUICtrlButton_GetText

Function Reference

_GUICtrlButton_GetText

Retrieve the text of the button

#Include <GuiButton.au3>
_GUICtrlButton_GetText($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The text of the button
Failure: Empty string ""

Remarks

None.

Related

_GUICtrlButton_SetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $y = 70, $btn[6], $iRand

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
$y += 60
Next

$iRand = Random(0, 5, 1)
MsgBox(4096, "Information", "Setting Button" & $iRand + 1 & " Text")
_GUICtrlButton_SetText($btn[$iRand], "New Text" & $iRand + 1)

For $x = 0 To 5
MemoWrite("$btn[" & $x & "] Text: " & _GUICtrlButton_GetText($btn[$x]))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_GetTextMargin

Function Reference

_GUICtrlButton_GetTextMargin

Gets the margins used to draw text in a button control

#Include <GuiButton.au3>
_GUICtrlButton_GetTextMargin($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - Left margin to use for drawing text
[1] - Top margin to use for drawing text
[2] - Right margin to use for drawing text
[3] - Bottom margin to use for drawing text

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlButton_SetTextMargin

See Also

Search BCM_GETTEXTMARGIN in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $y = 70, $iIcon = 125, $btn[6], $aMargins

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetTextMargin($btn[0], 10, 5, 10, 5)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
$y += 60
Next

For $x = 0 To 5
$aMargins = _GUICtrlButton_GetTextMargin($btn[$x])
MemoWrite("Button" & $x + 1 & " Margins:" & @CRLF & @TAB & _
"Left.: " & $aMargins[0] & @TAB & "Top...: " & $aMargins[1] & @CRLF & @TAB & _
"Right: " & $aMargins[2] & @TAB & "Bottom: " & $aMargins[3] & @CRLF)
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_SetCheck

Function Reference

_GUICtrlButton_SetCheck

Sets the check state of a radio button or check box

#Include <GuiButton.au3>
_GUICtrlButton_SetCheck($hWnd[, $iState = $BST_CHECKED]])

Parameters

$hWnd | Handle to the control
$iState | [optional] The check state. This parameter can be one of the following values: $BST_CHECKED - Sets the button state to checked. $BST_INDETERMINATE - Sets the button state to grayed, indicating an indeterminate state. Use this value only if the button has the $BS_3STATE or $BS_AUTO3STATE style. $BST_UNCHECKED - Sets the button state to cleared.

Return Value

None.

Remarks

_GUICtrlButton_SetCheck has no effect on push buttons.

Related

_GUICtrlButton_GetCheck, _GUICtrlButton_GetState, _GUICtrlButton_SetState

See Also

Search BCM_GETTEXTMARGIN in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)
_GUICtrlButton_SetFocus($rdo2) ; set focus, shows this doesn't affect _GUICtrlButton_GetCheck

$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

GUISetState()

MemoWrite("$rdo checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo)) & @CRLF)
MemoWrite("$rdo2 checked status: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($rdo2)) & @CRLF)
MemoWrite("$chk checked status.: " & @CRLF & @TAB & _ExplainCheckState(_GUICtrlButton_GetCheck($chk)) & @CRLF)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainCheckState($iState)
Switch $iState
Case $BST_CHECKED
Return "Button is checked."
Case $BST_INDETERMINATE
Return "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)."
Case $BST_UNCHECKED
Return "Button is cleared"
EndSwitch
EndFunc ;==>_ExplainCheckState


Function _GUICtrlButton_SetDontClick

Function Reference

_GUICtrlButton_SetDontClick

Sets the state of $BST_DONTCLICK flag on a button

#Include <GuiButton.au3>
_GUICtrlButton_SetDontClick($hWnd[, $fState = True])

Parameters

$hWnd | Handle to the control
$fState | [optional] The state. True to set the $BST_DONTCLICK, otherwise False

Return Value

None.

Remarks

Minimum Operating Systems: Windows Vista

Related

See Also

Search BM_SETDONTCLICK in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo, $btn2

; Note the controlId from these buttons can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI, $aInfo

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 100, 390, 284, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 160, 40)
_GUICtrlButton_SetDontClick($btn)

$btn2 = _GUICtrlButton_Create($hGUI, "Button2", 10, 55, 160, 40)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; React on a button click
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
Local $hCtrl = $lParam
Local $sText = ""

Switch $hCtrl
Case $btn, $btn2
Switch $nNotifyCode
Case $BN_CLICKED
If BitAND(_GUICtrlButton_GetState($hCtrl), $BST_DONTCLICK) = $BST_DONTCLICK Then
$sText = "$BST_DONTCLICK" & @CRLF
Else
$sText = "$BN_CLICKED" & @CRLF
EndIf
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_COMMAND - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Case $BN_PAINT
$sText = "$BN_PAINT" & @CRLF
Case $BN_PUSHED, $BN_HILITE
$sText = "$BN_PUSHED, $BN_HILITE" & @CRLF
Case $BN_UNPUSHED, $BN_UNHILITE
$sText = "$BN_UNPUSHED" & @CRLF
Case $BN_DISABLE
$sText = "$BN_DISABLE" & @CRLF
Case $BN_DBLCLK, $BN_DOUBLECLICKED
$sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF
Case $BN_SETFOCUS
$sText = "$BN_SETFOCUS" & @CRLF
Case $BN_KILLFOCUS
$sText = "$BN_KILLFOCUS" & @CRLF
EndSwitch
Return 0 ; Only workout clicking on the button
EndSwitch
; Proceed the default Autoit3 internal message commands.
; You also can complete let the line out.
; !!! But only 'Return' (without any value) will not proceed
; the default Autoit3-message in the future !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND


Function _GUICtrlButton_SetFocus

Function Reference

_GUICtrlButton_SetFocus

Sets the keyboard focus to the specified button

#Include <GuiButton.au3>
_GUICtrlButton_SetFocus($hWnd[, $fFocus = True])

Parameters

$hWnd | Handle to the control
$fFocus | [optional] This parameter can be one of the following values: True - Sets the keyboard focus to the button False - Removes the keyboard focus from the button

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlButton_GetFocus

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$rdo = GUICtrlCreateRadio("Radio1", 10, 10, 90, 50)
_GUICtrlButton_SetFocus($rdo)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 60, 90, 50)
_GUICtrlButton_SetCheck($rdo2)

$chk = GUICtrlCreateCheckbox("Check1", 10, 120, 90, 50, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

GUISetState()

MemoWrite(StringFormat("$rdo focus status.: %s", _GUICtrlButton_GetFocus($rdo)))
MemoWrite(StringFormat("$rdo2 focus status: %s", _GUICtrlButton_GetFocus($rdo2)))
MemoWrite(StringFormat("$chk focus status.: %s", _GUICtrlButton_GetFocus($chk)))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainCheckState($iState)
Switch $iState
Case $BST_CHECKED
Return "Button is checked."
Case $BST_INDETERMINATE
Return "Button is grayed, indicating an indeterminate state (applies only if the button has the $BS_3STATE or $BS_AUTO3STATE style)."
Case $BST_UNCHECKED
Return "Button is cleared"
EndSwitch
EndFunc ;==>_ExplainCheckState


Function _GUICtrlButton_SetImage

Function Reference

_GUICtrlButton_SetImage

Sets the check state of a radio button or check box

#Include <GuiButton.au3>
_GUICtrlButton_SetImage($hWnd, $sImageFile[, $nIconId = -1[, $fLarge = False]])

Parameters

$hWnd | Handle to the control
$sImageFile | File containing the Image
$nIconId | [optional] Specifies the zero-based index of the icon to extract
$fLarge | [optional] Extract Large Icon

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlButton_GetImage

See Also

Search BM_SETIMAGE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
Local $btn, $chk, $rdo, $Msg
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images"

GUICreate("Buttons", 300, 300)
$iMemo = GUICtrlCreateEdit("", 2, 60, 296, 236, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn = GUICtrlCreateButton("Button1", 10, 10, 40, 40, $BS_BITMAP)
_GUICtrlButton_SetImage($btn, $sPath & "\blue.bmp")

$chk = GUICtrlCreateCheckbox("Check1", 60, 10, 50, 32, $BS_ICON)
_GUICtrlButton_SetImage($chk, "shell32.dll", 14, True)

$rdo = GUICtrlCreateRadio("Radio1", 120, 10, 50, 32, $BS_ICON)
_GUICtrlButton_SetImage($rdo, "shell32.dll", 21, True)

MemoWrite("Button1 Image Handle: " & _GUICtrlButton_GetImage($btn))
MemoWrite("Check1 Image Handle: " & _GUICtrlButton_GetImage($chk))
MemoWrite("Radio1 Image Handle: " & _GUICtrlButton_GetImage($rdo))

While 1
$Msg = GUIGetMsg()
If $Msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_SetImageList

Function Reference

_GUICtrlButton_SetImageList

Assigns an image list to a button control

#Include <GuiButton.au3>
_GUICtrlButton_SetImageList($hWnd, $hImage[, $nAlign = 0[, $iLeft = 1[, $iTop = 1[, $iRight = 1[, $iBottom = 1]]]]])

Parameters

$hWnd | Handle to the control
$hImage | A handle to the image list. Should contain either a single image to be used for all states or individual images for each state listed in the following: 1 - Normal 2 - Hot 3 - Pressed 4 - Disabled 5 - Defaulted 6 - Stylus Hot (tablet computers only)
$nAlign | [optional] Specifies the alignment to use. This parameter can be one of the following values: 0 - Align the image with the left margin. 1 - Align the image with the right margin. 2 - Align the image with the top margin. 3 - Align the image with the bottom margin. 4 - Center the image.
$iLeft | [optional] Left margin of the icon
$iTop | [optional] Top margin of the icon
$iRight | [optional] Right margin of the icon
$iBottom | [optional] Bottom margin of the icon

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Image list with multiple images will only show the images other than the 1st image when
Themes is being used.

Related

_GUICtrlButton_GetImageList

See Also

Search BCM_SETIMAGELIST in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $hImage, $y = 70, $iIcon = 125, $btn[6], $rdo[6], $chk[6], $hImageSmall

GUICreate("Buttons", 510, 400)
GUISetState()

$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next

$hImageSmall = _GUIImageList_Create(16, 16, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImageSmall, "shell32.dll", $x)
Next

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn[0], $hImage)

$rdo[0] = GUICtrlCreateRadio("Radio Button1", 120, 10, 120, 25)
_GUICtrlButton_SetImageList($rdo[0], $hImageSmall)

$chk[0] = GUICtrlCreateCheckbox("Check Button1", 260, 10, 120, 25)
_GUICtrlButton_SetImageList($chk[0], $hImageSmall)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
_GUICtrlButton_SetImageList($btn[$x], _GetImageListHandle("shell32.dll", $iIcon + $x, True), $x)
$rdo[$x] = GUICtrlCreateRadio("Radio Button" & $x + 1, 120, $y, 120, 25)
_GUICtrlButton_SetImageList($rdo[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x)
$chk[$x] = GUICtrlCreateCheckbox("Check Button" & $x + 1, 260, $y, 120, 25)
_GUICtrlButton_SetImageList($chk[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x)
$y += 60
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; using image list to set 1 image and have text on button
Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
Local $iSize = 16
If $fLarge Then $iSize = 32

Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3)
If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then
_GUIImageList_AddBitmap($hImage, $sFile)
Else
_GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)
EndIf
Return $hImage
EndFunc ;==>_GetImageListHandle


Function _GUICtrlButton_SetNote

Function Reference

_GUICtrlButton_SetNote

Sets the text of the note associated with a command link button

#Include <GuiButton.au3>
_GUICtrlButton_SetNote($hWnd, $sNote)

Parameters

$hWnd | Handle to the control
$sNote | String that contains the note

Return Value

Success: True
Failure: False

Remarks

Minimum Operating Systems: Windows Vista

Related

_GUICtrlButton_GetNote, _GUICtrlButton_GetNoteLength

See Also

Search BCM_SETNOTE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo

; Note the controlId from these button(s) can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 65, 390, 325, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 160, 40, BitOR($BS_COMMANDLINK, $BS_DEFPUSHBUTTON, $BS_PUSHLIKE))
_GUICtrlButton_SetNote($btn, "This is a test of Vista")

GUISetState()

MemoWrite("Note: " & _GUICtrlButton_GetNote($btn))
MemoWrite("Note Length: " & _GUICtrlButton_GetNoteLength($btn))
MemoWrite("Button Text: " & _GUICtrlButton_GetText($btn))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_SetShield

Function Reference

_GUICtrlButton_SetShield

Sets the elevation required state for a specified button or command link to display an elevated icon

#Include <GuiButton.au3>
_GUICtrlButton_SetShield($hWnd[, $fRequired = True])

Parameters

$hWnd | Handle to the control
$fRequired | [optional] True to draw an elevated icon, or False otherwise

Return Value

Success: | True
Failure: | False

Remarks

Minimum Operating Systems: Windows Vista

Related

See Also

Search BCM_SETSHIELD in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $btn2

; Note the controlId from these buttons can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("Buttons", 400, 400)

$btn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 90, 30)
_GUICtrlButton_SetShield($btn)

$btn2 = _GUICtrlButton_Create($hGUI, "Button2", 10, 60, 90, 30, $BS_SPLITBUTTON)
_GUICtrlButton_SetShield($btn2)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main


Function _GUICtrlButton_SetSize

Function Reference

_GUICtrlButton_SetSize

Sets the size of the button

#Include <GuiButton.au3>
_GUICtrlButton_SetSize($hWnd, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the control
$iWidth | New width of the button
$iHeight | New height of the button

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlButton_GetIdealSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $btn, $aIdealSize

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next

$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn, $hImage)

GUISetState()

$aIdealSize = _GUICtrlButton_GetIdealSize($btn)
MemoWrite("Button1 Ideal width: " & $aIdealSize[0] & " height: " & $aIdealSize[1])

Sleep(3000)

MemoWrite(StringFormat("Set Size: %s", _GUICtrlButton_SetSize($btn, $aIdealSize[0], $aIdealSize[1])))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_SetSplitInfo

Function Reference

_GUICtrlButton_SetSplitInfo

Gets information for a split button control

#Include <GuiButton.au3>
_GUICtrlButton_SetSplitInfo($hWnd[, $himlGlyph = -1[, $iSplitStyle = $BCSS_ALIGNLEFT[, $iWidth = 0[, $iHeight = 0]]]])

Parameters

$hWnd | Handle to the control
$himlGlyph | [optional] Handle to the image list
$iSplitStyle | [optional] The split button style. Value must be one or more of the following flags. $BCSS_ALIGNLEFT - Align the image or glyph horizontally with the left margin $BCSS_IMAGE - Draw an icon image as the glyph $BCSS_NOSPLIT - No split $BCSS_STRETCH - Stretch glyph, but try to retain aspect ratio
$iWidth | [optional] Width of the glyph
$iHeight | [optional] Height of the glyph

Return Value

Success: | True
Failure: | False

Remarks

This function works only with the $BS_SPLITBUTTON and $BS_DEFSPLITBUTTON button styles

Minimum Operating Systems: Windows Vista

Related

_GUICtrlButton_GetSplitInfo

See Also

Search BCM_SETSPLITINFO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt("MustDeclareVars", 1)

Global $btn, $iMemo, $btn2

; Note the controlId from these buttons can NOT be read with GuiCtrlRead

_Main()

Func _Main()
Local $hGUI, $aInfo

$hGUI = GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 10, 100, 390, 284, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = _GUICtrlButton_Create($hGUI, "Split Button", 10, 10, 120, 30, $BS_SPLITBUTTON)
_GUICtrlButton_SetSplitInfo($btn)
$btn2 = _GUICtrlButton_Create($hGUI, "Split Button 2", 10, 50, 120, 30, $BS_SPLITBUTTON)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

GUISetState()

$aInfo = _GUICtrlButton_GetSplitInfo($btn)
MemoWrite("Split Info" & @LF & "----------------")
For $x = 0 To 3
MemoWrite("$ainfo[" & $x & "] = " & $aInfo[$x])
Next
MemoWrite("Split Info" & @LF & "----------------")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit

EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg, $wParam
Local Const $BCN_HOTITEMCHANGE = -1249
Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam)
Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code")
Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom")
Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom")
Local $dwFlags = DllStructGetData($tNMBHOTITEM, "dwFlags")
Local $sText = ""

Switch $nNotifyCode
Case $BCN_HOTITEMCHANGE ; Win XP and Above
If BitAND($dwFlags, 0x10) = 0x10 Then
$sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF

ElseIf BitAND($dwFlags, 0x20) = 0x20 Then
$sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF
EndIf
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_NOTIFY - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Case $BCN_DROPDOWN
MemoWrite("$BCN_DROPDOWN")
_Popup_Menu($hCtrl)
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _Popup_Menu($hCtrl)
Local $hMenu
Local Enum $idOpen = 1000, $idSave, $idInfo
$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo)
Switch _GUICtrlMenu_TrackPopupMenu($hMenu, $hCtrl, -1, -1, 1, 1, 2)
Case $idOpen
MemoWrite("Open - Selected")
Case $idSave
MemoWrite("Save - Selected")
Case $idInfo
MemoWrite("Info - Selected")
EndSwitch
_GUICtrlMenu_DestroyMenu($hMenu)
EndFunc ;==>_Popup_Menu

; React on a button click
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
Local $hCtrl = $lParam
Local $sText = ""

Switch $hCtrl
Case $btn, $btn2
Switch $nNotifyCode
Case $BN_CLICKED
$sText = "$BN_CLICKED" & @CRLF
Case $BN_PAINT
$sText = "$BN_PAINT" & @CRLF
Case $BN_PUSHED, $BN_HILITE
$sText = "$BN_PUSHED, $BN_HILITE" & @CRLF
Case $BN_UNPUSHED, $BN_UNHILITE
$sText = "$BN_UNPUSHED" & @CRLF
Case $BN_DISABLE
$sText = "$BN_DISABLE" & @CRLF
Case $BN_DBLCLK, $BN_DOUBLECLICKED
$sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF
Case $BN_SETFOCUS
$sText = "$BN_SETFOCUS" & @CRLF
Case $BN_KILLFOCUS
$sText = "$BN_KILLFOCUS" & @CRLF
EndSwitch
MemoWrite($sText & _
"-----------------------------" & @CRLF & _
"WM_COMMAND - Infos:" & @CRLF & _
"-----------------------------" & @CRLF & _
"Code" & @TAB & ":" & $nNotifyCode & @CRLF & _
"CtrlID" & @TAB & ":" & $nID & @CRLF & _
"CtrlHWnd:" & $hCtrl & @CRLF & _
_GUICtrlButton_GetText($hCtrl) & @CRLF)
Return 0 ; Only workout clicking on the button
EndSwitch
; Proceed the default Autoit3 internal message commands.
; You also can complete let the line out.
; !!! But only 'Return' (without any value) will not proceed
; the default Autoit3-message in the future !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND


Function _GUICtrlButton_SetState

Function Reference

_GUICtrlButton_SetState

Sets the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it.

#Include <GuiButton.au3>
_GUICtrlButton_SetState($hWnd[, $fHighlighted = True]])

Parameters

$hWnd | Handle to the control
$fHighlighted | [optional] sSpecifies whether the button is highlighted.

Return Value

None.

Remarks

Highlighting affects only the appearance of a button. It has no effect on the check state of a radio button or check box.

A button is automatically highlighted when the user positions the cursor over it and presses and holds the left mouse button.
The highlighting is removed when the user releases the mouse button.

Related

_GUICtrlButton_GetState, _GUICtrlButton_SetCheck

See Also

Search BM_SETSTATE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $rdo, $rdo2, $chk, $chk2, $chk3, $btn, $btn2

GUICreate("Buttons", 400, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")

$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 25)
_GUICtrlButton_SetState($btn)

$btn2 = GUICtrlCreateButton("Button2", 10, 60, 90, 25)

$rdo = GUICtrlCreateRadio("Radio1", 10, 110, 90, 25)
_GUICtrlButton_SetFocus($rdo)

$rdo2 = GUICtrlCreateRadio("Radio2", 10, 170, 90, 25)
_GUICtrlButton_SetCheck($rdo2)

$chk = GUICtrlCreateCheckbox("Check1", 10, 230, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk, $BST_INDETERMINATE)

$chk2 = GUICtrlCreateCheckbox("Check2", 10, 290, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))

$chk3 = GUICtrlCreateCheckbox("Check3", 10, 350, 90, 25, BitOR($BS_AUTO3STATE, $BS_NOTIFY))
_GUICtrlButton_SetCheck($chk3, $BST_CHECKED)

GUISetState()

MemoWrite("Button1 status:" & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($btn), True))
MemoWrite("Button2 status:" & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($btn2), True))
MemoWrite("Radio1 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($rdo)))
MemoWrite("Radio2 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($rdo2)))
MemoWrite("Check1 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk)))
MemoWrite("Check2 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk2)))
MemoWrite("Check3 status: " & @CRLF & "--------------------------------" & _
_ExplainState(_GUICtrlButton_GetState($chk3)))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func _ExplainState($iState, $fPushButton = False)
Local $sText = ""
If Not $fPushButton And Not $iState Then Return _
@CRLF & "Indicates the button is cleared. Same as a return value of zero." & @CRLF
If BitAND($iState, $BST_CHECKED) = $BST_CHECKED Then _
$sText &= @CRLF & "Indicates the button is checked." & @CRLF
If BitAND($iState, $BST_FOCUS) = $BST_FOCUS Then _
$sText &= @CRLF & "Specifies the focus state. A nonzero value indicates that the button has the keyboard focus." & @CRLF
If BitAND($iState, $BST_INDETERMINATE) = $BST_INDETERMINATE Then _
$sText &= @CRLF & "Indicates the button is grayed because the state of the button is indeterminate." & @CRLF
If $fPushButton Then
If BitAND($iState, $BST_PUSHED) = $BST_PUSHED Then
$sText &= @CRLF & "Specifies the highlight state." & @CRLF
Else
$sText &= @CRLF & "Specifies not highlighted state." & @CRLF
EndIf
EndIf
Return $sText
EndFunc ;==>_ExplainState


Function _GUICtrlButton_SetStyle

Function Reference

_GUICtrlButton_SetStyle

Sets the style of a button

#Include <GuiButton.au3>
_GUICtrlButton_SetStyle($hWnd, $iStyle)

Parameters

$hWnd | Handle to the control
$iStyle | Can be a combination of button styles

Return Value

None.

Remarks

None.

Related

See Also

Search BM_SETSTYLE in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $btn, $btn2

GUICreate("Buttons", 400, 400)
GUISetState()

$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 50)

$btn2 = GUICtrlCreateButton("Button2", 10, 70, 90, 50)

MsgBox(4096, "Information", "Setting Button Style")
_GUICtrlButton_SetStyle($btn, $BS_AUTORADIOBUTTON)
_GUICtrlButton_SetStyle($btn2, $BS_AUTOCHECKBOX)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main


Function _GUICtrlButton_SetText

Function Reference

_GUICtrlButton_SetText

Sets the text of the button

#Include <GuiButton.au3>
_GUICtrlButton_SetText($hWnd, $sText)

Parameters

$hWnd | Handle to the control
$sText | New text

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlButton_GetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $y = 70, $btn[6], $iRand

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
$y += 60
Next

$iRand = Random(0, 5, 1)
MsgBox(4096, "Information", "Setting Button" & $iRand + 1 & " Text")
_GUICtrlButton_SetText($btn[$iRand], "New Text" & $iRand + 1)

For $x = 0 To 5
MemoWrite("$btn[" & $x & "] Text: " & _GUICtrlButton_GetText($btn[$x]))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_SetTextMargin

Function Reference

_GUICtrlButton_SetTextMargin

Sets the margins for drawing text in a button control

#Include <GuiButton.au3>
_GUICtrlButton_SetTextMargin($hWnd[, $iLeft = 1[, $iTop = 1[, $iRight = 1[, $iBottom = 1]]]])

Parameters

$hWnd | Handle to the control
$iLeft | [optional] Left margin to use for drawing text
$iTop | [optional] Top margin to use for drawing text
$iRight | [optional] Right margin to use for drawing text
$iBottom | [optional] Bottom margin to use for drawing text

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlButton_GetTextMargin

See Also

Search BCM_SETTEXTMARGIN in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $y = 70, $btn[6], $aMargins

GUICreate("Buttons", 510, 400)
$iMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetTextMargin($btn[0], 10, 5, 10, 5)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
$y += 60
Next

For $x = 0 To 5
$aMargins = _GUICtrlButton_GetTextMargin($btn[$x])
MemoWrite("Button" & $x + 1 & " Margins:" & @CRLF & @TAB & _
"Left.: " & $aMargins[0] & @TAB & "Top...: " & $aMargins[1] & @CRLF & @TAB & _
"Right: " & $aMargins[2] & @TAB & "Bottom: " & $aMargins[3] & @CRLF)
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlButton_Show

Function Reference

_GUICtrlButton_Show

Show/Hide button

#Include <GuiButton.au3>
_GUICtrlButton_Show($hWnd[, $fShow = True])

Parameters

$hWnd | Handle to the control
$fShow | [optional] One of the following: True - Show button False - Hide button

Return Value

Success: One of the Following:
1 - If the button was previously visible
0 - If the button was previously hidden

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $y = 70, $btn[6], $rdo[6], $chk[6]

GUICreate("Buttons", 510, 400)
GUISetState()

$btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50)

$rdo[0] = GUICtrlCreateRadio("Radio Button1", 120, 10, 120, 25)

$chk[0] = GUICtrlCreateCheckbox("Check Button1", 260, 10, 120, 25)

For $x = 1 To 5
$btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50)
$rdo[$x] = GUICtrlCreateRadio("Radio Button" & $x + 1, 120, $y, 120, 25)
$chk[$x] = GUICtrlCreateCheckbox("Check Button" & $x + 1, 260, $y, 120, 25)
$y += 60
Next

; Hide the buttons
For $x = 0 To 5
_GUICtrlButton_Show($btn[$x], False)
_GUICtrlButton_Show($rdo[$x], False)
_GUICtrlButton_Show($chk[$x], False)
Sleep(500)
Next

; Show the buttons
For $x = 5 To 0 Step -1
_GUICtrlButton_Show($chk[$x])
_GUICtrlButton_Show($rdo[$x])
_GUICtrlButton_Show($btn[$x])
Sleep(500)
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main


User Defined Functions

GuiComboBox user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiComboBox.au3>.

User Defined Function | Description
_GUICtrlComboBox_AddDir | Adds the names of directories and files
_GUICtrlComboBox_AddString | Add a string
_GUICtrlComboBox_AutoComplete | AutoComplete a ComboBox edit control
_GUICtrlComboBox_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlComboBox_Create | Create a ComboBox control
_GUICtrlComboBox_DeleteString | Delete a string
_GUICtrlComboBox_Destroy | Delete the control
_GUICtrlComboBox_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlComboBox_FindString | Search for a string
_GUICtrlComboBox_FindStringExact | Search for a string
_GUICtrlComboBox_GetComboBoxInfo | Gets information about the specified ComboBox
_GUICtrlComboBox_GetCount | Retrieve the number of items
_GUICtrlComboBox_GetCueBanner | Gets the cue banner text displayed in the edit control of a combo box
_GUICtrlComboBox_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlComboBox_GetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBox_GetDroppedControlRectEx | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBox_GetDroppedState | Determines whether the ListBox of a ComboBox is dropped down
_GUICtrlComboBox_GetDroppedWidth | Retrieve the minimum allowable width, of the ListBox of a ComboBox
_GUICtrlComboBox_GetEditSel | Gets the starting and ending character positions of the current selection in the edit control of a ComboBox
_GUICtrlComboBox_GetEditText | Get the text from the edit control of a ComboBox
_GUICtrlComboBox_GetExtendedUI | Determines whether a ComboBox has the default user interface or the extended user interface
_GUICtrlComboBox_GetHorizontalExtent | Gets the width, in pixels, that the ListBox of a ComboBox control can be scrolled horizontally
_GUICtrlComboBox_GetItemHeight | Determines the height of list items or the selection field in a ComboBox
_GUICtrlComboBox_GetLBText | Retrieve a string from the list of a ComboBox
_GUICtrlComboBox_GetLBTextLen | Gets the length, in characters, of a string in the list of a combo box
_GUICtrlComboBox_GetList | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBox_GetListArray | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBox_GetLocale | Retrieves the current locale
_GUICtrlComboBox_GetLocaleCountry | Retrieves the current country code
_GUICtrlComboBox_GetLocaleLang | Retrieves the current language identifier
_GUICtrlComboBox_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlComboBox_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlComboBox_GetMinVisible | Retrieve the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBox_GetTopIndex | Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox
_GUICtrlComboBox_InitStorage | Allocates memory for storing ListBox items
_GUICtrlComboBox_InsertString | Insert a string
_GUICtrlComboBox_LimitText | Limits the length of the text the user may type into the edit control of a ComboBox
_GUICtrlComboBox_ReplaceEditSel | Replace text selected in edit box
_GUICtrlComboBox_ResetContent | Remove all items from the ListBox and edit control of a ComboBox
_GUICtrlComboBox_SelectString | Searches the ListBox of a ComboBox for an item that begins with the characters in a specified string
_GUICtrlComboBox_SetCueBanner | Sets the cue banner text that is displayed for the edit control of a combo box
_GUICtrlComboBox_SetCurSel | Select a string in the list of a ComboBox
_GUICtrlComboBox_SetDroppedWidth | Set the maximum allowable width, in pixels, of the ListBox of a ComboBox
_GUICtrlComboBox_SetEditSel | Select characters in the edit control of a ComboBox
_GUICtrlComboBox_SetEditText | Set the text of the edit control of the ComboBox
_GUICtrlComboBox_SetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboBox_SetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlComboBox_SetItemHeight | Set the height of list items or the selection field in a ComboBox
_GUICtrlComboBox_SetMinVisible | Set the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBox_SetTopIndex | Ensure that a particular item is visible in the ListBox of a ComboBox
_GUICtrlComboBox_ShowDropDown | Show or hide the ListBox of a ComboBox


Function _GUICtrlComboBox_AddDir

Function Reference

_GUICtrlComboBox_AddDir

Adds the names of directories and files

#Include <GuiComboBox.au3>
_GUICtrlComboBox_AddDir($hWnd, $sFile[, $iAttributes = 0[, $fBrackets = True]])

Parameters

$hWnd | Handle to control
$sFile | Specifies an absolute path, relative path, or filename
$iAttributes | [optional] Specifies the attributes of the files or directories to be added: $DDL_READWRITE - Includes read-write files with no additional attributes $DDL_READONLY - Includes read-only files $DDL_HIDDEN - Includes hidden files $DDL_SYSTEM - Includes system files $DDL_DIRECTORY - Includes subdirectories $DDL_ARCHIVE - Includes archived files $DDL_DRIVES - All mapped drives are added to the list $DDL_EXCLUSIVE - Includes only files with the specified attributes
$fBrackets | [optional] include/exclude brackets when $DDL_DRIVES is used

Return Value

Success: Zero based index of the last name added
Failure: -1

Remarks

If there is insufficient space to store the new strings, the return value is $CB_ERRSPACE
Needs Constants.au3 for pre-defined constants

Related

_GUICtrlComboBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Add Dir", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_AddString

Function Reference

_GUICtrlComboBox_AddString

Add a string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_AddString($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String to add

Return Value

Success: The index of the new item
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_DeleteString, _GUICtrlComboBox_InsertString, _GUICtrlComboBox_ResetContent, _GUICtrlComboBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Add String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)

; Add string
_GUICtrlComboBox_AddString($hCombo, "This string has been added")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_AutoComplete

Function Reference

_GUICtrlComboBox_AutoComplete

AutoComplete a ComboBox edit control

#Include <GuiComboBox.au3>
_GUICtrlComboBox_AutoComplete($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

Minimum OS - Windows XP.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $hCombo

_Main()

Func _Main()

; Create GUI
GUICreate("ComboBox Auto Complete", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _Edit_Changed()
_GUICtrlComboBox_AutoComplete($hCombo)
EndFunc ;==>_Edit_Changed

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
Case $hCombo, $hWndCombo
Switch $iCode
Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed
_DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box
_DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible
_DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
_DebugPrint("$CBN_EDITCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
_Edit_Changed()
; no return value
Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
_DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request
_DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus
_DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
_DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box
_DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list
_DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus
_DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlComboBox_BeginUpdate

Function Reference

_GUICtrlComboBox_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiComboBox.au3>
_GUICtrlComboBox_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBox_EndUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Begin Update", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_Create

Function Reference

_GUICtrlComboBox_Create

Create a ComboBox control

#Include <GuiComboBox.au3>
_GUICtrlComboBox_Create($hWnd, $sText, $iX, $iY[, $iWidth = 100[, $iHeight = 120[, $iStyle = 0x00200042[, $iExStyle = 0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$sText | Delimited string to add to the combobox
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control style:
$CBS_AUTOHSCROLL - Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line.
$CBS_DISABLENOSCROLL - Shows a disabled vertical scroll bar
$CBS_DROPDOWN - Similar to $CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control
$CBS_DROPDOWNLIST - Similar to $CBS_DROPDOWN, except that the edit control is replaced by a static text item that displays the current selection in the list box
$CBS_LOWERCASE - Converts to lowercase all text in both the selection field and the list
$CBS_NOINTEGRALHEIGHT - Specifies that the size of the combo box is exactly the size specified by the application when it created the combo box
$CBS_OEMCONVERT - Converts text entered in the combo box edit control from the Windows character set to the OEM character set and then back to the Windows character set
$CBS_OWNERDRAWFIXED - Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are all the same height
$CBS_OWNERDRAWVARIABLE - Specifies that the owner of the list box is responsible for drawing its contents and that the items in the list box are variable in height
$CBS_SIMPLE - Displays the list box at all times
$CBS_SORT - Automatically sorts strings added to the list box
$CBS_UPPERCASE - Converts to uppercase all text in both the selection field and the list
Default: $CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL
Forced : $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE
$iExStyle | [optional] Control extended style. These correspond to the standard $WS_EX_ constants.

Return Value

Success: Handle to the Listbox control
Failure: 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlComboBox_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $hCombo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(UDF) ComboBox Create", 400, 296)
$hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBox_EndUpdate($hCombo)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
Case $hCombo
Switch $iCode
Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed
_DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box
_DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible
_DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
_DebugPrint("$CBN_EDITCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
_DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request
_DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus
_DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
_DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box
_DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list
_DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus
_DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlComboBox_DeleteString

Function Reference

_GUICtrlComboBox_DeleteString

Delete a string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_DeleteString($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based index of string

Return Value

Success: Count of the strings remaining
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_AddString, _GUICtrlComboBox_ResetContent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Delete String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add drives
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)

;Delete string
MsgBox(4160, "Information", "Deleting string at index 1")
_GUICtrlComboBox_DeleteString($hCombo, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_Destroy

Function Reference

_GUICtrlComboBox_Destroy

Delete the control

#Include <GuiComboBox.au3>
_GUICtrlComboBox_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Listbox created with _GUICtrlComboBox_Create

Related

_GUICtrlComboBox_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("(UDF Created) ComboBox Destroy", 400, 296)
$hCombo = _GUICtrlComboBox_Create($hGUI, "", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBox_EndUpdate($hCombo)

; Destroy ComboBox
MsgBox(4160, "Information", "Destroy ComboBox")
MsgBox(4160, "Information", "Destroyed: " & _GUICtrlComboBox_Destroy($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_EndUpdate

Function Reference

_GUICtrlComboBox_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiComboBox.au3>
_GUICtrlComboBox_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBox_BeginUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox End Update", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_FindString

Function Reference

_GUICtrlComboBox_FindString

Search for a string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_FindString($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | String to search for
$iIndex | [optional] Zero based index of the item preceding the first item to be searched

Return Value

Success: Zero based index of the matching item
Failure: -1

Remarks

Finds the first string beginning with the characters specified in $sText

When the search reaches the bottom of the ListBox, it continues from the top of the
ListBox back to the item specified by $iIndex.

If $iIndex is –1, the entire ListBox is searched from the beginning.

Related

_GUICtrlComboBox_SelectString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Find String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBox_AddString($hCombo, "This is a test")
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBox_EndUpdate($hCombo)

; Find string
MsgBox(4160, "Information", "Find String: " & _GUICtrlComboBox_FindString($hCombo, "this"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_FindStringExact

Function Reference

_GUICtrlComboBox_FindStringExact

Search for a string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_FindStringExact($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | String to search for
$iIndex | [optional] Zero based index of the item preceding the first item to be searched

Return Value

Success: Zero based index of the matching item
Failure: -1

Remarks

Find the first string that matches the string specified in the $sText parameter

When the search reaches the bottom of the ListBox, it continues from the top of the
ListBox back to the item specified by $iIndex.

If $iIndex is –1, the entire ListBox is searched from the beginning.

Related

_GUICtrlComboBox_SelectString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Find String Exact", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBox_AddString($hCombo, "This is a test")
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBox_AddString($hCombo, "This is eXact")
_GUICtrlComboBox_EndUpdate($hCombo)

; Find string
MsgBox(4160, "Information", "Find String: " & _GUICtrlComboBox_FindStringExact($hCombo, "This is eXact"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetComboBoxInfo

Function Reference

_GUICtrlComboBox_GetComboBoxInfo

Gets information about the specified ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetComboBoxInfo($hWnd, ByRef $tInfo)

Parameters

$hWnd | Handle to control
$tInfo | infos as defined by $tagCOMBOBOXINFO

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tInfo, $hCombo

; Create GUI
GUICreate("ComboBox Get ComboBox Info", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

If _GUICtrlComboBox_GetComboBoxInfo($hCombo, $tInfo) Then
MemoWrite("Handle to the ComboBox .....: " & DllStructGetData($tInfo, "hCombo"))
MemoWrite("Handle to the Edit Box .....: " & DllStructGetData($tInfo, "hEdit"))
MemoWrite("Handle to the drop-down list: " & DllStructGetData($tInfo, "hList"))
EndIf

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetCount

Function Reference

_GUICtrlComboBox_GetCount

Retrieve the number of items

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Number of items
Failure: -1

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Count", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Count
MsgBox(4160, "Information", "Count: " & _GUICtrlComboBox_GetCount($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetCueBanner

Function Reference

_GUICtrlComboBox_GetCueBanner

Gets the cue banner text displayed in the edit control of a combo box

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetCueBanner($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The cue banner text
Failure: empty string ""

Remarks

The cue banner is text that is displayed in the edit control of a combo box when there is no selection

Minimum Operating Systems: Windows Vista

Related

_GUICtrlComboBox_SetCueBanner

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo
_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Count", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
_GUICtrlComboBox_SetCueBanner($hCombo, "Select an Item")
$iMemo = GUICtrlCreateEdit("", 10, 50, 376, 234, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

MemoWrite("Cue Banner: " & _GUICtrlComboBox_GetCueBanner($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetCurSel

Function Reference

_GUICtrlComboBox_GetCurSel

Retrieve the index of the currently selected item

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetCurSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Zero-based index of the currently selected item
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_SetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Cur Sel", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Select Item
_GUICtrlComboBox_SetCurSel($hCombo, 2)

; Get Cur Sel
MsgBox(4160, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetDroppedControlRect

Function Reference

_GUICtrlComboBox_GetDroppedControlRect

Retrieve the screen coordinates of a combo box in its dropped-down state

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetDroppedControlRect($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlComboBox_GetDroppedControlRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aRect, $hCombo

; Create GUI
GUICreate("ComboBox Get Dropped Control Rect", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Dropped Control Rect
$aRect = _GUICtrlComboBox_GetDroppedControlRect($hCombo)

MemoWrite("X coordinate of the upper left corner ......: " & $aRect[0])
MemoWrite("Y coordinate of the upper left corner ......: " & $aRect[1])
MemoWrite("X coordinate of the lower right corner .....: " & $aRect[2])
MemoWrite("Y coordinate of the lower right corner .....: " & $aRect[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetDroppedControlRectEx

Function Reference

_GUICtrlComboBox_GetDroppedControlRectEx

Retrieve the screen coordinates of a combo box in its dropped-down state

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetDroppedControlRectEx($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagRECT structure that receives the screen coordinates

Remarks

None.

Related

_GUICtrlComboBox_GetDroppedControlRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRect, $hCombo

; Create GUI
GUICreate("ComboBox Get Dropped Control RectEx", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Dropped Control Rect
$tRect = _GUICtrlComboBox_GetDroppedControlRectEx($hCombo)

MemoWrite("X coordinate of the upper left corner ......: " & DllStructGetData($tRect, "Left"))
MemoWrite("Y coordinate of the upper left corner ......: " & DllStructGetData($tRect, "Top"))
MemoWrite("X coordinate of the lower right corner .....: " & DllStructGetData($tRect, "Right"))
MemoWrite("Y coordinate of the lower right corner .....: " & DllStructGetData($tRect, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetDroppedState

Function Reference

_GUICtrlComboBox_GetDroppedState

Determines whether the ListBox of a ComboBox is dropped down

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetDroppedState($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Is dropped down
False: Not dropped down

Remarks

None.

Related

_GUICtrlComboBox_ShowDropDown, _GUICtrlComboBoxEx_GetDroppedWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Dropped Stated", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; get dropped state
MemoWrite("Dropped Down State......: " & _GUICtrlComboBox_GetDroppedState($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; get dropped state
MemoWrite("Dropped Down State......: " & _GUICtrlComboBox_GetDroppedState($hCombo))

Sleep(500)

; hide drop down
_GUICtrlComboBox_ShowDropDown($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetDroppedWidth

Function Reference

_GUICtrlComboBox_GetDroppedWidth

Retrieve the minimum allowable width, of the ListBox of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetDroppedWidth($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The width, in pixels
Failure: -1

Remarks

The ComboBox must have $CBS_DROPDOWN or $CBS_DROPDOWNLIST style.

Related

_GUICtrlComboBox_SetDroppedWidth, _GUICtrlComboBoxEx_GetDroppedState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Dropped Width", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Dropped Width
MsgBox(4160, "Information", "Dropped Width: " & _GUICtrlComboBox_GetDroppedWidth($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetEditSel

Function Reference

_GUICtrlComboBox_GetEditSel

Gets the starting and ending character positions of the current selection in the edit control of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetEditSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array in the following format:
[0] - Starting position
[1] - Ending position
Failure: -1

Remarks

If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBox_SetEditSel, _GUICtrlComboBoxEx_SetEditSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aSel, $hCombo

; Create GUI
GUICreate("ComboBox Get Edit Sel", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Select Item
_GUICtrlComboBox_SetCurSel($hCombo, 2)

; Set Edit Sel
_GUICtrlComboBox_SetEditSel($hCombo, 0, 4)

; Get Edit Sel
$aSel = _GUICtrlComboBox_GetEditSel($hCombo)
MemoWrite(StringFormat("Edit Sel: %d - %d", $aSel[0], $aSel[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetEditText

Function Reference

_GUICtrlComboBox_GetEditText

Get the text from the edit control of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetEditText($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | String from the edit control
Failure: | Empty string

Remarks

Minimum OS - Windows XP.
If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBox_SetEditText, _GUICtrlComboBoxEx_SetEditText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Edit Text", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Set Edit Text
_GUICtrlComboBox_SetEditText($hCombo, StringFormat("%d - Some New Text", Random(1, 20, 1)))

; Get Edit Text
MemoWrite("Edit Text: " & _GUICtrlComboBox_GetEditText($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetExtendedUI

Function Reference

_GUICtrlComboBox_GetExtendedUI

Determines whether a ComboBox has the default user interface or the extended user interface

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetExtendedUI($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: ComboBox has the extended user interface
False: ComboBox does "NOT" have the extended user interface

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection.

In a ComboBox with the extended user interface, the F4 key is disabled and pressing the DOWN ARROW
key opens the drop-down list

Related

_GUICtrlComboBox_SetExtendedUI

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Extended UI", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBox_GetExtendedUI($hCombo))

; Set Extended UI
_GUICtrlComboBox_SetExtendedUI($hCombo, True)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBox_GetExtendedUI($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetHorizontalExtent

Function Reference

_GUICtrlComboBox_GetHorizontalExtent

Gets the width, in pixels, that the ListBox of a ComboBox control can be scrolled horizontally

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetHorizontalExtent($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The scrollable width, in pixels

Remarks

None.

Related

_GUICtrlComboBox_SetHorizontalExtent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Horizontal Extent", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Horizontal Extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlComboBox_GetHorizontalExtent($hCombo))

; Set Horizontal Extent
_GUICtrlComboBox_SetHorizontalExtent($hCombo, 500)

; Get Horizontal Extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlComboBox_GetHorizontalExtent($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetItemHeight

Function Reference

_GUICtrlComboBox_GetItemHeight

Determines the height of list items or the selection field in a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetItemHeight($hWnd, $iIndex = -1)

Parameters

$hWnd | Handle to control
$iIndex | Determines which height to get: –1 - Retrieve the height of the selection field 0 - Retrieve the height of list items

Return Value

Success: The height, in pixels
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_SetItemHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Item Height", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Item Height (selection field)
MemoWrite("Item Height (selection field): " & _GUICtrlComboBox_GetItemHeight($hCombo))

; Get Item Height (list items)
MemoWrite("Item Height (list items): " & _GUICtrlComboBox_GetItemHeight($hCombo, 0))

; Set Item Height (selection field)
_GUICtrlComboBox_SetItemHeight($hCombo, 18)

; Set Item Height (selection field)
_GUICtrlComboBox_SetItemHeight($hCombo, 20, 0)

; Get Item Height (selection field)
MemoWrite("Item Height (selection field): " & _GUICtrlComboBox_GetItemHeight($hCombo))

; Get Item Height (list items)
MemoWrite("Item Height (list items): " & _GUICtrlComboBox_GetItemHeight($hCombo, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetLBText

Function Reference

_GUICtrlComboBox_GetLBText

Retrieve a string from the list of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLBText($hWnd, $iIndex, ByRef $sText)

Parameters

$hWnd | Handle to control
$iIndex | Zero based index to Retrieve from
$sText | Variable that will receive the string

Return Value

Success: The length of the string
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_GetLBTextLen

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $iLen, $hCombo

; Create GUI
GUICreate("ComboBox Get LB Text", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get LB Text
$iLen = _GUICtrlComboBox_GetLBText($hCombo, 2, $sText)
MsgBox(4160, "Information", "LB Text: " & $sText)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetLBTextLen

Function Reference

_GUICtrlComboBox_GetLBTextLen

Gets the length, in characters, of a string in the list of a combo box

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLBTextLen($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | index of the required entry

Return Value

Success: The length of the string
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_GetLBText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get LB Text Len", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get LB Text Len
MsgBox(4160, "Information", "LB Text Len: " & _GUICtrlComboBox_GetLBTextLen($hCombo, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetList

Function Reference

_GUICtrlComboBox_GetList

Retrieves all items from the list portion of a ComboBox control

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetList($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Delimited string of all ComboBox items

Remarks

Default delimiter is "|" this can be change using the Opt("GUIDataSeparatorChar", "new delimiter")

Related

_GUICtrlComboBox_GetListArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aList, $hCombo
Opt("GUIDataSeparatorChar", ",") ; set seperator char to char we want to use

; Create GUI
GUICreate("ComboBox Get List", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)

; Get List
$aList = StringSplit(_GUICtrlComboBox_GetList($hCombo), ",")
For $x = 1 To $aList[0]
MemoWrite($aList[$x])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetListArray

Function Reference

_GUICtrlComboBox_GetListArray

Retrieves all items from the list portion of a ComboBox control

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetListArray($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array in the following format:
[0] - Number of items
[1] - Item 1
[2] - Item 2
[n] - Item n

Remarks

None.

Related

_GUICtrlComboBox_GetList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aList, $hCombo

; Create GUI
GUICreate("ComboBox Get List Array", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)

; Get List
$aList = _GUICtrlComboBox_GetListArray($hCombo)
For $x = 1 To $aList[0]
MemoWrite($aList[$x])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_GetLocale

Function Reference

_GUICtrlComboBox_GetLocale

Retrieves the current locale

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLocale($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The high order word contains the country code and the low order word contains the language identifier.

Remarks

None.

Related

_GUICtrlComboBox_GetLocaleCountry, _GUICtrlComboBox_GetLocaleLang, _GUICtrlComboBox_GetLocalePrimLang, _GUICtrlComboBox_GetLocaleSubLang

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Locale", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBox_GetLocale($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBox_GetLocaleCountry($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBox_GetLocaleLang($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBox_GetLocalePrimLang($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBox_GetLocaleSubLang($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetLocaleCountry

Function Reference

_GUICtrlComboBox_GetLocaleCountry

Retrieves the current country code

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLocaleCountry($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The country code of the ComboBox

Remarks

None.

Related

_GUICtrlComboBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Locale Country Code", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBox_GetLocale($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBox_GetLocaleCountry($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBox_GetLocaleLang($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBox_GetLocalePrimLang($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBox_GetLocaleSubLang($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetLocaleLang

Function Reference

_GUICtrlComboBox_GetLocaleLang

Retrieves the current language identifier

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLocaleLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The language code of the ComboBox

Remarks

None.

Related

_GUICtrlComboBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Locale Country Language id", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBox_GetLocale($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBox_GetLocaleCountry($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBox_GetLocaleLang($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBox_GetLocalePrimLang($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBox_GetLocaleSubLang($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetLocalePrimLang

Function Reference

_GUICtrlComboBox_GetLocalePrimLang

Extract primary language id from a language id

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLocalePrimLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Primary language id

Remarks

None.

Related

_GUICtrlComboBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Locale Primary Language id", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBox_GetLocale($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBox_GetLocaleCountry($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBox_GetLocaleLang($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBox_GetLocalePrimLang($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBox_GetLocaleSubLang($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetLocaleSubLang

Function Reference

_GUICtrlComboBox_GetLocaleSubLang

Extract sublanguage id from a language id

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetLocaleSubLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Sub-Language id

Remarks

None.

Related

_GUICtrlComboBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Locale Sub-Language id", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBox_GetLocale($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBox_GetLocaleCountry($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBox_GetLocaleLang($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBox_GetLocalePrimLang($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBox_GetLocaleSubLang($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetMinVisible

Function Reference

_GUICtrlComboBox_GetMinVisible

Retrieve the minimum number of visible items in the drop-down list of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetMinVisible($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: True
Failure: False

Remarks

When the number of items in the drop-down list is greater than the minimum, the combo box uses a scrollbar.

This Function is ignored if the ComboBox control has style $CBS_NOINTEGRALHEIGHT

Related

_GUICtrlComboBox_SetMinVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Min Visible", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Min Visible
MsgBox(4160, "Information", "Min Visible:" & @TAB & _GUICtrlComboBox_GetMinVisible($hCombo), 3)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; Set Min Visible
_GUICtrlComboBox_SetMinVisible($hCombo, 50)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo)

Sleep(500)

_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; Get Min Visible
MsgBox(4160, "Information", "Min Visible:" & @TAB & _GUICtrlComboBox_GetMinVisible($hCombo), 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_GetTopIndex

Function Reference

_GUICtrlComboBox_GetTopIndex

Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_GetTopIndex($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The index of the first visible item in the ListBox of the ComboBox
Failure: -1

Remarks

None.

Related

_GUICtrlComboBox_SetTopIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Top Index", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Set Top Index
_GUICtrlComboBox_SetTopIndex($hCombo, 10)

; Get Top Index
MsgBox(4160, "Information", "Top Index:" & @TAB & _GUICtrlComboBox_GetTopIndex($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_InitStorage

Function Reference

_GUICtrlComboBox_InitStorage

Allocates memory for storing ListBox items

#Include <GuiComboBox.au3>
_GUICtrlComboBox_InitStorage($hWnd, $iNum, $iBytes)

Parameters

$hWnd | Handle to control
$iNum | Number of items to add
$iBytes | The amount of memory to allocate for item strings, in bytes

Return Value

Success: The total number of items for which memory has been pre-allocated
Failure: $CB_ERRSPACE

Remarks

Helps speed up the initialization of ComboBoxes that have a large number of items (over 100).

You can use estimates for the $iNum and $iBytes parameters.
If you overestimate, the extra memory is allocated.
If you underestimate, the normal allocation is used for items that exceed the requested amount.

Related

_GUICtrlComboBox_AddDir, _GUICtrlComboBox_AddString, _GUICtrlComboBox_InsertString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Init Storage", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Init Storaged
MsgBox(4160, "Information", "Pre-Allocated Memory For: " & _GUICtrlComboBox_InitStorage($hCombo, 50, 500) & " items")

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_InsertString

Function Reference

_GUICtrlComboBox_InsertString

Insert a string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_InsertString($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | Text string to be inserted
$iIndex | [optional] Specifies the zero based index of the position at which to insert the string.

Return Value

Success: Zero based index of the position at which the string was inserted
Failure: -1

Remarks

If the $iIndex parameter is –1, the string is added to the end of the list.

If the ComboBox has $WS_HSCROLL style and you insert a string wider than the ComboBox,
you should use the _GUICtrlComboBox_SetHorizontalExtent function to ensure the horizontal scrollbar appears.

Related

_GUICtrlComboBox_AddString, _GUICtrlComboBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Insert String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Insert string
_GUICtrlComboBox_InsertString($hCombo, "Some Inserted string", 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_LimitText

Function Reference

_GUICtrlComboBox_LimitText

Limits the length of the text the user may type into the edit control of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_LimitText($hWnd[, $iLimit = 0])

Parameters

$hWnd | Handle to control
$iLimit | [optional] limit length of the text

Return Value

None.

Remarks

If the $iLimit parameter is zero, the text length is limited to 0x7FFFFFFE characters.

If the ComboBox does not have the $CBS_AUTOHSCROLL style, setting the text limit to
be larger than the size of the edit control has no effect.

The _GUICtrlComboBox_LimitText function limits only the text the user can enter.
It has no effect on any text already in the edit control when the message is sent,
nor does it affect the length of the text copied to the edit control when a string
in the ListBox is selected.

The default limit to the text a user can enter in the edit control is 30,000 characters

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Limit Text", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Limit text in edit box
_GUICtrlComboBox_LimitText($hCombo, 10)

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_ReplaceEditSel

Function Reference

_GUICtrlComboBox_ReplaceEditSel

Replace text selected in edit box

#Include <GuiComboBox.au3>
_GUICtrlComboBox_ReplaceEditSel($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String containing the replacement text

Return Value

None.

Remarks

Minimum OS - Windows XP.
If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBox_SetEditText, _GUICtrlComboBox_SetEditSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Replace Edit Sel", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Set Edit Text
_GUICtrlComboBox_SetEditText($hCombo, "Old Edit Text")

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

Sleep(500)

; Set selected text in edit box
_GUICtrlComboBox_SetEditSel($hCombo, 0, -1)

Sleep(500)

; Limit text in edit box
_GUICtrlComboBox_ReplaceEditSel($hCombo, "New Edit Text")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_ResetContent

Function Reference

_GUICtrlComboBox_ResetContent

Remove all items from the ListBox and edit control of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_ResetContent($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

None.

Related

_GUICtrlComboBox_DeleteString, _GUICtrlComboBox_AddString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Reset Content", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
GUISetState()

; Set Edit Text
_GUICtrlComboBox_SetEditText($hCombo, "Edit Text")

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

Sleep(500)

; Reset content
_GUICtrlComboBox_ResetContent($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SelectString

Function Reference

_GUICtrlComboBox_SelectString

Searches the ListBox of a ComboBox for an item that begins with the characters in a specified string

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SelectString($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | String that contains the characters for which to search
$iIndex | [optional] Specifies the zero-based index of the item preceding the first item to be searched

Return Value

Success: The index of the selected item
Failure: -1

Remarks

When the search reaches the bottom of the list, it continues from the top of the list back to the
item specified by the wParam parameter.

If $iIndex is –1, the entire list is searched from the beginning.
A string is selected only if the characters from the starting point match the characters in the
prefix string

If a matching item is found, it is selected and copied to the edit control

Related

_GUICtrlComboBox_FindString, _GUICtrlComboBox_FindStringExact, _GUICtrlComboBoxEx_FindStringExact

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Select String", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
; Add string
_GUICtrlComboBox_AddString($hCombo, "This string has been added")
; Add files
_GUICtrlComboBox_AddDir($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBox_EndUpdate($hCombo)

; select string
_GUICtrlComboBox_SelectString($hCombo, "This")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SetCueBanner

Function Reference

_GUICtrlComboBox_SetCueBanner

Sets the cue banner text that is displayed for the edit control of a combo box

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetCueBanner($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String that contains the text

Return Value

Success: True
Failure: False

Remarks

The cue banner is text that is displayed in the edit control of a combo box when there is no selection

Minimum Operating Systems: Windows Vista

Related

_GUICtrlComboBox_GetCueBanner

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo
_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Get Count", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
_GUICtrlComboBox_SetCueBanner($hCombo, "Select an Item")
$iMemo = GUICtrlCreateEdit("", 10, 50, 376, 234, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

MemoWrite("Cue Banner: " & _GUICtrlComboBox_GetCueBanner($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_SetCurSel

Function Reference

_GUICtrlComboBox_SetCurSel

Select a string in the list of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetCurSel($hWnd[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$iIndex | [optional] Specifies the zero-based index of the string to select

Return Value

Success: The index of the item selected
Failure: -1

Remarks

If $iIndex is –1, any current selection in the list is removed and the edit control is cleared.

If $iIndex is greater than the number of items in the list or if $iIndex is –1, the return value
is -1 and the selection is cleared.

Related

_GUICtrlComboBox_GetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Cur Sel", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Select Item
_GUICtrlComboBox_SetCurSel($hCombo, 2)

; Get Cur Sel
MsgBox(4160, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SetDroppedWidth

Function Reference

_GUICtrlComboBox_SetDroppedWidth

Set the maximum allowable width, in pixels, of the ListBox of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetDroppedWidth($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | The width of the ListBox, in pixels

Return Value

Success: The new width of the ListBox
Failure: -1

Remarks

By default, the minimum allowable width of the drop-down ListBox is zero.
The width of the ListBox is either the minimum allowable width or the ComboBox width, whichever is larger.

Use $CBS_DROPDOWN or $CBS_DROPDOWNLIST style.

Related

_GUICtrlComboBox_GetDroppedWidth, _GUICtrlComboBoxEx_GetDroppedState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Dropped Width", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Set Dropped Width
_GUICtrlComboBox_SetDroppedWidth($hCombo, 500)

; Get Dropped Width
MsgBox(4160, "Information", "Dropped Width: " & _GUICtrlComboBox_GetDroppedWidth($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SetEditSel

Function Reference

_GUICtrlComboBox_SetEditSel

Select characters in the edit control of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetEditSel($hWnd, $iStart, $iStop)

Parameters

$hWnd | Handle to control
$iStart | Starting position
$iStop | Ending postions

Return Value

Success: True
Failure: False If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style

Remarks

The positions are zero-based. The first character of the edit control is in the zero position.
If $iStop is –1, all text from the starting position to the last character in the edit control is selected.

The first character after the last selected character is in the ending position.

For example, to select the first four characters of the edit control, use a starting position
of 0 and an ending position of 4.

Related

_GUICtrlComboBox_GetEditSel, _GUICtrlComboBox_ReplaceEditSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aSel, $hCombo

; Create GUI
GUICreate("ComboBox Set Edit Sel", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Select Item
_GUICtrlComboBox_SetCurSel($hCombo, 2)

; Set Edit Sel
_GUICtrlComboBox_SetEditSel($hCombo, 0, 4)

; Get Edit Sel
$aSel = _GUICtrlComboBox_GetEditSel($hCombo)
MemoWrite(StringFormat("Edit Sel: %d - %d", $aSel[0], $aSel[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_SetEditText

Function Reference

_GUICtrlComboBox_SetEditText

Set the text of the edit control of the ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetEditText($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | Text to be set

Return Value

None.

Remarks

Minimum OS - Windows XP.
If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBox_GetEditText, _GUICtrlComboBox_ReplaceEditSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Edit Text", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Set Edit Text
_GUICtrlComboBox_SetEditText($hCombo, StringFormat("%d - Some New Text", Random(1, 20, 1)))

; Get Edit Text
MemoWrite("Edit Text: " & _GUICtrlComboBox_GetEditText($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_SetExtendedUI

Function Reference

_GUICtrlComboBox_SetExtendedUI

Select either the default user interface or the extended user interface

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetExtendedUI($hWnd[, $fExtended = False])

Parameters

$hWnd | Handle to control
$fExtended | [optional] Specifies whether the combo box uses the extended

Return Value

Success: True
Failure: False

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection.

In a ComboBox with the extended user interface, the F4 key is disabled and pressing the DOWN ARROW
key opens the drop-down list

Related

_GUICtrlComboBox_GetExtendedUI

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Extended UI", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBox_GetExtendedUI($hCombo))

; Set Extended UI
_GUICtrlComboBox_SetExtendedUI($hCombo, True)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBox_GetExtendedUI($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_SetHorizontalExtent

Function Reference

_GUICtrlComboBox_SetHorizontalExtent

Set the width, in pixels, by which a list box can be scrolled horizontally

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetHorizontalExtent($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | Specifies the scrollable width of the list box, in pixels

Return Value

None.

Remarks

If the width of the ListBox is smaller than $iWidth, the horizontal scroll bar horizontally scrolls
items in the list box.

If the width of the ListBox is equal to or greater than $iWidth, the horizontal scroll bar is hidden
or, if the ComboBox has the $CBS_DISABLENOSCROLL style, disabled.

Related

_GUICtrlComboBox_GetHorizontalExtent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Horizontal Extent", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Horizontal Extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlComboBox_GetHorizontalExtent($hCombo))

; Set Horizontal Extent
_GUICtrlComboBox_SetHorizontalExtent($hCombo, 500)

; Get Horizontal Extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlComboBox_GetHorizontalExtent($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SetItemHeight

Function Reference

_GUICtrlComboBox_SetItemHeight

Set the height of list items or the selection field in a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetItemHeight($hWnd, $iHeight[, $iComponent = -1])

Parameters

$hWnd | Handle to control
$iHeight | The height, in pixels, of the combo box component identified by $iComponent
$iComponent | [optional] Use the following values: –1 - Set the height of the selection field 0 - Set the height of list items

Return Value

Failure: If height is invalid, the return value is -1.

Remarks

None.

Related

_GUICtrlComboBox_GetItemHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Item Height", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Item Height (selection field)
MemoWrite("Item Height (selection field): " & _GUICtrlComboBox_GetItemHeight($hCombo))

; Get Item Height (list items)
MemoWrite("Item Height (list items): " & _GUICtrlComboBox_GetItemHeight($hCombo, 0))

; Set Item Height (selection field)
_GUICtrlComboBox_SetItemHeight($hCombo, 18)

; Set Item Height (selection field)
_GUICtrlComboBox_SetItemHeight($hCombo, 20, 0)

; Get Item Height (selection field)
MemoWrite("Item Height (selection field): " & _GUICtrlComboBox_GetItemHeight($hCombo))

; Get Item Height (list items)
MemoWrite("Item Height (list items): " & _GUICtrlComboBox_GetItemHeight($hCombo, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBox_SetMinVisible

Function Reference

_GUICtrlComboBox_SetMinVisible

Set the minimum number of visible items in the drop-down list of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetMinVisible($hWnd, $iMinimum)

Parameters

$hWnd | Handle to control
$iMinimum | Specifies the minimum number of visible items

Return Value

Success: True
Failure: False

Remarks

When the number of items in the drop-down list is greater than the minimum,
the Combobbox uses a scrollbar. By default, 30 is the minimum number of visible items.

This message is ignored if the combo box control has style $CBS_NOINTEGRALHEIGHT.

Related

_GUICtrlComboBox_GetMinVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Min Visible", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Get Min Visible
MsgBox(4160, "Information", "Min Visible:" & @TAB & _GUICtrlComboBox_GetMinVisible($hCombo), 3)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; Set Min Visible
_GUICtrlComboBox_SetMinVisible($hCombo, 50)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo)

Sleep(500)

_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; Get Min Visible
MsgBox(4160, "Information", "Min Visible:" & @TAB & _GUICtrlComboBox_GetMinVisible($hCombo), 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_SetTopIndex

Function Reference

_GUICtrlComboBox_SetTopIndex

Ensure that a particular item is visible in the ListBox of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_SetTopIndex($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero-based index of the list item

Return Value

Success: True
Failure: False

Remarks

The system scrolls the ListBox contents so that either the specified item appears at the top
of the list box or the maximum scroll range has been reached.

Related

_GUICtrlComboBox_GetTopIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Set Top Index", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296, BitOR($CBS_SIMPLE, $CBS_DISABLENOSCROLL, $WS_VSCROLL))
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; Set Top Index
_GUICtrlComboBox_SetTopIndex($hCombo, 10)

; Get Top Index
MsgBox(4160, "Information", "Top Index:" & @TAB & _GUICtrlComboBox_GetTopIndex($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlComboBox_ShowDropDown

Function Reference

_GUICtrlComboBox_ShowDropDown

Show or hide the ListBox of a ComboBox

#Include <GuiComboBox.au3>
_GUICtrlComboBox_ShowDropDown($hWnd[, $fShow = False])

Parameters

$hWnd | Handle to control
$fShow | [optional] Specifies whether the drop-down ListBox is to be shown or hidden: True - Show ListBox False - Hide ListBox

Return Value

None.

Remarks

This function has no effect on a ComboBox created with the $CBS_SIMPLE style.

Related

_GUICtrlComboBox_GetDroppedState, _GUICtrlComboBoxEx_GetDroppedState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIComboBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hCombo

; Create GUI
GUICreate("ComboBox Show Drop Down", 400, 296)
$hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; get dropped state
MemoWrite("Dropped Down State......: " & _GUICtrlComboBox_GetDroppedState($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBox_ShowDropDown($hCombo, True)

Sleep(500)

; get dropped state
MemoWrite("Dropped Down State......: " & _GUICtrlComboBox_GetDroppedState($hCombo))

Sleep(500)

; hide drop down
_GUICtrlComboBox_ShowDropDown($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

GuiComboBoxEx user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiComboBoxEx.au3>.

User Defined Function | Description
_GUICtrlComboBoxEx_AddDir | Adds the names of directories and files
_GUICtrlComboBoxEx_AddString | Add a string
_GUICtrlComboBoxEx_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlComboBoxEx_Create | Create a ComboBoxEx control
_GUICtrlComboBoxEx_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlComboBoxEx_DeleteString | Removes an item from a ComboBoxEx control
_GUICtrlComboBoxEx_Destroy | Delete the control
_GUICtrlComboBoxEx_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlComboBoxEx_FindStringExact | Search for a string
_GUICtrlComboBoxEx_GetComboBoxInfo | Gets information about the specified ComboBox
_GUICtrlComboBoxEx_GetComboControl | Gets the handle to the child combo box control
_GUICtrlComboBoxEx_GetCount | Retrieve the number of items
_GUICtrlComboBoxEx_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlComboBoxEx_GetDroppedControlRect | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBoxEx_GetDroppedControlRectEx | Retrieve the screen coordinates of a combo box in its dropped-down state
_GUICtrlComboBoxEx_GetDroppedState | Determines whether the ListBox of a ComboBox is dropped down
_GUICtrlComboBoxEx_GetDroppedWidth | Retrieve the minimum allowable width, of the ListBox of a ComboBox
_GUICtrlComboBoxEx_GetEditControl | Gets the handle to the edit control portion of a ComboBoxEx control
_GUICtrlComboBoxEx_GetEditSel | Gets the starting and ending character positions of the current selection in the edit control of a ComboBox
_GUICtrlComboBoxEx_GetEditText | Get the text from the edit control of a ComboBoxEx
_GUICtrlComboBoxEx_GetExtendedStyle | Gets the extended styles that are in use for a ComboBoxEx control
_GUICtrlComboBoxEx_GetExtendedUI | Determines whether a ComboBox has the default user interface or the extended user interface
_GUICtrlComboBoxEx_GetImageList | Retrieves the handle to an image list assigned to a ComboBoxEx control
_GUICtrlComboBoxEx_GetItem | Retrieves an item's attributes
_GUICtrlComboBoxEx_GetItemEx | Retrieves some or all of an item's attributes
_GUICtrlComboBoxEx_GetItemHeight | Determines the height of list items or the selection field in a ComboBox
_GUICtrlComboBoxEx_GetItemImage | Retrieves the index of the item's icon
_GUICtrlComboBoxEx_GetItemIndent | Retrieves the number of image widths the item is indented
_GUICtrlComboBoxEx_GetItemOverlayImage | Retrieves the index of the item's overlay image icon
_GUICtrlComboBoxEx_GetItemParam | Retrieves the application specific value of the item
_GUICtrlComboBoxEx_GetItemSelectedImage | Retrieves the index of the item's selected image icon
_GUICtrlComboBoxEx_GetItemText | Retrieve a string from the list of a ComboBox
_GUICtrlComboBoxEx_GetItemTextLen | Gets the length, in characters, of a string in the list of a combo box
_GUICtrlComboBoxEx_GetList | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBoxEx_GetListArray | Retrieves all items from the list portion of a ComboBox control
_GUICtrlComboBoxEx_GetLocale | Retrieves the current locale
_GUICtrlComboBoxEx_GetLocaleCountry | Retrieves the current country code
_GUICtrlComboBoxEx_GetLocaleLang | Retrieves the current language identifier
_GUICtrlComboBoxEx_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlComboBoxEx_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlComboBoxEx_GetMinVisible | Retrieve the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBoxEx_GetTopIndex | Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox
_GUICtrlComboBoxEx_GetUnicode | Retrieves if control is using Unicode
_GUICtrlComboBoxEx_InitStorage | Allocates memory for storing ListBox items
_GUICtrlComboBoxEx_InsertString | Inserts a new item in the control
_GUICtrlComboBoxEx_LimitText | Limits the length of the text the user may type into the edit control of a ComboBox
_GUICtrlComboBoxEx_ReplaceEditSel | Replace text selected in edit box
_GUICtrlComboBoxEx_ResetContent | Removes all items
_GUICtrlComboBoxEx_SetCurSel | Select a string in the list of a ComboBox
_GUICtrlComboBoxEx_SetDroppedWidth | Set the maximum allowable width, in pixels, of the ListBox of a ComboBox
_GUICtrlComboBoxEx_SetEditSel | Select characters in the edit control of a ComboBox
_GUICtrlComboBoxEx_SetEditText | Set the text of the edit control of the ComboBox
_GUICtrlComboBoxEx_SetExtendedStyle | Sets extended styles within a ComboBoxEx control
_GUICtrlComboBoxEx_SetExtendedUI | Select either the default user interface or the extended user interface
_GUICtrlComboBoxEx_SetImageList | Sets an image list for a ComboBoxEx control
_GUICtrlComboBoxEx_SetItem | Sets some or all of a item's attributes
_GUICtrlComboBoxEx_SetItemEx | Sets some or all of a item's attributes
_GUICtrlComboBoxEx_SetItemHeight | Set the height of list items or the selection field in a ComboBox
_GUICtrlComboBoxEx_SetItemImage | Sets the index of the item's icon in the control's image list
_GUICtrlComboBoxEx_SetItemIndent | Sets the number of image widths to indent the item
_GUICtrlComboBoxEx_SetItemOverlayImage | Sets the index of the item's overlay icon in the control's image list
_GUICtrlComboBoxEx_SetItemParam | Sets the value specific to the item
_GUICtrlComboBoxEx_SetItemSelectedImage | Sets the index of the item's overlay icon in the control's image list
_GUICtrlComboBoxEx_SetMinVisible | Set the minimum number of visible items in the drop-down list of a ComboBox
_GUICtrlComboBoxEx_SetTopIndex | Ensure that a particular item is visible in the ListBox of a ComboBox
_GUICtrlComboBoxEx_SetUnicode | Sets if control is using Unicode
_GUICtrlComboBoxEx_ShowDropDown | Show or hide the ListBox of a ComboBox


Function _GUICtrlComboBoxEx_AddDir

Function Reference

_GUICtrlComboBoxEx_AddDir

Adds the names of directories and files

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_AddDir($hWnd, $sFile[, $iAttributes = 0[, $fBrackets = True]])

Parameters

$hWnd | Handle to control
$sFile | Specifies an absolute path, relative path, or filename
$iAttributes | [optional] Specifies the attributes of the files or directories to be added: $DDL_READWRITE - Includes read-write files with no additional attributes $DDL_READONLY - Includes read-only files $DDL_HIDDEN - Includes hidden files $DDL_SYSTEM - Includes system files $DDL_DIRECTORY - Includes subdirectories $DDL_ARCHIVE - Includes archived files $DDL_DRIVES - All mapped drives are added to the list $DDL_EXCLUSIVE - Includes only files with the specified attributes
$fBrackets | [optional] include/exclude brackets when $DDL_DRIVES is used

Return Value

Success: | Zero based index of the last name added
Failure: | -1

Remarks

If there is insufficient space to store the new strings, the return value is $CB_ERRSPACE
Needs Constants.au3 for pre-defined constants

Related

_GUICtrlComboBoxEx_InitStorage

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $input, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Add Dir", 400, 300, -1, -1, -1)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$input = GUICtrlCreateInput("Input control", 2, 30, 120)
GUISetState()

; Add files
;~ _GUICtrlComboBoxEx_BeginUpdate ($input) ; check that ClassName checking works properly
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_AddString

Function Reference

_GUICtrlComboBoxEx_AddString

Add a string

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_AddString($hWnd, $sText[, $iImage = -1[, $iSelecteImage = -1[, $iOverlayImage = -1[, $iIndent = -1[, $iParam = -1]]]]])

Parameters

$hWnd | Handle to the control To insert an item at the end of the list, set the $iIndex member to -1
$sText | Item text. If set to -1, the item set is set via the $CBEN_GETDISPINFO notification message.
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelecteImage | [optional] Zero based index of the item's icon in the control's image list
$iOverlayImage | [optional] Zero based index of the item's icon in the control's image list
$iIndent | [optional] Number of image widths to indent the item. A single indentation equals the width of an image.
$iParam | [optional] Value specific to the item

Return Value

Success: | The index of the new item
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_DeleteString, _GUICtrlComboBoxEx_InitStorage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Add String", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
For $x = 0 To 146
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
Next
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_BeginUpdate

Function Reference

_GUICtrlComboBoxEx_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_EndUpdate

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Begin Update", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
For $x = 0 To 146
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
Next
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_Create

Function Reference

_GUICtrlComboBoxEx_Create

Create a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_Create($hWnd, $sText, $iX, $iY[, $iWidth = 100[, $iHeight = 200[, $iStyle = 0x00200002[, $iExStyle = 0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$sText | Delimited text to add to ComboBox
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control style: $CBS_DROPDOWN - Similar to $CBS_SIMPLE, except that the list box is not displayed unless the user selects an icon next to the edit control $CBS_DROPDOWNLIST - Similar to $CBS_DROPDOWN, except that the edit control is replaced by a static text item that displays the current selection in the list box $CBS_SIMPLE - Displays the list box at all times
 | Default: $CBS_DROPDOWN, $WS_VSCROLL Forced : $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE
$iExStyle | [optional] Control extended style: $CBES_EX_CASESENSITIVE - Searches in the list will be case sensitive $CBES_EX_NOEDITIMAGE - The edit box and the dropdown list will not display item images $CBES_EX_NOEDITIMAGEINDENT - The edit box and the dropdown list will not display item images $CBES_EX_NOSIZELIMIT - Allows the ComboBoxEx control to be vertically sized smaller than its contained combo box control $CBES_EX_PATHWORDBREAKPROC - Microsoft Windows NT only. The edit box will use the slash (/), backslash (\), and period (.) characters as word delimiters. This makes keyboard shortcuts for word-by-word cursor movement () effective in path names and URLs.

Return Value

Success: | Handle to the Listbox control
Failure: | 0

Remarks

None.

Related

_GUICtrlComboBoxEx_Destroy

Example

#include <GuiComboBoxEx.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $hCombo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("ComboBoxEx Create", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "This is a test|Line 2", 2, 2, 394, 268)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlComboBoxEx_AddString ($hCombo, "Some More Text")
_GUICtrlComboBoxEx_InsertString ($hCombo, "Inserted Text", 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hCombo
Switch $iCode
Case $CBEN_BEGINEDIT ; Sent when the user activates the drop-down list or clicks in the control's edit box.
_DebugPrint("$CBEN_BEGINEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
Return 0
Case $CBEN_DELETEITEM
_DebugPrint("$CBEN_DELETEITEM" & _GetComboBoxEx($ilParam))
Return 0
Case $CBEN_DRAGBEGINA, $CBEN_DRAGBEGINW
Local $tInfo = DllStructCreate($tagNMCBEDRAGBEGIN, $ilParam)
If DllStructGetData($tInfo, "ItemID") Then _DebugPrint("$CBEN_DRAGBEGIN" & _GetComboBoxEx($ilParam))
_DebugPrint("$CBEN_DRAGBEGIN" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->ItemID:" & @TAB & DllStructGetData($tInfo, "ItemID") & @LF & _
"-->Text:" & @TAB & DllStructGetData($tInfo, "Text"))
; return is ignored
Case $CBEN_ENDEDITA, $CBEN_ENDEDITW ; Sent when the user has concluded an operation within the edit box or has selected an item from the control's drop-down list.
Local $tInfo = DllStructCreate($tagNMCBEENDEDIT, $ilParam)
_DebugPrint("$CBEN_ENDEDIT" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->fChanged:" & @TAB & DllStructGetData($tInfo, "fChanged") & @LF & _
"-->NewSelection:" & @TAB & DllStructGetData($tInfo, "NewSelection") & @LF & _
"-->Text:" & @TAB & DllStructGetData($tInfo, "Text") & @LF & _
"-->Why:" & @TAB & DllStructGetData($tInfo, "Why"))
Return False ; accept the notification and allow the control to display the selected item
;~ Return True ; otherwise
Case $CBEN_GETDISPINFOA, $CBEN_GETDISPINFOW ; Sent to retrieve display information about a callback item
_DebugPrint("$CBEN_GETDISPINFO" & _GetComboBoxEx($ilParam))
Return 0
Case $CBEN_INSERTITEM
Local $tInfo = DllStructCreate($tagNMCOMBOBOXEX, $ilParam)
Local $tBuffer = DllStructCreate("wchar Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
_DebugPrint("$CBEN_INSERTITEM" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
"-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
"-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
"-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
"-->SelectedImage:" & @TAB & DllStructGetData($tInfo, "SelectedImage") & @LF & _
"-->OverlayImage:" & @TAB & DllStructGetData($tInfo, "OverlayImage") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
Return 0
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _GetComboBoxEx($ilParam)
Local $tInfo = DllStructCreate($tagNMCOMBOBOXEX, $ilParam)
Local $aItem = _GUICtrlComboBoxEx_GetItem ($hCombo, DllStructGetData($tInfo, "Item"))
Return @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->Text:" & @TAB & $aItem[0] & @LF & _
"-->TextMax:" & @TAB & $aItem[1] & @LF & _
"-->Indent:" & @TAB & $aItem[2] & @LF & _
"-->Image:" & @TAB & $aItem[3] & @LF & _
"-->SelectedImage:" & @TAB & $aItem[4] & @LF & _
"-->OverlayImage:" & @TAB & $aItem[5] & @LF & _
"-->Param:" & @TAB & $aItem[5]
EndFunc ;==>_GetComboBoxEx

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlComboBoxEx_CreateSolidBitMap

Function Reference

_GUICtrlComboBoxEx_CreateSolidBitMap

Creates a solid color bitmap

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_CreateSolidBitMap($hWnd, $iColor, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the window where the bitmap will be displayed
$iColor | The color of the bitmap, stated in RGB
$iWidth | The width of the bitmap
$iHeight | The height of the bitmap

Return Value

Success: Handle to the bitmap

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Create Solid BitMap", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 2
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x)
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_DeleteString

Function Reference

_GUICtrlComboBoxEx_DeleteString

Removes an item from a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_DeleteString($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the Item to delete

Return Value

Success: Number of items remaining in the control

Remarks

None.

Related

_GUICtrlComboBoxEx_AddString

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Delete String", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 2
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; Delete String
MsgBox(4160, "Information", "Delete String")
_GUICtrlComboBoxEx_DeleteString ($hCombo, 1)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_Destroy

Function Reference

_GUICtrlComboBoxEx_Destroy

Delete the control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on ComboBox created with _GUICtrlComboBoxEx_Create

Related

_GUICtrlComboBoxEx_Create

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Destroy", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "This is a test|Line 2", 2, 2, 394, 268)
GUISetState()

_GUICtrlComboBoxEx_AddString ($hCombo, "Some More Text")
_GUICtrlComboBoxEx_InsertString ($hCombo, "Inserted Text", 1)

;Destroy control
MsgBox(266256, "Information", "Destroy the control")
_GUICtrlComboBoxEx_Destroy ($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_EndUpdate

Function Reference

_GUICtrlComboBoxEx_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_BeginUpdate

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx End Update", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
For $x = 0 To 146
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", $x)
Next
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 200, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_FindStringExact

Function Reference

_GUICtrlComboBoxEx_FindStringExact

Search for a string

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_FindStringExact($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | String to search for
$iIndex | [optional] Zero based index of the item preceding the first item to be searched

Return Value

Success: | Zero based index of the matching item
Failure: | -1

Remarks

Find the first string that matches the string specified in the $sText parameter

When the search reaches the bottom of the ListBox, it continues from the top of the
ListBox back to the item specified by $iIndex.

If $iIndex is –1, the entire ListBox is searched from the beginning.

Related

_GUICtrlComboBox_SelectString

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $Delimiter = ";", $hCombo

Opt("GUIDataSeparatorChar", $Delimiter)

; Create GUI
$hGUI = GUICreate("ComboBoxEx Find String Exact", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "This is;mY tExT", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Find exact string
MsgBox(4160, "Information", "Found at: " & _GUICtrlComboBoxEx_FindStringExact ($hCombo, "mY tExT"))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetComboBoxInfo

Function Reference

_GUICtrlComboBoxEx_GetComboBoxInfo

Gets information about the specified ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetComboBoxInfo($hWnd, ByRef $tInfo)

Parameters

$hWnd | Handle to control
$tInfo | The information about the ComboBox.

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $tInfo, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get ComboBox Info", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

If _GUICtrlComboBoxEx_GetComboBoxInfo ($hCombo, $tInfo) Then _
MsgBox(4160, "Information", StringFormat("Edit Rect [%d][%d][%d][%d]", _
DllStructGetData($tInfo, "EditLeft"), DllStructGetData($tInfo, "EditTop"), _
DllStructGetData($tInfo, "EditRight"), DllStructGetData($tInfo, "EditBottom")))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetComboControl

Function Reference

_GUICtrlComboBoxEx_GetComboControl

Gets the handle to the child combo box control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetComboControl($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: handle to the combo box control within the ComboBoxEx control

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Combo Control", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 268)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 5
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x)
Next

MsgBox(4160, "Information", _
"Combo Control Handle: " & _GUICtrlComboBoxEx_GetComboControl ($hCombo) & @LF & _
"Edit Control Handle: " & _GUICtrlComboBoxEx_GetEditControl ($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetCount

Function Reference

_GUICtrlComboBoxEx_GetCount

Retrieve the number of items

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Number of items
Failure: -1

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Count", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 268)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 5
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x)
Next

MsgBox(4160, "Information", "Count: " & _GUICtrlComboBoxEx_GetCount ($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetCurSel

Function Reference

_GUICtrlComboBoxEx_GetCurSel

Retrieve the index of the currently selected item

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetCurSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | The index of the item selected
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetCurSel

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Cur Sel", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 100, 320)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 99
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", $x), Random(0, 8, 1), Random(0, 8, 1), Random(0, 8, 1))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Set Cur Sel
_GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 99, 1))

; Get Cur Sel
MsgBox(4160, "Information", "Current Sel: " & _GUICtrlComboBoxEx_GetCurSel ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetDroppedControlRect

Function Reference

_GUICtrlComboBoxEx_GetDroppedControlRect

Retrieve the screen coordinates of a combo box in its dropped-down state

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetDroppedControlRect($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlComboBoxEx_GetDroppedControlRectEx

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $aRect, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Dropped Control Rect", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Get Dropped Control Rect
$aRect = _GUICtrlComboBoxEx_GetDroppedControlRect ($hCombo)
MsgBox(4160, "Information", "Dropped Control Rect: " & StringFormat("[%d][%d][%d][%d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetDroppedControlRectEx

Function Reference

_GUICtrlComboBoxEx_GetDroppedControlRectEx

Retrieve the screen coordinates of a combo box in its dropped-down state

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetDroppedControlRectEx($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagRECT structure that receives the screen coordinates

Remarks

None.

Related

_GUICtrlComboBoxEx_GetDroppedControlRect, $tagRECT

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $tRect, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Dropped Control RectEx", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Get Dropped Control Rect
$tRect = _GUICtrlComboBoxEx_GetDroppedControlRectEx ($hCombo)
MsgBox(4160, "Information", "Dropped Control Rect: " & _
StringFormat("[%d][%d][%d][%d]", DllStructGetData($tRect, "Left"), DllStructGetData($tRect, "Top"), _
DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom")))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetDroppedState

Function Reference

_GUICtrlComboBoxEx_GetDroppedState

Determines whether the ListBox of a ComboBox is dropped down

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetDroppedState($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Is dropped down
False: Not dropped down

Remarks

None.

Related

_GUICtrlComboBox_GetDroppedWidth, _GUICtrlComboBox_SetDroppedWidth, _GUICtrlComboBox_ShowDropDown, _GUICtrlComboBoxEx_ShowDropDown

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Dropped State", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; get dropped state
MemoWrite ("Dropped Down State......: " & _GUICtrlComboBoxEx_GetDroppedState ($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; get dropped state
MemoWrite ("Dropped Down State......: " & _GUICtrlComboBoxEx_GetDroppedState ($hCombo))

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite5


Function _GUICtrlComboBoxEx_GetDroppedWidth

Function Reference

_GUICtrlComboBoxEx_GetDroppedWidth

Retrieve the minimum allowable width, of the ListBox of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetDroppedWidth($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The width, in pixels
Failure: -1

Remarks

The ComboBox must have $CBS_DROPDOWN or $CBS_DROPDOWNLIST style.

Related

_GUICtrlComboBox_GetDroppedState, _GUICtrlComboBoxEx_SetDroppedWidth

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Dropped Width", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; get dropped width
MemoWrite("Dropped Width......: " & _GUICtrlComboBoxEx_GetDroppedWidth ($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; set Dropped Width
_GUICtrlComboBoxEx_SetDroppedWidth ($hCombo, 500)

Sleep(500)

; get dropped width
MemoWrite("Dropped Width......: " & _GUICtrlComboBoxEx_GetDroppedWidth ($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetEditControl

Function Reference

_GUICtrlComboBoxEx_GetEditControl

Gets the handle to the edit control portion of a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetEditControl($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The handle to the edit control within the ComboBoxEx control if it uses the $CBS_DROPDOWN style

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Edit Control", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 268)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 5
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x)
Next

MsgBox(4160, "Information", _
"Combo Control Handle: " & _GUICtrlComboBoxEx_GetComboControl ($hCombo) & @LF & _
"Edit Control Handle: " & _GUICtrlComboBoxEx_GetEditControl ($hCombo))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetEditSel

Function Reference

_GUICtrlComboBoxEx_GetEditSel

Gets the starting and ending character positions of the current selection in the edit control of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetEditSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array in the following format:
[0] - Starting position
[1] - Ending position
Failure: -1

Remarks

If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBoxEx_SetEditSel

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $aSel, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Edit Sel", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 70, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
$iMemo = GUICtrlCreateEdit("", 2, 72, 396, 226, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

; Add strings
For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Cur Sel
_GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 8, 1))

;Set Edit Sel
_GUICtrlComboBoxEx_SetEditSel ($hCombo, 0, 4)

;Get Edit Sel
$aSel = _GUICtrlComboBoxEx_GetEditSel ($hCombo)
MemoWrite(StringFormat("Selected: [%d][%d]", $aSel[0], $aSel[1]))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetEditText

Function Reference

_GUICtrlComboBoxEx_GetEditText

Get the text from the edit control of a ComboBoxEx

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetEditText($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: String from the edit control
Failure: Empty string

Remarks

If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBoxEx_SetEditText

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Edit Text", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Edit Text
_GUICtrlComboBoxEx_SetEditText ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))

;Get Edit Text
MsgBox(4160, "Information", "Edit Text: " & _GUICtrlComboBoxEx_GetEditText ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetExtendedStyle

Function Reference

_GUICtrlComboBoxEx_GetExtendedStyle

Gets the extended styles that are in use for a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetExtendedStyle($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: DWORD value that contains the ComboBoxEx control extended styles in use for the control

Remarks

None.

Related

_GUICtrlComboBoxEx_SetExtendedStyle

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Extended Style", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
;Set Extended Style
_GUICtrlComboBoxEx_SetExtendedStyle ($hCombo, $CBES_EX_CASESENSITIVE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Get Extended Style
MsgBox(4160, "Information", "Extend Styles found: " & _DisplayExtendStringList($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func _DisplayExtendStringList($hCombo)
Local $Styles = @LF & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_CASESENSITIVE) = $CBES_EX_CASESENSITIVE) Then $Styles &= "$CBES_EX_CASESENSITIVE" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOEDITIMAGE) = $CBES_EX_NOEDITIMAGE) Then $Styles &= "$CBES_EX_NOEDITIMAGE" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOEDITIMAGEINDENT) = $CBES_EX_NOEDITIMAGEINDENT) Then $Styles &= "$CBES_EX_NOEDITIMAGEINDENT" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOSIZELIMIT) = $CBES_EX_NOSIZELIMIT) Then $Styles &= "$CBES_EX_NOSIZELIMIT" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_PATHWORDBREAKPROC) = $CBES_EX_PATHWORDBREAKPROC) Then $Styles &= "$CBES_EX_PATHWORDBREAKPROC"
Return $Styles
EndFunc ;==>_DisplayExtendStringList


Function _GUICtrlComboBoxEx_GetExtendedUI

Function Reference

_GUICtrlComboBoxEx_GetExtendedUI

Determines whether a ComboBox has the default user interface or the extended user interface

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetExtendedUI($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: ComboBox has the extended user interface
False: ComboBox does "NOT" have the extended user interface

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection.

In a ComboBox with the extended user interface, the F4 key is disabled and pressing the DOWN ARROW
key opens the drop-down list

Related

_GUICtrlComboBoxEx_SetExtendedUI

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Extended UI", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBoxEx_GetExtendedUI ($hCombo))

; Set Extended UI
_GUICtrlComboBoxEx_SetExtendedUI ($hCombo, True)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBoxEx_GetExtendedUI ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetImageList

Function Reference

_GUICtrlComboBoxEx_GetImageList

Retrieves the handle to an image list assigned to a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The handle to the image list
Failure: 0

Remarks

None.

Related

_GUICtrlComboBoxEx_SetImageList

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Image List", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Get Image List
MemoWrite("ImageList Handle: " & _GUICtrlComboBoxEx_GetImageList($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetItem

Function Reference

_GUICtrlComboBoxEx_GetItem

Retrieves an item's attributes

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Array with the following format:
[0] - Item text
[1] - Length of Item text
[2] - Number of image widths to indent the item
[3] - Zero based item image index
[4] - Zero based item state image index
[5] - Zero based item image overlay index
[6] - Item application defined value

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItem, _GUICtrlComboBoxEx_GetItemEx

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $aItem, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Item indent
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)

$aItem = _GUICtrlComboBoxEx_GetItem ($hCombo, 1)
MemoWrite("Item Text : " & $aItem[0])
MemoWrite("Item Len ..........................: " & $aItem[1])
MemoWrite("# image widths to indent ..........: " & $aItem[2])
MemoWrite("Zero based item image index .......: " & $aItem[3])
MemoWrite("Zero based item state image index .: " & $aItem[4])
MemoWrite("Zero based item image overlay index: " & $aItem[5])
MemoWrite("Item application defined value ....: " & $aItem[6])

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetItemEx

Function Reference

_GUICtrlComboBoxEx_GetItemEx

Retrieves some or all of an item's attributes

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemEx($hWnd, ByRef $tItem)

Parameters

$hWnd | Handle to the control
$tItem | $tagCOMBOBOXEXITEM structure that specifies the information to retrieve

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItem, _GUICtrlComboBoxEx_SetItemEx, $tagCOMBOBOXEXITEM

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $tItem, $sText, $iLen, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get ItemEx", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Item indent
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)

;Create Structure
$tItem = DllStructCreate($tagCOMBOBOXEXITEM)
;Set Mask for what to retrieve
DllStructSetData($tItem, "Mask", BitOR($CBEIF_IMAGE, $CBEIF_INDENT, $CBEIF_LPARAM, $CBEIF_SELECTEDIMAGE, $CBEIF_OVERLAY))
;Set Index of item to retrieve
DllStructSetData($tItem, "Item", 1)

_GUICtrlComboBoxEx_GetItemEx ($hCombo, $tItem)
$iLen = _GUICtrlComboBoxEx_GetItemText ($hCombo, 1, $sText)
MemoWrite("Item Text : " & $sText)
MemoWrite("Item Len ..........................: " & $iLen)
MemoWrite("# image widths to indent ..........: " & DllStructGetData($tItem, "Indent"))
MemoWrite("Zero based item image index .......: " & DllStructGetData($tItem, "Image"))
MemoWrite("Zero based item state image index .: " & DllStructGetData($tItem, "SelectedImage"))
MemoWrite("Zero based item image overlay index: " & DllStructGetData($tItem, "OverlayImage"))
MemoWrite("Item application defined value ....: " & DllStructGetData($tItem, "Param"))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetItemHeight

Function Reference

_GUICtrlComboBoxEx_GetItemHeight

Determines the height of list items or the selection field in a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemHeight($hWnd, $iComponent = -1)

Parameters

$hWnd | Handle to control
$iComponent | Use the following values: –1 - Get the height of the selection field 0 - Get the height of list items

Return Value

Success: The height, in pixels
Failure: -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemHeight

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Height", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

MemoWrite("Set Item Height: " & _GUICtrlComboBoxEx_SetItemHeight ($hCombo, -1, 18))
MemoWrite("Item Height: " & _GUICtrlComboBoxEx_GetItemHeight ($hCombo, -1))
MemoWrite("Set Item Height: " & _GUICtrlComboBoxEx_SetItemHeight ($hCombo, 0, 20))
MemoWrite("Item Height: " & _GUICtrlComboBoxEx_GetItemHeight ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetItemImage

Function Reference

_GUICtrlComboBoxEx_GetItemImage

Retrieves the index of the item's icon

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: | Zero based item image index
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 2)
MsgBox(4160, "Information", "Item Image: " & _GUICtrlComboBoxEx_GetItemImage ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemIndent

Function Reference

_GUICtrlComboBoxEx_GetItemIndent

Retrieves the number of image widths the item is indented

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemIndent($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Item indention

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemIndent

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Indent", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
MsgBox(4160, "Information", "Item Indent: " & _GUICtrlComboBoxEx_GetItemIndent ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemOverlayImage

Function Reference

_GUICtrlComboBoxEx_GetItemOverlayImage

Retrieves the index of the item's overlay image icon

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemOverlayImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: | Zero based item overlay image index
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemOverlayImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Overlay Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemOverlayImage ($hCombo, 2, 6)
MsgBox(4160, "Information", "Item Overlay Image: " & _GUICtrlComboBoxEx_GetItemOverlayImage ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemParam

Function Reference

_GUICtrlComboBoxEx_GetItemParam

Retrieves the application specific value of the item

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemParam($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Application specific value

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemParam

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Param", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemParam ($hCombo, 2, 54321)
MsgBox(4160, "Information", "Item Param: " & _GUICtrlComboBoxEx_GetItemParam ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemSelectedImage

Function Reference

_GUICtrlComboBoxEx_GetItemSelectedImage

Retrieves the index of the item's selected image icon

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemSelectedImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: | Zero based item selected image index
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetItemSelectedImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Selected Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemSelectedImage ($hCombo, 0, 3)
MsgBox(4160, "Information", "Item Selected Image: " & _GUICtrlComboBoxEx_GetItemSelectedImage ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemText

Function Reference

_GUICtrlComboBoxEx_GetItemText

Retrieve a string from the list of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemText($hWnd, $iIndex, ByRef $sText)

Parameters

$hWnd | Handle to control
$iIndex | Zero based index to Retrieve from
$sText | Variable that will receive the string

Return Value

Success: The length of the string
Failure: -1

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $sText, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Text", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemSelectedImage ($hCombo, 0, 3)

; Get Item Text
_GUICtrlComboBoxEx_GetItemText ($hCombo, 0, $sText)
MsgBox(4160, "Information", "Item Text: " & $sText)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetItemTextLen

Function Reference

_GUICtrlComboBoxEx_GetItemTextLen

Gets the length, in characters, of a string in the list of a combo box

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetItemTextLen($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | index item

Return Value

Success: The length of the string
Failure: -1

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Item Text Len", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemSelectedImage ($hCombo, 0, 3)

; Get Item Text Len
MsgBox(4160, "Information", "Item Text Len: " & _GUICtrlComboBoxEx_GetItemTextLen ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetList

Function Reference

_GUICtrlComboBoxEx_GetList

Retrieves all items from the list portion of a ComboBox control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetList($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Delimited string of all ComboBox items

Remarks

Default delimiter is "|" this can be change using the Opt("GUIDataSeparatorChar", "new delimiter")

Related

_GUICtrlComboBoxEx_GetListArray

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aItem, $Delimiter = ";", $hCombo

Opt("GUIDataSeparatorChar", $Delimiter)

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get List", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Get List
$aItem = StringSplit(_GUICtrlComboBoxEx_GetList ($hCombo), $Delimiter)

For $x = 1 To $aItem[0]
MemoWrite($aItem[$x])
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetListArray

Function Reference

_GUICtrlComboBoxEx_GetListArray

Retrieves all items from the list portion of a ComboBox control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetListArray($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array in the following format:
[0] - Number of items
[1] - Item 1
[2] - Item 2
[n] - Item n

Remarks

None.

Related

_GUICtrlComboBoxEx_GetList

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aItem, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get List Array", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Get List
$aItem = _GUICtrlComboBoxEx_GetListArray ($hCombo)

For $x = 1 To $aItem[0]
MemoWrite($aItem[$x])
Next

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_GetLocale

Function Reference

_GUICtrlComboBoxEx_GetLocale

Retrieves the current locale

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetLocale($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The high order word contains the country code and the low order word contains the language identifier.

Remarks

None.

Related

_GUICtrlComboBoxEx_GetLocaleCountry, _GUICtrlComboBoxEx_GetLocaleLang, _GUICtrlComboBoxEx_GetLocalePrimLang, _GUICtrlComboBoxEx_GetLocaleSubLang

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Locale", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBoxEx_GetLocale ($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBoxEx_GetLocaleCountry ($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBoxEx_GetLocaleLang ($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBoxEx_GetLocalePrimLang ($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBoxEx_GetLocaleSubLang ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetLocaleCountry

Function Reference

_GUICtrlComboBoxEx_GetLocaleCountry

Retrieves the current country code

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetLocaleCountry($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The country code of the ComboBox

Remarks

None.

Related

_GUICtrlComboBoxEx_GetLocale

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Locale Country code", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBoxEx_GetLocale ($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBoxEx_GetLocaleCountry ($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBoxEx_GetLocaleLang ($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBoxEx_GetLocalePrimLang ($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBoxEx_GetLocaleSubLang ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetLocaleLang

Function Reference

_GUICtrlComboBoxEx_GetLocaleLang

Retrieves the current language identifier

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetLocaleLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The language code of the ComboBox

Remarks

None.

Related

_GUICtrlComboBoxEx_GetLocale

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Locale Country Language id", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBoxEx_GetLocale ($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBoxEx_GetLocaleCountry ($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBoxEx_GetLocaleLang ($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBoxEx_GetLocalePrimLang ($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBoxEx_GetLocaleSubLang ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetLocalePrimLang

Function Reference

_GUICtrlComboBoxEx_GetLocalePrimLang

Extract primary language id from a language id

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetLocalePrimLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Primary language id

Remarks

None.

Related

_GUICtrlComboBoxEx_GetLocale

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Locale Country Primary Language id", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBoxEx_GetLocale ($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBoxEx_GetLocaleCountry ($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBoxEx_GetLocaleLang ($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBoxEx_GetLocalePrimLang ($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBoxEx_GetLocaleSubLang ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetLocaleSubLang

Function Reference

_GUICtrlComboBoxEx_GetLocaleSubLang

Extract sublanguage id from a language id

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetLocaleSubLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Sub-Language id

Remarks

None.

Related

_GUICtrlComboBoxEx_GetLocale

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Locale Country Sub-Language id", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlComboBoxEx_GetLocale ($hCombo) & @LF & _
"Country code ........: " & _GUICtrlComboBoxEx_GetLocaleCountry ($hCombo) & @LF & _
"Language identifier..: " & _GUICtrlComboBoxEx_GetLocaleLang ($hCombo) & @LF & _
"Primary Language id : " & _GUICtrlComboBoxEx_GetLocalePrimLang ($hCombo) & @LF & _
"Sub-Language id ....: " & _GUICtrlComboBoxEx_GetLocaleSubLang ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetMinVisible

Function Reference

_GUICtrlComboBoxEx_GetMinVisible

Retrieve the minimum number of visible items in the drop-down list of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetMinVisible($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: True
Failure: False

Remarks

When the number of items in the drop-down list is greater than the minimum, the combo box uses a scrollbar.

This Function is ignored if the ComboBox control has style $CBS_NOINTEGRALHEIGHT

Related

_GUICtrlComboBoxEx_SetMinVisible

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $iImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Min Visible", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)

For $x = 0 To 149
$iImage = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $iImage, $iImage)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
MsgBox(4160, "Information", "Min Vis.: " & _GUICtrlComboBoxEx_GetMinVisible ($hCombo))
MsgBox(4160, "Information", "Set Min Vis: " & _GUICtrlComboBoxEx_SetMinVisible ($hCombo, 50))
MsgBox(4160, "Information", "Min Vis.: " & _GUICtrlComboBoxEx_GetMinVisible ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetTopIndex

Function Reference

_GUICtrlComboBoxEx_GetTopIndex

Retrieve the zero-based index of the first visible item in the ListBox portion of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetTopIndex($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The index of the first visible item in the ListBox of the ComboBox
Failure: -1

Remarks

None.

Related

_GUICtrlComboBoxEx_SetTopIndex

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get Top Index", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)

For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

;Set Top Index
MsgBox(4160, "Information", "Set Top Index: " & _GUICtrlComboBoxEx_SetTopIndex ($hCombo, Random(50, 149, 1)))
MsgBox(4160, "Information", "Top Index: " & _GUICtrlComboBoxEx_GetTopIndex ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_GetUnicode

Function Reference

_GUICtrlComboBoxEx_GetUnicode

Retrieves if control is using Unicode

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_GetUnicode($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Using Unicode
False: Not using Unicode

Remarks

None.

Related

_GUICtrlComboBoxEx_SetUnicode

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get/Set Unicode", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

_GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate($hCombo)

For $x = 0 To 149
_GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate($hCombo)

;Set/Get Unicode
MsgBox(4160, "Information", "Set Unicode: " & _GUICtrlComboBoxEx_SetUnicode($hCombo, False))
MsgBox(4160, "Information", "Get Unicode: " & _GUICtrlComboBoxEx_GetUnicode($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_InitStorage

Function Reference

_GUICtrlComboBoxEx_InitStorage

Allocates memory for storing ListBox items

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_InitStorage($hWnd, $iNum, $iBytes)

Parameters

$hWnd | Handle to control
$iNum | Number of items to add
$iBytes | The amount of memory to allocate for item strings, in bytes

Return Value

Success: The total number of items for which memory has been pre-allocated
Failure: $CB_ERRSPACE

Remarks

Helps speed up the initialization of ComboBoxes that have a large number of items (over 100).

You can use estimates for the $iNum and $iBytes parameters.
If you overestimate, the extra memory is allocated.
If you underestimate, the normal allocation is used for items that exceed the requested amount.

Related

_GUICtrlComboBoxEx_AddDir, _GUICtrlComboBoxEx_AddString, _GUICtrlComboBoxEx_InsertString

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Init Storage", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 396, 296, $CBS_SIMPLE)
GUISetState()

MsgBox(4160, "Information", "Innit Storage Pre-Allocated Memory For: " & _GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300) & " Items")
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)

For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_InsertString

Function Reference

_GUICtrlComboBoxEx_InsertString

Inserts a new item in the control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_InsertString($hWnd, $sText[, $iIndex = 0[, $iImage = -1[, $iSelecteImage = -1[, $iOverlayImage = -1[, $iIndent = -1[, $iParam = -1]]]]]])

Parameters

$hWnd | Handle to the control
$sText | Item text. If set to -1, the item set is set via the $CBEN_GETDISPINFO notification message.
$iIndex | [optional] Zero based index at which the new string should be inserted. To insert an item at the end of the list, set the $iIndex member to -1
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelecteImage | [optional] Zero based index of the item's icon in the control's image list
$iOverlayImage | [optional] Zero based index of the item's icon in the control's image list
$iIndent | [optional] Number of image widths to indent the item. A single indentation equals the width of an image.
$iParam | [optional] Value specific to the item

Return Value

Success: | The index of the new item
Failure: | -1

Remarks

None.

Related

_GUICtrlComboBoxEx_InitStorage

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Insert String", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Insert string
_GUICtrlComboBoxEx_InsertString ($hCombo, "Text inserted", 1)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_LimitText

Function Reference

_GUICtrlComboBoxEx_LimitText

Limits the length of the text the user may type into the edit control of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_LimitText($hWnd[, $iLimit = 0])

Parameters

$hWnd | Handle to control
$iLimit | [optional] Limit length of the text

Return Value

None.

Remarks

If the $iLimit parameter is zero, the text length is limited to 0x7FFFFFFE characters.

If the ComboBox does not have the $CBS_AUTOHSCROLL style, setting the text limit to
be larger than the size of the edit control has no effect.

The _GUICtrlComboBox_LimitText function limits only the text the user can enter.
It has no effect on any text already in the edit control when the message is sent,
nor does it affect the length of the text copied to the edit control when a string
in the ListBox is selected.

The default limit to the text a user can enter in the edit control is 30,000 characters

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Limit Text", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

; Add files
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES, False)
_GUICtrlComboBoxEx_AddDir ($hCombo, "", $DDL_DRIVES)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
_GUICtrlComboBoxEx_AddDir ($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBoxEx_EndUpdate ($hCombo)
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Limit Text in Edit control
_GUICtrlComboBoxEx_LimitText ($hCombo, 10)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_ReplaceEditSel

Function Reference

_GUICtrlComboBoxEx_ReplaceEditSel

Replace text selected in edit box

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_ReplaceEditSel($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String containing the replacement text

Return Value

None.

Remarks

If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBoxEx_SetEditText

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Replace Edit Sel", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), Random(0, 8, 1), Random(0, 8, 1), Random(0, 8, 1))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Set Cur Sel
_GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 149, 1))

;Set Edit Sel
_GUICtrlComboBoxEx_SetEditSel ($hCombo, 0, 4)

Sleep(500)

; Replace Edit Sel
_GUICtrlComboBoxEx_ReplaceEditSel ($hCombo, "Replaced")

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_ResetContent

Function Reference

_GUICtrlComboBoxEx_ResetContent

Removes all items

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_ResetContent($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

None.

Related

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Reset Content", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), Random(0, 8, 1), Random(0, 8, 1), Random(0, 8, 1))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Reset Content
MsgBox(4160, "Information", "Reset Content")
_GUICtrlComboBoxEx_ResetContent ($hCombo)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetCurSel

Function Reference

_GUICtrlComboBoxEx_SetCurSel

Select a string in the list of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetCurSel($hWnd[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$iIndex | [optional] Specifies the zero-based index of the string to select

Return Value

Success: | True
Failure: | False

Remarks

If $iIndex is –1, any current selection in the list is removed and the edit control is cleared.

If $iIndex is greater than the number of items in the list or if $iIndex is –1, the return value
is -1 and the selection is cleared.

Related

_GUICtrlComboBoxEx_GetCurSel

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Cur Sel", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 100, 200)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 99
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", $x), Random(0, 8, 1), Random(0, 8, 1), Random(0, 8, 1))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Set Cur Sel
_GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 99, 1))

; Get Cur Sel
MsgBox(4160, "Information", "Current Sel: " & _GUICtrlComboBoxEx_GetCurSel ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetDroppedWidth

Function Reference

_GUICtrlComboBoxEx_SetDroppedWidth

Set the maximum allowable width, in pixels, of the ListBox of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetDroppedWidth($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | The width of the ListBox, in pixels

Return Value

Success: The new width of the ListBox
Failure: -1

Remarks

By default, the minimum allowable width of the drop-down ListBox is zero.
The width of the ListBox is either the minimum allowable width or the ComboBox width, whichever is larger.

Use $CBS_DROPDOWN or $CBS_DROPDOWNLIST style.

Related

_GUICtrlComboBoxEx_GetDroppedWidth

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Dropped Width", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; get dropped width
MemoWrite("Dropped Width......: " & _GUICtrlComboBoxEx_GetDroppedWidth ($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; set Dropped Width
_GUICtrlComboBoxEx_SetDroppedWidth ($hCombo, 500)

Sleep(500)

; get dropped width
MemoWrite("Dropped Width......: " & _GUICtrlComboBoxEx_GetDroppedWidth ($hCombo))

Sleep(500)

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_SetEditSel

Function Reference

_GUICtrlComboBoxEx_SetEditSel

Select characters in the edit control of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetEditSel($hWnd, $iStart, $iStop)

Parameters

$hWnd | Handle to control
$iStart | Starting position
$iStop | Ending postions

Return Value

Success: True
Failure: False If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style

Remarks

The positions are zero-based. The first character of the edit control is in the zero position.
If $iStop is –1, all text from the starting position to the last character in the edit control is selected.

The first character after the last selected character is in the ending position.

For example, to select the first four characters of the edit control, use a starting position
of 0 and an ending position of 4.

Related

_GUICtrlComboBox_GetEditSel, _GUICtrlComboBoxEx_GetEditSel

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $aSel, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Edit Sel", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 70, BitOR($CBS_SIMPLE, $WS_VSCROLL, $WS_BORDER))
$iMemo = GUICtrlCreateEdit("", 2, 72, 396, 226, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

; Add strings
For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Cur Sel
_GUICtrlComboBoxEx_SetCurSel ($hCombo, Random(0, 8, 1))

;Set Edit Sel
_GUICtrlComboBoxEx_SetEditSel ($hCombo, 0, 4)

;Get Edit Sel
$aSel = _GUICtrlComboBoxEx_GetEditSel ($hCombo)
MemoWrite(StringFormat("Selected: [%d][%d]", $aSel[0], $aSel[1]))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_SetEditText

Function Reference

_GUICtrlComboBoxEx_SetEditText

Set the text of the edit control of the ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetEditText($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | Text to be set

Return Value

None.

Remarks

If the message is sent to a ComboBox with the $CBS_DROPDOWN or $CBS_DROPDOWNLIST style the Function will fail.

Related

_GUICtrlComboBox_GetEditText, _GUICtrlComboBoxEx_GetEditText, _GUICtrlComboBoxEx_ReplaceEditSel

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Edit Text", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Set Edit Text
_GUICtrlComboBoxEx_SetEditText ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))

;Get Edit Text
MsgBox(4160, "Information", "Edit Text: " & _GUICtrlComboBoxEx_GetEditText ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetExtendedStyle

Function Reference

_GUICtrlComboBoxEx_SetExtendedStyle

Sets extended styles within a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetExtendedStyle($hWnd, $iExStyle[, $iExMask = 0])

Parameters

$hWnd | Handle to the control
$iExStyle | Extended control styles: $CBES_EX_CASESENSITIVE - Searches in the list will be case sensitive $CBES_EX_NOEDITIMAGE - The edit box and the dropdown list will not display item images $CBES_EX_NOEDITIMAGEINDENT - The edit box and the dropdown list will not display item images $CBES_EX_NOSIZELIMIT - Allows the ComboBoxEx control to be vertically sized smaller than its contained combo box control $CBES_EX_PATHWORDBREAKPROC - Microsoft Windows NT only. The edit box will use the slash (/), backslash (\), and period (.) characters as word delimiters
$iExMask | [optional] Specifies which styles in $iExStyle are to be affected. This parameter can be a combination of extended styles. Only the extended styles in $iExMask will be changed. All other styles will be maintained as they are. If this parameter is zero, all of the styles in $iExStyle will be affected.

Return Value

Success: The previous extended styles

Remarks

None.

Related

_GUICtrlComboBoxEx_GetExtendedStyle

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Extended Style", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
;Set Extended Style
_GUICtrlComboBoxEx_SetExtendedStyle ($hCombo, $CBES_EX_CASESENSITIVE)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Get Extended Style
MsgBox(4160, "Information", "Extend Styles found: " & _DisplayExtendStringList($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func _DisplayExtendStringList($hCombo)
Local $Styles = @LF & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_CASESENSITIVE) = $CBES_EX_CASESENSITIVE) Then $Styles &= "$CBES_EX_CASESENSITIVE" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOEDITIMAGE) = $CBES_EX_NOEDITIMAGE) Then $Styles &= "$CBES_EX_NOEDITIMAGE" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOEDITIMAGEINDENT) = $CBES_EX_NOEDITIMAGEINDENT) Then $Styles &= "$CBES_EX_NOEDITIMAGEINDENT" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_NOSIZELIMIT) = $CBES_EX_NOSIZELIMIT) Then $Styles &= "$CBES_EX_NOSIZELIMIT" & @LF & @TAB
If (BitAND(_GUICtrlComboBoxEx_GetExtendedStyle ($hCombo), $CBES_EX_PATHWORDBREAKPROC) = $CBES_EX_PATHWORDBREAKPROC) Then $Styles &= "$CBES_EX_PATHWORDBREAKPROC"
Return $Styles
EndFunc ;==>_DisplayExtendStringList


Function _GUICtrlComboBoxEx_SetExtendedUI

Function Reference

_GUICtrlComboBoxEx_SetExtendedUI

Select either the default user interface or the extended user interface

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetExtendedUI($hWnd[, $fExtended = False])

Parameters

$hWnd | Handle to control
$fExtended | [optional] Specifies whether the combo box uses the extended

Return Value

Success: | True
Failure: | False

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection.

In a ComboBox with the extended user interface, the F4 key is disabled and pressing the DOWN ARROW
key opens the drop-down list

Related

_GUICtrlComboBoxEx_GetExtendedUI

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Extended UI", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBoxEx_GetExtendedUI ($hCombo))

; Set Extended UI
_GUICtrlComboBoxEx_SetExtendedUI ($hCombo, True)

; Get Extended UI
MemoWrite("Extended UI: " & _GUICtrlComboBoxEx_GetExtendedUI ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_SetImageList

Function Reference

_GUICtrlComboBoxEx_SetImageList

Sets an image list for a ComboBoxEx control

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetImageList($hWnd, $hHandle)

Parameters

$hWnd | Handle to the control
$hHandle | A handle to the image list to be set for the control

Return Value

Success: handle to the image list previously associated with the control,
or returns NULL if no image list was previously set

Remarks

None.

Related

_GUICtrlComboBoxEx_GetImageList

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Image List", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
;Set Image List
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

;Get Image List
MemoWrite("ImageList Handle: " & _GUICtrlComboBoxEx_GetImageList($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_SetItem

Function Reference

_GUICtrlComboBoxEx_SetItem

Sets some or all of a item's attributes

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItem($hWnd, $sText[, $iIndex = 0[, $iImage = -1[, $iSelectedImage = -1[, $iOverlayImage = -1[, $iIndent = -1[, $iParam = -1]]]]]])

Parameters

$hWnd | Handle to the control
$sText | Item text
$iIndex | [optional] The zero-based index of the item
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelectedImage | [optional] Zero based index of the item's icon in the control's image list
$iOverlayImage | [optional] Zero based index of the item's icon in the control's image list
$iIndent | [optional] Number of image widths to indent the item. A single indentation equals the width of an image.
$iParam | [optional] Value specific to the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItem, _GUICtrlComboBoxEx_SetItemEx

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $iImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$iImage = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $iImage, $iImage)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Change item 2
MsgBox(4160, "Information", "Changing item 2")
_GUICtrlComboBoxEx_SetItem ($hCombo, "New Item 2", 1)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemEx

Function Reference

_GUICtrlComboBoxEx_SetItemEx

Sets some or all of a item's attributes

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemEx($hWnd, ByRef $tItem)

Parameters

$hWnd | Handle to the control
$tItem | $tagCOMBOBOXEXITEM structure

Return Value

Success: True
Failure: False

Remarks

To set the attributes of an item set the Item member of the $tagCOMBOBOXEXITEM structure to the index of the item.
For an item, you can set the Image, SelectedImage, OverlayImage, Ident, and Param members of the
$tagCOMBOBOXEXITEM structure.

Related

_GUICtrlComboBoxEx_GetItemEx, _GUICtrlComboBoxEx_SetItem, $tagCOMBOBOXEXITEM

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $iImage, $tItem, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set ItemEx", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$iImage = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $iImage, $iImage)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

; Change item 2
MsgBox(4160, "Information", "Changing item 2")
$tItem = DllStructCreate($tagCOMBOBOXEXITEM)
DllStructSetData($tItem, "Mask", $CBEIF_INDENT)
DllStructSetData($tItem, "Item", 1)
DllStructSetData($tItem, "Indent", 2)

_GUICtrlComboBoxEx_SetItemEx ($hCombo, $tItem)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemHeight

Function Reference

_GUICtrlComboBoxEx_SetItemHeight

Set the height of list items or the selection field in a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemHeight($hWnd, $iComponent, $iHeight)

Parameters

$hWnd | Handle to control
$iComponent | Use the following values: –1 - Set the height of the selection field 0 - Set the height of list items
$iHeight | The height, in pixels, of the combo box component identified by $iComponent

Return Value

Failure: If height is invalid, the return value is -1.

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemHeight

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Height", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

MemoWrite("Set Item Height: " & _GUICtrlComboBoxEx_SetItemHeight ($hCombo, -1, 18))
MemoWrite("Item Height: " & _GUICtrlComboBoxEx_GetItemHeight ($hCombo, -1))
MemoWrite("Set Item Height: " & _GUICtrlComboBoxEx_SetItemHeight ($hCombo, 0, 20))
MemoWrite("Item Height: " & _GUICtrlComboBoxEx_GetItemHeight ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlComboBoxEx_SetItemImage

Function Reference

_GUICtrlComboBoxEx_SetItemImage

Sets the index of the item's icon in the control's image list

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iImage | Zero based index into the control's image list

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 2)
MsgBox(4160, "Information", "Item Image: " & _GUICtrlComboBoxEx_GetItemImage ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemIndent

Function Reference

_GUICtrlComboBoxEx_SetItemIndent

Sets the number of image widths to indent the item

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemIndent($hWnd, $iIndex, $iIndent)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iIndent | Indention value

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemIndent

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Indent", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
MsgBox(4160, "Information", "Item Indent: " & _GUICtrlComboBoxEx_GetItemIndent ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemOverlayImage

Function Reference

_GUICtrlComboBoxEx_SetItemOverlayImage

Sets the index of the item's overlay icon in the control's image list

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemOverlayImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iImage | Zero based index into the control's image list

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemOverlayImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Overlay Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemOverlayImage ($hCombo, 2, 6)
MsgBox(4160, "Information", "Item Overlay Image: " & _GUICtrlComboBoxEx_GetItemOverlayImage ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemParam

Function Reference

_GUICtrlComboBoxEx_SetItemParam

Sets the value specific to the item

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemParam($hWnd, $iIndex, $iParam)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iParam | Item specific value

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemParam

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Param", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemParam ($hCombo, 2, 54321)
MsgBox(4160, "Information", "Item Param: " & _GUICtrlComboBoxEx_GetItemParam ($hCombo, 2))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetItemSelectedImage

Function Reference

_GUICtrlComboBoxEx_SetItemSelectedImage

Sets the index of the item's overlay icon in the control's image list

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetItemSelectedImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iImage | Zero based index into the control's image list

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetItemSelectedImage

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $image, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Item Selected Image", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_BeginUpdate ($hCombo)
For $x = 0 To 149
$image = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $image, $image)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

_GUICtrlComboBoxEx_SetItemImage ($hCombo, 0, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)
_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 2, 1)
_GUICtrlComboBoxEx_SetItemSelectedImage ($hCombo, 0, 3)
MsgBox(4160, "Information", "Item Selected Image: " & _GUICtrlComboBoxEx_GetItemSelectedImage ($hCombo, 0))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetMinVisible

Function Reference

_GUICtrlComboBoxEx_SetMinVisible

Set the minimum number of visible items in the drop-down list of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetMinVisible($hWnd, $iMinimum)

Parameters

$hWnd | Handle to control
$iMinimum | Specifies the minimum number of visible items

Return Value

Success: True
Failure: False

Remarks

When the number of items in the drop-down list is greater than the minimum,
the Combobbox uses a scrollbar. By default, 30 is the minimum number of visible items.

This message is ignored if the combo box control has style $CBS_NOINTEGRALHEIGHT.

Related

_GUICtrlComboBoxEx_GetMinVisible

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $iImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Min Visible", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)

For $x = 0 To 149
$iImage = Random(0, 8, 1)
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $iImage, $iImage)
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

MsgBox(4160, "Information", "Min Vis.: " & _GUICtrlComboBoxEx_GetMinVisible ($hCombo))
MsgBox(4160, "Information", "Set Min Vis: " & _GUICtrlComboBoxEx_SetMinVisible ($hCombo, 50))
MsgBox(4160, "Information", "Min Vis.: " & _GUICtrlComboBoxEx_GetMinVisible ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetTopIndex

Function Reference

_GUICtrlComboBoxEx_SetTopIndex

Ensure that a particular item is visible in the ListBox of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetTopIndex($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero-based index of the list item

Return Value

Success: True
Failure: False

Remarks

The system scrolls the ListBox contents so that either the specified item appears at the top
of the list box or the maximum scroll range has been reached.

Related

_GUICtrlComboBoxEx_GetTopIndex

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Set Top Index", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

_GUICtrlComboBoxEx_InitStorage ($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate ($hCombo)

For $x = 0 To 149
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate ($hCombo)

;Set Top Index
MsgBox(4160, "Information", "Set Top Index: " & _GUICtrlComboBoxEx_SetTopIndex ($hCombo, Random(50, 149, 1)))
MsgBox(4160, "Information", "Top Index: " & _GUICtrlComboBoxEx_GetTopIndex ($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_SetUnicode

Function Reference

_GUICtrlComboBoxEx_SetUnicode

Sets if control is using Unicode

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetUnicode($hWnd[, $fUnicode = True])

Parameters

$hWnd | Handle to control
$fUnicode | [optional] May be one of the following True - Turn on Unicode False - Turn off Unicode

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlComboBoxEx_GetUnicode

Example

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Get/Set Unicode", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()

_GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate($hCombo)

For $x = 0 To 149
_GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate($hCombo)

;Set/Get Unicode
MsgBox(4160, "Information", "Set Unicode: " & _GUICtrlComboBoxEx_SetUnicode($hCombo, False))
MsgBox(4160, "Information", "Get Unicode: " & _GUICtrlComboBoxEx_GetUnicode($hCombo))

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlComboBoxEx_ShowDropDown

Function Reference

_GUICtrlComboBoxEx_ShowDropDown

Show or hide the ListBox of a ComboBox

#Include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_ShowDropDown($hWnd[, $fShow = False])

Parameters

$hWnd | Handle to control
$fShow | [optional] Specifies whether the drop-down ListBox is to be shown or hidden: True - Show ListBox False - Hide ListBox

Return Value

None.

Remarks

This function has no effect on a ComboBox created with the $CBS_SIMPLE style.

Related

_GUICtrlComboBoxEx_GetDroppedState

Example

#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hCombo

; Create GUI
$hGUI = GUICreate("ComboBoxEx Show Drop Down", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
GUISetState()

$hImage = _GUIImageList_Create (16, 16, 5, 3)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

For $x = 0 To 8
_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
Next

; show drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo, True)

Sleep(500)

; hide drop down
_GUICtrlComboBoxEx_ShowDropDown ($hCombo)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiDateTimePicker user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiDateTimePicker.au3>.

User Defined Function | Description
_GUICtrlDTP_Create | Create a DTP control
_GUICtrlDTP_Destroy | Delete the control
_GUICtrlDTP_GetMCColor | Retrieves the specified color
_GUICtrlDTP_GetMCFont | Retrieves the month calendar font handle
_GUICtrlDTP_GetMonthCal | Retrieves the handle to child month calendar control
_GUICtrlDTP_GetRange | Retrieves the current minimum and maximum allowable system times
_GUICtrlDTP_GetRangeEx | Retrieves the current minimum and maximum allowable system times
_GUICtrlDTP_GetSystemTime | Retrieves the currently selected date and time
_GUICtrlDTP_GetSystemTimeEx | Retrieves the currently selected date and time
_GUICtrlDTP_SetFormat | Sets the display based on a given format string
_GUICtrlDTP_SetMCColor | Sets the color for a given portion of the month calendar
_GUICtrlDTP_SetMCFont | Sets the month calendar font
_GUICtrlDTP_SetRange | Sets the current minimum and maximum allowable system times
_GUICtrlDTP_SetRangeEx | Sets the current minimum and maximum allowable system times
_GUICtrlDTP_SetSystemTime | Sets the currently selected date and time
_GUICtrlDTP_SetSystemTimeEx | Sets the currently selected date and time


Function _GUICtrlDTP_Create

Function Reference

_GUICtrlDTP_Create

Create a DTP control

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_Create($hWnd, $iX, $iY[, $iWidth = 120[, $iHeight = 21[, $iStyle = 0x00000000[, $iExStyle = 0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control styles: $DTS_APPCANPARSE - Allows the owner to parse user input and take action $DTS_LONGDATEFORMAT - Displays the date in long format $DTS_RIGHTALIGN - The calendar will be right-aligned $DTS_SHOWNONE - Displays a check box that can be checked once a date is entered $DTS_SHORTDATEFORMAT - Displays the date in short format $DTS_SHORTDATECENTURYFORMAT - The year is a four-digit field $DTS_TIMEFORMAT - Displays the time $DTS_UPDOWN - Places an up-down control to the right of the control
 | Forced: $WS_CHILD, $WS_VISIBLE
$iExStyle | [optional] Control external styles

Return Value

Success: | Handle to the DTP control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlDTP_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $hDTP

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(UDF Created) DateTimePick Create", 400, 300)
$hDTP = _GUICtrlDTP_Create($hGUI, 2, 6, 190)
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $tBuffer, $tBuffer2

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hDTP
Switch $iCode
Case $DTN_CLOSEUP ; Sent by a date and time picker (DTP) control when the user closes the drop-down month calendar
_DebugPrint("$DTN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; The return value for this notification is not used
Case $DTN_DATETIMECHANGE ; Sent by a date and time picker (DTP) control whenever a change occurs
$tInfo = DllStructCreate($tagNMDATETIMECHANGE, $ilParam)
_DebugPrint("$DTN_DATETIMECHANGE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Flag:" & @TAB & DllStructGetData($tInfo, "Flag") & @LF & _
"-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @LF & _
"-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @LF & _
"-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @LF & _
"-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @LF & _
"-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @LF & _
"-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @LF & _
"-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @LF & _
"-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond"))
Return 0
Case $DTN_DROPDOWN ; Sent by a date and time picker (DTP) control when the user activates the drop-down month calendar
_DebugPrint("$DTN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; The return value for this notification is not used
Case $DTN_FORMAT ; Sent by a date and time picker (DTP) control to request text to be displayed in a callback field
$tInfo = DllStructCreate($tagNMDATETIMEFORMAT, $ilParam)
$tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format"))
$tBuffer2 = DllStructCreate("char Display[64]", DllStructGetData($tInfo, "pDisplay"))
_DebugPrint("$DTN_FORMAT" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @LF & _
"-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @LF & _
"-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @LF & _
"-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @LF & _
"-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @LF & _
"-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @LF & _
"-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @LF & _
"-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @LF & _
"-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @LF & _
"-->Display:" & @TAB & DllStructGetData($tBuffer2, "Display"))
Return 0
Case $DTN_FORMATQUERY ; Sent by a date and time picker (DTP) control to retrieve the maximum allowable size of the string that will be displayed in a callback field
$tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $ilParam)
$tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format"))
_DebugPrint("$DTN_FORMATQUERY" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @LF & _
"-->SizeX:" & @TAB & DllStructGetData($tInfo, "SizeX") & @LF & _
"-->SizeY:" & @TAB & DllStructGetData($tBuffer2, "SizeY"))
DllStructSetData($tInfo, "SizeX", 64)
DllStructSetData($tInfo, "SizeY", 10)
Return 0
Case $DTN_USERSTRING ; Sent by a date and time picker (DTP) control when a user finishes editing a string in the control
$tInfo = DllStructCreate($tagNMDATETIMESTRING, $ilParam)
$tBuffer = DllStructCreate("char UserString[128]", DllStructGetData($tInfo, "UserString"))
_DebugPrint("$DTN_USERSTRING" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->UserString:" & @TAB & DllStructGetData($tBuffer, "UserString") & @LF & _
"-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @LF & _
"-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @LF & _
"-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @LF & _
"-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @LF & _
"-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @LF & _
"-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @LF & _
"-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @LF & _
"-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
Return 0
Case $DTN_WMKEYDOWN ; Sent by a date and time picker (DTP) control when the user types in a callback field
$tInfo = DllStructCreate($tagNMDATETIMEFORMATQUERY, $ilParam)
$tBuffer = DllStructCreate("char Format[128]", DllStructGetData($tInfo, "Format"))
_DebugPrint("$DTN_WMKEYDOWN" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->VirtKey:" & @TAB & DllStructGetData($tInfo, "VirtKey") & @LF & _
"-->Format:" & @TAB & DllStructGetData($tBuffer, "Format") & @LF & _
"-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @LF & _
"-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @LF & _
"-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @LF & _
"-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @LF & _
"-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @LF & _
"-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @LF & _
"-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @LF & _
"-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond"))
Return 0
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlDTP_Destroy

Function Reference

_GUICtrlDTP_Destroy

Delete the control

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Date Time Picker create with _GUICtrlDTP_Create

Related

_GUICtrlDTP_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $HandleBefore, $hDTP

; Create GUI
$hGUI = GUICreate("(UDF Created) DateTimePick Destroy", 400, 300)
$hDTP = _GUICtrlDTP_Create($hGUI, 2, 6, 190)
GUISetState()

MsgBox(4160, "Information", "Destroying the Control for Handle: " & $hDTP)
$HandleBefore = $hDTP
MsgBox(4160, "Information", "Control Destroyed: " & _GUICtrlDTP_Destroy($hDTP) & @LF & _
"Handel Before Destroy: " & $HandleBefore & @LF & _
"Handle After Destroy: " & $hDTP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlDTP_GetMCColor

Function Reference

_GUICtrlDTP_GetMCColor

Retrieves the specified color

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetMCColor($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Indicates which month calendar color to retrieve: 0 - Background color displayed between months 1 - Color used to display text within a month 2 - Background color displayed in the calendar title 3 - Color used to display text within the calendar title 4 - Background color displayed within the month 5 - Color used to display header day and trailing day text

Return Value

Success: The color setting for the specified portion of the control
Failure: -1

Remarks

None.

Related

_GUICtrlDTP_SetMCColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main() ;use autoit built-in control

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Get Month Calendar Color", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set month calendar background color
_GUICtrlDTP_SetMCColor($hDTP, 2, $CLR_MONEYGREEN)

; Get DTP colors
MemoWrite("Background between months: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 0), 6))
MemoWrite("Text within months ......: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 1), 6))
MemoWrite("Title background ........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 2), 6))
MemoWrite("Title text ..............: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 3), 6))
MemoWrite("Background within months : " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 4), 6))
MemoWrite("Header trailing .........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 5), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_GetMCFont

Function Reference

_GUICtrlDTP_GetMCFont

Retrieves the month calendar font handle

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetMCFont($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Font handle
Failure: 0

Remarks

None.

Related

_GUICtrlDTP_SetMCFont

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tLOGFONT, $hFont, $hDTP

; Create GUI
GUICreate("DateTimePick Get Month Calendar Font", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Create a new font for the month control
$tLOGFONT = DllStructCreate($tagLOGFONT)
DllStructSetData($tLOGFONT, "Height", 13)
DllStructSetData($tLOGFONT, "Weight", 400)
DllStructSetData($tLOGFONT, "FaceName", "Verdana")
$hFont = _WinAPI_CreateFontIndirect($tLOGFONT)
_GUICtrlDTP_SetMCFont($hDTP, $hFont)

; Get month control font handle
GUICtrlSetData($iMemo, "Font Handle: " & "0x" & Hex(_GUICtrlDTP_GetMCFont($hDTP), 6) & @CRLF, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_GetMonthCal

Function Reference

_GUICtrlDTP_GetMonthCal

Retrieves the handle to child month calendar control

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetMonthCal($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Month calendar handle
Failure: 0

Remarks

DTP controls create a child month calendar control when the user clicks the drop down arrow ($DTN_DROPDOWN
notification). When the month calendar is no longer needed, it is destroyed (a $DTN_CLOSEUP notification is
sent on destruction). So your application must not rely on a static handle to the DTP control's child month
calendar.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Get Month Calendar Child Handle", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlDTP_GetRange

Function Reference

_GUICtrlDTP_GetRange

Retrieves the current minimum and maximum allowable system times

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetRange($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns an array with the following format:
[ 0] - True if Min data is valid, otherwise False
[ 1] - Min Year
[ 2] - Min Month
[ 3] - Min Day
[ 4] - Min Hour
[ 5] - Min Minute
[ 6] - Min Second
[ 7] - True if Max data is valid, otherwise False
[ 8] - Max Year
[ 9] - Max Month
[10] - Max Day
[11] - Max Hour
[12] - Max Minute
[13] - Max Second

Remarks

None.

Related

_GUICtrlDTP_SetRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $aRange[14] = [True, @YEAR, 1, 1, 21, 45, 32, True, @YEAR, 12, 31, 23, 59, 59]

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Get Range", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set date range
_GUICtrlDTP_SetRange($hDTP, $aRange)

; Display date range
$aRange = _GUICtrlDTP_GetRange($hDTP)
MemoWrite("Minimum date: " & GetDateStr())
MemoWrite("Maximum date: " & GetDateStr(7))
MemoWrite("Minimum time: " & GetTimeStr(4))
MemoWrite("Maximum time: " & GetTimeStr(11))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr($iOff = 0)
Return StringFormat("%02d/%02d/%04d", $aRange[$iOff + 2], $aRange[$iOff + 3], $aRange[$iOff + 1])
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr($iOff = 0)
Return StringFormat("%02d:%02d:%02d", $aRange[$iOff], $aRange[$iOff + 1], $aRange[$iOff + 2])
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_GetRangeEx

Function Reference

_GUICtrlDTP_GetRangeEx

Retrieves the current minimum and maximum allowable system times

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetRangeEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagDTPRANGE structure
Failure: 0

Remarks

None.

Related

_GUICtrlDTP_SetRangeEx, $tagDTPRANGE

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tRange

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Get RangeEx", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set date range
$tRange = DllStructCreate($tagDTPRANGE)
DllStructSetData($tRange, "MinValid", True)
DllStructSetData($tRange, "MinYear", @YEAR)
DllStructSetData($tRange, "MinMonth", 1)
DllStructSetData($tRange, "MinDay", 1)
DllStructSetData($tRange, "MinHour", 0)
DllStructSetData($tRange, "MinMinute", 0)
DllStructSetData($tRange, "MinSecond", 1)
DllStructSetData($tRange, "MaxValid", True)
DllStructSetData($tRange, "MaxYear", @YEAR)
DllStructSetData($tRange, "MaxMonth", 12)
DllStructSetData($tRange, "MaxDay", 31)
DllStructSetData($tRange, "MaxHour", 12)
DllStructSetData($tRange, "MaxMinute", 59)
DllStructSetData($tRange, "MaxSecond", 59)
_GUICtrlDTP_SetRangeEx($hDTP, $tRange)

; Display date range
$tRange = _GUICtrlDTP_GetRangeEx($hDTP)
MemoWrite("Minimum date: " & GetDateStr("Min"))
MemoWrite("Maximum date: " & GetDateStr("Max"))
MemoWrite("Minimum time: " & GetTimeStr("Min"))
MemoWrite("Maximum time: " & GetTimeStr("Max"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr($sPrefix)
If $sPrefix = "Min" Then
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), DllStructGetData($tRange, "MinDay"), DllStructGetData($tRange, "MinYear"))
Else
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), DllStructGetData($tRange, "MaxDay"), DllStructGetData($tRange, "MaxYear"))
EndIf
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr($sPrefix)
If $sPrefix = "Min" Then
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tRange, "MinHour"), DllStructGetData($tRange, "MinMinute"), DllStructGetData($tRange, "MinSecond"))
Else
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tRange, "MaxHour"), DllStructGetData($tRange, "MaxMinute"), DllStructGetData($tRange, "MaxSecond"))
EndIf
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_GetSystemTime

Function Reference

_GUICtrlDTP_GetSystemTime

Retrieves the currently selected date and time

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetSystemTime($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns an array with the following format:
[0] - Year
[1] - Month
[2] - Day
[3] - Hour
[4] - Minute
[5] - Second

Remarks

@Error is set to $GDT_VALID if the time information was successfully returned, $GDT_NONE if the control was
set to the $DTS_SHOWNONE style and the control check box was not selected or $GDT_ERROR if an error occured.

Related

_GUICtrlDTP_SetSystemTime, _GUICtrlDTP_GetSystemTimeEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tRange, $aDate

_Main()

Func _Main()
Local $hDTP, $a_Date[7] = [False, @YEAR, 8, 19, 21, 57, 34]

; Create GUI
GUICreate("DateTimePick Get System Time", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set system time
_GUICtrlDTP_SetSystemTime($hDTP, $a_Date)

; Display system time
$aDate = _GUICtrlDTP_GetSystemTime($hDTP)
MemoWrite("Current date: " & GetDateStr())
MemoWrite("Current time: " & GetTimeStr())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr()
Return StringFormat("%02d/%02d/%04d", $aDate[1], $aDate[2], $aDate[0])
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr()
Return StringFormat("%02d:%02d:%02d", $aDate[3], $aDate[4], $aDate[5])
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_GetSystemTimeEx

Function Reference

_GUICtrlDTP_GetSystemTimeEx

Retrieves the currently selected date and time

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetSystemTimeEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagSYSTEMTIME structure

Remarks

@Error is set to $GDT_VALID if the time information was successfully returned, $GDT_NONE if the control was
set to the $DTS_SHOWNONE style and the control check box was not selected or $GDT_ERROR if an error occured.

Related

_GUICtrlDTP_GetSystemTime, _GUICtrlDTP_SetSystemTimeEx, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tDate

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Get System TimeEx", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set system time
$tDate = DllStructCreate($tagSYSTEMTIME)
DllStructSetData($tDate, "Year", @YEAR)
DllStructSetData($tDate, "Month", 8)
DllStructSetData($tDate, "Day", 19)
DllStructSetData($tDate, "Hour", 21)
DllStructSetData($tDate, "Minute", 57)
DllStructSetData($tDate, "Second", 34)
_GUICtrlDTP_SetSystemTimeEx($hDTP, $tDate)

; Display system time
$tDate = _GUICtrlDTP_GetSystemTimeEx($hDTP)
MemoWrite("Current date: " & GetDateStr())
MemoWrite("Current time: " & GetTimeStr())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr()
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tDate, "Month"), DllStructGetData($tDate, "Day"), DllStructGetData($tDate, "Year"))
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr()
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tDate, "Hour"), DllStructGetData($tDate, "Minute"), DllStructGetData($tDate, "Second"))
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetFormat

Function Reference

_GUICtrlDTP_SetFormat

Sets the display based on a given format string

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetFormat($hWnd, $sFormat)

Parameters

$hWnd | Handle to the control
$sFormat | String that defines the desired format. Setting this to blank will reset the control to the default format string for the current style. You can use the following format strings: "d" - The one or two digit day "dd" - The two digit day. Single digit day values are preceded by a zero "ddd" - The three character weekday abbreviation "dddd" - The full weekday name "h" - The one or two digit hour in 12-hour format "hh" - The two digit hour in 12-hour format "H" - The one or twodigit hour in 24-hour format "HH" - The two digit hour in 24 hour format "m" - The one or two digit minute "mm" - The two digit minute "M" - The one or two digit month number "MM" - The two digit month number "MMM" - The three-character month abbreviation "MMMM" - The full month name "t" - The one letter AM/PM abbreviation "tt" - The two letter AM/PM abbreviation "yy" - The last two digits of the year "yyyy" - The full year

Return Value

Success: True
Failure: False

Remarks

It is acceptable to include extra characters within the format string to produce a more rich display. However,
any nonformat characters must be enclosed within single quotes. For example, the format string "'Today is:
'hh':'m':'s ddddMMMdd', 'yyy" would produce output like "Today is: 04:22:31 Tuesday Mar 23, 1996". Note: A DTP
control tracks locale changes when it is using the default format string. If you set a custom format string,
it will not be updated in response to locale changes.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Set Format", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))

GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlDTP_SetMCColor

Function Reference

_GUICtrlDTP_SetMCColor

Sets the color for a given portion of the month calendar

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetMCColor($hWnd, $iIndex, $iColor)

Parameters

$hWnd | Handle to the control
$iIndex | Indicates which month calendar color to set: 0 - Background color displayed between months 1 - Color used to display text within a month 2 - Background color displayed in the calendar title 3 - Color used to display text within the calendar title 4 - Background color displayed within the month 5 - Color used to display header day and trailing day text
$iColor | The color that will be set for the specified area

Return Value

Success: The previous color for the given portion
Failure: -1

Remarks

None.

Related

_GUICtrlDTP_GetMCColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Set Month Calendar Color", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set month calendar background color
_GUICtrlDTP_SetMCColor($hDTP, 2, $CLR_MONEYGREEN)

; Get DTP colors
MemoWrite("Background between months: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 0), 6))
MemoWrite("Text within months ......: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 1), 6))
MemoWrite("Title background ........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 2), 6))
MemoWrite("Title text ..............: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 3), 6))
MemoWrite("Background within months : " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 4), 6))
MemoWrite("Header trailing .........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 5), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetMCFont

Function Reference

_GUICtrlDTP_SetMCFont

Sets the month calendar font

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetMCFont($hWnd, $hFont[, $fRedraw = True])

Parameters

$hWnd | Handle to the control
$hFont | Handle to the font that will be set
$fRedraw | [optional] Specifies whether the control should be redrawn immediately

Return Value

None.

Remarks

None.

Related

_GUICtrlDTP_GetMCFont

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tLOGFONT, $hFont, $hDTP

; Create GUI
GUICreate("DateTimePick Set Month Calendar Font", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Create a new font for the month control
$tLOGFONT = DllStructCreate($tagLOGFONT)
DllStructSetData($tLOGFONT, "Height", 13)
DllStructSetData($tLOGFONT, "Weight", 400)
DllStructSetData($tLOGFONT, "FaceName", "Verdana")
$hFont = _WinAPI_CreateFontIndirect($tLOGFONT)
_GUICtrlDTP_SetMCFont($hDTP, $hFont)

; Get month control font handle
GUICtrlSetData($iMemo, "Font Handle: " & "0x" & Hex(_GUICtrlDTP_GetMCFont($hDTP), 6) & @CRLF, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetRange

Function Reference

_GUICtrlDTP_SetRange

Sets the current minimum and maximum allowable system times

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetRange($hWnd, ByRef $aRange)

Parameters

$hWnd | Handle to the control
$aRange | Array formatted as follows: [ 0] - True if Min data is to be set, otherwise False [ 1] - Min Year [ 2] - Min Month [ 3] - Min Day [ 4] - Min Hour [ 5] - Min Minute [ 6] - Min Second [ 7] - True if Max data is to be set, otherwise False [ 8] - Max Year [ 9] - Max Month [10] - Max Day [11] - Max Hour [12] - Max Minute [13] - Max Second

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlDTP_GetRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $aRange[14] = [True, @YEAR, 1, 1, 21, 45, 32, True, @YEAR, 12, 31, 23, 59, 59]

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Set Range", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set date range
_GUICtrlDTP_SetRange($hDTP, $aRange)

; Display date range
$aRange = _GUICtrlDTP_GetRange($hDTP)
MemoWrite("Minimum date: " & GetDateStr(0))
MemoWrite("Maximum date: " & GetDateStr(7))
MemoWrite("Minimum time: " & GetTimeStr(4))
MemoWrite("Maximum time: " & GetTimeStr(11))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr($iOff = 0)
Return StringFormat("%02d/%02d/%04d", $aRange[$iOff + 2], $aRange[$iOff + 3], $aRange[$iOff + 1])
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr($iOff = 0)
Return StringFormat("%02d:%02d:%02d", $aRange[$iOff], $aRange[$iOff + 1], $aRange[$iOff + 2])
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetRangeEx

Function Reference

_GUICtrlDTP_SetRangeEx

Sets the current minimum and maximum allowable system times

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetRangeEx($hWnd, ByRef $tRange)

Parameters

$hWnd | Handle to the control
$tRange | $tagDTPRANGE structure

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlDTP_GetRangeEx, $tagDTPRANGE

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tRange

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Set RangeEx", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set date range
$tRange = DllStructCreate($tagDTPRANGE)
DllStructSetData($tRange, "MinValid", True)
DllStructSetData($tRange, "MinYear", @YEAR)
DllStructSetData($tRange, "MinMonth", 1)
DllStructSetData($tRange, "MinDay", 1)
DllStructSetData($tRange, "MaxValid", True)
DllStructSetData($tRange, "MaxYear", @YEAR)
DllStructSetData($tRange, "MaxMonth", 12)
DllStructSetData($tRange, "MaxDay", 31)
DllStructSetData($tRange, "MaxHour", 12)
DllStructSetData($tRange, "MaxMinute", 59)
DllStructSetData($tRange, "MaxSecond", 59)
_GUICtrlDTP_SetRangeEx($hDTP, $tRange)

; Display date range
$tRange = _GUICtrlDTP_GetRangeEx($hDTP)
MemoWrite("Minimum date: " & GetDateStr("Min"))
MemoWrite("Maximum date: " & GetDateStr("Max"))
MemoWrite("Minimum time: " & GetTimeStr("Min"))
MemoWrite("Maximum time: " & GetTimeStr("Max"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr($sPrefix)
If $sPrefix = "Min" Then
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), DllStructGetData($tRange, "MinDay"), DllStructGetData($tRange, "MinYear"))
Else
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), DllStructGetData($tRange, "MaxDay"), DllStructGetData($tRange, "MaxYear"))
EndIf
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr($sPrefix)
If $sPrefix = "Min" Then
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tRange, "MinHour"), DllStructGetData($tRange, "MinMinute"), DllStructGetData($tRange, "MinSecond"))
Else
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tRange, "MaxHour"), DllStructGetData($tRange, "MaxMinute"), DllStructGetData($tRange, "MaxSecond"))
EndIf
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetSystemTime

Function Reference

_GUICtrlDTP_SetSystemTime

Sets the currently selected date and time

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetSystemTime($hWnd, ByRef $aDate)

Parameters

$hWnd | Handle to the control
$aDate | Array formatted as follows: [0] - If True, the control will is set to "no date" [1] - Year [2] - Month [3] - Day [4] - Hour [5] - Minute [6] - Second

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlDTP_GetSystemTime

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tRange, $aDate

_Main()

Func _Main()
Local $hDTP, $a_Date[7] = [False, @YEAR, 8, 19, 21, 57, 34]

; Create GUI
GUICreate("DateTimePick Set System Time", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set system time
_GUICtrlDTP_SetSystemTime($hDTP, $a_Date)

; Display system time
$aDate = _GUICtrlDTP_GetSystemTime($hDTP)
MemoWrite("Current date: " & GetDateStr())
MemoWrite("Current time: " & GetTimeStr())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr()
Return StringFormat("%02d/%02d/%04d", $aDate[1], $aDate[2], $aDate[0])
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr()
Return StringFormat("%02d:%02d:%02d", $aDate[3], $aDate[4], $aDate[5])
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlDTP_SetSystemTimeEx

Function Reference

_GUICtrlDTP_SetSystemTimeEx

Sets the currently selected date and time

#Include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetSystemTimeEx($hWnd, ByRef $tDate[, $fFlag = False])

Parameters

$hWnd | Handle to the control
$tDate | $tagSYSTEMTIME structure
$fFlag | [optional] No date setting: True - Control will be set to "no date" False - Control is set to date and time value

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlDTP_GetSystemTimeEx, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiDateTimePicker.au3>

Opt('MustDeclareVars', 1)

$Debug_DTP = False ; Check ClassName being passed to DTP functions, set to True and use a handle to another control to see it work

Global $iMemo, $tDate

_Main()

Func _Main()
Local $hDTP

; Create GUI
GUICreate("DateTimePick Set System TimeEx", 400, 300)
$hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")

; Set system time
$tDate = DllStructCreate($tagSYSTEMTIME)
DllStructSetData($tDate, "Year", @YEAR)
DllStructSetData($tDate, "Month", 8)
DllStructSetData($tDate, "Day", 19)
DllStructSetData($tDate, "Hour", 21)
DllStructSetData($tDate, "Minute", 57)
DllStructSetData($tDate, "Second", 34)
_GUICtrlDTP_SetSystemTimeEx($hDTP, $tDate)

; Display system time
$tDate = _GUICtrlDTP_GetSystemTimeEx($hDTP)
MemoWrite("Current date: " & GetDateStr())
MemoWrite("Current time: " & GetTimeStr())

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Returns the date portion
Func GetDateStr()
Return StringFormat("%02d/%02d/%04d", DllStructGetData($tDate, "Month"), DllStructGetData($tDate, "Day"), DllStructGetData($tDate, "Year"))
EndFunc ;==>GetDateStr

; Returns the time portion
Func GetTimeStr()
Return StringFormat("%02d:%02d:%02d", DllStructGetData($tDate, "Hour"), DllStructGetData($tDate, "Minute"), DllStructGetData($tDate, "Second"))
EndFunc ;==>GetTimeStr

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

GuiEdit user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiEdit.au3>.

User Defined Function | Description
_GUICtrlEdit_AppendText | Append text
_GUICtrlEdit_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlEdit_CanUndo | Determines whether there are any actions in an edit control's undo queue
_GUICtrlEdit_CharFromPos | Retrieve information about the character closest to a specified point in the client area
_GUICtrlEdit_Create | Create a Edit control
_GUICtrlEdit_Destroy | Delete the Edit control
_GUICtrlEdit_EmptyUndoBuffer | Resets the undo flag of an edit control
_GUICtrlEdit_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlEdit_Find | Initiates a find dialog
_GUICtrlEdit_FmtLines | Determines whether a edit control includes soft line-break characters
_GUICtrlEdit_GetFirstVisibleLine | Retrieves the zero-based index of the uppermost visible line in a multiline edit control
_GUICtrlEdit_GetLimitText | Gets the current text limit for an edit control
_GUICtrlEdit_GetLine | Retrieves a line of text from an edit control
_GUICtrlEdit_GetLineCount | Retrieves the number of lines
_GUICtrlEdit_GetMargins | Retrieves the widths of the left and right margins
_GUICtrlEdit_GetModify | Retrieves the state of an edit control's modification flag
_GUICtrlEdit_GetPasswordChar | Gets the password character that an edit control displays when the user enters text
_GUICtrlEdit_GetRECT | Retrieves the formatting rectangle of an edit control
_GUICtrlEdit_GetRECTEx | Retrieves the formatting rectangle of an edit control
_GUICtrlEdit_GetSel | Retrieves the starting and ending character positions of the current selection
_GUICtrlEdit_GetText | Get the text from the edit control
_GUICtrlEdit_GetTextLen | Get the length of all the text from the edit control
_GUICtrlEdit_HideBalloonTip | Hides any balloon tip associated with an edit control
_GUICtrlEdit_InsertText | Insert text
_GUICtrlEdit_LineFromChar | Retrieves the index of the line that contains the specified character index
_GUICtrlEdit_LineIndex | Retrieves the character index of the first character of a specified line
_GUICtrlEdit_LineLength | Retrieves the length, in characters, of a line
_GUICtrlEdit_LineScroll | Scrolls the text
_GUICtrlEdit_PosFromChar | Retrieves the client area coordinates of a specified character in an edit control
_GUICtrlEdit_ReplaceSel | Replaces the current selection
_GUICtrlEdit_Scroll | Scrolls the text vertically
_GUICtrlEdit_SetLimitText | Sets the text limit
_GUICtrlEdit_SetMargins | Sets the widths of the left and right margins
_GUICtrlEdit_SetModify | Sets or clears the modification flag
_GUICtrlEdit_SetPasswordChar | Sets or removes the password character for an edit control
_GUICtrlEdit_SetReadOnly | Sets or removes the read-only style ($ES_READONLY)
_GUICtrlEdit_SetRECT | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRECTEx | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRECTNP | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetRectNPEx | Sets the formatting rectangle of a multiline edit control
_GUICtrlEdit_SetSel | Selects a range of characters
_GUICtrlEdit_SetTabStops | Sets the tab stops
_GUICtrlEdit_SetText | Set the text
_GUICtrlEdit_ShowBalloonTip | Displays a balloon tip associated with an edit control
_GUICtrlEdit_Undo | Undoes the last edit control operation in the control's undo queue


Function _GUICtrlEdit_AppendText

Function Reference

_GUICtrlEdit_AppendText

Append text

#Include <GuiEdit.au3>
_GUICtrlEdit_AppendText($hWnd, $sText)

Parameters

$hWnd | Handle to the control
$sText | String to append

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_SetText, _GUICtrlEdit_InsertText, _GUICtrlEdit_GetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Append Text", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_BeginUpdate

Function Reference

_GUICtrlEdit_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiEdit.au3>
_GUICtrlEdit_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlEdit_EndUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit, $StatusBar, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"

; Create GUI
$hGUI = GUICreate("Edit Begin Update", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, -1)
GUISetState()

_GUICtrlEdit_BeginUpdate($hEdit)
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
_GUICtrlEdit_EndUpdate($hEdit)

_GUICtrlStatusBar_SetIcon($StatusBar, 0, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, @TAB & "Lines: " & _GUICtrlEdit_GetLineCount($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_CanUndo

Function Reference

_GUICtrlEdit_CanUndo

Determines whether there are any actions in an edit control's undo queue

#Include <GuiEdit.au3>
_GUICtrlEdit_CanUndo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: If there are actions in the control's undo queue
False: If the undo queue is empty

Remarks

If the undo queue is not empty, you can call the _GUICtrlEdit_Undo to undo the most recent operation.

Related

_GUICtrlEdit_EmptyUndoBuffer, _GUICtrlEdit_GetModify, _GUICtrlEdit_SetModify, _GUICtrlEdit_Undo

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Can Undo", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

MsgBox(4160, "Information", "Can Undo: " & _GUICtrlEdit_CanUndo($hEdit))

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

MsgBox(4160, "Information", "Can Undo: " & _GUICtrlEdit_CanUndo($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_CharFromPos

Function Reference

_GUICtrlEdit_CharFromPos

Retrieve information about the character closest to a specified point in the client area

#Include <GuiEdit.au3>
_GUICtrlEdit_CharFromPos($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | horizontal position
$iY | vertical position

Return Value

Success: Array in the following format:
[0] - Zero-based index of the character nearest the specified point
[1] - Zero-based index of the line that contains the character

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aCharPos[2], $hEdit

; Create GUI
GUICreate("Edit Char From Pos", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

$aCharPos = _GUICtrlEdit_CharFromPos($hEdit, 100, 20)
MsgBox(4160, "Information", StringFormat("Char Nearsest Point: [%2d]", $aCharPos[0]) & @LF & _
StringFormat("Line Nearest Point: [%2d]", $aCharPos[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_Create

Function Reference

_GUICtrlEdit_Create

Create a Edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_Create($hWnd, $sText, $iX, $iY[, $iWidth = 150[, $iHeight = 150[, $iStyle = 0x003010C4[, $iExStyle = 0x00000200]]]])

Parameters

$hWnd | Handle to parent or owner window
$sText | Text to be displayed in the control
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control styles:
$ES_AUTOHSCROLL - Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line.
$ES_AUTOVSCROLL - Automatically scrolls text up one page when the user presses the ENTER key on the last line.
$ES_CENTER - Centers text in a edit control.
$ES_LEFT - Aligns text with the left margin.
$ES_LOWERCASE - Converts all characters to lowercase as they are typed into the edit control.
$ES_MULTILINE - Forced
$ES_NOHIDESEL - The selected text is inverted, even if the control does not have the focus.
$ES_NUMBER - Allows only digits to be entered into the edit control.
$ES_OEMCONVERT - Converts text entered in the edit control.
$ES_READONLY - Prevents the user from typing or editing text in the edit control.
$ES_RIGHT - Right-aligns text edit control.
$ES_UPPERCASE - Converts all characters to uppercase as they are typed into the edit control.
$ES_WANTRETURN - Specifies that a carriage return be inserted when the user presses the ENTER key.
$ES_PASSWORD - Displays an asterisk (*) for each character that is typed into the edit control
Default: $ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $WS_HSCROLL, $ES_AUTOVSCROLL, $ES_AUTOHSCROLL
Forced : WS_CHILD, $WS_VISIBLE, $WS_TABSTOP unless $ES_READONLY
$iExStyle | [optional] Control extended style. These correspond to the standard $WS_EX_ constants.

Return Value

Success: | Handle to the Edit control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlEdit_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <WinAPI.au3> ; used for Lo/Hi word
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

Global $hEdit

_Example1()
_Example2()

Func _Example1()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Edit Create", 400, 300)
$hEdit = _GUICtrlEdit_Create($hGUI, "This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Example1

Func _Example2()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Edit Create", 400, 300)
$hEdit = _GUICtrlEdit_Create($hGUI, "", 2, 2, 394, 268)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

_GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Example2

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit
If Not IsHWnd($hEdit) Then $hWndEdit = GUICtrlGetHandle($hEdit)
$hWndFrom = $ilParam
$iIDFrom = _WinAPI_LoWord($iwParam)
$iCode = _WinAPI_HiWord($iwParam)
Switch $hWndFrom
Case $hEdit, $hWndEdit
Switch $iCode
Case $EN_ALIGN_LTR_EC ; Sent when the user has changed the edit control direction to left-to-right
_DebugPrint("$EN_ALIGN_LTR_EC" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_ALIGN_RTL_EC ; Sent when the user has changed the edit control direction to right-to-left
_DebugPrint("$EN_ALIGN_RTL_EC" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_CHANGE ; Sent when the user has taken an action that may have altered text in an edit control
_DebugPrint("$EN_CHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_ERRSPACE ; Sent when an edit control cannot allocate enough memory to meet a specific request
_DebugPrint("$EN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_HSCROLL ; Sent when the user clicks an edit control's horizontal scroll bar
_DebugPrint("$EN_HSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_KILLFOCUS ; Sent when an edit control loses the keyboard focus
_DebugPrint("$EN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_MAXTEXT ; Sent when the current text insertion has exceeded the specified number of characters for the edit control
_DebugPrint("$EN_MAXTEXT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; This message is also sent when an edit control does not have the $ES_AUTOHSCROLL style and the number of characters to be
; inserted would exceed the width of the edit control.
; This message is also sent when an edit control does not have the $ES_AUTOVSCROLL style and the total number of lines resulting
; from a text insertion would exceed the height of the edit control

; no return value
Case $EN_SETFOCUS ; Sent when an edit control receives the keyboard focus
_DebugPrint("$EN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_UPDATE ; Sent when an edit control is about to redraw itself
_DebugPrint("$EN_UPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $EN_VSCROLL ; Sent when the user clicks an edit control's vertical scroll bar or when the user scrolls the mouse wheel over the edit control
_DebugPrint("$EN_VSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlEdit_Destroy

Function Reference

_GUICtrlEdit_Destroy

Delete the Edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Edit created with _GUICtrlEdit_Create

Related

_GUICtrlEdit_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hEdit

; Create GUI
$hGUI = GUICreate("Edit Destroy", 400, 300)
$hEdit = _GUICtrlEdit_Create($hGUI, "This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

MsgBox(4160, "Information", "Destroy Edit Control")
_GUICtrlEdit_Destroy($hEdit)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_EmptyUndoBuffer

Function Reference

_GUICtrlEdit_EmptyUndoBuffer

Resets the undo flag of an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_EmptyUndoBuffer($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

The undo flag is automatically reset whenever the edit control receives a _GUICtrlEdit_SetText

Related

_GUICtrlEdit_CanUndo, _GUICtrlEdit_Undo

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Empty Undo Buffer", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

MsgBox(4160, "Information", "Can Undo: " & _GUICtrlEdit_CanUndo($hEdit))

_GUICtrlEdit_EmptyUndoBuffer($hEdit)

MsgBox(4160, "Information", "Can Undo: " & _GUICtrlEdit_CanUndo($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_EndUpdate

Function Reference

_GUICtrlEdit_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiEdit.au3>
_GUICtrlEdit_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlEdit_BeginUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"

; Create GUI
$hGUI = GUICreate("Edit End Update", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, -1)
GUISetState()

_GUICtrlEdit_BeginUpdate($hEdit)
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
_GUICtrlEdit_EndUpdate($hEdit)

_GUICtrlStatusBar_SetIcon($StatusBar, 0, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, @TAB & "Lines: " & _GUICtrlEdit_GetLineCount($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_Find

Function Reference

_GUICtrlEdit_Find

Initiates a find dialog

#Include <GuiEdit.au3>
_GUICtrlEdit_Find($hWnd[, $fReplace = False])

Parameters

$hWnd | Handle to the control
$fReplace | [optional] Replace Option: True - Show option False - Hide option

Return Value

None.

Remarks

If you use text from the edit control and that text gets replaced the function will no
longer function correctly

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

Example_Internal()
Example_External()

Func Example_Internal()
Local $s_texttest = "this is a test" & @CRLF & _
"this is only a test" & @CRLF & _
"this testing should work for you as well as it does for me"
Local $Button1, $Button2, $msg, $hEdit

GUICreate('Find And Replace Example with AutoIt ' & FileGetVersion(@AutoItExe), 622, 448, 192, 125)
$hEdit = GUICtrlCreateEdit($s_texttest, 64, 24, 505, 233, _
BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE, $WS_HSCROLL, $ES_NOHIDESEL))
$Button1 = GUICtrlCreateButton("Find", 176, 288, 121, 33, 0)
$Button2 = GUICtrlCreateButton("Find And Replace", 368, 288, 121, 33, 0)
GUISetState()

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button1
_GUICtrlEdit_Find($hEdit)
Case $msg = $Button2
_GUICtrlEdit_Find($hEdit, True)
Case Else
;;;;;;;
EndSelect
WEnd
GUIDelete()
EndFunc ;==>Example_Internal

Func Example_External()
Local $s_texttest = 'Find And Replace Example with AutoIt ' & FileGetVersion(@AutoItExe) & @LF & _
"this is a test" & @LF & _
"this is only a test" & @LF & _
"this testing should work for you as well as it does for me"
Local $whandle, $handle
Local $Title = "[CLASS:Notepad]"

Run("notepad", "", @SW_MAXIMIZE)
;Wait for the window "Untitled" to exist
WinWait($Title)

; Get the handle of a notepad window
$whandle = WinGetHandle($Title)
If @error Then
MsgBox(4096, "Error", "Could not find the correct window")
Else
$handle = ControlGetHandle($whandle, "", "Edit1")
If @error Then
MsgBox(4096, "Error", "Could not find the correct control")
Else
; Send some text directly to this window's edit control
ControlSend($whandle, "", "Edit1", $s_texttest)
_GUICtrlEdit_Find($handle, True)
EndIf
EndIf
EndFunc ;==>Example_External


Function _GUICtrlEdit_FmtLines

Function Reference

_GUICtrlEdit_FmtLines

Determines whether a edit control includes soft line-break characters

#Include <GuiEdit.au3>
_GUICtrlEdit_FmtLines($hWnd[, $fSoftBreak = False])

Parameters

$hWnd | Handle to the control
$fSoftBreak | [optional] Specifies whether soft line-break characters are to be inserted: True - Inserts the characters False - Removes them

Return Value

Success: Identical to the $fSoftBreak parameter

Remarks

A soft line break consists of two carriage returns and a line feed and is inserted at the
end of a line that is broken because of wordwrapping.

This function affects only the text returned by the _GUICtrlEdit_GetText function.

It has no effect on the display of the text within the edit control.

The _GUICtrlEdit_FmtLines function does not affect a line that ends with a hard line break.
A hard line break consists of one carriage return and a line feed.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $sBefore, $sAfter

; Create GUI
GUICreate("Edit FmtLines", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
GUISetState()

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile, 500))

; Text retrieved in default format
$sBefore = _GUICtrlEdit_GetText($hEdit)

; insert soft line-breaks
_GUICtrlEdit_FmtLines($hEdit, True)

; Text with soft line breaks
$sAfter = _GUICtrlEdit_GetText($hEdit)

MsgBox(4096, "Information", "Before:" & @LF & @LF & $sBefore & @LF & _
'--------------------------------------------------------------' & @LF & _
"After:" & @LF & @LF & $sAfter)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetFirstVisibleLine

Function Reference

_GUICtrlEdit_GetFirstVisibleLine

Retrieves the zero-based index of the uppermost visible line in a multiline edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetFirstVisibleLine($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: zero-based index of the uppermost visible line in a multiline edit control

Remarks

The number of lines and the length of the lines in an edit control depend on the width of the control
and the current Wordwrap setting.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Get First Visible Line", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

For $x = 0 To 20
_GUICtrlEdit_AppendText($hEdit, StringFormat("[%02d] Append to the end?", $x) & @CRLF)
Next

MsgBox(4160, "Information", "First Visible Line: " & _GUICtrlEdit_GetFirstVisibleLine($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetLimitText

Function Reference

_GUICtrlEdit_GetLimitText

Gets the current text limit for an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetLimitText($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Text limit

Remarks

The text limit is the maximum amount of text, in TCHARs, that the control can contain.
For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters.
Two documents with the same character limit will yield the same text limit, even if one is ANSI
and the other is Unicode.

Related

_GUICtrlEdit_SetLimitText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Get Limit Text", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

MsgBox(4160, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($hEdit))

MsgBox(4160, "Information", "Setting Text Limit")
_GUICtrlEdit_SetLimitText($hEdit, 64000)

MsgBox(4160, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetLine

Function Reference

_GUICtrlEdit_GetLine

Retrieves a line of text from an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetLine($hWnd, $iLine)

Parameters

$hWnd | Handle to the control
$iLine | Zero-based line index to get

Return Value

Success: The line of text
Failure: Empty string

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"

; Create GUI
GUICreate("Edit Get Line", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

MsgBox(4160, "Information", _GUICtrlEdit_GetLine($hEdit, Random(0, 7, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetLineCount

Function Reference

_GUICtrlEdit_GetLineCount

Retrieves the number of lines

#Include <GuiEdit.au3>
_GUICtrlEdit_GetLineCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Total number of text lines
Failure: 1

Remarks

If the control has no text, the return value is 1.
The return value will never be less than 1.

The _GUICtrlEdit_GetLineCount retrieves the total number of text lines, not just the number of lines
that are currently visible.

If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing
window change

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"

; Create GUI
$hGUI = GUICreate("Edit Get Line Count", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, -1)
GUISetState()

_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
_GUICtrlStatusBar_SetIcon($StatusBar, 0, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, @TAB & "Lines: " & _GUICtrlEdit_GetLineCount($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetMargins

Function Reference

_GUICtrlEdit_GetMargins

Retrieves the widths of the left and right margins

#Include <GuiEdit.au3>
_GUICtrlEdit_GetMargins($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array in the following format:
[0] - The width of the left margin
[1] - The width of the right margin

Remarks

None.

Related

_GUICtrlEdit_SetMargins

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aMargins

; Create GUI
$hGUI = GUICreate("Edit Get Margins", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Get Margins
$aMargins = _GUICtrlEdit_GetMargins($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left Margin: " & $aMargins[0])
_GUICtrlStatusBar_SetText($StatusBar, "Right Margin: " & $aMargins[1], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetModify

Function Reference

_GUICtrlEdit_GetModify

Retrieves the state of an edit control's modification flag

#Include <GuiEdit.au3>
_GUICtrlEdit_GetModify($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Return values as follows:
True - Edit control contents have been modified
False - Edit control contents have not been modified

Remarks

The system automatically clears the modification flag to zero when the control is created
If the user changes the control's text, the system sets the flag to True
You can call _GUICtrlEdit_SetModify to set or clear the flag

Related

_GUICtrlEdit_CanUndo, _GUICtrlEdit_SetModify, _GUICtrlEdit_Undo

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[4] = [120, 248, 378, -1]

; Create GUI
$hGUI = GUICreate("Edit Get Modify", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 3, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Get Modified Flag
_GUICtrlStatusBar_SetText($StatusBar, "Modified: " & _GUICtrlEdit_GetModify($hEdit), 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetPasswordChar

Function Reference

_GUICtrlEdit_GetPasswordChar

Gets the password character that an edit control displays when the user enters text

#Include <GuiEdit.au3>
_GUICtrlEdit_GetPasswordChar($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The return value specifies the character to be displayed in place of any characters typed by the user
If the return value is 0, there is no password character, and the control displays the characters typed by the user

Remarks

None.

Related

_GUICtrlEdit_SetPasswordChar

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Get Password Char", 400, 300)
$hEdit = GUICtrlCreateInput("Test of build-in control", 2, 2, 394, 25, $ES_PASSWORD)
GUISetState()

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

_GUICtrlEdit_SetPasswordChar($hEdit, "$") ; change password char to $

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

_GUICtrlEdit_SetPasswordChar($hEdit) ; display characters typed by the user.

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetRECT

Function Reference

_GUICtrlEdit_GetRECT

Retrieves the formatting rectangle of an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetRECT($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array containing the RECT in the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

Under certain conditions, _GUICtrlEdit_GetRECT might not return the exact values that
_GUICtrlEdit_SetRECT set—it will be approximately correct, but it can be off by a few pixels.

Related

_GUICtrlEdit_GetRECTEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $aRect

; Create GUI
$hGUI = GUICreate("Edit Get RECT", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
$aRect[0] += 10
$aRect[1] += 10
$aRect[2] -= 10
$aRect[3] -= 10

; Set Rect
_GUICtrlEdit_SetRECT($hEdit, $aRect)

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & $aRect[0], 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & $aRect[1], 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & $aRect[2], 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & $aRect[3], 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetRECTEx

Function Reference

_GUICtrlEdit_GetRECTEx

Retrieves the formatting rectangle of an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetRECTEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagRECT structure that recieves formatting rectangle of an edit control

Remarks

Under certain conditions, _GUICtrlEdit_GetRECT might not return the exact values that
_GUICtrlEdit_SetRECTEx set—it will be approximately correct, but it can be off by a few pixels.

Related

_GUICtrlEdit_GetRECT, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $tRect

; Create GUI
$hGUI = GUICreate("Edit Get RECTEx", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
DllStructSetData($tRect, "Left", DllStructGetData($tRect, "Left") + 10)
DllStructSetData($tRect, "Top", DllStructGetData($tRect, "Top") + 10)
DllStructSetData($tRect, "Right", DllStructGetData($tRect, "Right") - 10)
DllStructSetData($tRect, "Bottom", DllStructGetData($tRect, "Bottom") - 10)

; Set RectEx
_GUICtrlEdit_SetRECTEx($hEdit, $tRect)

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & DllStructGetData($tRect, "Left"), 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & DllStructGetData($tRect, "Top"), 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & DllStructGetData($tRect, "Right"), 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & DllStructGetData($tRect, "Bottom"), 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetSel

Function Reference

_GUICtrlEdit_GetSel

Retrieves the starting and ending character positions of the current selection

#Include <GuiEdit.au3>
_GUICtrlEdit_GetSel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array in the following format:
[0] - Starting position
[1] - Ending position

Remarks

None.

Related

_GUICtrlEdit_ReplaceSel, _GUICtrlEdit_SetSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aSel

; Create GUI
$hGUI = GUICreate("Edit Get Sel", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Set Sel
_GUICtrlEdit_SetSel($hEdit, 15, 20)

; Get Sel
$aSel = _GUICtrlEdit_GetSel($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Start: " & $aSel[0])
_GUICtrlStatusBar_SetText($StatusBar, "End: " & $aSel[1], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetText

Function Reference

_GUICtrlEdit_GetText

Get the text from the edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetText($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: String from the edit control
Failure: Empty string

Remarks

None.

Related

_GUICtrlEdit_SetText, _GUICtrlEdit_AppendText, _GUICtrlEdit_GetTextLen

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Get Text", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

; Set Text
_GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line" & @CRLF & "Append to the end?")

; Get Text
MsgBox(4160, "Information", _GUICtrlEdit_GetText($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_GetTextLen

Function Reference

_GUICtrlEdit_GetTextLen

Get the length of all the text from the edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_GetTextLen($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Length of text in edit control

Remarks

None.

Related

_GUICtrlEdit_GetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[2] = [378, -1]

; Create GUI
$hGUI = GUICreate("Edit Get Text Len", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 1, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Get Text Len
_GUICtrlStatusBar_SetText($StatusBar, "Text Len: " & _GUICtrlEdit_GetTextLen($hEdit) & " chars")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_HideBalloonTip

Function Reference

_GUICtrlEdit_HideBalloonTip

Hides any balloon tip associated with an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_HideBalloonTip($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlEdit_ShowBalloonTip

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit, $sTitle = "ShowBalloonTip", $sText = "Displays a balloon tip associated with an edit control"

; Create GUI
GUICreate("Edit ShowBalloonTip", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

; Set Text
_GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line" & @CRLF & "Append to the end?")

_GUICtrlEdit_ShowBalloonTip($hEdit, $sTitle, $sText, $TTI_INFO)
Sleep(500)
_GUICtrlEdit_HideBalloonTip($hEdit)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_InsertText

Function Reference

_GUICtrlEdit_InsertText

Insert text

#Include <GuiEdit.au3>
_GUICtrlEdit_InsertText($hWnd, $sText, $iIndex = -1)

Parameters

$hWnd | Handle to the control
$sText | String to insert
$iIndex | character position to insert

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_AppendText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"

; Create GUI
GUICreate("Edit Insert Text", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Insert text
_GUICtrlEdit_InsertText($hEdit, "*** Excellent UDFs ***" & @CRLF & @CRLF, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_LineFromChar

Function Reference

_GUICtrlEdit_LineFromChar

Retrieves the index of the line that contains the specified character index

#Include <GuiEdit.au3>
_GUICtrlEdit_LineFromChar($hWnd[, $iIndex = -1])

Parameters

$hWnd | Handle to the control
$iIndex | [optional] The character index of the character contained in the line whose number is to be retrieved

Return Value

Success: Zero-based line number of the line containing the character index specified by $iIndex

Remarks

If $iIndex is –1, _GUICtrlEdit_LineFromChar retrieves either the line number of the current line
(the line containing the caret) or, if there is a selection, the line number of the line containing
the beginning of the selection.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[2] = [378, -1], $iRandom

; Create GUI
$hGUI = GUICreate("Edit Line From Char", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 1, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Line From Char
$iRandom = Random(0, _GUICtrlEdit_GetTextLen($hEdit) - 1, 1)
_GUICtrlStatusBar_SetText($StatusBar, "Line: " & _GUICtrlEdit_LineFromChar($hEdit, $iRandom) & " from char: " & $iRandom)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_LineIndex

Function Reference

_GUICtrlEdit_LineIndex

Retrieves the character index of the first character of a specified line

#Include <GuiEdit.au3>
_GUICtrlEdit_LineIndex($hWnd[, $iIndex = 0])

Parameters

$hWnd | Handle to the control
$iIndex | [optional] Specifies the zero-based line number

Return Value

Success: | the character index of the line specified in the $iIndex parameter
Failure: | –1 if the specified line number is greater than the number of lines in the edit control

Remarks

$iIndex = –1 specifies the current line number (the line that contains the caret)

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[2] = [378, -1], $iRandom

; Create GUI
$hGUI = GUICreate("Edit Line Index", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 1, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Line Index
$iRandom = Random(0, _GUICtrlEdit_GetLineCount($hEdit) - 1, 1)
_GUICtrlStatusBar_SetText($StatusBar, "Char Index: " & _GUICtrlEdit_LineIndex($hEdit, $iRandom) & " from Line: " & $iRandom)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_LineLength

Function Reference

_GUICtrlEdit_LineLength

Retrieves the length, in characters, of a line

#Include <GuiEdit.au3>
_GUICtrlEdit_LineLength($hWnd[, $iIndex = -1])

Parameters

$hWnd | Handle to the control
$iIndex | [optional] Specifies the zero-based line index of the line whose length is to be retrieved

Return Value

Remarks

$iIndex = –1 specifies the current line number (the line that contains the caret)

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[2] = [378, -1], $iRandom

; Create GUI
$hGUI = GUICreate("Edit Line Length", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 1, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Line Length
$iRandom = Random(0, 7, 1)
_GUICtrlStatusBar_SetText($StatusBar, "Length: " & _GUICtrlEdit_LineLength($hEdit, $iRandom) & " chars on Line Index: " & $iRandom)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_LineScroll

Function Reference

_GUICtrlEdit_LineScroll

Scrolls the text

#Include <GuiEdit.au3>
_GUICtrlEdit_LineScroll($hWnd, $iHoriz, $iVert)

Parameters

$hWnd | Handle to the control
$iHoriz | Specifies the number of characters to scroll horizontally.
$iVert | Specifies the number of lines to scroll vertically.

Return Value

Success: True
Failure: False

Remarks

The control does not scroll vertically past the last line of text in the edit control.

If the current line plus the number of lines specified by the $iVert parameter exceeds the total number
of lines in the edit control, the value is adjusted so that the last line of the edit control is scrolled
to the top of the edit-control window.

_GUICtrlEdit_LineScroll scrolls the text vertically or horizontally.
_GUICtrlEdit_LineScroll can be used to scroll horizontally past the last character of any line.

Related

_GUICtrlEdit_Scroll

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[2] = [378, -1]

; Create GUI
$hGUI = GUICreate("Edit Line Scroll", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 1, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Scroll
_GUICtrlStatusBar_SetText($StatusBar, "Scrolled: " & _GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_PosFromChar

Function Reference

_GUICtrlEdit_PosFromChar

Retrieves the client area coordinates of a specified character in an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_PosFromChar($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | The zero-based index of the character

Return Value

Success: Array in the following format:
[0] - The horizontal coordinate
[1] - The vertical coordinate

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [200, 378, -1], $aPos

; Create GUI
$hGUI = GUICreate("Edit Pos From Char", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Pos From Char
$aPos = _GUICtrlEdit_PosFromChar($hEdit, 300)
_GUICtrlStatusBar_SetText($StatusBar, "Horizontal Coord: " & $aPos[0])
_GUICtrlStatusBar_SetText($StatusBar, "Vertical Coord: " & $aPos[1], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_ReplaceSel

Function Reference

_GUICtrlEdit_ReplaceSel

Replaces the current selection

#Include <GuiEdit.au3>
_GUICtrlEdit_ReplaceSel($hWnd, $sText[, $fUndo = True])

Parameters

$hWnd | Handle to the control
$sText | String containing the replacement text.
$fUndo | [optional] Specifies whether the replacement operation can be undone: True - The operation can be undone. False - The operation cannot be undone.

Return Value

None.

Remarks

Use the _GUICtrlEdit_ReplaceSel to replace only a portion of the text in an edit control.
If there is no current selection, the replacement text is inserted at the current location of the caret.

Related

_GUICtrlEdit_GetSel, _GUICtrlEdit_SetSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [200, 378, -1]

; Create GUI
$hGUI = GUICreate("Edit Replace Sel", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Set Sel
_GUICtrlEdit_SetSel($hEdit, 0, 8)

MsgBox(4160, "Information", "Replace Sel")
_GUICtrlEdit_ReplaceSel($hEdit, StringFormat("%d/%2d/%4d", @MON, @MDAY, @YEAR))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_Scroll

Function Reference

_GUICtrlEdit_Scroll

Scrolls the text vertically

#Include <GuiEdit.au3>
_GUICtrlEdit_Scroll($hWnd, $iDirection)

Parameters

$hWnd | Handle to the control
$iDirection | This parameter can be one of the following values: $SB_LINEDOWN - Scrolls down one line $SB_LINEUP - Scrolls up one line $SB_PAGEDOWN - Scrolls down one page $SB_PAGEUP - Scrolls up one page $SB_SCROLLCARET - Scrolls the caret into view

Return Value

Success: The high-order word of the return value is TRUE
The low-order word is the number of lines that the command scrolls
Failure: 0

Remarks

$SB_xxxxx require include of ScrollBarConstants.au3

Related

_GUICtrlEdit_LineScroll

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [200, 378, -1], $iLen

; Create GUI
$hGUI = GUICreate("Edit Scroll", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

MsgBox(4160, "Information", "Scroll Line Down")
_GUICtrlEdit_Scroll($hEdit, $SB_LINEDOWN)

MsgBox(4160, "Information", "Scroll Line Up")
_GUICtrlEdit_Scroll($hEdit, $SB_LINEUP)

MsgBox(4160, "Information", "Scroll Page Down")
_GUICtrlEdit_Scroll($hEdit, $SB_PAGEDOWN)

MsgBox(4160, "Information", "Scroll Page Up")
_GUICtrlEdit_Scroll($hEdit, $SB_PAGEUP)

$iLen = _GUICtrlEdit_GetTextLen($hEdit)
_GUICtrlEdit_SetSel($hEdit, $iLen, $iLen)

MsgBox(4160, "Information", "Scroll Caret")
_GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetLimitText

Function Reference

_GUICtrlEdit_SetLimitText

Sets the text limit

#Include <GuiEdit.au3>
_GUICtrlEdit_SetLimitText($hWnd, $iLimit)

Parameters

$hWnd | Handle to the control
$iLimit | The maximum number of TCHARs the user can enter

Return Value

None.

Remarks

The _GUICtrlEdit_SetLimitText function limits only the text the user can enter.
It does not affect any text already in the edit control when the message is sent, nor does it affect
the length of the text copied to the edit control by the _GUICtrlEdit_SetText function.
If an application uses the _GUICtrlEdit_SetText function to place more text into an edit control than
is specified in the _GUICtrlEdit_SetLimitText function, the user can edit the entire contents of the
edit control.

Related

_GUICtrlEdit_GetLimitText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Set Limit Text", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

MsgBox(4160, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($hEdit))

MsgBox(4160, "Information", "Setting Text Limit")
_GUICtrlEdit_SetLimitText($hEdit, 64000)

MsgBox(4160, "Information", "Text Limit: " & _GUICtrlEdit_GetLimitText($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetMargins

Function Reference

_GUICtrlEdit_SetMargins

Sets the widths of the left and right margins

#Include <GuiEdit.au3>
_GUICtrlEdit_SetMargins($hWnd[, $iMargin = 0x1[, $iLeft = 0xFFFF[, $iRight = 0xFFFF]]])

Parameters

$hWnd | Handle to the control
$iMargin | [optional] Can be one or more of the following $EC_LEFTMARGIN - Sets the left margin $EC_RIGHTMARGIN - Sets the right margin
 | Default: $EC_LEFTMARGIN
$iLeft | [optional] The new width of the left margin
 | Default: $EC_USEFONTINFO
$iRight | [optional] The new width of the right margin
 | Default: $EC_USEFONTINFO

Return Value

Returns an array in the following format:
[0] - The width of the left margin
[1] - The width of the right margin

Remarks

None.

Related

_GUICtrlEdit_GetMargins

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aMargins

; Create GUI
$hGUI = GUICreate("Edit Set Margins", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Get Margins
$aMargins = _GUICtrlEdit_GetMargins($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left Margin: " & $aMargins[0])
_GUICtrlStatusBar_SetText($StatusBar, "Right Margin: " & $aMargins[1], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetModify

Function Reference

_GUICtrlEdit_SetModify

Sets or clears the modification flag

#Include <GuiEdit.au3>
_GUICtrlEdit_SetModify($hWnd, $fModified)

Parameters

$hWnd | Handle to the control
$fModified | Specifies the new value for the modification flag: True - Indicates the text has been modified. False - Indicates it has not been modified.

Return Value

None.

Remarks

The system automatically clears the modification flag to zero when the control is created.
If the user changes the control's text, the system sets the flag to nonzero.
You can use the _GUICtrlEdit_GetModify to retrieve the current state of the flag.

Related

_GUICtrlEdit_GetModify, _GUICtrlEdit_CanUndo

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[4] = [120, 248, 378, -1]

; Create GUI
$hGUI = GUICreate("Edit Set Modify", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 3, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Add Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Get Modified Flag
_GUICtrlStatusBar_SetText($StatusBar, "Modified: " & _GUICtrlEdit_GetModify($hEdit), 2)

MsgBox(4160, "Information", "Set Modify Flag")
; Set Modified Flag
_GUICtrlEdit_SetModify($hEdit, True)

; Get Modified Flag
_GUICtrlStatusBar_SetText($StatusBar, "Modified: " & _GUICtrlEdit_GetModify($hEdit), 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetPasswordChar

Function Reference

_GUICtrlEdit_SetPasswordChar

Sets or removes the password character for an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_SetPasswordChar($hWnd[, $cDisplayChar = "0"])

Parameters

$hWnd | Handle to the control
$cDisplayChar | [optional] The character to be displayed in place of the characters typed by the user If this parameter is zero, the control removes the current password character and displays the characters typed by the user

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_GetPasswordChar

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("(Internal) Edit Get Password Char", 400, 300)
$hEdit = GUICtrlCreateInput("Test of build-in control", 2, 2, 394, 25, $ES_PASSWORD)
GUISetState()

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

_GUICtrlEdit_SetPasswordChar($hEdit, "$") ; change password char to $

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

_GUICtrlEdit_SetPasswordChar($hEdit) ; display characters typed by the user.

MsgBox(4096, "Information", "Password Char: " & _GUICtrlEdit_GetPasswordChar($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetReadOnly

Function Reference

_GUICtrlEdit_SetReadOnly

Sets or removes the read-only style ($ES_READONLY)

#Include <GuiEdit.au3>
_GUICtrlEdit_SetReadOnly($hWnd, $fReadOnly)

Parameters

$hWnd | Handle to the control
$fReadOnly | Followin values: True - Sets the $ES_READONLY style False - Removes the $ES_READONLY style

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[4] = [120, 248, 378, -1]

; Create GUI
$hGUI = GUICreate("Edit Set Read Only", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 3, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Add Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Get Modified Flag
_GUICtrlStatusBar_SetText($StatusBar, "Modified: " & _GUICtrlEdit_GetModify($hEdit), 2)

; Set Read Only
_GUICtrlEdit_SetReadOnly($hEdit, True)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetRECT

Function Reference

_GUICtrlEdit_SetRECT

Sets the formatting rectangle of a multiline edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_SetRECT($hWnd, $aRect)

Parameters

$hWnd | Handle to the control
$aRect | Array in the following format: [0] - Specifies the x-coordinate of the upper-left corner of the rectangle. [1] - Specifies the y-coordinate of the upper-left corner of the rectangle. [2] - Specifies the x-coordinate of the lower-right corner of the rectangle. [3] - Specifies the y-coordinate of the lower-right corner of the rectangle.

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_SetRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $aRect

; Create GUI
$hGUI = GUICreate("Edit Set RECT", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
$aRect[0] += 10
$aRect[1] += 10
$aRect[2] -= 10
$aRect[3] -= 10

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Set Rect
_GUICtrlEdit_SetRECT($hEdit, $aRect)

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & $aRect[0], 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & $aRect[1], 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & $aRect[2], 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & $aRect[3], 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetRECTEx

Function Reference

_GUICtrlEdit_SetRECTEx

Sets the formatting rectangle of a multiline edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_SetRECTEx($hWnd, $tRect)

Parameters

$hWnd | Handle to the control
$tRect | $tagRECT structure that contains formatting rectangle of an edit control

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_SetRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $tRect

; Create GUI
$hGUI = GUICreate("Edit Set RECTEx", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
DllStructSetData($tRect, "Left", DllStructGetData($tRect, "Left") + 10)
DllStructSetData($tRect, "Top", DllStructGetData($tRect, "Top") + 10)
DllStructSetData($tRect, "Right", DllStructGetData($tRect, "Right") - 10)
DllStructSetData($tRect, "Bottom", DllStructGetData($tRect, "Bottom") - 10)

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Set RectEx
_GUICtrlEdit_SetRECTEx($hEdit, $tRect)

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & DllStructGetData($tRect, "Left"), 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & DllStructGetData($tRect, "Top"), 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & DllStructGetData($tRect, "Right"), 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & DllStructGetData($tRect, "Bottom"), 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetRECTNP

Function Reference

_GUICtrlEdit_SetRECTNP

Sets the formatting rectangle of a multiline edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_SetRECTNP($hWnd, $aRect)

Parameters

$hWnd | Handle to the control
$aRect | Array in the following format: [0] - Specifies the x-coordinate of the upper-left corner of the rectangle. [1] - Specifies the y-coordinate of the upper-left corner of the rectangle. [2] - Specifies the x-coordinate of the lower-right corner of the rectangle. [3] - Specifies the y-coordinate of the lower-right corner of the rectangle.

Return Value

None.

Remarks

The _GUICtrlEdit_SetRECTNP function is identical to the _GUICtrlEdit_SetRECT function,
except that _GUICtrlEdit_SetRECTNP does not redraw the edit control window.

Related

_GUICtrlEdit_SetRectNPEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $aRect

; Create GUI
$hGUI = GUICreate("Edit Set RECTNP", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
$aRect[0] += 10
$aRect[1] += 10
$aRect[2] -= 10
$aRect[3] -= 10

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Set Rect
_GUICtrlEdit_SetRECTNP($hEdit, $aRect)

; Get Rect
$aRect = _GUICtrlEdit_GetRECT($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & $aRect[0], 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & $aRect[1], 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & $aRect[2], 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & $aRect[3], 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetRectNPEx

Function Reference

_GUICtrlEdit_SetRectNPEx

Sets the formatting rectangle of a multiline edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_SetRectNPEx($hWnd, $tRect)

Parameters

$hWnd | Handle to the control
$tRect | $tagRECT structure that contains formatting rectangle of an edit control

Return Value

None.

Remarks

The _GUICtrlEdit_SetRECTNPEx function is identical to the _GUICtrlEdit_SetRECTEx function,
except that _GUICtrlEdit_SetRECTNPEx does not redraw the edit control window.

Related

_GUICtrlEdit_SetRectNP, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[6] = [50, 130, 210, 290, 378, -1], $tRect

; Create GUI
$hGUI = GUICreate("Edit Set RECTNPEx", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 5, 97, "shell32.dll")
_GUICtrlStatusBar_SetText($StatusBar, "Rect")
GUISetState()

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
DllStructSetData($tRect, "Left", DllStructGetData($tRect, "Left") + 10)
DllStructSetData($tRect, "Top", DllStructGetData($tRect, "Top") + 10)
DllStructSetData($tRect, "Right", DllStructGetData($tRect, "Right") - 10)
DllStructSetData($tRect, "Bottom", DllStructGetData($tRect, "Bottom") - 10)

; Add Text
_GUICtrlEdit_AppendText($hEdit, FileRead($sFile))
_GUICtrlEdit_LineScroll($hEdit, 0, _GUICtrlEdit_GetLineCount($hEdit) * - 1)

; Set RectEx
_GUICtrlEdit_SetRectNPEx($hEdit, $tRect)

; Get RectEx
$tRect = _GUICtrlEdit_GetRECTEx($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Left: " & DllStructGetData($tRect, "Left"), 1)
_GUICtrlStatusBar_SetText($StatusBar, "Topt: " & DllStructGetData($tRect, "Top"), 2)
_GUICtrlStatusBar_SetText($StatusBar, "Right: " & DllStructGetData($tRect, "Right"), 3)
_GUICtrlStatusBar_SetText($StatusBar, "Bottom: " & DllStructGetData($tRect, "Bottom"), 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetSel

Function Reference

_GUICtrlEdit_SetSel

Selects a range of characters

#Include <GuiEdit.au3>
_GUICtrlEdit_SetSel($hWnd, $iStart, $iEnd)

Parameters

$hWnd | Handle to the control
$iStart | Specifies the starting character position of the selection.
$iEnd | Specifies the ending character position of the selection.

Return Value

None.

Remarks

The start value can be greater than the end value.
The lower of the two values specifies the character position of the first character in the selection.
The higher value specifies the position of the first character beyond the selection.

The start value is the anchor point of the selection, and the end value is the active end.
If the user uses the SHIFT key to adjust the size of the selection, the active end can move but the
anchor point remains the same.

If the $iStart is 0 and the $iEnd is –1, all the text in the edit control is selected.
If the $iStart is –1, any current selection is deselected.

The control displays a flashing caret at the $iEnd position regardless of the relative values of $iStart and $iEnd.

Related

_GUICtrlEdit_GetSel, _GUICtrlEdit_ReplaceSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aSel

; Create GUI
$hGUI = GUICreate("Edit Set Sel", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, FileRead($sFile))

; Set Sel
_GUICtrlEdit_SetSel($hEdit, 15, 20)

; Get Sel
$aSel = _GUICtrlEdit_GetSel($hEdit)
_GUICtrlStatusBar_SetText($StatusBar, "Start: " & $aSel[0])
_GUICtrlStatusBar_SetText($StatusBar, "End: " & $aSel[1], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetTabStops

Function Reference

_GUICtrlEdit_SetTabStops

Sets the tab stops

#Include <GuiEdit.au3>
_GUICtrlEdit_SetTabStops($hWnd, $aTabStops)

Parameters

$hWnd | Handle to the control
$aTabStops | Array of tab stops in the following format: [0] - Tab stop 1 [2] - Tab stop 2 [n] - Tab stop n

Return Value

True: All the tabs are set
False: All the tabs are not set

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $StatusBar, $hEdit, $hGUI
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt"
Local $aPartRightSide[3] = [190, 378, -1], $aTabStops[3] = [10, 30, 50]

; Create GUI
$hGUI = GUICreate("Edit Set Tab Stops", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
$StatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
_GUICtrlStatusBar_SetIcon($StatusBar, 2, 97, "shell32.dll")
GUISetState()

; Set Margins
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

; Set Text
_GUICtrlEdit_SetText($hEdit, @TAB & "1st" & @TAB & "2nd" & @TAB & "3rd")

MsgBox(4160, "Information", "Set Tab Stops")
; Set Tab Stops
_GUICtrlEdit_SetTabStops($hEdit, $aTabStops)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_SetText

Function Reference

_GUICtrlEdit_SetText

Set the text

#Include <GuiEdit.au3>
_GUICtrlEdit_SetText($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String to place in edit control

Return Value

None.

Remarks

None.

Related

_GUICtrlEdit_GetText, _GUICtrlEdit_AppendText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Set Text", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

; Set Text
_GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line" & @CRLF & "Append to the end?")

; Get Text
MsgBox(4160, "Information", _GUICtrlEdit_GetText($hEdit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_ShowBalloonTip

Function Reference

_GUICtrlEdit_ShowBalloonTip

Displays a balloon tip associated with an edit control

#Include <GuiEdit.au3>
_GUICtrlEdit_ShowBalloonTip($hWnd, $sTitle, $sText, $iIcon)

Parameters

$hWnd | Handle to the control
$sTitle | String for title of ToolTip (Unicode)
$sText | String for text of ToolTip (Unicode)
$iIcon | Icon can be one of the following: $TTI_ERROR - Use the error icon $TTI_INFO - Use the information icon $TTI_NONE - Use no icon $TTI_WARNING - Use the warning icon The following for Vista and above OS $TTI_ERROR_LARGE - Use the error icon $TTI_INFO_LARGE - Use the information icon $TTI_WARNING_LARGE - Use the warning icon

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlEdit_HideBalloonTip

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit, $sTitle = "ShowBalloonTip", $sText = "Displays a balloon tip associated with an edit control"

; Create GUI
GUICreate("Edit ShowBalloonTip", 400, 300)
$hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268)
GUISetState()

; Set Text
_GUICtrlEdit_SetText($hEdit, "This is a test" & @CRLF & "Another Line" & @CRLF & "Append to the end?")

_GUICtrlEdit_ShowBalloonTip($hEdit, $sTitle, $sText, $TTI_INFO)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlEdit_Undo

Function Reference

_GUICtrlEdit_Undo

Undoes the last edit control operation in the control's undo queue

#Include <GuiEdit.au3>
_GUICtrlEdit_Undo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

An undo operation can also be undone.
For example, you can restore deleted text with the first _GUICtrlEdit_Undo,
and remove the text again with a second _GUICtrlEdit_Undo as long as there
is no intervening edit operation.

Related

_GUICtrlEdit_CanUndo, _GUICtrlEdit_EmptyUndoBuffer, _GUICtrlEdit_GetModify

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hEdit

; Create GUI
GUICreate("Edit Undo", 400, 300)
$hEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
GUISetState()

_GUICtrlEdit_AppendText($hEdit, @CRLF & "Append to the end?")

; Undo
MsgBox(4160, "Information", "Undo")
_GUICtrlEdit_Undo($hEdit)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiHeader user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiHeader.au3>.

User Defined Function | Description
_GUICtrlHeader_AddItem | Adds a new header item
_GUICtrlHeader_ClearFilter | Clears the filter
_GUICtrlHeader_ClearFilterAll | Clears all of the filters
_GUICtrlHeader_Create | Creates a Header control
_GUICtrlHeader_CreateDragImage | Creates a semi-transparent version of an item's image for use as a dragging image
_GUICtrlHeader_DeleteItem | Deletes a header item
_GUICtrlHeader_Destroy | Delete the Header control
_GUICtrlHeader_EditFilter | Starts editing the specified filter
_GUICtrlHeader_GetBitmapMargin | Retrieves the width of the bitmap margin
_GUICtrlHeader_GetImageList | Retrieves the handle to the image list
_GUICtrlHeader_GetItem | Retrieves information about an item
_GUICtrlHeader_GetItemAlign | Retrieves the item text alignment
_GUICtrlHeader_GetItemBitmap | Retrieves the item bitmap handle
_GUICtrlHeader_GetItemCount | Retrieves a count of the items
_GUICtrlHeader_GetItemDisplay | Returns the item display information
_GUICtrlHeader_GetItemFlags | Returns the item flag information
_GUICtrlHeader_GetItemFormat | Returns the format of the item
_GUICtrlHeader_GetItemImage | Retrieves the index of an image within the image list
_GUICtrlHeader_GetItemOrder | Retrieves the order in which the item appears
_GUICtrlHeader_GetItemParam | Retrieves the param value of the item
_GUICtrlHeader_GetItemRect | Retrieves the bounding rectangle for a given item
_GUICtrlHeader_GetItemRectEx | Retrieves the bounding rectangle for a given item
_GUICtrlHeader_GetItemText | Retrieves the item text
_GUICtrlHeader_GetItemWidth | Retrieves the item's width
_GUICtrlHeader_GetOrderArray | Retrieves the current left-to-right order of items in a header control
_GUICtrlHeader_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlHeader_HitTest | Tests a point to determine which item is at the specified point
_GUICtrlHeader_InsertItem | Inserts a new header item
_GUICtrlHeader_Layout | Retrieves the correct size and position of the control
_GUICtrlHeader_OrderToIndex | Retrieves an index value for an item based on its order
_GUICtrlHeader_SetBitmapMargin | Sets the width of the margin, specified in pixels, of a bitmap
_GUICtrlHeader_SetFilterChangeTimeout | Sets the filter change timeout interval
_GUICtrlHeader_SetHotDivider | Changes the hot divider color
_GUICtrlHeader_SetImageList | Assigns an image list
_GUICtrlHeader_SetItem | Sets information about an item
_GUICtrlHeader_SetItemAlign | Sets the item text alignment
_GUICtrlHeader_SetItemBitmap | Sets the item bitmap handle
_GUICtrlHeader_SetItemDisplay | Returns the item display information
_GUICtrlHeader_SetItemFlags | Returns the item flag information
_GUICtrlHeader_SetItemFormat | Sets the format of the item
_GUICtrlHeader_SetItemImage | Sets the index of an image within the image list
_GUICtrlHeader_SetItemOrder | Sets the order in which the item appears
_GUICtrlHeader_SetItemParam | Sets the param value of the item
_GUICtrlHeader_SetItemText | Sets the item text
_GUICtrlHeader_SetItemWidth | Sets the item's width
_GUICtrlHeader_SetOrderArray | Sets the current left-to-right order of items
_GUICtrlHeader_SetUnicodeFormat | Sets the Unicode character format flag for the control


Function _GUICtrlHeader_AddItem

Function Reference

_GUICtrlHeader_AddItem

Adds a new header item

#Include <GuiHeader.au3>
_GUICtrlHeader_AddItem($hWnd, $sText[, $iWidth = 50[, $iAlign = 0[, $iImage = -1[, $fOnRight = False]]]])

Parameters

$hWnd | Handle to control
$sText | Item text
$iWidth | [optional] Item width
$iAlign | [optional] Text alignment: 0 - Text is left-aligned 1 - Text is right-aligned 2 - Text is centered
$iImage | [optional] Zero based index of an image within the image list
$fOnRight | [optional] If True, the column image appears to the right of text

Return Value

Success: | The index of the new item
Failure: | -1

Remarks

None.

Related

_GUICtrlHeader_InsertItem, _GUICtrlHeader_DeleteItem

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_ClearFilter

Function Reference

_GUICtrlHeader_ClearFilter

Clears the filter

#Include <GuiHeader.au3>
_GUICtrlHeader_ClearFilter($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_ClearFilterAll, _GUICtrlHeader_EditFilter

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set up filters
_GUICtrlHeader_EditFilter ($hHeader, 0)
Send("Filter 1")
Sleep(1000)
Send("{ENTER}")
_GUICtrlHeader_EditFilter ($hHeader, 1)
Send("Filter 2")
Sleep(1000)
Send("{ENTER}")

; Clear first filter
_GUICtrlHeader_ClearFilter ($hHeader, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_ClearFilterAll

Function Reference

_GUICtrlHeader_ClearFilterAll

Clears all of the filters

#Include <GuiHeader.au3>
_GUICtrlHeader_ClearFilterAll($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_ClearFilter, _GUICtrlHeader_EditFilter

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set up filters
_GUICtrlHeader_EditFilter ($hHeader, 0)
Send("Filter 1")
Sleep(1000)
Send("{ENTER}")
_GUICtrlHeader_EditFilter ($hHeader, 1)
Send("Filter 2")
Sleep(1000)
Send("{ENTER}")

; Clear all filters
_GUICtrlHeader_ClearFilterAll($hHeader)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_Create

Function Reference

_GUICtrlHeader_Create

Creates a Header control

#Include <GuiHeader.au3>
_GUICtrlHeader_Create($hWnd[, $iStyle = 0x00000046])

Parameters

$hWnd | Handle to parent or owner window
$iStyle | [optional] Control styles: $HDS_BUTTONS - Each item in the control looks and behaves like a push button $HDS_DRAGDROP - Allows drag-and-drop reordering of header items $HDS_FILTERBAR - Include a filter bar as part of the standard header control $HDS_FLAT - Causes the header control to be drawn flat $HDS_FULLDRAG - Causes the header control to display column contents $HDS_HIDDEN - Indicates a header control that is intended to be hidden $HDS_HORZ - Creates a header control with a horizontal orientation $HDS_HOTTRACK - Enables hot tracking
 | Default: $HDS_BUTTONS, $HDS_HOTTRACK, $HDS_DRAGDROP Forced : $WS_CHILD, $WS_VISIBLE

Return Value

Success: | Handle to the Header control
Failure: | 0

Remarks

None.

Related

_GUICtrlHeader_Destroy

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hHeader

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Clear all filters
_GUICtrlHeader_ClearFilterAll ($hHeader)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode
Local $tNMHDR, $tNMHEADER, $tNMHDFILTERBTNCLICK, $tNMHDDISPINFO

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hHeader
Switch $iCode
Case $HDN_BEGINDRAG ; Sent by a header control when a drag operation has begun on one of its items
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the header control to automatically manage drag-and-drop operations
;~ Return True ; To indicate external (manual) drag-and-drop management allows the owner of the
; control to provide custom services as part of the drag-and-drop process
Case $HDN_BEGINTRACK, $HDN_BEGINTRACKW ; Notifies a header control's parent window that the user has begun dragging a divider in the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_BEGINTRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow tracking of the divider
;~ Return True ; To prevent tracking
Case $HDN_DIVIDERDBLCLICK, $HDN_DIVIDERDBLCLICKW ; Notifies a header control's parent window that the user double-clicked the divider area of the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_DIVIDERDBLCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ENDDRAG ; Sent by a header control when a drag operation has ended on one of its items
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ENDDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the control to automatically place and reorder the item
;~ Return True ; To prevent the item from being placed
Case $HDN_ENDTRACK, $HDN_ENDTRACKW ; Notifies a header control's parent window that the user has finished dragging a divider
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ENDTRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_FILTERBTNCLICK ; Notifies the header control's parent window when the filter button is clicked or in response to an $HDM_SETITEM message
$tNMHDFILTERBTNCLICK = DllStructCreate($tagNMHDFILTERBTNCLICK, $ilParam)
_DebugPrint("$HDN_FILTERBTNCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Item") & @LF & _
"-->Left:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Left") & @LF & _
"-->Top:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Top") & @LF & _
"-->Right:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Right") & @LF & _
"-->Bottom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Bottom"))
;~ Return True ; An $HDN_FILTERCHANGE notification will be sent to the header control's parent window
; This notification gives the parent window an opportunity to synchronize its user interface elements
Return False ; If you do not want the notification sent
Case $HDN_FILTERCHANGE ; Notifies the header control's parent window that the attributes of a header control filter are being changed or edited
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_FILTERCHANGE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_GETDISPINFO, $HDN_GETDISPINFOW ; Sent to the owner of a header control when the control needs information about a callback header item
$tNMHDDISPINFO = DllStructCreate($tagNMHDDISPINFO, $ilParam)
_DebugPrint("$HDN_GETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHDDISPINFO, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHDDISPINFO, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHDDISPINFO, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHDDISPINFO, "Item"))
;~ Return LRESULT
Case $HDN_ITEMCHANGED, $HDN_ITEMCHANGEDW ; Notifies a header control's parent window that the attributes of a header item have changed
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCHANGED" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ITEMCHANGING, $HDN_ITEMCHANGINGW ; Notifies a header control's parent window that the attributes of a header item are about to change
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCHANGING" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the changes
;~ Return True ; To prevent them
Case $HDN_ITEMCLICK, $HDN_ITEMCLICKW ; Notifies a header control's parent window that the user clicked the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ITEMDBLCLICK, $HDN_ITEMDBLCLICKW ; Notifies a header control's parent window that the user double-clicked the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMDBLCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_TRACK, $HDN_TRACKW ; Notifies a header control's parent window that the user is dragging a divider in the header control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_TRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To continue tracking the divider
;~ Return True ; To end tracking
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlHeader_CreateDragImage

Function Reference

_GUICtrlHeader_CreateDragImage

Creates a semi-transparent version of an item's image for use as a dragging image

#Include <GuiHeader.au3>
_GUICtrlHeader_CreateDragImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index. The image assigned to the item is the basis for the transparent image.

Return Value

Success: Handle to an image list that contains the new image as its only element
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_GetImageList

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage, $iMsg, $aSize, $tPos, $tRect, $hDC

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Create a drag image
$hImage = _GUICtrlHeader_CreateDragImage ($hHeader, 1)
$aSize = _GUIImageList_GetIconSize ($hImage)
$hDC = _WinAPI_GetDC ($hGUI)

; Show drag image at cursor position until user exits
Do
$iMsg = GUIGetMsg()
If $iMsg = $GUI_EVENT_MOUSEMOVE Then
If $tPos <> 0 Then
$tRect = DllStructCreate($tagRECT)
DllStructSetData($tRect, "Left", DllStructGetData($tPos, "X"))
DllStructSetData($tRect, "Top", DllStructGetData($tPos, "Y"))
DllStructSetData($tRect, "Right", DllStructGetData($tPos, "X") + $aSize[0])
DllStructSetData($tRect, "Bottom", DllStructGetData($tPos, "Y") + $aSize[1])
_WinAPI_InvalidateRect ($hGUI, $tRect)
EndIf
$tRect = _WinAPI_GetClientRect ($hGUI)
$tPos = _WinAPI_GetMousePos (True, $hGUI)
If _WinAPI_PtInRect ($tRect, $tPos) Then
_GUIImageList_Draw ($hImage, 0, $hDC, DllStructGetData($tPos, "X"), DllStructGetData($tPos, "Y"))
EndIf
EndIf
Until $iMsg = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_DeleteItem

Function Reference

_GUICtrlHeader_DeleteItem

Deletes a header item

#Include <GuiHeader.au3>
_GUICtrlHeader_DeleteItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_AddItem, _GUICtrlHeader_InsertItem

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Delete column 3
MsgBox(4096, "Information", "Deleting Column 3")
_GUICtrlHeader_DeleteItem($hHeader, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_Destroy

Function Reference

_GUICtrlHeader_Destroy

Delete the Header control

#Include <GuiHeader.au3>
_GUICtrlHeader_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Edit created with _GUICtrlHeader_Create

Related

_GUICtrlHeader_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hHeader

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create($hGUI)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Add columns
_GUICtrlHeader_AddItem($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem($hHeader, "Column 4", 100)

; Clear all filters
_GUICtrlHeader_ClearFilterAll($hHeader)

MsgBox(4096, "Information", "About to Destroy Header")

_GUICtrlHeader_Destroy($hHeader)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode
Local $tNMHDR, $tNMHEADER, $tNMHDFILTERBTNCLICK, $tNMHDDISPINFO

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hHeader
Switch $iCode
Case $HDN_BEGINDRAG ; Sent by a header control when a drag operation has begun on one of its items
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the header control to automatically manage drag-and-drop operations
;~ Return True ; To indicate external (manual) drag-and-drop management allows the owner of the
; control to provide custom services as part of the drag-and-drop process
Case $HDN_BEGINTRACK, $HDN_BEGINTRACKW ; Notifies a header control's parent window that the user has begun dragging a divider in the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_BEGINTRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow tracking of the divider
;~ Return True ; To prevent tracking
Case $HDN_DIVIDERDBLCLICK, $HDN_DIVIDERDBLCLICKW ; Notifies a header control's parent window that the user double-clicked the divider area of the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_DIVIDERDBLCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ENDDRAG ; Sent by a header control when a drag operation has ended on one of its items
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ENDDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the control to automatically place and reorder the item
;~ Return True ; To prevent the item from being placed
Case $HDN_ENDTRACK, $HDN_ENDTRACKW ; Notifies a header control's parent window that the user has finished dragging a divider
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ENDTRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_FILTERBTNCLICK ; Notifies the header control's parent window when the filter button is clicked or in response to an $HDM_SETITEM message
$tNMHDFILTERBTNCLICK = DllStructCreate($tagNMHDFILTERBTNCLICK, $ilParam)
_DebugPrint("$HDN_FILTERBTNCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Item") & @LF & _
"-->Left:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Left") & @LF & _
"-->Top:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Top") & @LF & _
"-->Right:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Right") & @LF & _
"-->Bottom:" & @TAB & DllStructGetData($tNMHDFILTERBTNCLICK, "Bottom"))
;~ Return True ; An $HDN_FILTERCHANGE notification will be sent to the header control's parent window
; This notification gives the parent window an opportunity to synchronize its user interface elements
Return False ; If you do not want the notification sent
Case $HDN_FILTERCHANGE ; Notifies the header control's parent window that the attributes of a header control filter are being changed or edited
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_FILTERCHANGE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_GETDISPINFO, $HDN_GETDISPINFOW ; Sent to the owner of a header control when the control needs information about a callback header item
$tNMHDDISPINFO = DllStructCreate($tagNMHDDISPINFO, $ilParam)
_DebugPrint("$HDN_GETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHDDISPINFO, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHDDISPINFO, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHDDISPINFO, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHDDISPINFO, "Item"))
;~ Return LRESULT
Case $HDN_ITEMCHANGED, $HDN_ITEMCHANGEDW ; Notifies a header control's parent window that the attributes of a header item have changed
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCHANGED" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ITEMCHANGING, $HDN_ITEMCHANGINGW ; Notifies a header control's parent window that the attributes of a header item are about to change
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCHANGING" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To allow the changes
;~ Return True ; To prevent them
Case $HDN_ITEMCLICK, $HDN_ITEMCLICKW ; Notifies a header control's parent window that the user clicked the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_ITEMDBLCLICK, $HDN_ITEMDBLCLICKW ; Notifies a header control's parent window that the user double-clicked the control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_ITEMDBLCLICK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
; no return value
Case $HDN_TRACK, $HDN_TRACKW ; Notifies a header control's parent window that the user is dragging a divider in the header control
$tNMHEADER = DllStructCreate($tagNMHEADER, $ilParam)
_DebugPrint("$HDN_TRACK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMHEADER, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMHEADER, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMHEADER, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tNMHEADER, "Item") & @LF & _
"-->Button:" & @TAB & DllStructGetData($tNMHEADER, "Button"))
Return False ; To continue tracking the divider
;~ Return True ; To end tracking
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlHeader_EditFilter

Function Reference

_GUICtrlHeader_EditFilter

Starts editing the specified filter

#Include <GuiHeader.au3>
_GUICtrlHeader_EditFilter($hWnd, $iIndex[, $fDiscard = True])

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$fDiscard | [optional] Flag that specifies how to handle the user's editing changes. Use this flag to specify what to do if the user is in the process of editing the filter when the message is sent: True - Discard the changes made by the user False - Accept the changes made by the user

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlHeader_ClearFilter, _GUICtrlHeader_ClearFilterAll

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set up filters
_GUICtrlHeader_EditFilter ($hHeader, 0)
Send("Filter 1")
Sleep(1000)
Send("{ENTER}")
_GUICtrlHeader_EditFilter ($hHeader, 1)
Send("Filter 2")
Sleep(1000)
Send("{ENTER}")

; Clear first filter
_GUICtrlHeader_ClearFilter ($hHeader, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_GetBitmapMargin

Function Reference

_GUICtrlHeader_GetBitmapMargin

Retrieves the width of the bitmap margin

#Include <GuiHeader.au3>
_GUICtrlHeader_GetBitmapMargin($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The width of the bitmap margin in pixels. If the bitmap margin was not previously specified,
the default value of 3 * GetSystemMetrics(SM_CXEDGE) is returned.
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_SetBitmapMargin

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show current bitmap margin
MemoWrite("Current margin .: " & _GUICtrlHeader_GetBitmapMargin ($hHeader))

; Set new bitmap margin
_GUICtrlHeader_SetBitmapMargin ($hHeader, 8)

; Show new bitmap margin
MemoWrite("New margin .....: " & _GUICtrlHeader_GetBitmapMargin ($hHeader))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetImageList

Function Reference

_GUICtrlHeader_GetImageList

Retrieves the handle to the image list

#Include <GuiHeader.au3>
_GUICtrlHeader_GetImageList($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: A handle to the image list set for the header control
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_SetImageList, _GUICtrlHeader_CreateDragImage

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show header information
MemoWrite("Image list handle ....: " & "0x" & Hex(_GUICtrlHeader_GetImageList ($hHeader)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItem

Function Reference

_GUICtrlHeader_GetItem

Retrieves information about an item

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItem($hWnd, $iIndex, ByRef $tItem)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$tItem | $tagHDITEM structure

Return Value

Success: True
Failure: False

Remarks

When the message is sent, the mask member indicates the type of information being requested. When the message
returns, the other members receive the requested information. If the mask member specifies zero, the message
returns True but copies no information to the structure.

Related

_GUICtrlHeader_SetItem, $tagHDITEM

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage, $tItem

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column 3 image index
$tItem = DllStructCreate($tagHDITEM)
DllStructSetData($tItem, "Mask", $HDI_IMAGE)
_GUICtrlHeader_GetItem ($hHeader, 2, $tItem)
MemoWrite("Column 3 image index: " & DllStructGetData($tItem, "Image"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemAlign

Function Reference

_GUICtrlHeader_GetItemAlign

Retrieves the item text alignment

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemAlign($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item text alignment:
0 - Left
1 - Right
2 - Center
Failure: -1

Remarks

None.

Related

_GUICtrlHeader_SetItemAlign

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Reset column 1 alignment
_GUICtrlHeader_SetItemAlign ($hHeader, 0, 2)

; Show column 1 alignment
MemoWrite("Column 1 alignment: " & _GUICtrlHeader_GetItemAlign ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemBitmap

Function Reference

_GUICtrlHeader_GetItemBitmap

Retrieves the item bitmap handle

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemBitmap($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item bitmap handle
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_SetItemBitmap

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 4 bitmap
_GUICtrlHeader_SetItemBitmap ($hHeader, 3, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF00FF, 11, 11))
_GUICtrlHeader_SetItemDisplay ($hHeader, 3, 1 + 8)

; Show column 4 bitmap handle
MemoWrite("Column 4 bitmap handle: " & "0x" & Hex(_GUICtrlHeader_GetItemBitmap ($hHeader, 3)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemCount

Function Reference

_GUICtrlHeader_GetItemCount

Retrieves a count of the items

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The number of items
Failure: -1

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column count
MemoWrite("Column count: " & _GUICtrlHeader_GetItemCount ($hHeader))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemDisplay

Function Reference

_GUICtrlHeader_GetItemDisplay

Returns the item display information

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemDisplay($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item display information:
1 - The item displays a bitmap
2 - The bitmap appears to the right of text
4 - The control's owner draws the item
8 - The item displays a string

Remarks

None.

Related

_GUICtrlHeader_SetItemDisplay

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 bitmap
_GUICtrlHeader_SetItemBitmap ($hHeader, 0, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF00FF, 11, 11))

; Set column 1 display
_GUICtrlHeader_SetItemDisplay ($hHeader, 0, 1 + 2 + 8)

; Show column 1 display
MemoWrite("Column 1 display: " & _GUICtrlHeader_GetItemDisplay ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemFlags

Function Reference

_GUICtrlHeader_GetItemFlags

Returns the item flag information

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemFlags($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item flag information:
1 - Displays an image from an image list
2 - Text reads in the opposite direction from the text in the parent window
4 - Draws a down arrow on this item
8 - Draws a up arrow on this item

Remarks

None.

Related

_GUICtrlHeader_SetItemFlags

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 flags
_GUICtrlHeader_SetItemFlags ($hHeader, 0, 4)

; Show column 1 flags
MemoWrite("Column 1 flags: " & _GUICtrlHeader_GetItemFlags ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemFormat

Function Reference

_GUICtrlHeader_GetItemFormat

Returns the format of the item

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemFormat($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item format:
HDF_CENTER - The item's contents are centered
HDF_LEFT - The item's contents are left-aligned.
HDF_RIGHT - The item's contents are right-aligned.
HDF_BITMAP - The item displays a bitmap.
HDF_BITMAP_ON_RIGHT - The bitmap appears to the right of text.
HDF_OWNERDRAW - The control's owner draws the item.
HDF_STRING - The item displays a string.
HDF_IMAGE - Display an image from an image list
HDF_RTLREADING - Text will read in the opposite direction
HDF_SORTDOWN - Draw a down-arrow on this item
HDF_SORTUP - Draw an up-arrow on this item

Remarks

None.

Related

_GUICtrlHeader_SetItemFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 format
_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_CENTER, $HDF_STRING))

; Show column 1 format
MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

Sleep(1000)

; Reset column 1 format
_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_LEFT, $HDF_STRING, $HDF_IMAGE))

; Show column 1 format
MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemImage

Function Reference

_GUICtrlHeader_GetItemImage

Retrieves the index of an image within the image list

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Zero based index of the image

Remarks

None.

Related

_GUICtrlHeader_SetItemImage

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column 1 image
MemoWrite("Column 1 image: " & _GUICtrlHeader_GetItemImage ($hHeader, 0))

Sleep(1000)

; Set column 1 image
_GUICtrlHeader_SetItemImage ($hHeader, 0, 2)

; Show column 1 image
MemoWrite("Column 1 image: " & _GUICtrlHeader_GetItemImage ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemOrder

Function Reference

_GUICtrlHeader_GetItemOrder

Retrieves the order in which the item appears

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemOrder($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Zero based item order

Remarks

None.

Related

_GUICtrlHeader_SetItemOrder

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 order
_GUICtrlHeader_SetItemOrder ($hHeader, 0, 3)

; Show column 1 order
MemoWrite("Column 1 order: " & _GUICtrlHeader_GetItemOrder ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemParam

Function Reference

_GUICtrlHeader_GetItemParam

Retrieves the param value of the item

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemParam($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item param value

Remarks

None.

Related

_GUICtrlHeader_SetItemParam

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 param
_GUICtrlHeader_SetItemParam ($hHeader, 0, 1234)

; Show column 1 param
MemoWrite("Column 1 param: " & _GUICtrlHeader_GetItemParam ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemRect

Function Reference

_GUICtrlHeader_GetItemRect

Retrieves the bounding rectangle for a given item

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemRect($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlHeader_GetItemRectEx

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $aRect

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column 1 rectangle
$aRect = _GUICtrlHeader_GetItemRect ($hHeader, 0)
MemoWrite("Column 1 left .: " & $aRect[0])
MemoWrite("Column 1 top ..: " & $aRect[1])
MemoWrite("Column 1 right : " & $aRect[2])
MemoWrite("Column 1 bottom: " & $aRect[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemRectEx

Function Reference

_GUICtrlHeader_GetItemRectEx

Retrieves the bounding rectangle for a given item

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemRectEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: $tagRECT structure that receives the bounding rectangle

Remarks

None.

Related

_GUICtrlHeader_GetItemRect

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $tRect

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column 1 rectangle
$tRect = _GUICtrlHeader_GetItemRectEx ($hHeader, 0)
MemoWrite("Column 1 left .: " & DllStructGetData($tRect, "Left"))
MemoWrite("Column 1 top ..: " & DllStructGetData($tRect, "Top"))
MemoWrite("Column 1 right : " & DllStructGetData($tRect, "Right"))
MemoWrite("Column 1 bottom: " & DllStructGetData($tRect, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemText

Function Reference

_GUICtrlHeader_GetItemText

Retrieves the item text

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemText($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Item text

Remarks

None.

Related

_GUICtrlHeader_SetItemText

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 text
_GUICtrlHeader_SetItemText ($hHeader, 0, "Column X")

; Show column 1 text
MemoWrite("Column 1 text: " & _GUICtrlHeader_GetItemText ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetItemWidth

Function Reference

_GUICtrlHeader_GetItemWidth

Retrieves the item's width

#Include <GuiHeader.au3>
_GUICtrlHeader_GetItemWidth($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index

Return Value

Success: Width of the item

Remarks

None.

Related

_GUICtrlHeader_SetItemWidth

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 width
_GUICtrlHeader_SetItemWidth ($hHeader, 0, 80)

; Show column 1 width
MemoWrite("Column 1 width: " & _GUICtrlHeader_GetItemWidth ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetOrderArray

Function Reference

_GUICtrlHeader_GetOrderArray

Retrieves the current left-to-right order of items in a header control

#Include <GuiHeader.au3>
_GUICtrlHeader_GetOrderArray($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - Number of items in array
[1] - Item index 1
[2] - Item index 2
[n] - Item index n

Remarks

None.

Related

_GUICtrlHeader_SetOrderArray

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $aOrder[5] = [4, 3, 1, 2, 0]

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set order array
_GUICtrlHeader_SetOrderArray ($hHeader, $aOrder)

; Show order array
$aOrder = _GUICtrlHeader_GetOrderArray ($hHeader)
For $iI = 0 To $aOrder[0]
MemoWrite("Order " & $iI & ": " & $aOrder[$iI])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_GetUnicodeFormat

Function Reference

_GUICtrlHeader_GetUnicodeFormat

Retrieves the Unicode character format flag for the control

#Include <GuiHeader.au3>
_GUICtrlHeader_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Control uses Unicode characters
False: Control uses ANSI characters

Remarks

None.

Related

_GUICtrlHeader_SetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show Unicode format
MemoWrite("Using Unicode characters: " & _GUICtrlHeader_GetUnicodeFormat ($hHeader))

; Set Unicode format
_GUICtrlHeader_SetUnicodeFormat ($hHeader, True)

; Show Unicode format
MemoWrite("Using Unicode characters: " & _GUICtrlHeader_GetUnicodeFormat ($hHeader))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_HitTest

Function Reference

_GUICtrlHeader_HitTest

Tests a point to determine which item is at the specified point

#Include <GuiHeader.au3>
_GUICtrlHeader_HitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to control
$iX | X position to test
$iY | Y position to text

Return Value

Success: Array with the following format:
[ 0] - Zero based index of the item at the specified position, or -1 if no item was found
[ 1] - If True, position is in control's client window but not on an item
[ 2] - If True, position is in the control's bounding rectangle
[ 3] - If True, position is on the divider between two items
[ 4] - If True, position is on the divider of an item that has a zero width
[ 5] - If True, position is over the filter area
[ 6] - If True, position is on the filter button
[ 7] - If True, position is above the control's bounding rectangle
[ 8] - If True, position is below the control's bounding rectangle
[ 9] - If True, position is to the right of the control's bounding rectangle
[10] - If True, position is to the left of the control's bounding rectangle

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $aHT

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Do a hit test on column 2
$aHT = _GUICtrlHeader_HitTest ($hHeader, 110, 10)
MemoWrite("Item index ...................: " & $aHT[ 0])
MemoWrite("In client window .............: " & $aHT[ 1])
MemoWrite("In control rectangle .........: " & $aHT[ 2])
MemoWrite("On divider ...................: " & $aHT[ 3])
MemoWrite("On zero width divider ........: " & $aHT[ 4])
MemoWrite("Over filter area .............: " & $aHT[ 5])
MemoWrite("Over filter button ...........: " & $aHT[ 6])
MemoWrite("Above bounding rectangle .....: " & $aHT[ 7])
MemoWrite("Below bounding rectangle .....: " & $aHT[ 8])
MemoWrite("To right of bounding rectangle: " & $aHT[ 9])
MemoWrite("To left of bounding rectangle : " & $aHT[10])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_InsertItem

Function Reference

_GUICtrlHeader_InsertItem

Inserts a new header item

#Include <GuiHeader.au3>
_GUICtrlHeader_InsertItem($hWnd, $iIndex, $sText[, $iWidth = 50[, $iAlign = 0[, $iImage = -1[, $fOnRight = False]]]])

Parameters

$hWnd | Handle to control
$iIndex | Index of the item after which the new item is to be inserted. The new item is inserted at the end of the control if index is greater than or equal to the number of items in the control. If index is zero, the new item is inserted at the beginning of the control.
$sText | Item text
$iWidth | [optional] Item width
$iAlign | [optional] Text alignment: 0 - Text is left-aligned 1 - Text is right-aligned 2 - Text is centered
$iImage | [optional] Zero based index of an image within the image list
$fOnRight | [optional] If True, the column image appears to the right of text

Return Value

Success: | The index of the new item
Failure: | -1

Remarks

None.

Related

_GUICtrlHeader_AddItem, _GUICtrlHeader_DeleteItem

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)

; Insert new column
_GUICtrlHeader_InsertItem ($hHeader, 1, "Column X", 100, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_Layout

Function Reference

_GUICtrlHeader_Layout

Retrieves the correct size and position of the control

#Include <GuiHeader.au3>
_GUICtrlHeader_Layout($hWnd, ByRef $tRect)

Parameters

$hWnd | Handle to control
$tRect | $tagRECT structure that contains the rectangle the control will occupy.

Return Value

Success: $tagWINDOWPOS structure that contains the control size and position

Remarks

None.

Related

$tagRECT, $tagWINDOWPOS

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $tRect, $tPos

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Get header layout
$tRect = _WinAPI_GetClientRect ($hGUI)
$tPos = _GUICtrlHeader_Layout ($hHeader, $tRect)

; Show header layout
MemoWrite("Window handle .....: " & DllStructGetData($tPos, "hWnd"))
MemoWrite("Z order handle ....: " & DllStructGetData($tPos, "InsertAfter"))
MemoWrite("Horizontal position: " & DllStructGetData($tPos, "X"))
MemoWrite("Vertical position .: " & DllStructGetData($tPos, "Y"))
MemoWrite("Width .............: " & DllStructGetData($tPos, "CX"))
MemoWrite("Height ............: " & DllStructGetData($tPos, "CY"))
MemoWrite("Flags .............: " & DllStructGetData($tPos, "Flags"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_OrderToIndex

Function Reference

_GUICtrlHeader_OrderToIndex

Retrieves an index value for an item based on its order

#Include <GuiHeader.au3>
_GUICtrlHeader_OrderToIndex($hWnd, $iOrder)

Parameters

$hWnd | Handle to control
$iOrder | Order in which the item appears within the header control, from left to right

Return Value

Success: Returns the item index
Failure: iOrder

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show the index for order 3
MemoWrite("Order 3 index: " & _GUICtrlHeader_OrderToIndex ($hHeader, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetBitmapMargin

Function Reference

_GUICtrlHeader_SetBitmapMargin

Sets the width of the margin, specified in pixels, of a bitmap

#Include <GuiHeader.au3>
_GUICtrlHeader_SetBitmapMargin($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | Width, specified in pixels, of the bitmap margin

Return Value

Success: The previous bitmap margin width
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_GetBitmapMargin

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show current bitmap margin
MemoWrite("Current margin .: " & _GUICtrlHeader_GetBitmapMargin ($hHeader))

; Set new bitmap margin
_GUICtrlHeader_SetBitmapMargin ($hHeader, 8)

; Show new bitmap margin
MemoWrite("New margin .....: " & _GUICtrlHeader_GetBitmapMargin ($hHeader))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetFilterChangeTimeout

Function Reference

_GUICtrlHeader_SetFilterChangeTimeout

Sets the filter change timeout interval

#Include <GuiHeader.au3>
_GUICtrlHeader_SetFilterChangeTimeout($hWnd, $iTimeOut)

Parameters

$hWnd | Handle to control
$iTimeOut | Timeout value, in milliseconds

Return Value

Success: The index of the filter control being modified
Failure: 0

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set filter change timeout
_GUICtrlHeader_SetFilterChangeTimeout ($hHeader, 3000)

; Set up filters
_GUICtrlHeader_EditFilter ($hHeader, 0)
Send("Filter 1")
Sleep(1000)
Send("{ENTER}")
_GUICtrlHeader_EditFilter ($hHeader, 1)
Send("Filter 2")
Sleep(1000)
Send("{ENTER}")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_SetHotDivider

Function Reference

_GUICtrlHeader_SetHotDivider

Changes the hot divider color

#Include <GuiHeader.au3>
_GUICtrlHeader_SetHotDivider($hWnd, $iFlag, $iInputValue)

Parameters

$hWnd | Handle to control
$iFlag | Value specifying the type of value represented by $iInputValue. This value can be one of the following: True - Indicates that $iInputValue holds the client coordinates of the pointer False - Indicates that $iInputValue holds a divider index value
$iInputValue | Value interpreted by $iFlag

Return Value

Success: A value equal to the index of the divider that the control highlighted

Remarks

This function creates an effect that a header control automatically produces when it has the HDS_DRAGDROP
style. It is intended to be used when the owner of the control handles drag-and-drop operations manually.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hHeader, $iTicks, $iIndex, $begin

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Loop until user exits
Do
If TimerDiff($begin) > 500 Then
$iIndex = Mod($iIndex + 1, 4)
_GUICtrlHeader_SetHotDivider ($hHeader, False, $iIndex)
$begin = TimerInit()
EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlHeader_SetImageList

Function Reference

_GUICtrlHeader_SetImageList

Assigns an image list

#Include <GuiHeader.au3>
_GUICtrlHeader_SetImageList($hWnd, $hImage)

Parameters

$hWnd | Handle to control
$hImage | Handle to an image list

Return Value

Success: The handle to the image list previously associated with the control
Failure: 0

Remarks

None.

Related

_GUICtrlHeader_GetImageList

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show header information
MemoWrite("Image list handle ....: " & "0x" & Hex(_GUICtrlHeader_GetImageList ($hHeader)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItem

Function Reference

_GUICtrlHeader_SetItem

Sets information about an item

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItem($hWnd, $iIndex, ByRef $tItem)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$tItem | DllStructCreate($tagHDITEM) structure

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItem, $tagHDITEM

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage, $tItem

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 3 image index
$tItem = DllStructCreate($tagHDITEM)
DllStructSetData($tItem, "Mask", $HDI_IMAGE)
DllStructSetData($tItem, "Image", 0)
_GUICtrlHeader_SetItem ($hHeader, 2, $tItem)

; Show column 3 image index
$tItem = DllStructCreate($tagHDITEM)
DllStructSetData($tItem, "Mask", $HDI_IMAGE)
_GUICtrlHeader_GetItem ($hHeader, 2, $tItem)
MemoWrite("Column 3 image index: " & DllStructGetData($tItem, "Image"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemAlign

Function Reference

_GUICtrlHeader_SetItemAlign

Sets the item text alignment

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemAlign($hWnd, $iIndex, $iAlign)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iAlign | Text alignment: 0 - Text is left-aligned 1 - Text is right-aligned 2 - Text is centered

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemAlign

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Reset column 1 alignment
_GUICtrlHeader_SetItemAlign ($hHeader, 0, 2)

; Show column 1 alignment
MemoWrite("Column 1 alignment: " & _GUICtrlHeader_GetItemAlign ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemBitmap

Function Reference

_GUICtrlHeader_SetItemBitmap

Sets the item bitmap handle

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemBitmap($hWnd, $iIndex, $hBmp)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$hBmp | Item bitmap handle

Return Value

Success: True
Failure: False

Remarks

After calling this function, make sure you call _GUICtrlHeader_SetItemDisplay to set the items display information

Related

_GUICtrlHeader_GetItemBitmap, _GUICtrlHeader_SetItemDisplay

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 4 bitmap
_GUICtrlHeader_SetItemBitmap ($hHeader, 3, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF00FF, 11, 11))
_GUICtrlHeader_SetItemDisplay ($hHeader, 3, 1 + 8)

; Show column 4 bitmap handle
MemoWrite("Column 4 bitmap handle: " & "0x" & Hex(_GUICtrlHeader_GetItemBitmap ($hHeader, 3)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemDisplay

Function Reference

_GUICtrlHeader_SetItemDisplay

Returns the item display information

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemDisplay($hWnd, $iIndex, $iDisplay)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iDisplay | Item display information. Can be a combination of the following: 1 - The item displays a bitmap 2 - The bitmap appears to the right of text 4 - The control's owner draws the item 8 - The item displays a string

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemDisplay, _GUICtrlHeader_SetItemBitmap

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 bitmap
_GUICtrlHeader_SetItemBitmap ($hHeader, 0, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF00FF, 11, 11))

; Set column 1 display
_GUICtrlHeader_SetItemDisplay ($hHeader, 0, 1 + 2 + 8)

; Show column 1 display
MemoWrite("Column 1 display: " & _GUICtrlHeader_GetItemDisplay ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemFlags

Function Reference

_GUICtrlHeader_SetItemFlags

Returns the item flag information

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemFlags($hWnd, $iIndex, $iFlags)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iFlags | Item flag information. Can be a combination of the following: 1 - Displays an image from an image list 2 - Text reads in the opposite direction from the text in the parent window 4 - Draws a down arrow on this item 8 - Draws a up arrow on this item

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemFlags

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 flags
_GUICtrlHeader_SetItemFlags ($hHeader, 0, 4)

; Show column 1 flags
MemoWrite("Column 1 flags: " & _GUICtrlHeader_GetItemFlags ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemFormat

Function Reference

_GUICtrlHeader_SetItemFormat

Sets the format of the item

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemFormat($hWnd, $iIndex, $iFormat)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iFormat | Combination of the following format identifiers: $HDF_CENTER - The item's contents are centered $HDF_LEFT - The item's contents are left-aligned $HDF_RIGHT - The item's contents are right-aligned $HDF_BITMAP - The item displays a bitmap $HDF_BITMAP_ON_RIGHT - The bitmap appears to the right of text $HDF_OWNERDRAW - The header control's owner draws the item $HDF_STRING - The item displays a string $HDF_IMAGE - Display an image from an image list $HDF_RTLREADING - Text will read in the opposite direction from the text in the parent window $HDF_SORTDOWN - Draws a down-arrow on this item (Windows XP and above) $HDF_SORTUP - Draws an up-arrow on this item (Windows XP and above)

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 format
_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_CENTER, $HDF_STRING))

; Show column 1 format
MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

Sleep(1000)

; Reset column 1 format
_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_LEFT, $HDF_STRING, $HDF_IMAGE))

; Show column 1 format
MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemImage

Function Reference

_GUICtrlHeader_SetItemImage

Sets the index of an image within the image list

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iImage | Zero based image index

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemImage

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $hImage

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create (11, 11)
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
_GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
_GUICtrlHeader_SetImageList ($hHeader, $hImage)

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show column 1 image
MemoWrite("Column 1 image: " & _GUICtrlHeader_GetItemImage ($hHeader, 0))

Sleep(1000)

; Set column 1 image
_GUICtrlHeader_SetItemImage ($hHeader, 0, 2)

; Show column 1 image
MemoWrite("Column 1 image: " & _GUICtrlHeader_GetItemImage ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemOrder

Function Reference

_GUICtrlHeader_SetItemOrder

Sets the order in which the item appears

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemOrder($hWnd, $iIndex, $iOrder)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iOrder | Zero based item order

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemOrder

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 order
_GUICtrlHeader_SetItemOrder ($hHeader, 0, 3)

; Show column 1 order
MemoWrite("Column 1 order: " & _GUICtrlHeader_GetItemOrder ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemParam

Function Reference

_GUICtrlHeader_SetItemParam

Sets the param value of the item

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemParam($hWnd, $iIndex, $iParam)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iParam | Item param value

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemParam

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 param
_GUICtrlHeader_SetItemParam ($hHeader, 0, 1234)

; Show column 1 param
MemoWrite("Column 1 param: " & _GUICtrlHeader_GetItemParam ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemText

Function Reference

_GUICtrlHeader_SetItemText

Sets the item text

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemText($hWnd, $iIndex, $sText)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$sText | New item text

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemText

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 text
_GUICtrlHeader_SetItemText ($hHeader, 0, "Column X")

; Show column 1 text
MemoWrite("Column 1 text: " & _GUICtrlHeader_GetItemText ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetItemWidth

Function Reference

_GUICtrlHeader_SetItemWidth

Sets the item's width

#Include <GuiHeader.au3>
_GUICtrlHeader_SetItemWidth($hWnd, $iIndex, $iWidth)

Parameters

$hWnd | Handle to control
$iIndex | Zero based item index
$iWidth | New width for item

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetItemWidth

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set column 1 width
_GUICtrlHeader_SetItemWidth ($hHeader, 0, 80)

; Show column 1 width
MemoWrite("Column 1 width: " & _GUICtrlHeader_GetItemWidth ($hHeader, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetOrderArray

Function Reference

_GUICtrlHeader_SetOrderArray

Sets the current left-to-right order of items

#Include <GuiHeader.au3>
_GUICtrlHeader_SetOrderArray($hWnd, ByRef $aOrder)

Parameters

$hWnd | Handle to control
$aOrder | Array that specifies the index values for items in the header: [0] - Number of items in array [1] - Item index 1 [2] - Item index 2 [n] - Item index n

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlHeader_GetOrderArray

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader, $aOrder[5] = [4, 3, 1, 2, 0]

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Set order array
_GUICtrlHeader_SetOrderArray ($hHeader, $aOrder)

; Show order array
$aOrder = _GUICtrlHeader_GetOrderArray ($hHeader)
For $iI = 0 To $aOrder[0]
MemoWrite("Order " & $iI & ": " & $aOrder[$iI])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlHeader_SetUnicodeFormat

Function Reference

_GUICtrlHeader_SetUnicodeFormat

Sets the Unicode character format flag for the control

#Include <GuiHeader.au3>
_GUICtrlHeader_SetUnicodeFormat($hWnd, $fUnicode)

Parameters

$hWnd | Handle to control
$fUnicode | Unicode flag: True - Control uses Unicode characters False - Control uses ANSI characters

Return Value

Success: The previous Unicode format flag

Remarks

None.

Related

_GUICtrlHeader_GetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hHeader

; Create GUI
$hGUI = GUICreate("Header", 400, 300)
$hHeader = _GUICtrlHeader_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Add columns
_GUICtrlHeader_AddItem ($hHeader, "Column 1", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 2", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 3", 100)
_GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

; Show Unicode format
MemoWrite("Using Unicode characters: " & _GUICtrlHeader_GetUnicodeFormat ($hHeader))

; Set Unicode format
_GUICtrlHeader_SetUnicodeFormat ($hHeader, True)

; Show Unicode format
MemoWrite("Using Unicode characters: " & _GUICtrlHeader_GetUnicodeFormat ($hHeader))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

GuiImageList user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiImageList.au3>.

User Defined Function | Description
_GUIImageList_Add | Adds an image or images to an image list
_GUIImageList_AddBitmap | Adds a bitmap to an image list
_GUIImageList_AddIcon | Adds an icon to an image list
_GUIImageList_AddMasked | Adds an image or images to an image list, generating a mask from the specified bitmap
_GUIImageList_BeginDrag | Begins dragging an image
_GUIImageList_Copy | Source image is copied to the destination image's index
_GUIImageList_Create | Create an ImageList control
_GUIImageList_Destroy | Destroys an image list
_GUIImageList_DestroyIcon | Destroys an icon and frees any memory the icon occupied
_GUIImageList_DragEnter | Displays the drag image at the specified position within the window
_GUIImageList_DragLeave | Unlocks the specified window and hides the drag image, allowing the window to be updated
_GUIImageList_DragMove | Moves the image that is being dragged during a drag-and-drop operation
_GUIImageList_Draw | Draws an image list item in the specified device context
_GUIImageList_DrawEx | Draws an image list item in the specified device context
_GUIImageList_Duplicate | Creates a duplicate of an existing image list
_GUIImageList_EndDrag | Ends a drag operation
_GUIImageList_GetBkColor | Retrieves the current background color for an image list
_GUIImageList_GetIcon | Creates an icon from an image and mask in an image list
_GUIImageList_GetIconHeight | Retrieves the height of the images in an image list
_GUIImageList_GetIconSize | Retrieves the dimensions of images in an image list
_GUIImageList_GetIconSizeEx | Retrieves the dimensions of images in an image list
_GUIImageList_GetIconWidth | Retrieves the width of the images in an image list
_GUIImageList_GetImageCount | Retrieves the number of images in an image list
_GUIImageList_GetImageInfoEx | Retrieves information about an image
_GUIImageList_Remove | Remove Image(s) from the ImageList
_GUIImageList_ReplaceIcon | Replaces an image with an icon or cursor
_GUIImageList_SetBkColor | Sets the background color for an image list
_GUIImageList_SetIconSize | Sets the dimensions of images in an image list and removes all images from the list
_GUIImageList_SetImageCount | Resizes an existing image list
_GUIImageList_Swap | Source image is copied to the destination image's index


Function _GUIImageList_Add

Function Reference

_GUIImageList_Add

Adds an image or images to an image list

#Include <GuiImageList.au3>
_GUIImageList_Add($hWnd, $hImage[, $hMask=0])

Parameters

$hWnd | Handle to the control
$hImage | Handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap.
$hMask | [optional] Handle to the bitmap that contains the mask

Return Value

Success: | The index of the first new image
Failure: | -1

Remarks

This function copies the bitmap to an internal data structure. Be sure to use the _WinAPI_DeleteObject function
to delete hImage and hMask after the function returns.

Related

_GUIImageList_AddMasked, _GUIImageList_AddBitmap, _GUIImageList_AddIcon

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Add", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 11, 11))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 11, 11))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x0000FF, 11, 11))
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_AddBitmap

Function Reference

_GUIImageList_AddBitmap

Adds a bitmap to an image list

#Include <GuiImageList.au3>
_GUIImageList_AddBitmap($hWnd, $sImage[, $sMask=""])

Parameters

$hWnd | Handle to the control
$sImage | Path to the bitmap that contains the image
$sMask | [optional] Path to the bitmap that contains the mask

Return Value

Success: | The index of the image
Failure: | -1

Remarks

None.

Related

_GUIImageList_Add, _GUIImageList_AddIcon

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images"

GUICreate("ImageList AddBitmap", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 32)
_GUIImageList_AddBitmap($hImage, $sPath & "\Red.bmp")
_GUIImageList_AddBitmap($hImage, $sPath & "\Green.bmp")
_GUIImageList_AddBitmap($hImage, $sPath & "\Blue.bmp")
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_AddIcon

Function Reference

_GUIImageList_AddIcon

Adds an icon to an image list

#Include <GuiImageList.au3>
_GUIImageList_AddIcon($hWnd, $sFile[, $iIndex=0[, $fLarge = False])

Parameters

$hWnd | Handle to the control
$sFile | Path to the icon that contains the image
$iIndex | [optional] Specifies the zero-based index of the icon to extract
$fLarge | [optional] Extract Large Icon

Return Value

Success: | The index of the image
Failure: | -1

Remarks

None.

Related

_GUIImageList_Add, _GUIImageList_AddBitmap

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList AddIcon", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_AddMasked

Function Reference

_GUIImageList_AddMasked

Adds an image or images to an image list, generating a mask from the specified bitmap

#Include <GuiImageList.au3>
_GUIImageList_AddMasked($hWnd, $hImage[, $iMask=0])

Parameters

$hWnd | Handle to the control
$hImage | Handle to the bitmap that contains the image or images. The number of images is inferred from the width of the bitmap.
$iMask | [optional] Color used to generate the mask. Each pixel of this color in the specified bitmap is changed to black, and the corresponding bit in the mask is set to 1.

Return Value

Success: | The index of the first new image
Failure: | -1

Remarks

This function copies the bitmap to an internal data structure. Be sure to use the _WinAPI_DeleteObject function
to delete hImage after the function returns. Bitmaps with color depth greater than 8 bpp are not supported.

Related

_GUIImageList_Add

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage

GUICreate("ImageList AddMasked", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
GUISetState()

; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_AddMasked($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0xFF0000, 11, 11))
_GUIImageList_AddMasked($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x00FF00, 11, 11))
_GUIImageList_AddMasked($hImage, _GUICtrlListView_CreateSolidBitMap($listview, 0x0000FF, 11, 11))
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_BeginDrag

Function Reference

_GUIImageList_BeginDrag

Begins dragging an image

#Include <GuiImageList.au3>
_GUIImageList_BeginDrag($hWnd, $iTrack, $iXHotSpot, $iYHotSpot)

Parameters

$hWnd | Handle to the control
$iTrack | Index of the image to drag
$iXHotSpot | X coordinate of the location of the drag position relative to image upper left corner
$iYHotSpot | Y coordinate of the location of the drag position relative to image upper left corner

Return Value

Success: | True
Failure: | False

Remarks

This function creates a temporary image list that is used for dragging. In response to subsequent WM_MOUSEMOVE
messages, you can move the drag image by using the ImageList_DragMove function. To end the drag operation, you
can use the ImageList_EndDrag function.

Related

_GUIImageList_EndDrag, _GUIImageList_DragEnter

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
Opt("MustDeclareVars", 1)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

#region Globals *************************************************************************
Global $hDragImageList, $hListView, $bDragging = False, $LV_Height
Global $a_index[2] ; from and to

Global Const $DebugIt = 1

#endregion Globals *************************************************************************

Opt("WinTitleMatchMode", 2)

_Main()

Func _Main()
Local Const $image_width = 20
Local Const $image_height = 20
Local $himages, $main_GUI, $iIndex

$main_GUI = GUICreate("GuiImageList Begin Drag", 225, 400)

$hListView = _GUICtrlListView_Create($main_GUI, "Entry Name|Category", 5, 75, 220, 180, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$LV_Height = 180
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
;------------------------------------------------------
; Using subitem images
;------------------------------------------------------
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SUBITEMIMAGES))

;------------------------------------------------------
; create the image list
;------------------------------------------------------
$himages = _GUIImageList_Create($image_width, $image_height, 5, 1)
For $x = 1 To 21
_GUIImageList_AddIcon($himages, @SystemDir & "\shell32.dll", $x)
Next

_GUICtrlListView_SetImageList($hListView, $himages, $LVSIL_SMALL)

;------------------------------------------------------
;Register event functions
;------------------------------------------------------
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")

;------------------------------------------------------
; add listview items with images
;------------------------------------------------------
Local $y = 1
For $x = 0 To 9
$iIndex = _GUICtrlListView_AddItem($hListView, "Name " & $x + 1, $y) ; handle, string, image index
_GUICtrlListView_AddSubItem($hListView, $iIndex, "Category " & $x + 1, 1, $y + 1) ; handle, index, string, subitem, image index
$y += 2
Next

GUISetState()

While 1

Switch GUIGetMsg()

;-----------------------------------------------------------------------------------------
;This case statement exits and updates code if needed
Case $GUI_EVENT_CLOSE
ExitLoop
;-----------------------------------------------------------------------------------------
;put all the misc. stuff here
Case Else
;;;
EndSwitch
WEnd
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($himages)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
GUIDelete()
EndFunc ;==>_Main

#region Item Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVInsertItem($i_FromItem, $i_ToItem)
Local $item_state, $i_newIndex
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("wchar Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; Insert item into new position
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", 0)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(-1, -1, -1)
$item_state = DllStructGetData($struct_LVITEM, "State")
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
$i_newIndex = _GUICtrlListView_InsertItem($hListView, DllStructGetData($struct_String, "Buffer"), $i_ToItem, DllStructGetData($struct_LVITEM, "Image"))
If @error Then Return SetError(-1, -1, -1)

; restore previous state
If $DebugIt Then _DebugPrint("$i_newIndex = " & $i_newIndex)
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "Item", $i_newIndex)
DllStructSetData($struct_LVITEM, "State", $item_state)
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
_GUICtrlListView_SetItemState($hListView, $i_newIndex, $item_state, $LVIS_STATEIMAGEMASK)
If @error Then Return SetError(-1, -1, -1)
Return $i_newIndex
EndFunc ;==>_LVInsertItem
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVCopyItem($i_FromItem, $i_ToItem, $i_SubItem = 0)
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("wchar Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; get from item info
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", $i_SubItem)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)

; set to
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
; set text
DllStructSetData($struct_LVITEM, "Mask", $LVIF_TEXT)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(@error, @error, @error)
; set status
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set image
DllStructSetData($struct_LVITEM, "Mask", $LVIF_IMAGE)
DllStructSetData($struct_LVITEM, "State", $LVIF_IMAGE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set state
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "State", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set indent
DllStructSetData($struct_LVITEM, "Mask", $LVIF_INDENT)
DllStructSetData($struct_LVITEM, "State", $LVIF_INDENT)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set Param
DllStructSetData($struct_LVITEM, "Mask", $LVIF_PARAM)
DllStructSetData($struct_LVITEM, "State", $LVIF_PARAM)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
EndFunc ;==>_LVCopyItem
#endregion Item Function(s) **********************************************************************************************

#region Event Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_MOUSEMOVE event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
;------------------------------------------------------
; not dragging item we are done here
;------------------------------------------------------
If $bDragging = False Then Return $GUI_RUNDEFMSG

;------------------------------------------------------
; update the image move
;------------------------------------------------------
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $y > $LV_Height - 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y)
ElseIf $y < 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y * - 1)
EndIf
_GUIImageList_DragMove($x, $y)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_MOUSEMOVE
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_LBUTTONUP event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_LBUTTONUP($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
$bDragging = False
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $DebugIt Then _DebugPrint("$x = " & $x)
If $DebugIt Then _DebugPrint("$y = " & $y)
;------------------------------------------------------
; done dragging
;------------------------------------------------------
_GUIImageList_DragLeave($hListView)
_GUIImageList_EndDrag()
_GUIImageList_Destroy($hDragImageList[0])
_WinAPI_ReleaseCapture()
;------------------------------------------------------
; do hit test see if drag ended in the listview
;------------------------------------------------------
Local $struct_LVHITTESTINFO = DllStructCreate($tagLVHITTESTINFO)

DllStructSetData($struct_LVHITTESTINFO, "X", $x)
DllStructSetData($struct_LVHITTESTINFO, "Y", $y)
$a_index[1] = _SendMessage($hListView, $LVM_HITTEST, 0, DllStructGetPtr($struct_LVHITTESTINFO), 0, "wparam", "ptr")
Local $flags = DllStructGetData($struct_LVHITTESTINFO, "Flags")
If $DebugIt Then _DebugPrint("$flags: " & $flags)
;------------------------------------------------------
;~ // Out of the ListView?
;------------------------------------------------------
If $a_index[1] == -1 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
;~ // Not in an item?
;------------------------------------------------------
If BitAND($flags, $LVHT_ONITEMLABEL) == 0 And BitAND($flags, $LVHT_ONITEMSTATEICON) == 0 And BitAND($flags, $LVHT_ONITEMICON) = 0 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
; make sure insert is at least 2 items above or below, don't want to create a duplicate
;------------------------------------------------------
If $a_index[0] < $a_index[1] - 1 Or $a_index[0] > $a_index[1] + 1 Then
If $DebugIt Then _DebugPrint("To = " & $a_index[1])
Local $i_newIndex = _LVInsertItem($a_index[0], $a_index[1])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Local $From_index = $a_index[0]
If $a_index[0] > $a_index[1] Then $From_index = $a_index[0] + 1
;------------------------------------------------------
; copy item and subitem(s) images, text, and state
;------------------------------------------------------
For $x = 1 To _GUICtrlListView_GetColumnCount($hListView) - 1
_LVCopyItem($From_index, $i_newIndex, $x)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Next
;------------------------------------------------------
; delete from
;------------------------------------------------------
_GUICtrlListView_DeleteItem($hListView, $From_index)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_LBUTTONUP
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_NOTIFY event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $code, $x, $y, $tNMLISTVIEW, $hwndFrom, $tDraw, $dwDrawStage, $dwItemSpec
$tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$code = DllStructGetData($tNMHDR, "Code")
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
Switch $hwndFrom
Case $hListView
Switch $code
Case $LVN_BEGINDRAG
If $DebugIt Then _DebugPrint("$LVN_BEGINDRAG")
$x = BitAND($lParam, 0xFFFF)
$y = BitShift($lParam, 16)
$tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam)
$a_index[0] = DllStructGetData($tNMLISTVIEW, "Item")
$hDragImageList = _GUICtrlListView_CreateDragImage($hListView, $a_index[0])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_BeginDrag($hDragImageList[0], 0, 0, 0)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
If $DebugIt Then _DebugPrint("From = " & $a_index[0])
_GUIImageList_DragEnter($hListView, $x, $y)
_WinAPI_SetCapture($hWndGUI)
$bDragging = True
Case $NM_CUSTOMDRAW
If $DebugIt Then _DebugPrint("$NM_CUSTOMDRAW")
$tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
$dwDrawStage = DllStructGetData($tDraw, "dwDrawStage")
$dwItemSpec = DllStructGetData($tDraw, "dwItemSpec")
Switch $dwDrawStage
Case $CDDS_PREPAINT
If $DebugIt Then _DebugPrint("$CDDS_PREPAINT")
Return $CDRF_NOTIFYITEMDRAW
Case $CDDS_ITEMPREPAINT
If $DebugIt Then _DebugPrint("$CDDS_ITEMPREPAINT")
If BitAND($dwItemSpec, 1) = 1 Then
DllStructSetData($tDraw, "clrTextBk", $CLR_AQUA)
Else
DllStructSetData($tDraw, "clrTextBk", $CLR_WHITE)
EndIf
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#endregion Event Function(s) **********************************************************************************************

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_Copy

Function Reference

_GUIImageList_Copy

Source image is copied to the destination image's index

#Include <GuiImageList.au3>
_GUIImageList_Copy($hWnd, $iSource, $iDestination)

Parameters

$hWnd | Handle to the control
$iSource | The zero-based index of the image to be used as the source of the copy operation
$iDestination | The zero-based index of the image to be used as the destination of the copy operation

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_Swap

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $AutoItDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir")

GUICreate("ImageList Copy", 410, 300)
$listview = GUICtrlCreateListView("", 2, 2, 404, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create(11, 11)
ConsoleWrite(_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype1.ico") & @LF)
ConsoleWrite(_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype2.ico") & @LF)
ConsoleWrite(_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype3.ico") & @LF)
ConsoleWrite(_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype3.ico") & @LF)
_GUIImageList_Copy($hImage, 0, 3)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 100, 1, 0, True)
_GUICtrlListView_AddColumn($listview, "Column 2", 100, 0, 1, True)
_GUICtrlListView_AddColumn($listview, "Column 3", 100, 2, 2, True)
_GUICtrlListView_AddColumn($listview, "Column 4", 100, 0, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_Create

Function Reference

_GUIImageList_Create

Create an ImageList control

#Include <GuiImageList.au3>
_GUIImageList_Create([$iCX=16[, $iCY=16[, $iColor=4[, $iOptions=0[, $iInitial=4[, $iGrow=4]]]]]])

Parameters

$iCX | [optional] Width, in pixels, of each image
$iCY | [optional] Height, in pixels, of each image
$iColor | [optional] Image color depth: 0 - Use the default behavior 1 - Use a 4 bit DIB section 2 - Use a 8 bit DIB section 3 - Use a 16 bit DIB section 4 - Use a 24 bit DIB section 5 - Use a 32 bit DIB section 6 - Use a device-dependent bitmap
$iOptions | [optional] Option flags. Can be a combination of the following: 1 - Use a mask 2 - The images in the lists are mirrored 4 - The image list contains a strip of images
$iInitial | [optional] Number of images that the image list initially contains
$iGrow | [optional] Number of images by which the image list can grow when the system needs to make room for new images. This parameter represents the number of new images that the resized image list can contain.

Return Value

Success: | Handle to the new control
Failure: | 0

Remarks

None.

Related

_GUIImageList_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Create", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0xFF0000, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x00FF00, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x0000FF, 11, 11))
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_Destroy

Function Reference

_GUIImageList_Destroy

Destroys an image list

#Include <GuiImageList.au3>
_GUIImageList_Destroy($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage1, $hImage2
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Destroy", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage1 = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage1, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0xFF0000, 11, 11))
_GUIImageList_Add($hImage1, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x00FF00, 11, 11))
_GUIImageList_Add($hImage1, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x0000FF, 11, 11))
_GUICtrlListView_SetImageList($listview, $hImage1, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Items", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Item 1", 0)
_GUICtrlListView_AddItem($listview, "Item 2", 1)
_GUICtrlListView_AddItem($listview, "Item 3", 2)

MsgBox(4160, "Information", "Creating new image list")

; Create a new image list
$hImage2 = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage2, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x0000FF, 11, 11))
_GUIImageList_Add($hImage2, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x00FF00, 11, 11))
_GUIImageList_Add($hImage2, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0xFF0000, 11, 11))
_GUICtrlListView_SetImageList($listview, $hImage2, 1)

MsgBox(4160, "Information", "Destroying 1st image list")

; Free first image list
_GUIImageList_Destroy($hImage1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_DestroyIcon

Function Reference

_GUIImageList_DestroyIcon

Destroys an icon and frees any memory the icon occupied

#Include <GuiImageList.au3>
_GUIImageList_DestroyIcon($hIcon)

Parameters

$hIcon Handle to the icon

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hStatus, $iMemo

_Main()

Func _Main()

Local $hGUI, $hIcons[2], $hImage
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("ImageList Destroy Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Set parts
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0xFF0000, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0x00FF00, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0x0000FF, 11, 11))

; Set icons
$hIcons[0] = _GUIImageList_GetIcon($hImage, 1)
$hIcons[1] = _GUIImageList_GetIcon($hImage, 2)
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon($hStatus, 1, $hIcons[1])

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex($hIcons[0]))
MemoWrite("Part 2 icon handle .: 0x" & Hex($hIcons[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
MsgBox(4096, "Information", "Icon 1 Destroyed? " & _GUIImageList_DestroyIcon($hIcons[0]))
MsgBox(4096, "Information", "Icon 2 Destroyed? " & _GUIImageList_DestroyIcon($hIcons[1]))
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hStatus
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $SBN_SIMPLEMODECHANGE ; Simple mode changes
_DebugPrint("$SBN_SIMPLEMODECHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_DragEnter

Function Reference

_GUIImageList_DragEnter

Displays the drag image at the specified position within the window

#Include <GuiImageList.au3>
_GUIImageList_DragEnter($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | The x-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area
$iY | The y-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_BeginDrag

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
Opt("MustDeclareVars", 1)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

#region Globals *************************************************************************
Global $hDragImageList, $hListView, $bDragging = False, $LV_Height
Global $a_index[2] ; from and to

Global Const $DebugIt = 1

#endregion Globals *************************************************************************

Opt("WinTitleMatchMode", 2)

_Main()

Func _Main()
Local Const $image_width = 20
Local Const $image_height = 20
Local $himages, $main_GUI, $iIndex

$main_GUI = GUICreate("GuiImageList", 225, 400)

$hListView = _GUICtrlListView_Create($main_GUI, "Entry Name|Category", 5, 75, 220, 280, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$LV_Height = 280 - 75
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
;------------------------------------------------------
; Using subitem images
;------------------------------------------------------
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SUBITEMIMAGES))

;------------------------------------------------------
; create the image list
;------------------------------------------------------
$himages = _GUIImageList_Create($image_width, $image_height, 5, 1)
For $x = 1 To 21
_GUIImageList_AddIcon($himages, @SystemDir & "\shell32.dll", $x)
Next

_GUICtrlListView_SetImageList($hListView, $himages, $LVSIL_SMALL)

;------------------------------------------------------
;Register event functions
;------------------------------------------------------
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")

;------------------------------------------------------
; add listview items with images
;------------------------------------------------------
Local $y = 1
For $x = 0 To 9
$iIndex = _GUICtrlListView_AddItem($hListView, "Name " & $x + 1, $y) ; handle, string, image index
_GUICtrlListView_AddSubItem($hListView, $iIndex, "Category " & $x + 1, 1, $y + 1) ; handle, index, string, subitem, image index
$y += 2
Next

GUISetState()

While 1

Switch GUIGetMsg()

;-----------------------------------------------------------------------------------------
;This case statement exits and updates code if needed
Case $GUI_EVENT_CLOSE
ExitLoop
;-----------------------------------------------------------------------------------------
;put all the misc. stuff here
Case Else
;;;
EndSwitch
WEnd
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($himages)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
GUIDelete()
EndFunc ;==>_Main

#region Item Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVInsertItem($i_FromItem, $i_ToItem)
Local $item_state, $i_newIndex
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; Insert item into new position
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", 0)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(-1, -1, -1)
$item_state = DllStructGetData($struct_LVITEM, "State")
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
$i_newIndex = _GUICtrlListView_InsertItem($hListView, DllStructGetData($struct_String, "Buffer"), $i_ToItem, DllStructGetData($struct_LVITEM, "Image"))
If @error Then Return SetError(-1, -1, -1)

; restore previous state
If $DebugIt Then _DebugPrint("$i_newIndex = " & $i_newIndex)
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "Item", $i_newIndex)
DllStructSetData($struct_LVITEM, "State", $item_state)
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
_GUICtrlListView_SetItemState($hListView, $i_newIndex, $item_state, $LVIS_STATEIMAGEMASK)
If @error Then Return SetError(-1, -1, -1)
Return $i_newIndex
EndFunc ;==>_LVInsertItem
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVCopyItem($i_FromItem, $i_ToItem, $i_SubItem = 0)
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; get from item info
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", $i_SubItem)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)

; set to
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
; set text
DllStructSetData($struct_LVITEM, "Mask", $LVIF_TEXT)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(@error, @error, @error)
; set status
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set image
DllStructSetData($struct_LVITEM, "Mask", $LVIF_IMAGE)
DllStructSetData($struct_LVITEM, "State", $LVIF_IMAGE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set state
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "State", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set indent
DllStructSetData($struct_LVITEM, "Mask", $LVIF_INDENT)
DllStructSetData($struct_LVITEM, "State", $LVIF_INDENT)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set Param
DllStructSetData($struct_LVITEM, "Mask", $LVIF_PARAM)
DllStructSetData($struct_LVITEM, "State", $LVIF_PARAM)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
EndFunc ;==>_LVCopyItem
#endregion Item Function(s) **********************************************************************************************

#region Event Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_MOUSEMOVE event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
;------------------------------------------------------
; not dragging item we are done here
;------------------------------------------------------
If $bDragging = False Then Return $GUI_RUNDEFMSG

;------------------------------------------------------
; update the image move
;------------------------------------------------------
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $y > $LV_Height - 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y)
ElseIf $y < 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y * - 1)
EndIf
_GUIImageList_DragMove($x, $y)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_MOUSEMOVE
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_LBUTTONUP event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_LBUTTONUP($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
$bDragging = False
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $DebugIt Then _DebugPrint("$x = " & $x)
If $DebugIt Then _DebugPrint("$y = " & $y)
;------------------------------------------------------
; done dragging
;------------------------------------------------------
_GUIImageList_DragLeave($hListView)
_GUIImageList_EndDrag()
_GUIImageList_Destroy($hDragImageList[0])
_WinAPI_ReleaseCapture()
;------------------------------------------------------
; do hit test see if drag ended in the listview
;------------------------------------------------------
Local $struct_LVHITTESTINFO = DllStructCreate($tagLVHITTESTINFO)

DllStructSetData($struct_LVHITTESTINFO, "X", $x)
DllStructSetData($struct_LVHITTESTINFO, "Y", $y)
$a_index[1] = _SendMessage($hListView, $LVM_HITTEST, 0, DllStructGetPtr($struct_LVHITTESTINFO), 0, "wparam", "ptr")
Local $flags = DllStructGetData($struct_LVHITTESTINFO, "Flags")
If $DebugIt Then _DebugPrint("$flags: " & $flags)
;------------------------------------------------------
;~ // Out of the ListView?
;------------------------------------------------------
If $a_index[1] == -1 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
;~ // Not in an item?
;------------------------------------------------------
If BitAND($flags, $LVHT_ONITEMLABEL) == 0 And BitAND($flags, $LVHT_ONITEMSTATEICON) == 0 And BitAND($flags, $LVHT_ONITEMICON) = 0 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
; make sure insert is at least 2 items above or below, don't want to create a duplicate
;------------------------------------------------------
If $a_index[0] < $a_index[1] - 1 Or $a_index[0] > $a_index[1] + 1 Then
If $DebugIt Then _DebugPrint("To = " & $a_index[1])
Local $i_newIndex = _LVInsertItem($a_index[0], $a_index[1])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Local $From_index = $a_index[0]
If $a_index[0] > $a_index[1] Then $From_index = $a_index[0] + 1
;------------------------------------------------------
; copy item and subitem(s) images, text, and state
;------------------------------------------------------
For $x = 1 To _GUICtrlListView_GetColumnCount($hListView) - 1
_LVCopyItem($From_index, $i_newIndex, $x)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Next
;------------------------------------------------------
; delete from
;------------------------------------------------------
_GUICtrlListView_DeleteItem($hListView, $From_index)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_LBUTTONUP
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_NOTIFY event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $code, $x, $y, $tNMLISTVIEW, $hwndFrom, $tDraw, $dwDrawStage, $dwItemSpec
$tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$code = DllStructGetData($tNMHDR, "Code")
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
Switch $hwndFrom
Case $hListView
Switch $code
Case $LVN_BEGINDRAG
If $DebugIt Then _DebugPrint("$LVN_BEGINDRAG")
$x = BitAND($lParam, 0xFFFF)
$y = BitShift($lParam, 16)
$tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam)
$a_index[0] = DllStructGetData($tNMLISTVIEW, "Item")
$hDragImageList = _GUICtrlListView_CreateDragImage($hListView, $a_index[0])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
_GUIImageList_BeginDrag($hDragImageList[0], 0, 0, 0)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
If $DebugIt Then _DebugPrint("From = " & $a_index[0])
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_DragEnter($hListView, $x, $y)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_WinAPI_SetCapture($hWndGUI)
$bDragging = True
Case $NM_CUSTOMDRAW
If $DebugIt Then _DebugPrint("$NM_CUSTOMDRAW")
$tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
$dwDrawStage = DllStructGetData($tDraw, "dwDrawStage")
$dwItemSpec = DllStructGetData($tDraw, "dwItemSpec")
Switch $dwDrawStage
Case $CDDS_PREPAINT
If $DebugIt Then _DebugPrint("$CDDS_PREPAINT")
Return $CDRF_NOTIFYITEMDRAW
Case $CDDS_ITEMPREPAINT
If $DebugIt Then _DebugPrint("$CDDS_ITEMPREPAINT")
If BitAND($dwItemSpec, 1) = 1 Then
DllStructSetData($tDraw, "clrTextBk", $CLR_AQUA)
Else
DllStructSetData($tDraw, "clrTextBk", $CLR_WHITE)
EndIf
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#endregion Event Function(s) **********************************************************************************************

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_DragLeave

Function Reference

_GUIImageList_DragLeave

Unlocks the specified window and hides the drag image, allowing the window to be updated

#Include <GuiImageList.au3>
_GUIImageList_DragLeave($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_EndDrag

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
Opt("MustDeclareVars", 1)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

#region Globals *************************************************************************
Global $hDragImageList, $hListView, $bDragging = False, $LV_Height
Global $a_index[2] ; from and to

Global Const $DebugIt = 1

#endregion Globals *************************************************************************

Opt("WinTitleMatchMode", 2)

_Main()

Func _Main()
Local Const $image_width = 20
Local Const $image_height = 20
Local $himages, $main_GUI, $iIndex

$main_GUI = GUICreate("GuiImageList", 225, 400)

$hListView = _GUICtrlListView_Create($main_GUI, "Entry Name|Category", 5, 75, 220, 280, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$LV_Height = 280 - 75
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
;------------------------------------------------------
; Using subitem images
;------------------------------------------------------
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SUBITEMIMAGES))

;------------------------------------------------------
; create the image list
;------------------------------------------------------
$himages = _GUIImageList_Create($image_width, $image_height, 5, 1)
For $x = 1 To 21
_GUIImageList_AddIcon($himages, @SystemDir & "\shell32.dll", $x)
Next

_GUICtrlListView_SetImageList($hListView, $himages, $LVSIL_SMALL)

;------------------------------------------------------
;Register event functions
;------------------------------------------------------
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")

;------------------------------------------------------
; add listview items with images
;------------------------------------------------------
Local $y = 1
For $x = 0 To 9
$iIndex = _GUICtrlListView_AddItem($hListView, "Name " & $x + 1, $y) ; handle, string, image index
_GUICtrlListView_AddSubItem($hListView, $iIndex, "Category " & $x + 1, 1, $y + 1) ; handle, index, string, subitem, image index
$y += 2
Next

GUISetState()

While 1

Switch GUIGetMsg()

;-----------------------------------------------------------------------------------------
;This case statement exits and updates code if needed
Case $GUI_EVENT_CLOSE
ExitLoop
;-----------------------------------------------------------------------------------------
;put all the misc. stuff here
Case Else
;;;
EndSwitch
WEnd
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($himages)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
GUIDelete()
EndFunc ;==>_Main

#region Item Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVInsertItem($i_FromItem, $i_ToItem)
Local $item_state, $i_newIndex
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; Insert item into new position
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", 0)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(-1, -1, -1)
$item_state = DllStructGetData($struct_LVITEM, "State")
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
$i_newIndex = _GUICtrlListView_InsertItem($hListView, DllStructGetData($struct_String, "Buffer"), $i_ToItem, DllStructGetData($struct_LVITEM, "Image"))
If @error Then Return SetError(-1, -1, -1)

; restore previous state
If $DebugIt Then _DebugPrint("$i_newIndex = " & $i_newIndex)
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "Item", $i_newIndex)
DllStructSetData($struct_LVITEM, "State", $item_state)
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
_GUICtrlListView_SetItemState($hListView, $i_newIndex, $item_state, $LVIS_STATEIMAGEMASK)
If @error Then Return SetError(-1, -1, -1)
Return $i_newIndex
EndFunc ;==>_LVInsertItem
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVCopyItem($i_FromItem, $i_ToItem, $i_SubItem = 0)
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; get from item info
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", $i_SubItem)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)

; set to
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
; set text
DllStructSetData($struct_LVITEM, "Mask", $LVIF_TEXT)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(@error, @error, @error)
; set status
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set image
DllStructSetData($struct_LVITEM, "Mask", $LVIF_IMAGE)
DllStructSetData($struct_LVITEM, "State", $LVIF_IMAGE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set state
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "State", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set indent
DllStructSetData($struct_LVITEM, "Mask", $LVIF_INDENT)
DllStructSetData($struct_LVITEM, "State", $LVIF_INDENT)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set Param
DllStructSetData($struct_LVITEM, "Mask", $LVIF_PARAM)
DllStructSetData($struct_LVITEM, "State", $LVIF_PARAM)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
EndFunc ;==>_LVCopyItem
#endregion Item Function(s) **********************************************************************************************

#region Event Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_MOUSEMOVE event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
;------------------------------------------------------
; not dragging item we are done here
;------------------------------------------------------
If $bDragging = False Then Return $GUI_RUNDEFMSG

;------------------------------------------------------
; update the image move
;------------------------------------------------------
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $y > $LV_Height - 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y)
ElseIf $y < 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y * - 1)
EndIf
_GUIImageList_DragMove($x, $y)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_MOUSEMOVE
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_LBUTTONUP event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_LBUTTONUP($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
$bDragging = False
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $DebugIt Then _DebugPrint("$x = " & $x)
If $DebugIt Then _DebugPrint("$y = " & $y)
;------------------------------------------------------
; done dragging
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_DragLeave($hListView)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_EndDrag()
_GUIImageList_Destroy($hDragImageList[0])
_WinAPI_ReleaseCapture()
;------------------------------------------------------
; do hit test see if drag ended in the listview
;------------------------------------------------------
Local $struct_LVHITTESTINFO = DllStructCreate($tagLVHITTESTINFO)

DllStructSetData($struct_LVHITTESTINFO, "X", $x)
DllStructSetData($struct_LVHITTESTINFO, "Y", $y)
$a_index[1] = _SendMessage($hListView, $LVM_HITTEST, 0, DllStructGetPtr($struct_LVHITTESTINFO), 0, "wparam", "ptr")
Local $flags = DllStructGetData($struct_LVHITTESTINFO, "Flags")
If $DebugIt Then _DebugPrint("$flags: " & $flags)
;------------------------------------------------------
;~ // Out of the ListView?
;------------------------------------------------------
If $a_index[1] == -1 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
;~ // Not in an item?
;------------------------------------------------------
If BitAND($flags, $LVHT_ONITEMLABEL) == 0 And BitAND($flags, $LVHT_ONITEMSTATEICON) == 0 And BitAND($flags, $LVHT_ONITEMICON) = 0 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
; make sure insert is at least 2 items above or below, don't want to create a duplicate
;------------------------------------------------------
If $a_index[0] < $a_index[1] - 1 Or $a_index[0] > $a_index[1] + 1 Then
If $DebugIt Then _DebugPrint("To = " & $a_index[1])
Local $i_newIndex = _LVInsertItem($a_index[0], $a_index[1])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Local $From_index = $a_index[0]
If $a_index[0] > $a_index[1] Then $From_index = $a_index[0] + 1
;------------------------------------------------------
; copy item and subitem(s) images, text, and state
;------------------------------------------------------
For $x = 1 To _GUICtrlListView_GetColumnCount($hListView) - 1
_LVCopyItem($From_index, $i_newIndex, $x)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Next
;------------------------------------------------------
; delete from
;------------------------------------------------------
_GUICtrlListView_DeleteItem($hListView, $From_index)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_LBUTTONUP
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_NOTIFY event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $code, $x, $y, $tNMLISTVIEW, $hwndFrom, $tDraw, $dwDrawStage, $dwItemSpec
$tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$code = DllStructGetData($tNMHDR, "Code")
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
Switch $hwndFrom
Case $hListView
Switch $code
Case $LVN_BEGINDRAG
If $DebugIt Then _DebugPrint("$LVN_BEGINDRAG")
$x = BitAND($lParam, 0xFFFF)
$y = BitShift($lParam, 16)
$tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam)
$a_index[0] = DllStructGetData($tNMLISTVIEW, "Item")
$hDragImageList = _GUICtrlListView_CreateDragImage($hListView, $a_index[0])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
_GUIImageList_BeginDrag($hDragImageList[0], 0, 0, 0)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
If $DebugIt Then _DebugPrint("From = " & $a_index[0])
_GUIImageList_DragEnter($hListView, $x, $y)
_WinAPI_SetCapture($hWndGUI)
$bDragging = True
Case $NM_CUSTOMDRAW
If $DebugIt Then _DebugPrint("$NM_CUSTOMDRAW")
$tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
$dwDrawStage = DllStructGetData($tDraw, "dwDrawStage")
$dwItemSpec = DllStructGetData($tDraw, "dwItemSpec")
Switch $dwDrawStage
Case $CDDS_PREPAINT
If $DebugIt Then _DebugPrint("$CDDS_PREPAINT")
Return $CDRF_NOTIFYITEMDRAW
Case $CDDS_ITEMPREPAINT
If $DebugIt Then _DebugPrint("$CDDS_ITEMPREPAINT")
If BitAND($dwItemSpec, 1) = 1 Then
DllStructSetData($tDraw, "clrTextBk", $CLR_AQUA)
Else
DllStructSetData($tDraw, "clrTextBk", $CLR_WHITE)
EndIf
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#endregion Event Function(s) **********************************************************************************************

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_DragMove

Function Reference

_GUIImageList_DragMove

Moves the image that is being dragged during a drag-and-drop operation

#Include <GuiImageList.au3>
_GUIImageList_DragMove($iX, $iY)

Parameters

$iX | The x-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area
$iY | The y-coordinate at which to display the drag image. The coordinate is relative to the upper-left corner of the window, not the client area

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
Opt("MustDeclareVars", 1)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

#region Globals *************************************************************************
Global $hDragImageList, $hListView, $bDragging = False, $LV_Height
Global $a_index[2] ; from and to

Global Const $DebugIt = 1

#endregion Globals *************************************************************************

Opt("WinTitleMatchMode", 2)

_Main()

Func _Main()
Local Const $image_width = 20
Local Const $image_height = 20
Local $himages, $main_GUI, $iIndex

$main_GUI = GUICreate("GuiImageList", 225, 400)

$hListView = _GUICtrlListView_Create($main_GUI, "Entry Name|Category", 5, 75, 220, 280, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$LV_Height = 280 - 75
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
;------------------------------------------------------
; Using subitem images
;------------------------------------------------------
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SUBITEMIMAGES))

;------------------------------------------------------
; create the image list
;------------------------------------------------------
$himages = _GUIImageList_Create($image_width, $image_height, 5, 1)
For $x = 1 To 21
_GUIImageList_AddIcon($himages, @SystemDir & "\shell32.dll", $x)
Next

_GUICtrlListView_SetImageList($hListView, $himages, $LVSIL_SMALL)

;------------------------------------------------------
;Register event functions
;------------------------------------------------------
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")

;------------------------------------------------------
; add listview items with images
;------------------------------------------------------
Local $y = 1
For $x = 0 To 9
$iIndex = _GUICtrlListView_AddItem($hListView, "Name " & $x + 1, $y) ; handle, string, image index
_GUICtrlListView_AddSubItem($hListView, $iIndex, "Category " & $x + 1, 1, $y + 1) ; handle, index, string, subitem, image index
$y += 2
Next

GUISetState()

While 1

Switch GUIGetMsg()

;-----------------------------------------------------------------------------------------
;This case statement exits and updates code if needed
Case $GUI_EVENT_CLOSE
ExitLoop
;-----------------------------------------------------------------------------------------
;put all the misc. stuff here
Case Else
;;;
EndSwitch
WEnd
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($himages)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
GUIDelete()
EndFunc ;==>_Main

#region Item Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVInsertItem($i_FromItem, $i_ToItem)
Local $item_state, $i_newIndex
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; Insert item into new position
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", 0)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(-1, -1, -1)
$item_state = DllStructGetData($struct_LVITEM, "State")
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
$i_newIndex = _GUICtrlListView_InsertItem($hListView, DllStructGetData($struct_String, "Buffer"), $i_ToItem, DllStructGetData($struct_LVITEM, "Image"))
If @error Then Return SetError(-1, -1, -1)

; restore previous state
If $DebugIt Then _DebugPrint("$i_newIndex = " & $i_newIndex)
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "Item", $i_newIndex)
DllStructSetData($struct_LVITEM, "State", $item_state)
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
_GUICtrlListView_SetItemState($hListView, $i_newIndex, $item_state, $LVIS_STATEIMAGEMASK)
If @error Then Return SetError(-1, -1, -1)
Return $i_newIndex
EndFunc ;==>_LVInsertItem
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVCopyItem($i_FromItem, $i_ToItem, $i_SubItem = 0)
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; get from item info
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", $i_SubItem)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)

; set to
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
; set text
DllStructSetData($struct_LVITEM, "Mask", $LVIF_TEXT)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(@error, @error, @error)
; set status
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set image
DllStructSetData($struct_LVITEM, "Mask", $LVIF_IMAGE)
DllStructSetData($struct_LVITEM, "State", $LVIF_IMAGE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set state
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "State", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set indent
DllStructSetData($struct_LVITEM, "Mask", $LVIF_INDENT)
DllStructSetData($struct_LVITEM, "State", $LVIF_INDENT)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set Param
DllStructSetData($struct_LVITEM, "Mask", $LVIF_PARAM)
DllStructSetData($struct_LVITEM, "State", $LVIF_PARAM)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
EndFunc ;==>_LVCopyItem
#endregion Item Function(s) **********************************************************************************************

#region Event Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_MOUSEMOVE event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
;------------------------------------------------------
; not dragging item we are done here
;------------------------------------------------------
If $bDragging = False Then Return $GUI_RUNDEFMSG

;------------------------------------------------------
; update the image move
;------------------------------------------------------
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $y > $LV_Height - 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y)
ElseIf $y < 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y * - 1)
EndIf
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_DragMove($x, $y)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_MOUSEMOVE
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_LBUTTONUP event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_LBUTTONUP($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
$bDragging = False
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $DebugIt Then _DebugPrint("$x = " & $x)
If $DebugIt Then _DebugPrint("$y = " & $y)
;------------------------------------------------------
; done dragging
;------------------------------------------------------
_GUIImageList_DragLeave($hListView)
_GUIImageList_EndDrag()
_GUIImageList_Destroy($hDragImageList[0])
_WinAPI_ReleaseCapture()
;------------------------------------------------------
; do hit test see if drag ended in the listview
;------------------------------------------------------
Local $struct_LVHITTESTINFO = DllStructCreate($tagLVHITTESTINFO)

DllStructSetData($struct_LVHITTESTINFO, "X", $x)
DllStructSetData($struct_LVHITTESTINFO, "Y", $y)
$a_index[1] = _SendMessage($hListView, $LVM_HITTEST, 0, DllStructGetPtr($struct_LVHITTESTINFO), 0, "wparam", "ptr")
Local $flags = DllStructGetData($struct_LVHITTESTINFO, "Flags")
If $DebugIt Then _DebugPrint("$flags: " & $flags)
;------------------------------------------------------
;~ // Out of the ListView?
;------------------------------------------------------
If $a_index[1] == -1 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
;~ // Not in an item?
;------------------------------------------------------
If BitAND($flags, $LVHT_ONITEMLABEL) == 0 And BitAND($flags, $LVHT_ONITEMSTATEICON) == 0 And BitAND($flags, $LVHT_ONITEMICON) = 0 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
; make sure insert is at least 2 items above or below, don't want to create a duplicate
;------------------------------------------------------
If $a_index[0] < $a_index[1] - 1 Or $a_index[0] > $a_index[1] + 1 Then
If $DebugIt Then _DebugPrint("To = " & $a_index[1])
Local $i_newIndex = _LVInsertItem($a_index[0], $a_index[1])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Local $From_index = $a_index[0]
If $a_index[0] > $a_index[1] Then $From_index = $a_index[0] + 1
;------------------------------------------------------
; copy item and subitem(s) images, text, and state
;------------------------------------------------------
For $x = 1 To _GUICtrlListView_GetColumnCount($hListView) - 1
_LVCopyItem($From_index, $i_newIndex, $x)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Next
;------------------------------------------------------
; delete from
;------------------------------------------------------
_GUICtrlListView_DeleteItem($hListView, $From_index)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_LBUTTONUP
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_NOTIFY event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $code, $x, $y, $tNMLISTVIEW, $hwndFrom, $tDraw, $dwDrawStage, $dwItemSpec
$tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$code = DllStructGetData($tNMHDR, "Code")
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
Switch $hwndFrom
Case $hListView
Switch $code
Case $LVN_BEGINDRAG
If $DebugIt Then _DebugPrint("$LVN_BEGINDRAG")
$x = BitAND($lParam, 0xFFFF)
$y = BitShift($lParam, 16)
$tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam)
$a_index[0] = DllStructGetData($tNMLISTVIEW, "Item")
$hDragImageList = _GUICtrlListView_CreateDragImage($hListView, $a_index[0])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
_GUIImageList_BeginDrag($hDragImageList[0], 0, 0, 0)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
If $DebugIt Then _DebugPrint("From = " & $a_index[0])
_GUIImageList_DragEnter($hListView, $x, $y)
_WinAPI_SetCapture($hWndGUI)
$bDragging = True
Case $NM_CUSTOMDRAW
If $DebugIt Then _DebugPrint("$NM_CUSTOMDRAW")
$tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
$dwDrawStage = DllStructGetData($tDraw, "dwDrawStage")
$dwItemSpec = DllStructGetData($tDraw, "dwItemSpec")
Switch $dwDrawStage
Case $CDDS_PREPAINT
If $DebugIt Then _DebugPrint("$CDDS_PREPAINT")
Return $CDRF_NOTIFYITEMDRAW
Case $CDDS_ITEMPREPAINT
If $DebugIt Then _DebugPrint("$CDDS_ITEMPREPAINT")
If BitAND($dwItemSpec, 1) = 1 Then
DllStructSetData($tDraw, "clrTextBk", $CLR_AQUA)
Else
DllStructSetData($tDraw, "clrTextBk", $CLR_WHITE)
EndIf
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#endregion Event Function(s) **********************************************************************************************

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_Draw

Function Reference

_GUIImageList_Draw

Draws an image list item in the specified device context

#Include <GuiImageList.au3>
_GUIImageList_Draw($hWnd, $iIndex, $hDC, $iX, $iY[, $iStyle=0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the image to draw
$hDC | Handle to the destination device context
$iX | X coordinate where the image will be drawn
$iY | Y coordinate where the image will be drawn
$iStyle | [optional] Drawing style and overlay image: 1 - Draws the image transparently using the mask, regardless of the background color 2 - Draws the image, blending 25 percent with the system highlight color 4 - Draws the image, blending 50 percent with the system highlight color 8 - Draws the mask

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_DrawEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC

$hGUI = GUICreate("ImageList Draw", 400, 300)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_DrawEx

Function Reference

_GUIImageList_DrawEx

Draws an image list item in the specified device context

#Include <GuiImageList.au3>
_GUIImageList_DrawEx($hWnd, $iIndex, $hDC, $iX, $iY[, $iDX = 0[, $iDY = 0[, $iRGBBk = 0xFFFFFFFF[, $iRGBFg = 0xFFFFFFFF[, $iStyle=0]]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the image to draw
$hDC | Handle to the destination device context
$iX | X coordinate where the image will be drawn
$iY | Y coordinate where the image will be drawn
$iDX | [optional] The width of the portion of the image to draw relative to the upper-left corner of the image. If $iDX and $iDY are zero, the function draws the entire image. The function does not ensure that the parameters are valid.
$iDY | [optional] The height of the portion of the image to draw, relative to the upper-left corner of the image. If $iDX and $iDY are zero, the function draws the entire image. The function does not ensure that the parameters are valid.
$iRGBBk | [optional] The background color of the image. This parameter can be an application-defined RGB value or one of the following values: $CLR_NONE - No background color. The image is drawn transparently. $CLR_DEFAULT - The default background color. The image is drawn using the background color of the image list.
$iRGBFg | [optional] The foreground color of the image. This parameter can be an application-defined RGB value or one of the following values: $CLR_NONE - No blend color. The image is blended with the color of the destination device context. $CLR_DEFAULT - The default foreground color. The image is drawn using the system highlight color as the foreground color.
$iStyle | [optional] Drawing style and overlay image: 1 - Draws the image transparently using the mask, regardless of the background color 2 - Draws the image, blending 25 percent with the system highlight color 4 - Draws the image, blending 50 percent with the system highlight color 8 - Draws the mask

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_Draw

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC

$hGUI = GUICreate("ImageList DrawEx", 400, 300)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_DrawEx($hImage, 0, $hDC, 4, 4)
_GUIImageList_DrawEx($hImage, 1, $hDC, 40, 4)
_GUIImageList_DrawEx($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_Duplicate

Function Reference

_GUIImageList_Duplicate

Creates a duplicate of an existing image list

#Include <GuiImageList.au3>
_GUIImageList_Duplicate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The handle to the new duplicate image list
Failure: | 0

Remarks

All information contained in the original image list for normal images is copied to the new image list.
Overlay images are not copied.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $AutoItDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir")
Local $hImage2

GUICreate("ImageList Duplicate", 410, 300)
$listview = GUICtrlCreateListView("", 2, 2, 404, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype1.ico")
_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype2.ico")
_GUIImageList_AddIcon($hImage, $AutoItDir & "\Icons\filetype3.ico")
$hImage2 = _GUIImageList_Duplicate($hImage)
_GUICtrlListView_SetImageList($listview, $hImage2, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 100, "Left", 0)
_GUICtrlListView_AddColumn($listview, "Column 2", 100, "Left", 1)
_GUICtrlListView_AddColumn($listview, "Column 3", 100, "Left", 2)
_GUICtrlListView_AddColumn($listview, "Column 4", 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_EndDrag

Function Reference

_GUIImageList_EndDrag

Ends a drag operation

#Include <GuiImageList.au3>
_GUIImageList_EndDrag()

Parameters

None.

Return Value

None.

Remarks

None.

Related

_GUIImageList_BeginDrag, _GUIImageList_DragLeave

Example

#AutoIt3Wrapper_au3check_parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
Opt("MustDeclareVars", 1)

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>

#region Globals *************************************************************************
Global $hDragImageList, $hListView, $bDragging = False, $LV_Height
Global $a_index[2] ; from and to

Global Const $DebugIt = 1

#endregion Globals *************************************************************************

Opt("WinTitleMatchMode", 2)

_Main()

Func _Main()
Local Const $image_width = 20
Local Const $image_height = 20
Local $himages, $main_GUI, $iIndex

$main_GUI = GUICreate("GuiImageList", 225, 400)

$hListView = _GUICtrlListView_Create($main_GUI, "Entry Name|Category", 5, 75, 220, 280, -1, BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
$LV_Height = 280 - 75
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
;------------------------------------------------------
; Using subitem images
;------------------------------------------------------
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_SUBITEMIMAGES))

;------------------------------------------------------
; create the image list
;------------------------------------------------------
$himages = _GUIImageList_Create($image_width, $image_height, 5, 1)
For $x = 1 To 21
_GUIImageList_AddIcon($himages, @SystemDir & "\shell32.dll", $x)
Next

_GUICtrlListView_SetImageList($hListView, $himages, $LVSIL_SMALL)

;------------------------------------------------------
;Register event functions
;------------------------------------------------------
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")

;------------------------------------------------------
; add listview items with images
;------------------------------------------------------
Local $y = 1
For $x = 0 To 9
$iIndex = _GUICtrlListView_AddItem($hListView, "Name " & $x + 1, $y) ; handle, string, image index
_GUICtrlListView_AddSubItem($hListView, $iIndex, "Category " & $x + 1, 1, $y + 1) ; handle, index, string, subitem, image index
$y += 2
Next

GUISetState()

While 1

Switch GUIGetMsg()

;-----------------------------------------------------------------------------------------
;This case statement exits and updates code if needed
Case $GUI_EVENT_CLOSE
ExitLoop
;-----------------------------------------------------------------------------------------
;put all the misc. stuff here
Case Else
;;;
EndSwitch
WEnd
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($himages)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
GUIDelete()
EndFunc ;==>_Main

#region Item Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVInsertItem($i_FromItem, $i_ToItem)
Local $item_state, $i_newIndex
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; Insert item into new position
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", 0)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(-1, -1, -1)
$item_state = DllStructGetData($struct_LVITEM, "State")
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
$i_newIndex = _GUICtrlListView_InsertItem($hListView, DllStructGetData($struct_String, "Buffer"), $i_ToItem, DllStructGetData($struct_LVITEM, "Image"))
If @error Then Return SetError(-1, -1, -1)

; restore previous state
If $DebugIt Then _DebugPrint("$i_newIndex = " & $i_newIndex)
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "Item", $i_newIndex)
DllStructSetData($struct_LVITEM, "State", $item_state)
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
_GUICtrlListView_SetItemState($hListView, $i_newIndex, $item_state, $LVIS_STATEIMAGEMASK)
If @error Then Return SetError(-1, -1, -1)
Return $i_newIndex
EndFunc ;==>_LVInsertItem
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func _LVCopyItem($i_FromItem, $i_ToItem, $i_SubItem = 0)
Local $struct_LVITEM = DllStructCreate($tagLVITEM)
Local $struct_String = DllStructCreate("char Buffer[4096]")
Local $sBuffer_pointer = DllStructGetPtr($struct_String)

; get from item info
DllStructSetData($struct_LVITEM, "Mask", BitOR($LVIF_STATE, $LVIF_IMAGE, $LVIF_INDENT, $LVIF_PARAM, $LVIF_TEXT))
DllStructSetData($struct_LVITEM, "StateMask", $LVIS_STATEIMAGEMASK)
DllStructSetData($struct_LVITEM, "Item", $i_FromItem)
DllStructSetData($struct_LVITEM, "SubItem", $i_SubItem)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
_GUICtrlListView_GetItemEx($hListView, $struct_LVITEM)

; set to
DllStructSetData($struct_LVITEM, "Item", $i_ToItem)
; set text
DllStructSetData($struct_LVITEM, "Mask", $LVIF_TEXT)
DllStructSetData($struct_LVITEM, "Text", $sBuffer_pointer)
DllStructSetData($struct_LVITEM, "TextMax", 4096)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
If @error Then Return SetError(@error, @error, @error)
; set status
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set image
DllStructSetData($struct_LVITEM, "Mask", $LVIF_IMAGE)
DllStructSetData($struct_LVITEM, "State", $LVIF_IMAGE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set state
DllStructSetData($struct_LVITEM, "Mask", $LVIF_STATE)
DllStructSetData($struct_LVITEM, "State", $LVIF_STATE)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set indent
DllStructSetData($struct_LVITEM, "Mask", $LVIF_INDENT)
DllStructSetData($struct_LVITEM, "State", $LVIF_INDENT)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
; set Param
DllStructSetData($struct_LVITEM, "Mask", $LVIF_PARAM)
DllStructSetData($struct_LVITEM, "State", $LVIF_PARAM)
_GUICtrlListView_SetItemEx($hListView, $struct_LVITEM)
EndFunc ;==>_LVCopyItem
#endregion Item Function(s) **********************************************************************************************

#region Event Function(s) **********************************************************************************************
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_MOUSEMOVE event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_MOUSEMOVE($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
;------------------------------------------------------
; not dragging item we are done here
;------------------------------------------------------
If $bDragging = False Then Return $GUI_RUNDEFMSG

;------------------------------------------------------
; update the image move
;------------------------------------------------------
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $y > $LV_Height - 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y)
ElseIf $y < 20 Then
_GUICtrlListView_Scroll($hListView, 0, $y * - 1)
EndIf
_GUIImageList_DragMove($x, $y)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_MOUSEMOVE
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_LBUTTONUP event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_LBUTTONUP($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $MsgID, $wParam
$bDragging = False
Local $lpos = ControlGetPos($hWndGUI, "", $hListView)
Local $x = BitAND($lParam, 0xFFFF) - $lpos[0]
Local $y = BitShift($lParam, 16) - $lpos[1]
If $DebugIt Then _DebugPrint("$x = " & $x)
If $DebugIt Then _DebugPrint("$y = " & $y)
;------------------------------------------------------
; done dragging
;------------------------------------------------------
_GUIImageList_DragLeave($hListView)
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_EndDrag()
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
_GUIImageList_Destroy($hDragImageList[0])
_WinAPI_ReleaseCapture()
;------------------------------------------------------
; do hit test see if drag ended in the listview
;------------------------------------------------------
Local $struct_LVHITTESTINFO = DllStructCreate($tagLVHITTESTINFO)

DllStructSetData($struct_LVHITTESTINFO, "X", $x)
DllStructSetData($struct_LVHITTESTINFO, "Y", $y)
$a_index[1] = _SendMessage($hListView, $LVM_HITTEST, 0, DllStructGetPtr($struct_LVHITTESTINFO), 0, "wparam", "ptr")
Local $flags = DllStructGetData($struct_LVHITTESTINFO, "Flags")
If $DebugIt Then _DebugPrint("$flags: " & $flags)
;------------------------------------------------------
;~ // Out of the ListView?
;------------------------------------------------------
If $a_index[1] == -1 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
;~ // Not in an item?
;------------------------------------------------------
If BitAND($flags, $LVHT_ONITEMLABEL) == 0 And BitAND($flags, $LVHT_ONITEMSTATEICON) == 0 And BitAND($flags, $LVHT_ONITEMICON) = 0 Then Return $GUI_RUNDEFMSG
;------------------------------------------------------
; make sure insert is at least 2 items above or below, don't want to create a duplicate
;------------------------------------------------------
If $a_index[0] < $a_index[1] - 1 Or $a_index[0] > $a_index[1] + 1 Then
If $DebugIt Then _DebugPrint("To = " & $a_index[1])
Local $i_newIndex = _LVInsertItem($a_index[0], $a_index[1])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Local $From_index = $a_index[0]
If $a_index[0] > $a_index[1] Then $From_index = $a_index[0] + 1
;------------------------------------------------------
; copy item and subitem(s) images, text, and state
;------------------------------------------------------
For $x = 1 To _GUICtrlListView_GetColumnCount($hListView) - 1
_LVCopyItem($From_index, $i_newIndex, $x)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
Next
;------------------------------------------------------
; delete from
;------------------------------------------------------
_GUICtrlListView_DeleteItem($hListView, $From_index)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_LBUTTONUP
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
; WM_NOTIFY event handler
;------------------------------------------------------
;------------------------------------------------------
;------------------------------------------------------
Func WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $code, $x, $y, $tNMLISTVIEW, $hwndFrom, $tDraw, $dwDrawStage, $dwItemSpec
$tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;NMHDR (hwndFrom, idFrom, code)
If @error Then Return
$code = DllStructGetData($tNMHDR, "Code")
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
Switch $hwndFrom
Case $hListView
Switch $code
Case $LVN_BEGINDRAG
If $DebugIt Then _DebugPrint("$LVN_BEGINDRAG")
$x = BitAND($lParam, 0xFFFF)
$y = BitShift($lParam, 16)
$tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam)
$a_index[0] = DllStructGetData($tNMLISTVIEW, "Item")
$hDragImageList = _GUICtrlListView_CreateDragImage($hListView, $a_index[0])
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
_GUIImageList_BeginDrag($hDragImageList[0], 0, 0, 0)
If @error Then Return SetError(-1, -1, $GUI_RUNDEFMSG)
If $DebugIt Then _DebugPrint("From = " & $a_index[0])
_GUIImageList_DragEnter($hListView, $x, $y)
_WinAPI_SetCapture($hWndGUI)
$bDragging = True
Case $NM_CUSTOMDRAW
If $DebugIt Then _DebugPrint("$NM_CUSTOMDRAW")
$tDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
$dwDrawStage = DllStructGetData($tDraw, "dwDrawStage")
$dwItemSpec = DllStructGetData($tDraw, "dwItemSpec")
Switch $dwDrawStage
Case $CDDS_PREPAINT
If $DebugIt Then _DebugPrint("$CDDS_PREPAINT")
Return $CDRF_NOTIFYITEMDRAW
Case $CDDS_ITEMPREPAINT
If $DebugIt Then _DebugPrint("$CDDS_ITEMPREPAINT")
If BitAND($dwItemSpec, 1) = 1 Then
DllStructSetData($tDraw, "clrTextBk", $CLR_AQUA)
Else
DllStructSetData($tDraw, "clrTextBk", $CLR_WHITE)
EndIf
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
#endregion Event Function(s) **********************************************************************************************

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_GetBkColor

Function Reference

_GUIImageList_GetBkColor

Retrieves the current background color for an image list

#Include <GuiImageList.au3>
_GUIImageList_GetBkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the background color

Remarks

None.

Related

_GUIImageList_SetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList GetBkColor", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

MsgBox(4160, "Information", "BackColor: " & _GUIImageList_GetBkColor($hImage))
_GUIImageList_SetBkColor($hImage, 0x0000FF)
MsgBox(4160, "Information", "BackColor: " & _GUIImageList_GetBkColor($hImage))

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_GetIcon

Function Reference

_GUIImageList_GetIcon

Creates an icon from an image and mask in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetIcon($hWnd, $iIndex[, $iStyle = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the image
$iStyle | [optional] Drawing style and overlay image: 1 - Draws the image transparently using the mask, regardless of the background color 2 - Draws the image, blending 25 percent with the system highlight color 4 - Draws the image, blending 50 percent with the system highlight color 8 - Draws the mask

Return Value

Success: | The handle to the icon if successful
Failure: | 0

Remarks

It is the responsibility of the calling application to destroy the icon returned from this function
using _GUIImageList_DestroyIcon

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hStatus, $iMemo

_Main()

Func _Main()

Local $hGUI, $hIcons[2], $hImage
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("ImageList Get Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Set parts
_GUICtrlStatusBar_SetParts($hStatus, $aParts)
_GUICtrlStatusBar_SetText($hStatus, "Part 1")
_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0xFF0000, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0x00FF00, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hStatus, 0x0000FF, 11, 11))

; Set icons
$hIcons[0] = _GUIImageList_GetIcon($hImage, 1)
$hIcons[1] = _GUIImageList_GetIcon($hImage, 2)
_GUICtrlStatusBar_SetIcon($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon($hStatus, 1, $hIcons[1])

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex($hIcons[0]))
MemoWrite("Part 2 icon handle .: 0x" & Hex($hIcons[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
MsgBox(4096, "Information", "Icon 1 Destroyed? " & _GUIImageList_DestroyIcon($hIcons[0]))
MsgBox(4096, "Information", "Icon 2 Destroyed? " & _GUIImageList_DestroyIcon($hIcons[1]))
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hStatus
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return True ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $SBN_SIMPLEMODECHANGE ; Simple mode changes
_DebugPrint("$SBN_SIMPLEMODECHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUIImageList_GetIconHeight

Function Reference

_GUIImageList_GetIconHeight

Retrieves the height of the images in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetIconHeight($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Height, in pixels, of each image
Failure: | 0

Remarks

None.

Related

_GUIImageList_GetIconSize, _GUIImageList_GetIconWidth, _GUIImageList_GetIconSizeEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC

$hGUI = GUICreate("ImageList Get Icon Height", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Show image list icon size
MemoWrite("Image width : " & _GUIImageList_GetIconWidth($hImage))
MemoWrite("Image height: " & _GUIImageList_GetIconHeight($hImage))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_GetIconSize

Function Reference

_GUIImageList_GetIconSize

Retrieves the dimensions of images in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetIconSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - Width, in pixels, of each image
[1] - Height, in pixels, of each image

Remarks

None.

Related

_GUIImageList_GetIconHeight, _GUIImageList_GetIconSizeEx, _GUIImageList_GetIconWidth, _GUIImageList_SetIconSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC, $aSize, $listview

$hGUI = GUICreate("ImageList Get Icon Size", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 199, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
$iMemo = GUICtrlCreateEdit("", 2, 200, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)

; Show image list icon size
$aSize = _GUIImageList_GetIconSize($hImage)
MemoWrite("Image width : " & $aSize[0])
MemoWrite("Image height: " & $aSize[1])

MsgBox(4096, "Information", "Changing Icon Size")

_GUIImageList_SetIconSize($hImage, 16, 16)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

$aSize = _GUIImageList_GetIconSize($hImage)
MemoWrite("Image width : " & $aSize[0])
MemoWrite("Image height: " & $aSize[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_GetIconSizeEx

Function Reference

_GUIImageList_GetIconSizeEx

Retrieves the dimensions of images in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetIconSizeEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | $tagPOINT structure
Failure: | 0

Remarks

None.

Related

_GUIImageList_GetIconHeight, _GUIImageList_GetIconSize, _GUIImageList_GetIconWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC, $tSize

$hGUI = GUICreate("ImageList Get Icon SizeEx", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Show image list icon size
$tSize = _GUIImageList_GetIconSizeEx($hImage)
MemoWrite("Image width : " & DllStructGetData($tSize, "X"))
MemoWrite("Image height: " & DllStructGetData($tSize, "Y"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_GetIconWidth

Function Reference

_GUIImageList_GetIconWidth

Retrieves the width of the images in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetIconWidth($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Width, in pixels, of each image
Failure: | 0

Remarks

None.

Related

_GUIImageList_GetIconHeight, _GUIImageList_GetIconSize, _GUIImageList_GetIconSizeEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC

$hGUI = GUICreate("ImageList Get Icon Width", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Show image list icon size
MemoWrite("Image width : " & _GUIImageList_GetIconWidth($hImage))
MemoWrite("Image height: " & _GUIImageList_GetIconHeight($hImage))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_GetImageCount

Function Reference

_GUIImageList_GetImageCount

Retrieves the number of images in an image list

#Include <GuiImageList.au3>
_GUIImageList_GetImageCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the number of images

Remarks

None.

Related

_GUIImageList_SetImageCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage, $iRandom
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Get Image Count", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
$iRandom = Random(6, 20, 1)
For $x = 1 To $iRandom
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", $x)
Next
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

MsgBox(4096, "Information", "Image Count: " & _GUIImageList_GetImageCount($hImage))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_GetImageInfoEx

Function Reference

_GUIImageList_GetImageInfoEx

Retrieves information about an image

#Include <GuiImageList.au3>
_GUIImageList_GetImageInfoEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Index of the image

Return Value

Success: | $tagIMAGEINFO structure that receives information about the image
Failure: | 0

Remarks

None.

Related

$tagIMAGEINFO

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $hGUI, $hDC, $tInfo

$hGUI = GUICreate("ImageList Get Icon InfoEx", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))

; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)

_WinAPI_ReleaseDC($hGUI, $hDC)

; Show information for second image
$tInfo = _GUIImageList_GetImageInfoEx($hImage, 1)
MemoWrite("Image handle .: 0x" & Hex(DllStructGetData($tInfo, "hBitmap")))
MemoWrite("Mask handle ..: " & DllStructGetData($tInfo, "hMask"))
MemoWrite("Image Left ...: " & DllStructGetData($tInfo, "Left"))
MemoWrite("Image Top ....: " & DllStructGetData($tInfo, "Top"))
MemoWrite("Image Right ..: " & DllStructGetData($tInfo, "Right"))
MemoWrite("Image Bottom .: " & DllStructGetData($tInfo, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_Remove

Function Reference

_GUIImageList_Remove

Remove Image(s) from the ImageList

#Include <GuiImageList.au3>
_GUIImageList_Remove($hWnd[, $iIndex = -1])

Parameters

$hWnd | Handle to the control
$iIndex | [optional] The index of the image to remove. If this parameter is -1, the function removes all images

Return Value

Success: | True
Failure: | False

Remarks

When an image is removed, the indexes of the remaining images are adjusted so that the image indexes
always range from zero to one less than the number of images in the image list.
For example, if you remove the image at index 0, then image 1 becomes image 0, image 2 becomes
image 1, and so on.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Remove", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

MsgBox(4096, "Information", "Removing Image Index 0")
_GUIImageList_Remove($hImage, 0)

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($listview))

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_ReplaceIcon

Function Reference

_GUIImageList_ReplaceIcon

Replaces an image with an icon or cursor

#Include <GuiImageList.au3>
_GUIImageList_ReplaceIcon($hWnd, $iIndex, $hIcon)

Parameters

$hWnd | Handle to the control
$iIndex | Index of the image to replace. If -1, the function appends the image to the end of the list.
$hIcon | Handle to the icon or cursor that contains the bitmap and mask for the new image

Return Value

Success: | The index of the image
Failure: | -1

Remarks

Because the system does not save hIcon you can destroy it after the function returns if the icon or cursor was
created by the CreateIcon function. You do not need to destroy hIcon if it was loaded by the LoadIcon function
the system automatically frees an icon resource when it is no longer needed.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $Wow64 = ""
If @AutoItX64 Then $Wow64 = "\Wow6432Node"
Local $AutoItDir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $Wow64 & "\AutoIt v3\AutoIt", "InstallDir")

GUICreate("ImageList AddIcon", 410, 300)
$listview = GUICtrlCreateListView("", 2, 2, 404, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
GUISetState()

; Create an image list with images
$hImage = _GUIImageList_Create(11, 11)
AddIcon($hImage, $AutoItDir & "\Icons\filetype1.ico")
AddIcon($hImage, $AutoItDir & "\Icons\filetype2.ico")
AddIcon($hImage, $AutoItDir & "\Icons\filetype3.ico")
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 100, 0, 0)
_GUICtrlListView_AddColumn($listview, "Column 2", 100, 1, 1)
_GUICtrlListView_AddColumn($listview, "Column 3", 100, 2, 2)
_GUICtrlListView_AddColumn($listview, "Column 4", 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; This is the long way to add an icon. Use _GUIImageList_AddIcon instead
Func AddIcon($hWnd, $sFile, $iIndex = 0)
Local $pIcon, $tIcon, $hIcon

$tIcon = DllStructCreate("int Icon")
$pIcon = DllStructGetPtr($tIcon)
_WinAPI_ExtractIconEx($sFile, $iIndex, 0, $pIcon, 1)
$hIcon = DllStructGetData($tIcon, "Icon")
_GUIImageList_ReplaceIcon($hWnd, -1, $hIcon)
_WinAPI_DestroyIcon($hIcon)
EndFunc ;==>AddIcon


Function _GUIImageList_SetBkColor

Function Reference

_GUIImageList_SetBkColor

Sets the background color for an image list

#Include <GuiImageList.au3>
_GUIImageList_SetBkColor($hWnd, $iClrBk)

Parameters

$hWnd | Handle to the control
$iClrBk | The background color to set. This parameter can be the $CLR_NONE value; in that case, images are drawn transparently using the mask.

Return Value

Success: | The previous background color if successful
Failure: | $CLR_NONE

Remarks

None.

Related

_GUIImageList_GetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList SetBkColor", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

MsgBox(4160, "Information", "BackColor: " & _GUIImageList_GetBkColor($hImage))
_GUIImageList_SetBkColor($hImage, 0x0000FF)
MsgBox(4160, "Information", "BackColor: " & _GUIImageList_GetBkColor($hImage))

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_SetIconSize

Function Reference

_GUIImageList_SetIconSize

Sets the dimensions of images in an image list and removes all images from the list

#Include <GuiImageList.au3>
_GUIImageList_SetIconSize($hWnd, $iCX, $iCY)

Parameters

$hWnd | Handle to the control
$iCX | The width, in pixels, of the images in the image list
$iCY | The height, in pixels, of the images in the image list

Return Value

Success: | True
Failure: | False

Remarks

All images in an image list have the same dimensions

Related

_GUIImageList_GetIconSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hImage, $aSize, $listview

GUICreate("ImageList Set Icon Size", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 199, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
$iMemo = GUICtrlCreateEdit("", 2, 200, 396, 266, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110, True)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131, True)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165, True)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)

; Show image list icon size
$aSize = _GUIImageList_GetIconSize($hImage)
MemoWrite("Image width : " & $aSize[0])
MemoWrite("Image height: " & $aSize[1])

MsgBox(4096, "Information", "Changing Icon Size")

_GUIImageList_SetIconSize($hImage, 16, 16)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

$aSize = _GUIImageList_GetIconSize($hImage)
MemoWrite("Image width : " & $aSize[0])
MemoWrite("Image height: " & $aSize[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIImageList_SetImageCount

Function Reference

_GUIImageList_SetImageCount

Resizes an existing image list

#Include <GuiImageList.au3>
_GUIImageList_SetImageCount($hWnd, $iNewCount)

Parameters

$hWnd | Handle to the control
$iNewCount | The new size of the image list

Return Value

Success: | True
Failure: | False

Remarks

If an application expands an image list with this function, it must add new images by using
the GUIImageList_Replace function. If your application does not add valid images at the new indexes,
draw operations that use the new indexes will be unpredictable.

If you decrease the size of an image list by using this function, the truncated images are freed.

Related

_GUIImageList_GetImageCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Set Image Count", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

GUISetState(@SW_LOCK)
MsgBox(4096, "Information", "Setting Image Count")
_GUIImageList_SetImageCount($hImage, 3)
GUISetState(@SW_UNLOCK)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUIImageList_Swap

Function Reference

_GUIImageList_Swap

Source image is copied to the destination image's index

#Include <GuiImageList.au3>
_GUIImageList_Swap($hWnd, $iSource, $iDestination)

Parameters

$hWnd | Handle to the control
$iSource | The zero-based index of the image to be used as the source of the swap operation
$iDestination | The zero-based index of the image to be used as the destination of the swap operation

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIImageList_Copy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $listview, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ImageList Swap", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)

GUISetState(@SW_LOCK)
MsgBox(4096, "Information", "Swapping 1st and Last Images")
_GUIImageList_Swap($hImage, 0, 5)
GUISetState(@SW_UNLOCK)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiIPAddress user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiIPAddress.au3>.

User Defined Function | Description
_GUICtrlIpAddress_ClearAddress | Clears the contents of the IP address control
_GUICtrlIpAddress_Create | Create a GUI IP Address Control
_GUICtrlIpAddress_Destroy | Delete the control
_GUICtrlIpAddress_Get | Retrieves the address from the IP address control
_GUICtrlIpAddress_GetArray | Retrieves the address from the IP address control
_GUICtrlIpAddress_GetEx | Retrieves the address from the IP address control
_GUICtrlIpAddress_IsBlank | Determines if all fields in the IP address control are blank
_GUICtrlIpAddress_Set | Sets the address in the IP address control
_GUICtrlIpAddress_SetArray | Sets the address in the IP address control
_GUICtrlIpAddress_SetEx | Sets the address in the IP address control
_GUICtrlIpAddress_SetFocus | Sets the keyboard focus to the specified field in the IP address control
_GUICtrlIpAddress_SetFont | Set font of the control
_GUICtrlIpAddress_SetRange | Sets the valid range for the specified field in the IP address control
_GUICtrlIpAddress_ShowHide | Shows/Hides the IP address control


Function _GUICtrlIpAddress_ClearAddress

Function Reference

_GUICtrlIpAddress_ClearAddress

Clears the contents of the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_ClearAddress($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

None.

Related

_GUICtrlIpAddress_IsBlank, _GUICtrlIpAddress_Set

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Clear Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

; Clear the IP Address
MsgBox(4160, "Information", "Clear IP Address")
_GUICtrlIpAddress_ClearAddress ($hIPAddress)

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_Create

Function Reference

_GUICtrlIpAddress_Create

Create a GUI IP Address Control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_Create($hWnd, $iX, $iY[, $iWidth = 125[, $iHeight = 25[, $iStyles = 0x00000000[, $iExstyles = 0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyles | [optional] Control styles: Forced : $WS_CHILD, $WS_VISIBLE, $WS_TABSTOP
$iExStyles | [optional] Extended control styles

Return Value

Success: | Handle to the IP Address control
Failure: | 0

Remarks

None.

Related

_GUICtrlIpAddress_Destroy

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $hIPAddress

_Main()

Func _Main()
Local $hgui

$hgui = GUICreate("IP Address Control Create Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
Local $tInfo

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hIPAddress
Switch $iCode
Case $IPN_FIELDCHANGED ; Sent when the user changes a field in the control or moves from one field to another
$tInfo = DllStructCreate($tagNMIPADDRESS, $ilParam)
_DebugPrint("$IPN_FIELDCHANGED" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tInfo, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tInfo, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tInfo, "Code") & @LF & _
"-->Field:" & @TAB & DllStructGetData($tInfo, "Field") & @LF & _
"-->Value:" & @TAB & DllStructGetData($tInfo, "Value"))
; The return value is ignored
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlIpAddress_Destroy

Function Reference

_GUICtrlIpAddress_Destroy

Delete the control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on IP Address Controlr created with _GUICtrlIpAddress_Create

Related

_GUICtrlIpAddress_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Destroy Control Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10, 125, 30, $WS_THICKFRAME)
GUISetState(@SW_SHOW)

; Clear the IP Address
MsgBox (4160, "Information", "Destroy IP Address Control")
_GUICtrlIpAddress_Destroy ($hIPAddress)

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_Get

Function Reference

_GUICtrlIpAddress_Get

Retrieves the address from the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_Get($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: IP address string

Remarks

None.

Related

_GUICtrlIpAddress_Set, _GUICtrlIpAddress_GetEx

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Get (String) Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create($hgui, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

MsgBox (4160, "Information", "IP Address: " & _GUICtrlIpAddress_Get($hIPAddress))

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_GetArray

Function Reference

_GUICtrlIpAddress_GetArray

Retrieves the address from the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_GetArray($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array formatted as follows:
[0] - 1st address field
[1] - 2nd address field
[2] - 3rd address field
[3] - 4th address field

Remarks

None.

Related

_GUICtrlIpAddress_SetArray, _GUICtrlIpAddress_GetEx

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hgui, $aIP[4] = [24, 168, 2, 128], $hIPAddress

$hgui = GUICreate("IP Address Control Get (Array) Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4, 125, 20)
$iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_SetArray ($hIPAddress, $aIP)

$aIP = _GUICtrlIpAddress_GetArray ($hIPAddress)

MemoWrite("Field 1 .....: " & $aIP[0])
MemoWrite("Field 2 .....: " & $aIP[1])
MemoWrite("Field 3 .....: " & $aIP[2])
MemoWrite("Field 4 .....: " & $aIP[3])

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlIpAddress_GetEx

Function Reference

_GUICtrlIpAddress_GetEx

Retrieves the address from the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_GetEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagGetIPAddress structure that receives the ip address

Remarks

None.

Related

_GUICtrlIpAddress_Get, _GUICtrlIpAddress_GetArray, _GUICtrlIpAddress_SetEx

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hgui, $tIP = DllStructCreate($tagGetIPAddress), $aIP[4] = [24, 168, 2, 128], $hIPAddress

$hgui = GUICreate("IP Address Control GetEx Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4, 125, 20)
$iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

For $x = 0 To 3
DllStructSetData($tIP, "Field" & $x + 1, $aIP[$x])
Next

_GUICtrlIpAddress_SetEx ($hIPAddress, $tIP)

$tIP = _GUICtrlIpAddress_GetEx ($hIPAddress)

For $x = 0 To 3
MemoWrite("Field " & $x + 1 & " .....: " & DllStructGetData($tIP, "Field" & $x + 1))
Next

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlIpAddress_IsBlank

Function Reference

_GUICtrlIpAddress_IsBlank

Determines if all fields in the IP address control are blank

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_IsBlank($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: IP address is blank
False: IP address is not blank

Remarks

None.

Related

_GUICtrlIpAddress_ClearAddress

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $msg, $hgui, $clear, $getaddress, $isblank, $button, $hIPAddress

$hgui = GUICreate("IP Address Control IsBlank Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4)
$iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

; See if IP Address is blank
MemoWrite("Blank: " & _GUICtrlIpAddress_IsBlank ($hIPAddress))

Sleep(1000)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

; See if IP Address is blank
MemoWrite("Blank: " & _GUICtrlIpAddress_IsBlank ($hIPAddress))

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlIpAddress_Set

Function Reference

_GUICtrlIpAddress_Set

Sets the address in the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_Set($hWnd, $sAddress)

Parameters

$hWnd | Handle to the control
$sAddress | IP Address string

Return Value

None.

Remarks

None.

Related

_GUICtrlIpAddress_Get, _GUICtrlIpAddress_ClearAddress

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Set (String) Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create($hgui, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

MsgBox (4160, "Information", "IP Address: " & _GUICtrlIpAddress_Get($hIPAddress))

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_SetArray

Function Reference

_GUICtrlIpAddress_SetArray

Sets the address in the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetArray($hWnd, $aAddress)

Parameters

$hWnd | Handle to the control
$aAddress | Array formatted as follows: [0] - 1st address field [1] - 2nd address field [2] - 3rd address field [3] - 4th address field

Return Value

None.

Remarks

None.

Related

_GUICtrlIpAddress_GetArray

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hgui, $aIP[4] = [24, 168, 2, 128], $hIPAddress

$hgui = GUICreate("IP Address Control Set (Array) Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4, 125, 20)
$iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_SetArray ($hIPAddress, $aIP)

$aIP = _GUICtrlIpAddress_GetArray ($hIPAddress)

MemoWrite("Field 1 .....: " & $aIP[0])
MemoWrite("Field 2 .....: " & $aIP[1])
MemoWrite("Field 3 .....: " & $aIP[2])
MemoWrite("Field 4 .....: " & $aIP[3])

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlIpAddress_SetEx

Function Reference

_GUICtrlIpAddress_SetEx

Sets the address in the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetEx($hWnd, $tIP)

Parameters

$hWnd | Handle to the control
$tIP | $tagGetIPAddress structure containing new ip address for the control

Return Value

None.

Remarks

None.

Related

_GUICtrlIpAddress_GetEx, $tagGetIPAddress

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hgui, $tIP = DllStructCreate($tagGetIPAddress), $aIP[4] = [24, 168, 2, 128], $hIPAddress

$hgui = GUICreate("IP Address Control SetEx Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4, 125, 20)
$iMemo = GUICtrlCreateEdit("", 2, 28, 396, 270, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

For $x = 0 To 3
DllStructSetData($tIP, "Field" & $x + 1, $aIP[$x])
Next

_GUICtrlIpAddress_SetEx ($hIPAddress, $tIP)

$tIP = _GUICtrlIpAddress_GetEx ($hIPAddress)

For $x = 0 To 3
MemoWrite("Field " & $x + 1 & " .....: " & DllStructGetData($tIP, "Field" & $x + 1))
Next

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlIpAddress_SetFocus

Function Reference

_GUICtrlIpAddress_SetFocus

Sets the keyboard focus to the specified field in the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetFocus($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero-based field index to which the focus should be set. If this value is greater than the number of fields, focus is set to the first blank field. If all fields are nonblank, focus is set to the first field.

Return Value

None.

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Set Focus Example", 400, 300)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 2, 4)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

_GUICtrlIpAddress_SetFocus ($hIPAddress, 1)
; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_SetFont

Function Reference

_GUICtrlIpAddress_SetFont

Set font of the control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetFont($hWnd[, $sFaceName = "Arial"[, $iFontSize = 12[, $iFontWeight = 400[, $fFontItalic = False]]]])

Parameters

$hWnd | Handle to the control
$sFaceName | [optional] The Font Name of the font to use
$iFontSize | [optional] The Font Size
$iFontWeight | [optional] The Font Weight
$fFontItalic | [optional] Use Italic Attribute

Return Value

None.

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress, $hIPAddress2

$hgui = GUICreate("IP Address Control Set Font Example", 300, 150)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10, 150, 30)
$hIPAddress2 = _GUICtrlIpAddress_Create ($hgui, 10, 50, 150, 30)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")
_GUICtrlIpAddress_SetFont ($hIPAddress, "Times New Roman", 14, 800, True)
_GUICtrlIpAddress_Set ($hIPAddress2, "24.168.2.128")
_GUICtrlIpAddress_SetFont ($hIPAddress2, "Arial", 10, 300)

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_SetRange

Function Reference

_GUICtrlIpAddress_SetRange

Sets the valid range for the specified field in the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetRange($hWnd, $iIndex[, $iLowRange = 0[, $iHighRange = 255]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero-based field index to which the range will be applied
$iLowRange | [optional] Lower limit of the range
$iHighRange | [optional] Upper limit of the range

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Set Range Example", 300, 150)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

; set range on 1st field
_GUICtrlIpAddress_SetRange ($hIPAddress, 0, 198, 200)

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlIpAddress_ShowHide

Function Reference

_GUICtrlIpAddress_ShowHide

Shows/Hides the IP address control

#Include <GuiIPAddress.au3>
_GUICtrlIpAddress_ShowHide($hWnd, $iState)

Parameters

$hWnd | Handle to the control
$iState | State of the IP Address control, can be the following values:

Return Value

True: The control was previously visible
False: The control was previously hidden

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiIPAddress.au3>

Opt("MustDeclareVars", 1)

$Debug_IP = False ; Check ClassName being passed to IPAddress functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hgui, $hIPAddress

$hgui = GUICreate("IP Address Control Show/Hide Example", 300, 150)
$hIPAddress = _GUICtrlIpAddress_Create ($hgui, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlIpAddress_Set ($hIPAddress, "24.168.2.128")

Sleep(1000)
_GUICtrlIpAddress_ShowHide ($hIPAddress, @SW_HIDE)
Sleep(1000)
_GUICtrlIpAddress_ShowHide ($hIPAddress, @SW_SHOW)

; Wait for user to close GUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


User Defined Functions

GuiListBox user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiListBox.au3>.

User Defined Function | Description
_GUICtrlListBox_AddFile | Adds the specified filename that contains a directory listing
_GUICtrlListBox_AddString | Add a string
_GUICtrlListBox_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlListBox_ClickItem | Clicks an item
_GUICtrlListBox_Create | Create a Listbox control
_GUICtrlListBox_DeleteString | Delete a string
_GUICtrlListBox_Destroy | Delete the control
_GUICtrlListBox_Dir | Adds the names of directories and files
_GUICtrlListBox_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlListBox_FindInText | Searches for an item that contains the specified text anywhere in its text
_GUICtrlListBox_FindString | Search for a string
_GUICtrlListBox_GetAnchorIndex | Retrieves the index of the anchor item
_GUICtrlListBox_GetCaretIndex | Return index of item that has the focus rectangle
_GUICtrlListBox_GetCount | Retrieves the number of items
_GUICtrlListBox_GetCurSel | Retrieve the index of the currently selected item
_GUICtrlListBox_GetHorizontalExtent | Retrieve from a list box the the scrollable width
_GUICtrlListBox_GetItemData | Retrieves the application defined value associated with an item
_GUICtrlListBox_GetItemHeight | Retrieves the height of items
_GUICtrlListBox_GetItemRect | Retrieves the rectangle that bounds an item
_GUICtrlListBox_GetItemRectEx | Retrieves the rectangle that bounds an item
_GUICtrlListBox_GetListBoxInfo | Retrieve the number of items per column in a specified list box
_GUICtrlListBox_GetLocale | Retrieves the current locale
_GUICtrlListBox_GetLocaleCountry | Retrieves the current country code
_GUICtrlListBox_GetLocaleLang | Retrieves the current language identifier
_GUICtrlListBox_GetLocalePrimLang | Extract primary language id from a language id
_GUICtrlListBox_GetLocaleSubLang | Extract sublanguage id from a language id
_GUICtrlListBox_GetSel | Retrieves the selection state of an item
_GUICtrlListBox_GetSelCount | Retrieves the total number of selected items
_GUICtrlListBox_GetSelItems | Fills a buffer with an array of selected items
_GUICtrlListBox_GetSelItemsText | Retrieves the text of selected items
_GUICtrlListBox_GetText | Returns the item (string) at the specified index
_GUICtrlListBox_GetTextLen | Gets the length of a string in a list box
_GUICtrlListBox_GetTopIndex | Retrieve the index of the first visible item in a list
_GUICtrlListBox_InitStorage | This message allocates memory for storing items
_GUICtrlListBox_InsertString | Insert a string into the list
_GUICtrlListBox_ItemFromPoint | Retrieves the zero based index of the item nearest the specified point
_GUICtrlListBox_ReplaceString | Replaces the text of an item
_GUICtrlListBox_ResetContent | Remove all items from the list box
_GUICtrlListBox_SelectString | Searchs for an item that begins with the specified string
_GUICtrlListBox_SelItemRange | Select one or more consecutive items in a multiple-selection list box
_GUICtrlListBox_SelItemRangeEx | Select one or more consecutive items in a multiple-selection list box
_GUICtrlListBox_SetAnchorIndex | Set the anchor item—that is, the item from which a multiple selection starts
_GUICtrlListBox_SetCaretIndex | Set the focus rectangle to the item at the specified index in a multiple-selection list box
_GUICtrlListBox_SetColumnWidth | Set the width, in pixels, of all columns
_GUICtrlListBox_SetCurSel | Select a string and scroll it into view, if necessary
_GUICtrlListBox_SetHorizontalExtent | Set the width, in pixels, by which a list box can be scrolled horizontally
_GUICtrlListBox_SetItemData | Sets the value associated with the specified item
_GUICtrlListBox_SetItemHeight | Sets the height, in pixels, of items
_GUICtrlListBox_SetLocale | Set the current locale
_GUICtrlListBox_SetSel | Select a string(s) in a multiple-selection list box
_GUICtrlListBox_SetTabStops | Sets the tab-stop positions
_GUICtrlListBox_SetTopIndex | Ensure that a particular item in a list box is visible
_GUICtrlListBox_Sort | Re-sorts list box if it has the $LBS_SORT style
_GUICtrlListBox_SwapString | Swaps the text of two items at the specified indices
_GUICtrlListBox_UpdateHScroll | Update the horizontal scroll bar based on the longest string


Function _GUICtrlListBox_AddFile

Function Reference

_GUICtrlListBox_AddFile

Adds the specified filename that contains a directory listing

#Include <GuiListBox.au3>
_GUICtrlListBox_AddFile($hWnd, $sFile)

Parameters

$hWnd | Handle to control
$sFile | Name of the file to add

Return Value

Success: Zero based index of the file that was added
Failure: -1

Remarks

None.

Related

_GUICtrlListBox_AddString, _GUICtrlListBox_DeleteString, _GUICtrlListBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Add File", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add file
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_AddString

Function Reference

_GUICtrlListBox_AddString

Add a string

#Include <GuiListBox.au3>
_GUICtrlListBox_AddString($hWnd, $sText)

Parameters

$hWnd | Handle to control
$sText | String that is to be added

Return Value

Success: Zero based index of string
Failure: -1

Remarks

If there is insufficient space to store the new string, the return value is $LB_ERRSPACE.

If the list box does not have the $LBS_SORT style, the string is added to the end of the list.
Otherwise, the string is inserted into the list and the list is sorted.

Related

_GUICtrlListBox_InsertString, _GUICtrlListBox_DeleteString, _GUICtrlListBox_AddFile, _GUICtrlListBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Add String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_InsertString($hListBox, "Exact teXt", 3)
_GUICtrlListBox_InsertString($hListBox, "This is the string that we're looking for", 6)
_GUICtrlListBox_InsertString($hListBox, _
"Let's add one really long line of text so that we can set the horizontal scroll bar and " & _
"show that, unless we dynamically update the scroll bar, it won't show the full line.", 9)
_GUICtrlListBox_UpdateHScroll($hListBox)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_BeginUpdate

Function Reference

_GUICtrlListBox_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiListBox.au3>
_GUICtrlListBox_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlListBox_EndUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Begin Update", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_ClickItem

Function Reference

_GUICtrlListBox_ClickItem

Clicks an item

#Include <GuiListBox.au3>
_GUICtrlListBox_ClickItem($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 0]]]])

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item
$sButton | [optional] Button to click with
$fMove | [optional] If True, the mouse will be moved. If False, the mouse does not move.
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Click Item_GUICtrlListBox_ClickItem", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Click an item
_GUICtrlListBox_ClickItem($hListBox, 4, "left", True)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_Create

Function Reference

_GUICtrlListBox_Create

Create a Listbox control

#Include <GuiListBox.au3>
_GUICtrlListBox_Create($hWnd, $sText, $iX, $iY[, $iWidth = 100[, $iHeight = 200[, $iStyle = 0x00B00002[, $iExStyle = 0x00000200]]]])

Parameters

$hWnd | Handle to parent or owner window
$sText | String to add to the combobox
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control style:
$LBS_COMBOBOX - Notifies a list box that it is part of a combo box
$LBS_DISABLENOSCROLL - Shows a disabled vertical scroll bar
$LBS_EXTENDEDSEL - Allows multiple items to be selected
$LBS_HASSTRINGS - Specifies that a list box contains items consisting of strings
$LBS_MULTICOLUMN - Specifies a multi columnn list box that will be scrolled horizontally
$LBS_MULTIPLESEL - Turns string selection on or off each time the user clicks a string
$LBS_NODATA - Specifies a no-data list box
$LBS_NOINTEGRALHEIGHT - Specifies that the size is exactly the size set by the application
$LBS_NOREDRAW - Specifies that the list box's appearance is not updated when changes are made
$LBS_NOSEL - Specifies that the list box contains items that can be viewed but not selected
$LBS_NOTIFY - Notifies whenever the user clicks or double clicks a string
$LBS_OWNERDRAWFIXED - Specifies that the list box is owner drawn
$LBS_OWNERDRAWVARIABLE - Specifies that the list box is owner drawn with variable height
$LBS_SORT - Sorts strings in the list box alphabetically
$LBS_STANDARD - Standard list box style
$LBS_USETABSTOPS - Enables a list box to recognize and expand tab characters
$LBS_WANTKEYBOARDINPUT - Specifies that the owner receives WM_VKEYTOITEM messages
Default: $LBS_SORT, $WS_HSCROLL, $WS_VSCROLL, $WS_BORDER
Forced : $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE, $LBS_NOTIFY
$iExStyle [optional] Control extended style. These correspond to the standard $WS_EX_ constants.
Default: $WS_EX_CLIENTEDGE

Return Value

Success: | Handle to the Listbox control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlListBox_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

Global $hListBox

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(UDF Created) List Box Create", 400, 296)
$hListBox = _GUICtrlListBox_Create($hGUI, "String upon creation", 2, 2, 396, 296)
GUISetState()

MsgBox(4160, "Information", "Adding Items")

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word

Switch $hWndFrom
Case $hListBox, $hWndListBox
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
_DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $LBN_ERRSPACE ; Sent when a list box cannot allocate enough memory to meet a specific request
_DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $LBN_KILLFOCUS ; Sent when a list box loses the keyboard focus
_DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $LBN_SELCANCEL ; Sent when the user cancels the selection in a list box
_DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $LBN_SELCHANGE ; Sent when the selection in a list box has changed
_DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
Case $LBN_SETFOCUS ; Sent when a list box receives the keyboard focus
_DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; no return value
EndSwitch
EndSwitch
; Proceed the default Autoit3 internal message commands.
; You also can complete let the line out.
; !!! But only 'Return' (without any value) will not proceed
; the default Autoit3-message in the future !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

Func _DebugPrint($s_text)
$s_text = StringReplace($s_text, @LF, @LF & "-->")
ConsoleWrite("!===========================================================" & @LF & _
"+===========================================================" & @LF & _
"-->" & $s_text & @LF & _
"+===========================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListBox_DeleteString

Function Reference

_GUICtrlListBox_DeleteString

Delete a string

#Include <GuiListBox.au3>
_GUICtrlListBox_DeleteString($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero-based index of the string to be deleted

Return Value

Success: Count of strings remaining
Failure: -1

Remarks

None.

Related

_GUICtrlListBox_AddString, _GUICtrlListBox_InsertString, _GUICtrlListBox_AddFile, _GUICtrlListBox_ResetContent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Delete String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%d : List box string", $iI))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Delete middle string
_GUICtrlListBox_DeleteString($hListBox, 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_Destroy

Function Reference

_GUICtrlListBox_Destroy

Delete the control

#Include <GuiListBox.au3>
_GUICtrlListBox_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Listbox created with _GUICtrlListBox_Create

Related

_GUICtrlListBox_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hListBox

; Create GUI
$hGUI = GUICreate("(UDF Created) List Box Destroy", 400, 296)
$hListBox = _GUICtrlListBox_Create($hGUI, "", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($hListBox)

MsgBox(4160, "Information", "Destroying ListBox")
_GUICtrlListBox_Destroy($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlListBox_Dir

Function Reference

_GUICtrlListBox_Dir

Adds the names of directories and files

#Include <GuiListBox.au3>
_GUICtrlListBox_Dir($hWnd, $sFile[, $iAttributes = 0[, $fBrackets = True]])

Parameters

$hWnd | Handle to control
$sFile | Specifies an absolute path, relative path, or filename
$iAttributes | [optional] Specifies the attributes of the files or directories to be added: $DDL_READWRITE - Includes read-write files with no additional attributes $DDL_READONLY - Includes read-only files $DDL_HIDDEN - Includes hidden files $DDL_SYSTEM - Includes system files $DDL_DIRECTORY - Includes subdirectories $DDL_ARCHIVE - Includes archived files $DDL_DRIVES - All mapped drives are added to the list $DDL_EXCLUSIVE - Includes only files with the specified attributes
$fBrackets | [optional] include/exclude brackets when $DDL_DRIVES is used

Return Value

Success: | Zero based index of the last name added
Failure: | -1

Remarks

If there is insufficient space to store the new strings, the return value is $LB_ERRSPACE

Related

_GUICtrlListBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Dir", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_EndUpdate

Function Reference

_GUICtrlListBox_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiListBox.au3>
_GUICtrlListBox_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlListBox_BeginUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box End Update", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES)
_GUICtrlListBox_Dir($hListBox, "", $DDL_DRIVES, False)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_FindInText

Function Reference

_GUICtrlListBox_FindInText

Searches for an item that contains the specified text anywhere in its text

#Include <GuiListBox.au3>
_GUICtrlListBox_FindInText($hWnd, $sText[, $iStart = -1[, $fWrapOK = True]])

Parameters

$hWnd | Handle to the control
$sText | Text to match
$iStart | [optional] Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
$fWrapOK | [optional] If True, the search will continue with the first item if no match is found

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

The search is case insensitive

Related

_GUICtrlListBox_FindString, _GUICtrlListBox_SelectString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Find In Text", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_InsertString($hListBox, "eXaCt tExT", 3)
_GUICtrlListBox_EndUpdate($hListBox)

; Find an item
$iIndex = _GUICtrlListBox_FindInText($hListBox, "exa")
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_FindString

Function Reference

_GUICtrlListBox_FindString

Search for a string

#Include <GuiListBox.au3>
_GUICtrlListBox_FindString($hWnd, $sText[, $fExact = False])

Parameters

$hWnd | Handle to control
$sText | String to search for
$fExact | [optional] Exact match or not

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

Find the first string in a list box that begins with the specified string.

If exact is specified find the first list box string that exactly matches the specified string,
except that the search is not case sensitive

Related

_GUICtrlListBox_FindInText, _GUICtrlListBox_SelectString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

Example()
Example2()

Func Example()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Find String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_InsertString($hListBox, "eXaCt tExT", 3)
_GUICtrlListBox_EndUpdate($hListBox)

; Find an item
$iIndex = _GUICtrlListBox_FindString($hListBox, "exa")
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example

Func Example2()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Find String Exact", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_InsertString($hListBox, "eXa", 2)
_GUICtrlListBox_InsertString($hListBox, "eXaCt tExT", 3)
_GUICtrlListBox_EndUpdate($hListBox)

; Find an item
$iIndex = _GUICtrlListBox_FindString($hListBox, "exact text", True)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2


Function _GUICtrlListBox_GetAnchorIndex

Function Reference

_GUICtrlListBox_GetAnchorIndex

Retrieves the index of the anchor item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetAnchorIndex($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The zero based index of the item

Remarks

None.

Related

_GUICtrlListBox_SetAnchorIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Get Anchor Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set anchor index
_GUICtrlListBox_SetAnchorIndex($hListBox, 2)

; Read anchor index
$iIndex = _GUICtrlListBox_GetAnchorIndex($hListBox)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetCaretIndex

Function Reference

_GUICtrlListBox_GetCaretIndex

Return index of item that has the focus rectangle

#Include <GuiListBox.au3>
_GUICtrlListBox_GetCaretIndex($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Zero based index of the selected item
Failure: -1 if nothing is selected

Remarks

None.

Related

_GUICtrlListBox_SetCaretIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Get Caret Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set caret index
_GUICtrlListBox_SetCaretIndex($hListBox, 2)

; Read caret index
$iIndex = _GUICtrlListBox_GetCaretIndex($hListBox)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetCount

Function Reference

_GUICtrlListBox_GetCount

Retrieves the number of items

#Include <GuiListBox.au3>
_GUICtrlListBox_GetCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The number of items in the list box
Failure: -1

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Count", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)

GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Get item count
MsgBox(4160, "Information", "Item count: " & _GUICtrlListBox_GetCount($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetCurSel

Function Reference

_GUICtrlListBox_GetCurSel

Retrieve the index of the currently selected item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetCurSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Zero based index of the currently selected item
Failure: -1 if there is no selection

Remarks

Do not use this with a multiple-selection list box.

Related

_GUICtrlListBox_SetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Cur Sel", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select an item
_GUICtrlListBox_SetCurSel($hListBox, 4)

; Get currently selected item
_WinAPI_ShowMsg("Current selction: " & _GUICtrlListBox_GetCurSel($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetHorizontalExtent

Function Reference

_GUICtrlListBox_GetHorizontalExtent

Retrieve from a list box the the scrollable width

#Include <GuiListBox.au3>
_GUICtrlListBox_GetHorizontalExtent($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Scrollable width, in pixels, of the list box

Remarks

The list box must have been defined with the $WS_HSCROLL style.

Related

_GUICtrlListBox_SetHorizontalExtent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Horizontal Extent", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add long string
_GUICtrlListBox_AddString($hListBox, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.")

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

_GUICtrlListBox_SetHorizontalExtent($hListBox, 500)

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetItemData

Function Reference

_GUICtrlListBox_GetItemData

Retrieves the application defined value associated with an item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetItemData($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item

Return Value

Success: Application defined value
Failure: -1

Remarks

None.

Related

_GUICtrlListBox_SetItemData

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

; Warning this should not be used on items created using built-in functions
; Item data is the ControlID for each string

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Item Data", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set item data
_GUICtrlListBox_SetItemData($hListBox, 4, 1234)

; Get item data
MsgBox(4160, "Information", "Item 5 Data: " & _GUICtrlListBox_GetItemData($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetItemHeight

Function Reference

_GUICtrlListBox_GetItemHeight

Retrieves the height of items

#Include <GuiListBox.au3>
_GUICtrlListBox_GetItemHeight($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The height, in pixels, of each item in the list box
Failure: 0

Remarks

None.

Related

_GUICtrlListBox_SetItemHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Item Height", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item height
MsgBox(4160, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($hListBox))

; Set item height
_GUICtrlListBox_SetItemHeight($hListBox, 26)

; Show item height
MsgBox(4160, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetItemRect

Function Reference

_GUICtrlListBox_GetItemRect

Retrieves the rectangle that bounds an item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetItemRect($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlListBox_GetItemRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hListBox

; Create GUI
GUICreate("List Box Get Item Rect", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item rectangle
$aRect = _GUICtrlListBox_GetItemRect($hListBox, 4)
MsgBox(4160, "Information", "Item 5 Rectangle: " & $aRect[0] & ", " & $aRect[1] & ", " & $aRect[2] & ", " & $aRect[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetItemRectEx

Function Reference

_GUICtrlListBox_GetItemRectEx

Retrieves the rectangle that bounds an item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetItemRectEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item

Return Value

Success: $tagRECT structure that receives the client coordinates for the item

Remarks

None.

Related

_GUICtrlListBox_GetItemRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $hListBox

; Create GUI
GUICreate("List Box Get Item RectEx", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item rectangle
$tRect = _GUICtrlListBox_GetItemRectEx($hListBox, 4)
MsgBox(4160, "Information", "Item 5 Rectangle: " & _
DllStructGetData($tRect, "Left") & ", " & _
DllStructGetData($tRect, "Top") & ", " & _
DllStructGetData($tRect, "Right") & ", " & _
DllStructGetData($tRect, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetListBoxInfo

Function Reference

_GUICtrlListBox_GetListBoxInfo

Retrieve the number of items per column in a specified list box

#Include <GuiListBox.au3>
_GUICtrlListBox_GetListBoxInfo($hWnd)

Parameters

$hWnd Handle to control

Return Value

Returns the number of items per column

Remarks

Minimum OS - Windows XP.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GUIListBox.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get ListBox Info", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show items per column
MsgBox(4160, "Information", "Items per column: " & _GUICtrlListBox_GetListBoxInfo($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetLocale

Function Reference

_GUICtrlListBox_GetLocale

Retrieves the current locale

#Include <GuiListBox.au3>
_GUICtrlListBox_GetLocale($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The high order word contains the country code and the low order word contains the language identifier.

Remarks

None.

Related

_GUICtrlListBox_GetLocaleCountry, _GUICtrlListBox_GetLocaleLang, _GUICtrlListBox_GetLocalePrimLang, _GUICtrlListBox_GetLocaleSubLang, _GUICtrlListBox_SetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Locale", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlListBox_GetLocale($hListBox) & @LF & _
"Country code ........: " & _GUICtrlListBox_GetLocaleCountry($hListBox) & @LF & _
"Language identifier..: " & _GUICtrlListBox_GetLocaleLang($hListBox) & @LF & _
"Primary Language id : " & _GUICtrlListBox_GetLocalePrimLang($hListBox) & @LF & _
"Sub-Language id ....: " & _GUICtrlListBox_GetLocaleSubLang($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetLocaleCountry

Function Reference

_GUICtrlListBox_GetLocaleCountry

Retrieves the current country code

#Include <GuiListBox.au3>
_GUICtrlListBox_GetLocaleCountry($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The country code of the list box

Remarks

None.

Related

_GUICtrlListBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Locale Country Code", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlListBox_GetLocale($hListBox) & @LF & _
"Country code ........: " & _GUICtrlListBox_GetLocaleCountry($hListBox) & @LF & _
"Language identifier..: " & _GUICtrlListBox_GetLocaleLang($hListBox) & @LF & _
"Primary Language id : " & _GUICtrlListBox_GetLocalePrimLang($hListBox) & @LF & _
"Sub-Language id ....: " & _GUICtrlListBox_GetLocaleSubLang($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetLocaleLang

Function Reference

_GUICtrlListBox_GetLocaleLang

Retrieves the current language identifier

#Include <GuiListBox.au3>
_GUICtrlListBox_GetLocaleLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The language identifier of the list box

Remarks

None.

Related

_GUICtrlListBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Locale Language identifier", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlListBox_GetLocale($hListBox) & @LF & _
"Country code ........: " & _GUICtrlListBox_GetLocaleCountry($hListBox) & @LF & _
"Language identifier..: " & _GUICtrlListBox_GetLocaleLang($hListBox) & @LF & _
"Primary Language id : " & _GUICtrlListBox_GetLocalePrimLang($hListBox) & @LF & _
"Sub-Language id ....: " & _GUICtrlListBox_GetLocaleSubLang($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetLocalePrimLang

Function Reference

_GUICtrlListBox_GetLocalePrimLang

Extract primary language id from a language id

#Include <GuiListBox.au3>
_GUICtrlListBox_GetLocalePrimLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Primary language id

Remarks

None.

Related

_GUICtrlListBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Locale Primary Language id", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlListBox_GetLocale($hListBox) & @LF & _
"Country code ........: " & _GUICtrlListBox_GetLocaleCountry($hListBox) & @LF & _
"Language identifier..: " & _GUICtrlListBox_GetLocaleLang($hListBox) & @LF & _
"Primary Language id : " & _GUICtrlListBox_GetLocalePrimLang($hListBox) & @LF & _
"Sub-Language id ....: " & _GUICtrlListBox_GetLocaleSubLang($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetLocaleSubLang

Function Reference

_GUICtrlListBox_GetLocaleSubLang

Extract sublanguage id from a language id

#Include <GuiListBox.au3>
_GUICtrlListBox_GetLocaleSubLang($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Sub-Language id

Remarks

None.

Related

_GUICtrlListBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Locale Sub-Language id", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Show locale, country code, language identifier, primary language id, sub-language id
MsgBox(4160, "Information", _
"Locale .................: " & _GUICtrlListBox_GetLocale($hListBox) & @LF & _
"Country code ........: " & _GUICtrlListBox_GetLocaleCountry($hListBox) & @LF & _
"Language identifier..: " & _GUICtrlListBox_GetLocaleLang($hListBox) & @LF & _
"Primary Language id : " & _GUICtrlListBox_GetLocalePrimLang($hListBox) & @LF & _
"Sub-Language id ....: " & _GUICtrlListBox_GetLocaleSubLang($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetSel

Function Reference

_GUICtrlListBox_GetSel

Retrieves the selection state of an item

#Include <GuiListBox.au3>
_GUICtrlListBox_GetSel($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero-based index of the item

Return Value

True: Item is selected
False: Item is not selected

Remarks

None.

Related

_GUICtrlListBox_SetSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Sel", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SetSel($hListBox, 3)
_GUICtrlListBox_SetSel($hListBox, 4)
_GUICtrlListBox_SetSel($hListBox, 5)

; Show the item selection state
MsgBox(4160, "Information", "Item 5 Selected: " & _GUICtrlListBox_GetSel($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetSelCount

Function Reference

_GUICtrlListBox_GetSelCount

Retrieves the total number of selected items

#Include <GuiListBox.au3>
_GUICtrlListBox_GetSelCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Count of selected items
Failure: -1 if no items are selected

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Sel Count", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SetSel($hListBox, 3)
_GUICtrlListBox_SetSel($hListBox, 4)
_GUICtrlListBox_SetSel($hListBox, 5)

; Show the item selection state
MsgBox(4160, "Information", "Items Selected: " & _GUICtrlListBox_GetSelCount($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetSelItems

Function Reference

_GUICtrlListBox_GetSelItems

Fills a buffer with an array of selected items

#Include <GuiListBox.au3>
_GUICtrlListBox_GetSelItems($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - Total items in array
[1] - Index of the selected item
[2] - Index of the selected item
[n] - Index of the selected item

Remarks

None.

Related

_GUICtrlListBox_GetSelItemsText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sItems, $aItems, $hListBox

; Create GUI
GUICreate("List Box Get Sel Items", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SetSel($hListBox, 3)
_GUICtrlListBox_SetSel($hListBox, 4)
_GUICtrlListBox_SetSel($hListBox, 5)

; Get indexes of selected items
$aItems = _GUICtrlListBox_GetSelItems($hListBox)
For $iI = 1 To $aItems[0]
If $iI > 1 Then $sItems &= ", "
$sItems &= $aItems[$iI]
Next
MsgBox(4160, "Information", "Items Selected: " & $sItems)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetSelItemsText

Function Reference

_GUICtrlListBox_GetSelItemsText

Retrieves the text of selected items

#Include <GuiListBox.au3>
_GUICtrlListBox_GetSelItemsText($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - Total items in array
[1] - Text of the selected item
[2] - Text of the selected item
[n] - Text of the selected item

Remarks

None.

Related

_GUICtrlListBox_GetSelItems

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sItems, $aItems, $hListBox

; Create GUI
GUICreate("List Box Get Sel Items Text", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SetSel($hListBox, 3)
_GUICtrlListBox_SetSel($hListBox, 4)
_GUICtrlListBox_SetSel($hListBox, 5)

; Get indexes of selected items
$aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
For $iI = 1 To $aItems[0]
$sItems &= @LF & $aItems[$iI]
Next
MsgBox(4160, "Information", "Items Selected: " & $sItems)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetText

Function Reference

_GUICtrlListBox_GetText

Returns the item (string) at the specified index

#Include <GuiListBox.au3>
_GUICtrlListBox_GetText($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero-based index of the string to retrieve

Return Value

Success: item (string)

Remarks

None.

Related

_GUICtrlListBox_GetTextLen

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Get Text", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item text
MsgBox(4160, "Information", "Item 5 Text: " & _GUICtrlListBox_GetText($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetTextLen

Function Reference

_GUICtrlListBox_GetTextLen

Gets the length of a string in a list box

#Include <GuiListBox.au3>
_GUICtrlListBox_GetTextLen($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item

Return Value

Success: The length of the string

Remarks

None.

Related

_GUICtrlListBox_GetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Get Text Len", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item text length
MsgBox(4160, "Information", "Item 5 Text Length: " & _GUICtrlListBox_GetTextLen($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_GetTopIndex

Function Reference

_GUICtrlListBox_GetTopIndex

Retrieve the index of the first visible item in a list

#Include <GuiListBox.au3>
_GUICtrlListBox_GetTopIndex($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The index of the first visible item

Remarks

None.

Related

_GUICtrlListBox_SetTopIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Get Top Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 100
$sText = StringFormat("%03d : Random string ", $iI)
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show top index
MsgBox(4160, "Information", "Top Index: " & _GUICtrlListBox_GetTopIndex($hListBox))

; Set top index
_GUICtrlListBox_SetTopIndex($hListBox, 50)

; Show top index
MsgBox(4160, "Information", "Top Index: " & _GUICtrlListBox_GetTopIndex($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_InitStorage

Function Reference

_GUICtrlListBox_InitStorage

This message allocates memory for storing items

#Include <GuiListBox.au3>
_GUICtrlListBox_InitStorage($hWnd, $iItems, $iBytes)

Parameters

$hWnd | Handle to control
$iItems | The total amount of items that you intend to add
$iBytes | The total amount of memory your strings will consume

Return Value

Success: The total number of items for which memory has been pre-allocated

Remarks

None.

Related

_GUICtrlListBox_AddFile, _GUICtrlListBox_AddString, _GUICtrlListBox_Dir, _GUICtrlListBox_InsertString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Init Storage", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add files
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
MsgBox(4160, "Information", "Storage Allocated: " & _GUICtrlListBox_InitStorage($hListBox, 100, 4096))
_GUICtrlListBox_Dir($hListBox, @WindowsDir & "\win*.exe")
_GUICtrlListBox_AddFile($hListBox, @WindowsDir & "\Notepad.exe")
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_InsertString

Function Reference

_GUICtrlListBox_InsertString

Insert a string into the list

#Include <GuiListBox.au3>
_GUICtrlListBox_InsertString($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | Text string to be inserted
$iIndex | [optional] Specifies the zero based index of the position at which to insert the string. If this parameter is -1 the string is added to the end of the list.

Return Value

Success: | Zero based index of the item position
Failure: | -1

Remarks

If $iIndex is -1 then string is added to end of list. Unlike the _GUICtrlListBox_AddString,
this function does not cause a list with the $LBS_SORT style to be sorted.

Related

_GUICtrlListBox_AddString, _GUICtrlListBox_DeleteString, _GUICtrlListBox_InitStorage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Insert String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_InsertString($hListBox, "Let's add one really long line of text so that we can set the horizontal scroll bar and " & _
"show that, unless we dynamically update the scroll bar, it won't show the full line.", 4)
_GUICtrlListBox_UpdateHScroll($hListBox)
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_ItemFromPoint

Function Reference

_GUICtrlListBox_ItemFromPoint

Retrieves the zero based index of the item nearest the specified point

#Include <GuiListBox.au3>
_GUICtrlListBox_ItemFromPoint($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to control
$iX | X coordinate, relative to the upper-left corner of the client area
$iY | Y coordinate, relative to the upper-left corner of the client area

Return Value

Success: The index of the nearest item
Failure: -1 if the point is outside of the client area

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Item From Point", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Item closest to point
MsgBox(4160, "Information", "Item Closest to 30, 30: " & _GUICtrlListBox_ItemFromPoint($hListBox, 30, 30))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_ReplaceString

Function Reference

_GUICtrlListBox_ReplaceString

Replaces the text of an item

#Include <GuiListBox.au3>
_GUICtrlListBox_ReplaceString($hWnd, $iIndex, $sText)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item
$sText | String to replace old string

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Replace String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Replace string
MsgBox(4160, "Information", "Replacing String at Index 3")
_GUICtrlListBox_ReplaceString($hListBox, 3, "gone")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_ResetContent

Function Reference

_GUICtrlListBox_ResetContent

Remove all items from the list box

#Include <GuiListBox.au3>
_GUICtrlListBox_ResetContent($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

None.

Related

_GUICtrlListBox_DeleteString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Reset Content", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

MsgBox(4160, "Information", "Resetting Content")
_GUICtrlListBox_ResetContent($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SelectString

Function Reference

_GUICtrlListBox_SelectString

Searchs for an item that begins with the specified string

#Include <GuiListBox.au3>
_GUICtrlListBox_SelectString($hWnd, $sText[, $iIndex = -1])

Parameters

$hWnd | Handle to control
$sText | String that contains the string for which to search.
$iIndex | [optional] Specifies the zero based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues searching from the top of the list box back to the item specified by $iIndex. If $iIndex is –1, the entire list box is searched from the beginning.

Return Value

Success: | The zero based index of the selected item
Failure: | -1

Remarks

The list box is scrolled, if necessary, to bring the selected item into view.
Do not use this message with a list box that has the $LBS_MULTIPLESEL or the $LBS_EXTENDEDSEL styles.

Related

_GUICtrlListBox_FindString, _GUICtrlListBox_FindInText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Select String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 10
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_AddString($hListBox, "020 : Target string")
_GUICtrlListBox_EndUpdate($hListBox)

; Select string
MsgBox(4160, "Information", "Target String Index: " & _GUICtrlListBox_SelectString($hListBox, "020 : T"));

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SelItemRange

Function Reference

_GUICtrlListBox_SelItemRange

Select one or more consecutive items in a multiple-selection list box

#Include <GuiListBox.au3>
_GUICtrlListBox_SelItemRange($hWnd, $iFirst, $iLast[, $fSelect = True])

Parameters

$hWnd | Handle to control
$iFirst | Zero based index of the first item to select
$iLast | Zero based index of the last item to select
$fSelect | [optional] Specifies how to set the selection. If this parameter is True, the string is selected and highlighted; if it is False, the highlight is removed and the string is no longer selected.

Return Value

Success: | True
Failure: | False

Remarks

Use this message only with multiple-selection list boxes.
This message can select a range only within the first 65,536 items.

Related

_GUICtrlListBox_SelItemRangeEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Sel Item Range", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 10
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SelItemRange($hListBox, 3, 5)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SelItemRangeEx

Function Reference

_GUICtrlListBox_SelItemRangeEx

Select one or more consecutive items in a multiple-selection list box

#Include <GuiListBox.au3>
_GUICtrlListBox_SelItemRangeEx($hWnd, $iFirst, $iLast)

Parameters

$hWnd | Handle to control
$iFirst | Zero based index of the first item to select
$iLast | Zero based index of the last item to select

Return Value

Success: True
Failure: False

Remarks

If the $iFirst is less than the $iLast, the specified range of items is selected. If
$iFirst is greater than or equal to $iLast, the range is removed from the specified
range of items. To select only one item, select two items and then deselect the
unwanted item.

Use this message only with multiple-selection list boxes.
This message can select a range only within the first 65,536 items.

Related

_GUICtrlListBox_SelItemRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Sel Item RangeEx", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 10
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SelItemRangeEx($hListBox, 3, 5)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetAnchorIndex

Function Reference

_GUICtrlListBox_SetAnchorIndex

Set the anchor item—that is, the item from which a multiple selection starts

#Include <GuiListBox.au3>
_GUICtrlListBox_SetAnchorIndex($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlListBox_GetAnchorIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Set Anchor Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set anchor index
_GUICtrlListBox_SetAnchorIndex($hListBox, 2)

; Read anchor index
$iIndex = _GUICtrlListBox_GetAnchorIndex($hListBox)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetCaretIndex

Function Reference

_GUICtrlListBox_SetCaretIndex

Set the focus rectangle to the item at the specified index in a multiple-selection list box

#Include <GuiListBox.au3>
_GUICtrlListBox_SetCaretIndex($hWnd, $iIndex[, $fPartial = False])

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item
$fPartial | [optional] If False, the item is scrolled until it is fully visible; if it is True, the item is scrolled until it is at least partially visible.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListBox_GetCaretIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iIndex, $hListBox

; Create GUI
GUICreate("List Box Set Caret Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set caret index
_GUICtrlListBox_SetCaretIndex($hListBox, 2)

; Read caret index
$iIndex = _GUICtrlListBox_GetCaretIndex($hListBox)
_GUICtrlListBox_SetCurSel($hListBox, $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetColumnWidth

Function Reference

_GUICtrlListBox_SetColumnWidth

Set the width, in pixels, of all columns

#Include <GuiListBox.au3>
_GUICtrlListBox_SetColumnWidth($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | Specifies the width, in pixels, of all columns

Return Value

None.

Remarks

For use on controls created with the $LBS_MULTICOLUMN style

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Column Width", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_MULTICOLUMN))
GUISetState()

; Set the width of the columns
_GUICtrlListBox_SetColumnWidth($hListBox, 100)

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 50
_GUICtrlListBox_AddString($hListBox, StringFormat("Item %03d", $iI))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetCurSel

Function Reference

_GUICtrlListBox_SetCurSel

Select a string and scroll it into view, if necessary

#Include <GuiListBox.au3>
_GUICtrlListBox_SetCurSel($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the string that is selected. If this parameter is -1 the list box is set to have no selection.

Return Value

Success: True
Failure: False

Remarks

Use this message only with single-selection list boxes.
You cannot use it to set or remove a selection in a multiple-selection list box

Related

_GUICtrlListBox_GetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Cur Sel", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select an item
_GUICtrlListBox_SetCurSel($hListBox, 4)

; Get currently selected item
MsgBox(4160, "Information", "Current selction: " & _GUICtrlListBox_GetCurSel($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetHorizontalExtent

Function Reference

_GUICtrlListBox_SetHorizontalExtent

Set the width, in pixels, by which a list box can be scrolled horizontally

#Include <GuiListBox.au3>
_GUICtrlListBox_SetHorizontalExtent($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | Specifies the number of pixels the list box can be scrolled

Return Value

None.

Remarks

Microsoft Windows 95/Windows 98/Windows Millennium Edition (Windows Me) : The $iWidth parameter
is limited to 16-bit values.

To respond to the _GUICtrlListBox_SetHorizontalExtent, the list box must have been defined with
the $WS_HSCROLL style.

Related

_GUICtrlListBox_GetHorizontalExtent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Horizontal Extent", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
GUISetState()

; Add long string
_GUICtrlListBox_AddString($hListBox, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.")

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

_GUICtrlListBox_SetHorizontalExtent($hListBox, 500)

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetItemData

Function Reference

_GUICtrlListBox_SetItemData

Sets the value associated with the specified item

#Include <GuiListBox.au3>
_GUICtrlListBox_SetItemData($hWnd, $iIndex, $iValue)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item
$iValue | Specifies the value to be associated with the item

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlListBox_GetItemData

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

; Warning this should not be used on items created using built-in functions
; Item data is the ControlID for each string

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Item Data", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Set item data
_GUICtrlListBox_SetItemData($hListBox, 4, 1234)

; Get item data
MsgBox(4160, "Information", "Item 5 Data: " & _GUICtrlListBox_GetItemData($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetItemHeight

Function Reference

_GUICtrlListBox_SetItemHeight

Sets the height, in pixels, of items

#Include <GuiListBox.au3>
_GUICtrlListBox_SetItemHeight($hWnd, $iHeight[, $iIndex = 0])

Parameters

$hWnd | Handle to control
$iHeight | Specifies the height, in pixels, of the item
$iIndex | [optional] Specifies the zero based index of the item in the list box. Use this only if the control has the LBS_OWNERDRAWVARIABLE style otherwise, set it to zero.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListBox_GetItemHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Item Height", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show item height
MsgBox(4160, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($hListBox))

; Set item height
_GUICtrlListBox_SetItemHeight($hListBox, 26)

; Show item height
MsgBox(4160, "Information", "Item height: " & _GUICtrlListBox_GetItemHeight($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetLocale

Function Reference

_GUICtrlListBox_SetLocale

Set the current locale

#Include <GuiListBox.au3>
_GUICtrlListBox_SetLocale($hWnd, $iLocal)

Parameters

$hWnd | Handle to control
$iLocal | Specifies the locale identifier that the list box will use for sorting when adding text

Return Value

Success: The previous locale identifier
Failure: -1

Remarks

None.

Related

_GUICtrlListBox_GetLocale

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iLocale, $hListBox

; Create GUI
GUICreate("List Box Set Locale", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

$iLocale = _WinAPI_MAKELCID(_WinAPI_MAKELANGID($LANG_DUTCH, $SUBLANG_DUTCH), $SORT_DEFAULT)

MsgBox(4160, "Information", "Previous Locale: " & _GUICtrlListBox_SetLocale($hListBox, $iLocale))

$iLocale = _WinAPI_MAKELCID(_WinAPI_MAKELANGID($LANG_ENGLISH, $SUBLANG_ENGLISH_US), $SORT_DEFAULT)

MsgBox(4160, "Information", "Previous Locale: " & _GUICtrlListBox_SetLocale($hListBox, $iLocale))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetSel

Function Reference

_GUICtrlListBox_SetSel

Select a string(s) in a multiple-selection list box

#Include <GuiListBox.au3>
_GUICtrlListBox_SetSel($hWnd[, $iIndex = -1[, $fSelect = -1]])

Parameters

$hWnd | Handle to control
$iIndex | [optional] Specifies the zero based index of the item
$fSelect | [optional] Specifies how to set the selection.

Return Value

Success: | True
Failure: | False

Remarks

An $iIndex of -1 means to toggle select/unselect of all items (ignores the $fSelect)

Related

_GUICtrlListBox_GetSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListBox

; Create GUI
GUICreate("List Box Set Sel", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
_GUICtrlListBox_AddString($hListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Select a few items
_GUICtrlListBox_SetSel($hListBox, 3)
_GUICtrlListBox_SetSel($hListBox, 4)
_GUICtrlListBox_SetSel($hListBox, 5)

; Show the item selection state
MsgBox(4160, "Information", "Item 5 Selected: " & _GUICtrlListBox_GetSel($hListBox, 4))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetTabStops

Function Reference

_GUICtrlListBox_SetTabStops

Sets the tab-stop positions

#Include <GuiListBox.au3>
_GUICtrlListBox_SetTabStops($hWnd, $aTabStops)

Parameters

$hWnd | Handle to control
$aTabStops | Array with the following format: [0] - Number of tab stops in the array (n) [1] - First tab stop [2] - Second tab stop [n] - Nth tab stop

Return Value

Success: True
Failure: False

Remarks

The integers in $aTabStops represent the number of quarters of the average character width for the font that
is selected into the list box. For example, a tab stop of 4 is placed at 1.0 character units, and a tab stop
of 6 is placed at 1.5 average character units. However, if the list box is part of a dialog box, the integers
are in dialog template units. The tab stops must be sorted in ascending order; backward tabs are not allowed.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aTabs[4] = [3, 100, 200, 300], $hListBox

; Create GUI
GUICreate("List Box Set Tab Stops", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_USETABSTOPS))
GUISetState()

; Set tab stops
_GUICtrlListBox_SetTabStops($hListBox, $aTabs)

; Add tabbed string
_GUICtrlListBox_AddString($hListBox, "Column 1" & @TAB & "Column 2" & @TAB & "Column 3")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SetTopIndex

Function Reference

_GUICtrlListBox_SetTopIndex

Ensure that a particular item in a list box is visible

#Include <GuiListBox.au3>
_GUICtrlListBox_SetTopIndex($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero-based index of the item

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlListBox_GetTopIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Set Top Index", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296)
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 100
$sText = StringFormat("%03d : Random string ", $iI)
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; Show top index
MsgBox(4160, "Information", "Top Index: " & _GUICtrlListBox_GetTopIndex($hListBox))

; Set top index
_GUICtrlListBox_SetTopIndex($hListBox, 50)

; Show top index
MsgBox(4160, "Information", "Top Index: " & _GUICtrlListBox_GetTopIndex($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_Sort

Function Reference

_GUICtrlListBox_Sort

Re-sorts list box if it has the $LBS_SORT style

#Include <GuiListBox.au3>
_GUICtrlListBox_Sort($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: True
Failure: False

Remarks

Re-sorts list box if it has the LBS_SORT style
Might be useful if you use InsertString

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Sort", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL, $LBS_SORT))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_InsertString($hListBox, "This is a test", 0) ; doesn't auto sort when using insert
_GUICtrlListBox_EndUpdate($hListBox)

; Sort'em
MsgBox(4160, "Information", "Sort Data")
_GUICtrlListBox_Sort($hListBox)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_SwapString

Function Reference

_GUICtrlListBox_SwapString

Swaps the text of two items at the specified indices

#Include <GuiListBox.au3>
_GUICtrlListBox_SwapString($hWnd, $iIndexA, $iIndexB)

Parameters

$hWnd | Handle to control
$iIndexA | Zero-based index item to swap
$iIndexB | Zero-based index item to swap

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $sText, $hListBox

; Create GUI
GUICreate("List Box Swap String", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUISetState()

; Add strings
_GUICtrlListBox_BeginUpdate($hListBox)
For $iI = 1 To 9
$sText = StringFormat("%03d : Random string ", Random(1, 100, 1))
For $iX = 1 To Random(1, 20, 1)
$sText &= Chr(Random(65, 90, 1))
Next
_GUICtrlListBox_AddString($hListBox, $sText)
Next
_GUICtrlListBox_EndUpdate($hListBox)

; swap the strings
MsgBox(4160, "Information", "Swapping Strings (3:5)")
_GUICtrlListBox_SwapString($hListBox, 3, 5)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListBox_UpdateHScroll

Function Reference

_GUICtrlListBox_UpdateHScroll

Update the horizontal scroll bar based on the longest string

#Include <GuiListBox.au3>
_GUICtrlListBox_UpdateHScroll($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LB = False ; Check ClassName being passed to ListBox functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aTabs[4] = [3, 100, 200, 300], $hListBox

; Create GUI
GUICreate("List Box Update HScroll", 400, 296)
$hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_NOTIFY, $LBS_SORT, $WS_HSCROLL, $WS_VSCROLL))
GUISetState()

; Add long string
_GUICtrlListBox_AddString($hListBox, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.")

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

; Adjust horizontal scroll bars
_GUICtrlListBox_UpdateHScroll($hListBox)

; Show current horizontal extent
MsgBox(4160, "Information", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiListView user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiListView.au3>.

User Defined Function | Description
_GUICtrlListView_AddArray | Adds items from an array to the control
_GUICtrlListView_AddColumn | Adds a new column in the control
_GUICtrlListView_AddItem | Adds a new item to the end of the list
_GUICtrlListView_AddSubItem | Adds a new subitem to the control
_GUICtrlListView_ApproximateViewHeight | Calculates the approximate height required to display a given number of items
_GUICtrlListView_ApproximateViewRect | Calculates the approximate size required to display a given number of items
_GUICtrlListView_ApproximateViewWidth | Calculates the approximate width required to display a given number of items
_GUICtrlListView_Arrange | Arranges items in icon view
_GUICtrlListView_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlListView_CancelEditLabel | Cancels an item text editing operation
_GUICtrlListView_ClickItem | Clicks an item
_GUICtrlListView_CopyItems | Copy Items between 2 list-view controls
_GUICtrlListView_Create | Create a ListView control
_GUICtrlListView_CreateDragImage | Creates a drag image list for the specified item
_GUICtrlListView_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlListView_DeleteAllItems | Removes all items from a list-view control
_GUICtrlListView_DeleteColumn | Removes a column from a list-view control
_GUICtrlListView_DeleteItem | Removes an item from a list-view control
_GUICtrlListView_DeleteItemsSelected | Deletes item(s) selected
_GUICtrlListView_Destroy | Delete the listview control
_GUICtrlListView_DrawDragImage | Draw the Drage Image
_GUICtrlListView_EditLabel | Begins in place editing of the specified item text
_GUICtrlListView_EnableGroupView | Enables or disables whether the items in the control display as a group
_GUICtrlListView_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlListView_EnsureVisible | Ensures that a list-view item is either entirely or partially visible
_GUICtrlListView_FindInText | Searches for an item that contains the specified text anywhere in its text
_GUICtrlListView_FindItem | Searches for an item with the specified characteristics
_GUICtrlListView_FindNearest | Finds the item nearest to the position specified
_GUICtrlListView_FindParam | Searches for an item with the specified lParam
_GUICtrlListView_FindText | Searches for an item with the specified text
_GUICtrlListView_GetBkColor | Retrieves the background color of a list-view control
_GUICtrlListView_GetBkImage | Retrieves the background image in the control
_GUICtrlListView_GetCallbackMask | Retrieves the callback mask for the control
_GUICtrlListView_GetColumn | Retrieves the attributes of a column
_GUICtrlListView_GetColumnCount | Retrieve the number of columns
_GUICtrlListView_GetColumnOrder | Retrieves the current left-to-right order of columns
_GUICtrlListView_GetColumnOrderArray | Retrieves the current left-to-right order of columns in the control
_GUICtrlListView_GetColumnWidth | Retrieves the width of a column in report or list view
_GUICtrlListView_GetCounterPage | Calculates the number of items that can fit vertically in the visible area
_GUICtrlListView_GetEditControl | Retrieves the handle to the edit control being used to edit an item's text
_GUICtrlListView_GetExtendedListViewStyle | Retrieves the extended styles that are currently in use
_GUICtrlListView_GetFocusedGroup | Gets the group that has the focus
_GUICtrlListView_GetGroupCount | Gets the number of groups
_GUICtrlListView_GetGroupInfo | Retrieves group information
_GUICtrlListView_GetGroupInfoByIndex | Retrieves group information
_GUICtrlListView_GetGroupRect | Gets the rectangle for a specified group
_GUICtrlListView_GetGroupViewEnabled | Checks whether the control has group view enabled
_GUICtrlListView_GetHeader | Retrieves the handle to the header control
_GUICtrlListView_GetHotCursor | Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled
_GUICtrlListView_GetHotItem | Retrieves the index of the hot item
_GUICtrlListView_GetHoverTime | Retrieves the amount of time that the mouse cursor must hover over an item before it is selected
_GUICtrlListView_GetImageList | Retrieves the handle to an image list used for drawing listview items
_GUICtrlListView_GetISearchString | Retrieves the incremental search string of the control
_GUICtrlListView_GetItem | Retrieves an item's attributes
_GUICtrlListView_GetItemChecked | Returns the check state for a list-view control item
_GUICtrlListView_GetItemCount | Retrieves the number of items in a list-view control
_GUICtrlListView_GetItemCut | Determines whether the item is marked for a cut and paste operation
_GUICtrlListView_GetItemDropHilited | Determines whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_GetItemEx | Retrieves some or all of an item's attributes
_GUICtrlListView_GetItemFocused | Determines whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_GetItemGroupID | Gets the item group ID
_GUICtrlListView_GetItemImage | Retrieves the index of the item's icon
_GUICtrlListView_GetItemIndent | Retrieves the number of image widths the item is indented
_GUICtrlListView_GetItemParam | Retrieves the application specific value of the item
_GUICtrlListView_GetItemPosition | Retrieves the position of an item
_GUICtrlListView_GetItemPositionX | Retrieves the X position of an item
_GUICtrlListView_GetItemPositionY | Retrieves the Y position of an item
_GUICtrlListView_GetItemRect | Retrieves the bounding rectangle for all or part of an item
_GUICtrlListView_GetItemRectEx | Retrieves the bounding rectangle for all or part of an item
_GUICtrlListView_GetItemSelected | Determines whether the item is selected
_GUICtrlListView_GetItemSpacing | Determines the spacing between items in the control
_GUICtrlListView_GetItemSpacingX | Determines the horizontal spacing between items in the control
_GUICtrlListView_GetItemSpacingY | Determines the vertical spacing between items in the control
_GUICtrlListView_GetItemState | Retrieves the state of a listview item
_GUICtrlListView_GetItemStateImage | Gets the state image that is displayed
_GUICtrlListView_GetItemText | Retrieves the text of an item or subitem
_GUICtrlListView_GetItemTextArray | Retrieves all of a list-view item
_GUICtrlListView_GetItemTextString | Retrieves all of a list-view item
_GUICtrlListView_GetNextItem | Searches for an item that has the specified properties
_GUICtrlListView_GetNumberOfWorkAreas | Retrieves the number of working areas in the control
_GUICtrlListView_GetOrigin | Retrieves the current view origin for the control
_GUICtrlListView_GetOriginX | Retrieves the current horizontal view origin for the control
_GUICtrlListView_GetOriginY | Retrieves the current horizontal view origin for the control
_GUICtrlListView_GetOutlineColor | Retrieves the color of the border of the control
_GUICtrlListView_GetSelectedColumn | Retrieves the index of the selected column
_GUICtrlListView_GetSelectedCount | Determines the number of selected items
_GUICtrlListView_GetSelectedIndices | Retrieve indices of selected item(s)
_GUICtrlListView_GetSelectionMark | Retrieves the selection mark from the control
_GUICtrlListView_GetStringWidth | Determines the width of a specified string
_GUICtrlListView_GetSubItemRect | Retrieves information about an item bounding rectangle
_GUICtrlListView_GetTextBkColor | Retrieves the text background color of the control
_GUICtrlListView_GetTextColor | Retrieves the text color of the control
_GUICtrlListView_GetToolTips | Retrieves the ToolTip control handle
_GUICtrlListView_GetTopIndex | Retrieves the index of the topmost visible item when in list or report view
_GUICtrlListView_GetUnicodeFormat | Retrieves the UNICODE character format flag
_GUICtrlListView_GetView | Retrieves the current view of the control
_GUICtrlListView_GetViewDetails | Determines whether the view mode is in detail mode
_GUICtrlListView_GetViewLarge | Determines whether the view mode is in large icon mode
_GUICtrlListView_GetViewList | Determines whether the view mode is in list mode
_GUICtrlListView_GetViewRect | Retrieves the bounding rectangle of all items in the control
_GUICtrlListView_GetViewSmall | Determines whether the view mode is in small icon mode
_GUICtrlListView_GetViewTile | Determines whether the view mode is in tile mode
_GUICtrlListView_HideColumn | Hides the column "sets column width to zero"
_GUICtrlListView_HitTest | Determines which item is at a specified position
_GUICtrlListView_InsertColumn | Inserts a new column in the control
_GUICtrlListView_InsertGroup | Inserts a group
_GUICtrlListView_InsertItem | Inserts a new item in the control
_GUICtrlListView_JustifyColumn | Set Justification of a column for a list-view control
_GUICtrlListView_MapIDToIndex | Maps the ID of an item to an index
_GUICtrlListView_MapIndexToID | Maps an index to an item ID
_GUICtrlListView_RedrawItems | Forces the control to redraw a range of items
_GUICtrlListView_RegisterSortCallBack | Register the Simple Sort callback function
_GUICtrlListView_RemoveAllGroups | Removes all groups from the control
_GUICtrlListView_RemoveGroup | Removes a group from the control
_GUICtrlListView_Scroll | Scrolls the content of a list-view
_GUICtrlListView_SetBkColor | Sets the background color of the control
_GUICtrlListView_SetBkImage | Sets the background image in the control
_GUICtrlListView_SetCallBackMask | Changes the callback mask for the control
_GUICtrlListView_SetColumn | Sets the attributes of a column
_GUICtrlListView_SetColumnOrder | Sets the left-to-right order of columns
_GUICtrlListView_SetColumnOrderArray | Sets the left-to-right order of columns in the control
_GUICtrlListView_SetColumnWidth | Changes the width of a column
_GUICtrlListView_SetExtendedListViewStyle | Sets extended styles
_GUICtrlListView_SetGroupInfo | Sets group information
_GUICtrlListView_SetHotItem | Sets the hot item
_GUICtrlListView_SetHoverTime | Sets the amount of time which the mouse cursor must hover over an item before it is selected
_GUICtrlListView_SetIconSpacing | Sets the spacing between icons where the style is large icon
_GUICtrlListView_SetImageList | Assigns an image list to the control
_GUICtrlListView_SetItem | Sets some or all of a item's attributes
_GUICtrlListView_SetItemChecked | Sets the checked state
_GUICtrlListView_SetItemCount | Causes the list-view control to allocate memory for the specified number of items
_GUICtrlListView_SetItemCut | Sets whether the item is marked for a cut-and-paste operation
_GUICtrlListView_SetItemDropHilited | Sets whether the item is highlighted as a drag-and-drop target
_GUICtrlListView_SetItemEx | Sets some or all of a item's attributes
_GUICtrlListView_SetItemFocused | Sets whether the item has the focus
_GUICtrlListView_SetItemGroupID | Sets the item group ID
_GUICtrlListView_SetItemImage | Sets the index of the item's icon in the control's image list
_GUICtrlListView_SetItemIndent | Sets the number of image widths to indent the item
_GUICtrlListView_SetItemParam | Sets the value specific to the item
_GUICtrlListView_SetItemPosition | Moves an item to a specified position in the control
_GUICtrlListView_SetItemPosition32 | Moves an item to a specified position in the control
_GUICtrlListView_SetItemSelected | Sets whether the item is selected
_GUICtrlListView_SetItemState | Changes the state of an item in the control
_GUICtrlListView_SetItemStateImage | Sets the state image that is displayed
_GUICtrlListView_SetItemText | Changes the text of an item or subitem
_GUICtrlListView_SetOutlineColor | Sets the color of the border
_GUICtrlListView_SetSelectedColumn | Sets the index of the selected column
_GUICtrlListView_SetSelectionMark | Sets the selection mark in the control
_GUICtrlListView_SetTextBkColor | Sets the background color of text in the control
_GUICtrlListView_SetTextColor | Sets the color of text in the control
_GUICtrlListView_SetToolTips | Sets the ToolTip control that the control will use to display ToolTips
_GUICtrlListView_SetUnicodeFormat | Sets the UNICODE character format flag for the control
_GUICtrlListView_SetView | Sets the view of the control
_GUICtrlListView_SetWorkAreas | Creates a work area within the control
_GUICtrlListView_SimpleSort | Sorts a list-view control (limited)
_GUICtrlListView_SortItems | Starts the sort call back, also sets the Arrow in the Header
_GUICtrlListView_SubItemHitTest | Determines which listview item or subitem is at a given position
_GUICtrlListView_UnRegisterSortCallBack | UnRegister the Sort callback function


Function _GUICtrlListView_AddArray

Function Reference

_GUICtrlListView_AddArray

Adds items from an array to the control

#Include <GuiListView.au3>
_GUICtrlListView_AddArray($hWnd, ByRef $aItems)

Parameters

$hWnd | Handle to the control
$aItems | Array with the following format: [0][0] - Item 1 Text [0][1] - Item 1 Subitem 1 text [0][2] - Item 1 Subitem 2 text [0][n] - Item 1 Subitem n text [1][0] - Item 2 Text [1][1] - Item 2 Subitem 1 text [1][2] - Item 2 Subitem 2 text [1][n] - Item 2 Subitem n text

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iI, $iTimer, $hListView

; Create GUI
GUICreate("ListView Add Array", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)
_GUICtrlListView_AddColumn($hListView, "SubItems 1", 100)
_GUICtrlListView_AddColumn($hListView, "SubItems 2", 100)
_GUICtrlListView_AddColumn($hListView, "SubItems 3", 100)

_GUICtrlListView_SetItemCount($hListView, 5000)

; One column load
Local $aItems[5000][1]
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
Next
$iTimer = TimerInit()
_GUICtrlListView_AddArray($hListView, $aItems)
MsgBox(4160, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView)) ; items added with UDF function can be deleted using UDF function

; Four column load
Dim $aItems[5000][4]
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
$aItems[$iI][3] = "Item " & $iI & "-3"
Next
$iTimer = TimerInit()
_GUICtrlListView_AddArray($hListView, $aItems)
MsgBox(4160, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_AddColumn

Function Reference

_GUICtrlListView_AddColumn

Adds a new column in the control

#Include <GuiListView.au3>
_GUICtrlListView_AddColumn($hWnd, $sText[, $iWidth = 50[, $iAlign = -1[, $iImage = -1[, $fOnRight = False]]]])

Parameters

$hWnd | Handle to the control
$sText | Column header text
$iWidth | [optional] Width of the column, in pixels
$iAlign | [optional] Alignment of the column header and the subitem text in the column: 0 - Text is left aligned 1 - Text is right aligned 2 - Text is centered
$iImage | [optional] Zero based index of an image within the image list
$fOnRight | [optional] If True, the column image appears to the right of text

Return Value

Success: | The index of the new column
Failure: | -1

Remarks

The alignment of the leftmost column is always left justified

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

; Create GUI
GUICreate("ListView Add Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)

; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_AddItem

Function Reference

_GUICtrlListView_AddItem

Adds a new item to the end of the list

#Include <GuiListView.au3>
_GUICtrlListView_AddItem($hWnd, $sText[, $iImage = -1[, $iParam = 0]])

Parameters

$hWnd | Handle to the control
$sText | Item text. If set to -1, the item set is set via the $LVN_GETDISPINFO notification message.
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iParam | [optional] Application Defined data

Return Value

Success: | The index of the new column
Failure: | -1

Remarks

You can not use this function to insert subitems. Use _GUICtrlListView_AddSubItem to insert subitems.

Related

_GUICtrlListView_AddSubItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

; Create GUI
GUICreate("ListView Add Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_AddSubItem

Function Reference

_GUICtrlListView_AddSubItem

Adds a new subitem to the control

#Include <GuiListView.au3>
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $sText, $iSubItem[, $iImage = -1])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$sText | Item or subitem text
$iSubItem | One based index of the subitem
$iImage | [optional] Zero based index of the icon in the control's image list

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_AddItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

; Create GUI
GUICreate("ListView Add SubItem", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_ApproximateViewHeight

Function Reference

_GUICtrlListView_ApproximateViewHeight

Calculates the approximate height required to display a given number of items

#Include <GuiListView.au3>
_GUICtrlListView_ApproximateViewHeight($hWnd[, $iCount = -1[, $iCX = -1[, $iCY = -1]]])

Parameters

$hWnd | Handle to the control
$iCount | [optional] Number of items to be displayed in the control. If this parameter is set to -1 the message uses the total number of items in the control.
$iCX | [optional] Proposed X dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current width value.
$iCY | [optional] Proposed Y dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current height value.

Return Value

Returns the Approximate height, in pixels, needed to display the items

Remarks

Setting the size of the control based on the dimensions provided by this message can optimize redraw and
reduce flicker.

Related

_GUICtrlListView_ApproximateViewWidth, _GUICtrlListView_ApproximateViewRect

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iY, $hListView

GUICreate("ListView Approximate View Height", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Add column
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
For $iI = 0 To 9
_GUICtrlListView_AddItem($hListView, "Row " & $iI)
Next

MsgBox(4096, "Information", "Approximate View Height")
; Resize view height
$iY = _GUICtrlListView_ApproximateViewHeight($hListView)
_WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 2, 2, 394, $iY, $SWP_NOZORDER)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_ApproximateViewRect

Function Reference

_GUICtrlListView_ApproximateViewRect

Calculates the approximate size required to display a given number of items

#Include <GuiListView.au3>
_GUICtrlListView_ApproximateViewRect($hWnd[, $iCount = -1[, $iCX = -1[, $iCY = -1]]])

Parameters

$hWnd | Handle to the control
$iCount | [optional] Number of items to be displayed in the control. If this parameter is set to -1 the message uses the total number of items in the control.
$iCX | [optional] Proposed X dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current width value.
$iCY | [optional] Proposed Y dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current height value.

Return Value

Returns an Array with the following format:
[0] - Approximate width, in pixels, needed to display the items
[1] - Approximate height, in pixels, needed to display the items

Remarks

Setting the size of the control based on the dimensions provided by this message can optimize redraw and
reduce flicker.

Related

_GUICtrlListView_ApproximateViewHeight, _GUICtrlListView_ApproximateViewWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aXY, $hListView

GUICreate("ListView Approximate View Rect", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Add column
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
For $iI = 0 To 9
_GUICtrlListView_AddItem($hListView, "Row " & $iI)
Next

MsgBox(4096, "Information", "Approximate View Rect")
; Resize view
$aXY = _GUICtrlListView_ApproximateViewRect($hListView)
_WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 2, 2, $aXY[0], $aXY[1], $SWP_NOZORDER)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_ApproximateViewWidth

Function Reference

_GUICtrlListView_ApproximateViewWidth

Calculates the approximate width required to display a given number of items

#Include <GuiListView.au3>
_GUICtrlListView_ApproximateViewWidth($hWnd[, $iCount = -1[, $iCX = -1[, $iCY = -1]]])

Parameters

$hWnd | Handle to the control
$iCount | [optional] Number of items to be displayed in the control. If this parameter is set to -1 the message uses the total number of items in the control
$iCX | [optional] Proposed X dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current width value.
$iCY | [optional] Proposed Y dimension of the control, in pixels. This parameter can be set to -1 to allow the message to use the current height value.

Return Value

Return the Approximate width, in pixels, needed to display the items

Remarks

Setting the size of the control based on the dimensions provided by this message can optimize redraw and
reduce flicker.

Related

_GUICtrlListView_ApproximateViewHeight, _GUICtrlListView_ApproximateViewRect

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $hListView

GUICreate("ListView Approximate View Width", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Add column
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
For $iI = 0 To 9
_GUICtrlListView_AddItem($hListView, "Row " & $iI)
Next

MsgBox(4096, "Information", "Approximate View Width")
; Resize view width
$iX = _GUICtrlListView_ApproximateViewWidth($hListView)
_WinAPI_SetWindowPos(GUICtrlGetHandle($hListView), 0, 2, 2, $iX, 268, $SWP_NOZORDER)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_Arrange

Function Reference

_GUICtrlListView_Arrange

Arranges items in icon view

#Include <GuiListView.au3>
_GUICtrlListView_Arrange($hWnd[, $iArrange = 0])

Parameters

$hWnd | Handle to the control
$iArrange | [optional] Alignment. This can be one of the following values: 0 - Aligns items according to the controls default value 1 - Aligns items along the left edge of the window 2 - Aligns items along the top edge of the window 3 - Snaps all icons to the nearest grid position.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetItemPosition

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Arrange", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Move item 2
_GUICtrlListView_SetView($hListView, 3)
_GUICtrlListView_SetItemPosition($hListView, 1, 100, 100)

MsgBox(4160, "Information", "Arranging items")
_GUICtrlListView_Arrange($hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_BeginUpdate

Function Reference

_GUICtrlListView_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiListView.au3>
_GUICtrlListView_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_EndUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Begin Update", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 32)
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 32, 32))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)
Next
_GUICtrlListView_EndUpdate($hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_CancelEditLabel

Function Reference

_GUICtrlListView_CancelEditLabel

Cancels an item text editing operation

#Include <GuiListView.au3>
_GUICtrlListView_CancelEditLabel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_EditLabel, _GUICtrlListView_GetEditControl

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView

_Main()

Func _Main()
Local $hImage, $iTime

GUICreate("ListView Cancel Edit", 392, 322)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Edit item 0 label with time out
_GUICtrlListView_EditLabel($hListView, 0)
$iTime = TimerInit()

; Loop until user exits
Do
If _GUICtrlListView_GetEditControl($hListView) <> 0 Then
If TimerDiff($iTime) > 3000 Then _GUICtrlListView_CancelEditLabel($hListView)
EndIf
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_ITEMCHANGING ; An item is changing
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_ITEMCHANGING" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
Return True ; prevent the change
;Return False ; allow the change
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_ClickItem

Function Reference

_GUICtrlListView_ClickItem

Clicks an item

#Include <GuiListView.au3>
_GUICtrlListView_ClickItem($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$sButton | [optional] Button to click
$fMove | [optional] If True, the mouse will be moved. If False, the mouse does not move.
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Delay between clicks

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView

_Main()

Func _Main()
Local $hImage

; Create GUI
GUICreate("ListView Click Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

_GUICtrlListView_ClickItem($hListView, 1, "left", False, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_CopyItems

Function Reference

_GUICtrlListView_CopyItems

Copy Items between 2 list-view controls

#Include <GuiListView.au3>
_GUICtrlListView_CopyItems($hWnd_Source, $hWnd_Destination[, $fDelFlag = False])

Parameters

$hWnd_Source | controlID
$hWnd_Destination | control ID
$fDelFlag | [optional] Delete after copying

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
Opt('MustDeclareVars', 1)

Global $hListView, $hListView2, $GUI1, $GUI2, $run = 1
Global $Dock = 1, $Dock_Location = 1, $x1, $x2, $y1, $y2
Global $OptionsItem2, $OptionsItem3, $OptionsItem4
Global $Options2Item2, $Options2Item3, $Options2Item4

_Main()

Func _Main()
$run = 1
Local $OptionsMenu, $OptionsItem1, $Options2Menu, $Options2Item1, $width = 450
Local $Btn_MoveLeft, $Btn_MoveRight, $Btn_Exit1, $Btn_Exit2
Local $Btn_CopyRight, $Btn_CopyLeft, $hImage
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_SUBITEMIMAGES)

$GUI1 = GUICreate("(External) ListView Copy Items", $width, 300, 10, 10)
$OptionsMenu = GUICtrlCreateMenu("Options")
$OptionsItem1 = GUICtrlCreateMenu("Docking", $OptionsMenu)

$OptionsItem2 = GUICtrlCreateMenuItem("Docked", $OptionsItem1)
GUICtrlCreateMenuItem("", $OptionsItem1)
$OptionsItem3 = GUICtrlCreateMenuItem("Side By Side", $OptionsItem1)
$OptionsItem4 = GUICtrlCreateMenuItem("Top And Bottom", $OptionsItem1)
GUICtrlSetState($OptionsItem2, $GUI_CHECKED)
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetOnEvent($OptionsItem2, "_SetDocking")
GUICtrlSetOnEvent($OptionsItem3, "_SetDockSideBySide")
GUICtrlSetOnEvent($OptionsItem4, "_SetDockTopAndBottom")

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

; need the handle because UDF function(s) are used to create the items
$hListView = GUICtrlGetHandle(GUICtrlCreateListView("", 2, 2, $width - 100, 268, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)

$Btn_MoveRight = GUICtrlCreateButton("Move", $width - 95, 35, 90, 20)
GUICtrlSetOnEvent($Btn_MoveRight, "_MoveRight")

$Btn_CopyRight = GUICtrlCreateButton("Copy", $width - 95, 60, 90, 20)
GUICtrlSetOnEvent($Btn_CopyRight, "_CopyRight")

$Btn_Exit1 = GUICtrlCreateButton("Exit", $width - 95, 140, 90, 25)
GUICtrlSetOnEvent($Btn_Exit1, "_Exit")

$GUI2 = GUICreate("Right/Bottom Window", $width, 300, $width + 15, 10)

$Options2Menu = GUICtrlCreateMenu("Options")
$Options2Item1 = GUICtrlCreateMenu("Docking", $Options2Menu)
$Options2Item2 = GUICtrlCreateMenuItem("Docked", $Options2Item1)
GUICtrlCreateMenuItem("", $Options2Item1)
$Options2Item3 = GUICtrlCreateMenuItem("Side By Side", $Options2Item1)
$Options2Item4 = GUICtrlCreateMenuItem("Top And Bottom", $Options2Item1)
GUICtrlSetState($Options2Item2, $GUI_CHECKED)
GUICtrlSetState($Options2Item3, $GUI_CHECKED)
GUICtrlSetOnEvent($Options2Item2, "_SetDocking2")
GUICtrlSetOnEvent($Options2Item3, "_SetDockSideBySide2")
GUICtrlSetOnEvent($Options2Item4, "_SetDockTopAndBottom2")

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

$hListView2 = GUICtrlGetHandle(GUICtrlCreateListView("", 2, 2, $width - 100, 268, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE))
_GUICtrlListView_SetExtendedListViewStyle($hListView2, $exStyles)

$Btn_MoveLeft = GUICtrlCreateButton("Move", $width - 95, 35, 90, 20)
GUICtrlSetOnEvent($Btn_MoveLeft, "_MoveLeft")

$Btn_CopyLeft = GUICtrlCreateButton("Copy", $width - 95, 60, 90, 20)
GUICtrlSetOnEvent($Btn_CopyLeft, "_CopyLeft")

$Btn_Exit2 = GUICtrlCreateButton("Exit", $width - 95, 140, 90, 25)
GUICtrlSetOnEvent($Btn_Exit2, "_Exit")

GUISetState(@SW_SHOW, $GUI2)
GUISetState(@SW_SHOW, $GUI1)

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 13)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 14)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 15)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 16)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 17)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 18)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView2, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 120)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add columns
_GUICtrlListView_AddColumn($hListView2, "Column 1", 120)
_GUICtrlListView_AddColumn($hListView2, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($hListView, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($hListView, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($hListView, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($hListView, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($hListView, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($hListView, 5, "Row 6: Col 3", 2, 3)

While $run
If $Dock Then _KeepWindowsDocked()
Sleep(10)
WEnd
EndFunc ;==>_Main

Func _SetDocking()
If BitAND(GUICtrlRead($OptionsItem2), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem2, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item2, $GUI_UNCHECKED)
$Dock = 0
Else
GUICtrlSetState($OptionsItem2, $GUI_CHECKED)
GUICtrlSetState($Options2Item2, $GUI_CHECKED)
$Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDocking

Func _SetDocking2()
If BitAND(GUICtrlRead($Options2Item2), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem2, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item2, $GUI_UNCHECKED)
$Dock = 0
Else
GUICtrlSetState($OptionsItem2, $GUI_CHECKED)
GUICtrlSetState($Options2Item2, $GUI_CHECKED)
$Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDocking2

Func _SetDockSideBySide()
If BitAND(GUICtrlRead($OptionsItem3), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
GUICtrlSetState($Options2Item3, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item4, $GUI_CHECKED)
$Dock_Location = 2
Else
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item3, $GUI_CHECKED)
GUICtrlSetState($Options2Item4, $GUI_UNCHECKED)
$Dock_Location = 1
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockSideBySide

Func _SetDockSideBySide2()
If BitAND(GUICtrlRead($Options2Item3), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
GUICtrlSetState($Options2Item3, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item4, $GUI_CHECKED)
$Dock_Location = 2
Else
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item3, $GUI_CHECKED)
GUICtrlSetState($Options2Item4, $GUI_UNCHECKED)
$Dock_Location = 1
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockSideBySide2

Func _SetDockTopAndBottom()
If BitAND(GUICtrlRead($OptionsItem4), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetState($Options2Item4, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item3, $GUI_CHECKED)
$Dock_Location = 1
Else
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item4, $GUI_CHECKED)
GUICtrlSetState($Options2Item3, $GUI_UNCHECKED)
$Dock_Location = 2
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockTopAndBottom

Func _SetDockTopAndBottom2()
If BitAND(GUICtrlRead($Options2Item4), $GUI_CHECKED) = $GUI_CHECKED Then
GUICtrlSetState($OptionsItem4, $GUI_UNCHECKED)
GUICtrlSetState($OptionsItem3, $GUI_CHECKED)
GUICtrlSetState($Options2Item4, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item3, $GUI_CHECKED)
$Dock_Location = 1
Else
GUICtrlSetState($OptionsItem4, $GUI_CHECKED)
GUICtrlSetState($OptionsItem3, $GUI_UNCHECKED)
GUICtrlSetState($Options2Item4, $GUI_CHECKED)
GUICtrlSetState($Options2Item3, $GUI_UNCHECKED)
$Dock_Location = 2
If $Dock Then $Dock = 2
EndIf
If $Dock Then _KeepWindowsDocked()
EndFunc ;==>_SetDockTopAndBottom2

Func _KeepWindowsDocked()
Local $p_win1 = WinGetPos($GUI1)
Local $p_win2 = WinGetPos($GUI2)
If $Dock_Location == 1 Then
If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
$x1 = $p_win1[0]
$y1 = $p_win1[1]
$x2 = $p_win1[2] + $x1
$y2 = $y1
WinMove($GUI2, "", $x2, $y2)
$Dock = 1
ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
$x2 = $p_win2[0]
$y2 = $p_win2[1]
$x1 = $p_win2[0] - $p_win1[2]
$y1 = $y2
WinMove($GUI1, "", $x1, $y1)
EndIf
Else
If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 8) Or $Dock = 2) Then
$x1 = $p_win1[0]
$y1 = $p_win1[1]
$x2 = $x1
$y2 = $p_win1[3] + $y1
WinMove($GUI2, "", $x2, $y2)
$Dock = 1
ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 8)) Then
$x2 = $p_win2[0]
$y2 = $p_win2[1]
$x1 = $x2
$y1 = $p_win2[1] - $p_win1[3]
WinMove($GUI1, "", $x1, $y1)
EndIf
EndIf
EndFunc ;==>_KeepWindowsDocked

Func _CopyRight()
_GUICtrlListView_CopyItems($hListView, $hListView2)
EndFunc ;==>_CopyRight

Func _MoveRight()
_GUICtrlListView_CopyItems($hListView, $hListView2, 1)
EndFunc ;==>_MoveRight

Func _CopyLeft()
_GUICtrlListView_CopyItems($hListView2, $hListView)
EndFunc ;==>_CopyLeft

Func _MoveLeft()
_GUICtrlListView_CopyItems($hListView2, $hListView, 1)
EndFunc ;==>_MoveLeft

Func _Exit()
$run = 0
GUIDelete($GUI2)
GUIDelete($GUI1)
EndFunc ;==>_Exit

Func SpecialEvents()
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
_Exit()
EndSelect
EndFunc ;==>SpecialEvents


Function _GUICtrlListView_Create

Function Reference

_GUICtrlListView_Create

Create a ListView control

#Include <GuiListView.au3>
_GUICtrlListView_Create($hWnd, $sHeaderText, $iX, $iY[, $iWidth = 150[, $iHeight = 150[, $iStyle = 0x0000000D[, $iExStyle = 0x00000000[, $fCoInit = False]]]]])

Parameters

$hWnd | Handle to parent or owner window
$sHeaderText | Text to be displayed in the header. Pipe "|" delimited.
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control styles:
$LVS_ALIGNLEFT - Items are left aligned in icon and small icon view
$LVS_ALIGNTOP - Items are aligned with the top of the control in icon and small icon view
$LVS_AUTOARRANGE - Icons are automatically kept arranged in icon and small icon view
$LVS_EDITLABELS - Item text can be edited in place
$LVS_ICON - This style specifies icon view
$LVS_LIST - This style specifies list view
$LVS_NOCOLUMNHEADER - Column headers are not displayed in report view
$LVS_NOLABELWRAP - Item text is displayed on a single line in icon view
$LVS_NOSCROLL - Scrolling is disabled
$LVS_NOSORTHEADER - Column headers do not work like buttons
$LVS_OWNERDATA - This style specifies a virtual control
$LVS_OWNERDRAWFIXED - The owner window can paint items in report view
$LVS_REPORT - This style specifies report view
$LVS_SHAREIMAGELISTS - The image list will not be deleted
$LVS_SHOWSELALWAYS - The selection, if any, is always shown
$LVS_SINGLESEL - Only one item at a time can be selected
$LVS_SMALLICON - This style specifies small icon view
$LVS_SORTASCENDING - Item indexes are sorted in ascending order
$LVS_SORTDESCENDING - Item indexes are sorted in descending order
Default: $LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS
Forced : $WS_CHILD, $WS_VISIBLE
$iExStyle [optional] Extended control styles. Can be a combination of the following:
$LVS_EX_BORDERSELECT - When an item is selected the border color of the item changes
$LVS_EX_CHECKBOXES - Enables check boxes for items in a list-view control
$LVS_EX_DOUBLEBUFFER - Paints via double-buffering, which reduces flicker
$LVS_EX_FLATSB - Enables flat scroll bars in the list view
$LVS_EX_FULLROWSELECT - When an item is selected, the item and all its subitems are highlighted
$LVS_EX_GRIDLINES - Displays gridlines around items and subitems
$LVS_EX_HEADERDRAGDROP - Enables drag-and-drop reordering of columns
$LVS_EX_INFOTIP - The $LVN_GETINFOTIP notification message is sent before displaying a ToolTip
$LVS_EX_LABELTIP - If not set, the unfolds partly hidden labels only for the large icon mode
$LVS_EX_MULTIWORKAREAS - The control will not autoarrange its icons until one or more work areas are defined
$LVS_EX_ONECLICKACTIVATE - The control sends an $LVN_ITEMACTIVATE messages when the user clicks an item
$LVS_EX_REGIONAL - Sets the control region to include only the item icons and text
$LVS_EX_SIMPLESELECT - In icon view moves the state image of the control to the top right
$LVS_EX_SUBITEMIMAGES - Allows images to be displayed for subitems
$LVS_EX_TRACKSELECT - Enables hot-track selection in the control
$LVS_EX_TWOCLICKACTIVATE - The control sends an $LVN_ITEMACTIVATE message when the user double-clicks an item
$LVS_EX_UNDERLINECOLD - Causes non-hot items that may be activated to be displayed with underlined text
$LVS_EX_UNDERLINEHOT - Causes hot items that may be activated to be displayed with underlined text
$fCoInit | [optional] Initializes the COM library for use by the calling thread.

Return Value

Success: | Handle to the ListView controle
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlListView_Destroy, _GUICtrlListView_SetBkImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView

_Main()

Func _Main()

Local $GUI, $hImage
$GUI = GUICreate("(UDF Created) ListView Create", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
;~ Local $tBuffer
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
;~ Case $LVN_BEGINDRAG ; A drag-and-drop operation involving the left mouse button is being initiated
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; No return value
;~ Case $LVN_BEGINLABELEDIT ; Start of label editing for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ _DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ Return False ; Allow the user to edit the label
;~ ;Return True ; Prevent the user from editing the label
;~ Case $LVN_BEGINRDRAG ; A drag-and-drop operation involving the right mouse button is being initiated
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_BEGINRDRAG" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; No return value
;~ Case $LVN_BEGINSCROLL ; A scrolling operation starts, Minium OS WinXP
;~ $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~ _DebugPrint("$LVN_BEGINSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~ ; No return value
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
;~ Case $LVN_DELETEALLITEMS ; All items in the control are about to be deleted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_DELETEALLITEMS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return True ; To suppress subsequent $LVN_DELETEITEM messages
;~ ;Return False ; To receive subsequent $LVN_DELETEITEM messages
;~ Case $LVN_DELETEITEM ; An item is about to be deleted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; No return value
;~ Case $LVN_ENDLABELEDIT ; The end of label editing for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
;~ ; If Text is empty the return value is ignored
;~ Return True
;~ Case $LVN_ENDSCROLL ; A scrolling operation ends, Minium OS WinXP
;~ $tInfo = DllStructCreate($tagNMLVSCROLL, $ilParam)
;~ _DebugPrint("$LVN_ENDSCROLL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->DX:" & @TAB & DllStructGetData($tInfo, "DX") & @LF & _
;~ "-->DY:" & @TAB & DllStructGetData($tInfo, "DY"))
;~ ; No return value
;~ Case $LVN_GETDISPINFO ; Provide information needed to display or sort a list-view item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_GETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; No return value
;~ Case $LVN_GETINFOTIP ; Sent by a large icon view list-view control that has the $LVS_EX_INFOTIP extended style
;~ $tInfo = DllStructCreate($tagNMLVGETINFOTIP, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_GETINFOTIP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam"))
;~ ; No return value
;~ Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_HOTTRACK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return 0 ; allow the list view to perform its normal track select processing.
;~ ;Return 1 ; the item will not be selected.
;~ Case $LVN_INSERTITEM ; A new item was inserted
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_INSERTITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; No return value
;~ Case $LVN_ITEMACTIVATE ; Sent by a list-view control when the user activates an item
;~ $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
;~ _DebugPrint("$LVN_ITEMACTIVATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
;~ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;~ Return 0
;~ Case $LVN_ITEMCHANGED ; An item has changed
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_ITEMCHANGED" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ ; No return value
;~ Case $LVN_ITEMCHANGING ; An item is changing
;~ $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
;~ _DebugPrint("$LVN_ITEMCHANGING" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
;~ Return True ; prevent the change
;~ ;Return False ; allow the change
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
;~ Case $LVN_MARQUEEBEGIN ; A bounding box (marquee) selection has begun
;~ _DebugPrint("$LVN_MARQUEEBEGIN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode)
;~ Return 0 ; accept the message
;~ ;Return 1 ; quit the bounding box selection
;~ Case $LVN_SETDISPINFO ; Update the information it maintains for an item
;~ $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
;~ $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~ _DebugPrint("$LVN_SETDISPINFO" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
;~ "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
;~ "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~ "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~ "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
;~ "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
;~ "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
;~ "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
;~ "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
;~ ; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
;~ Case $NM_HOVER ; Sent by a list-view control when the mouse hovers over an item
;~ _DebugPrint("$NM_HOVER" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode)
;~ Return 0 ; process the hover normally
;~ ;Return 1 ; prevent the hover from being processed
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_CreateDragImage

Function Reference

_GUICtrlListView_CreateDragImage

Creates a drag image list for the specified item

#Include <GuiListView.au3>
_GUICtrlListView_CreateDragImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Returns an Array with the following format:
[0] - Handle to the drag image list if successful, otherwise 0
[1] - X coordinate of the upper left corner of the image
[2] - Y coordinate of the upper left corner of the image

Remarks

You are responsible for destroying the image list when it is no longer needed

Related

_GUICtrlListView_DrawDragImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $GUI, $hImage, $aDrag, $hListView

$GUI = GUICreate("(UDF Created) ListView Create Drag Image", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)

; Create drag image
$aDrag = _GUICtrlListView_CreateDragImage($hListView, 0)
_GUICtrlListView_DrawDragImage($hListView, $aDrag)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_MOUSEMOVE
_GUICtrlListView_DrawDragImage($hListView, $aDrag)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

; Destory image list
_GUIImageList_Destroy($aDrag[0])

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_CreateSolidBitMap

Function Reference

_GUICtrlListView_CreateSolidBitMap

Creates a solid color bitmap

#Include <GuiListView.au3>
_GUICtrlListView_CreateSolidBitMap($hWnd, $iColor, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the window where the bitmap will be displayed
$iColor | The color of the bitmap, stated in RGB
$iWidth | The width of the bitmap
$iHeight | The height of the bitmap

Return Value

Returns an Handle to the bitmap

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Create Solid BitMap", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Indent items
_GUICtrlListView_SetItemIndent($hListView, 1, 1)
_GUICtrlListView_SetItemIndent($hListView, 2, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_DeleteAllItems

Function Reference

_GUICtrlListView_DeleteAllItems

Removes all items from a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_DeleteAllItems($hWnd)

Parameters

$hWnd Control ID/Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_DeleteItem, _GUICtrlListView_DeleteItemsSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example1()
Example2()
Example_UDF_Created()

Func Example1()
Local $GUI, $hListView

$GUI = GUICreate("ListView Delete All Items", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

; 3 column load
For $iI = 0 To 9
GUICtrlCreateListViewItem("Item " & $iI & "|Item " & $iI & "-1|Item " & $iI & "-2", $hListView)
Next

MsgBox(4160, "Information", "Delete All Items")
; Items created using built-in function, pass the control ID
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteAllItems($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example1

Func Example2()
Local $GUI, $hListView, $aItems[10][3]

$GUI = GUICreate("ListView Delete All Items", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

; 3 column load
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next

_GUICtrlListView_AddArray($hListView, $aItems)

MsgBox(4160, "Information", "Delete All Items")
; Items created using UDF function(s), pass the handle to the control
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

Func Example_UDF_Created()
Local $GUI, $hListView, $aItems[10][3]

$GUI = GUICreate("(UDF Created) ListView Delete All Items", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "col1|col2|col3", 2, 2, 394, 268)
GUISetState()

; 3 column load
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next

_GUICtrlListView_AddArray($hListView, $aItems)

MsgBox(4160, "Information", "Delete All Items")
; This is already a handle
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteAllItems($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_DeleteColumn

Function Reference

_GUICtrlListView_DeleteColumn

Removes a column from a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_DeleteColumn($hWnd, $iCol)

Parameters

$hWnd | Handle to the control
$iCol | Index of the column to delete

Return Value

Success: | True
Failure: | False

Remarks

Column zero of the list-view control cannot be deleted.

If you must delete column zero, insert a zero length dummy
column zero, and delete column one and above

Related

_GUICtrlListView_InsertColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Delete Column", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
GUICtrlCreateListViewItem("line5|data5|more5", $hListView)
GUISetState()

MsgBox(4160, "Information", "Delete Column")
_GUICtrlListView_DeleteColumn($hListView, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_DeleteItem

Function Reference

_GUICtrlListView_DeleteItem

Removes an item from a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_DeleteItem($hWnd, $iIndex)

Parameters

$hWnd | Control ID/Handle to the control
$iIndex | Zero based index of the list-view item to delete

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_DeleteAllItems, _GUICtrlListView_DeleteItemsSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example1()
Example_UDF_Created()

Func Example1()
Local $hListView

GUICreate("ListView Delete Item", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

; 3 column load
For $iI = 0 To 9
GUICtrlCreateListViewItem("Item " & $iI & "|Item " & $iI & "-1|Item " & $iI & "-2", $hListView)
Next

MsgBox(4160, "Information", "Delete Item")
; Items created using built-in function, pass the control ID
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example1

Func Example_UDF_Created()
Local $GUI, $aItems[10][3], $hListView

$GUI = GUICreate("(UDF Created) ListView Delete Item", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "col1|col2|col3", 2, 2, 394, 268)
GUISetState()

; 3 column load
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next

_GUICtrlListView_AddArray($hListView, $aItems)

MsgBox(4160, "Information", "Delete Item")
; This is already a handle
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_DeleteItemsSelected

Function Reference

_GUICtrlListView_DeleteItemsSelected

Deletes item(s) selected

#Include <GuiListView.au3>
_GUICtrlListView_DeleteItemsSelected($hWnd)

Parameters

$hWnd Control ID/Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_DeleteItem, _GUICtrlListView_DeleteAllItems

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example1()
Example2()
Example_UDF_Created()

Func Example1()
Local $aItems[10][3], $hListView

GUICreate("ListView Delete Items Selected", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUISetState()

; 3 column load
For $iI = 0 To 9
GUICtrlCreateListViewItem("Item " & $iI & "|Item " & $iI & "-1|Item " & $iI & "-2", $hListView)
Next

_GUICtrlListView_SetItemSelected($hListView, Random(0, UBound($aItems) - 1, 1))

MsgBox(4160, "Information", "Delete Item Selected")
; Items created using UDF function(s), pass the handle to the control
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItemsSelected($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example1

Func Example2()
Local $aItems[10][3], $hListView

GUICreate("ListView Delete Items Selected", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUISetState()

; 3 column load
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next

_GUICtrlListView_AddArray($hListView, $aItems)

_GUICtrlListView_SetItemSelected($hListView, Random(0, UBound($aItems) - 1, 1))

MsgBox(4160, "Information", "Delete Item Selected")
; Items created using UDF function(s), pass the handle to the control
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($hListView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

Func Example_UDF_Created()
Local $GUI, $aItems[10][3], $hListView

$GUI = GUICreate("(UDF Created) ListView Delete Items Selected", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "col1|col2|col3", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUISetState()

; 3 column load
For $iI = 0 To UBound($aItems) - 1
$aItems[$iI][0] = "Item " & $iI
$aItems[$iI][1] = "Item " & $iI & "-1"
$aItems[$iI][2] = "Item " & $iI & "-2"
Next

_GUICtrlListView_AddArray($hListView, $aItems)

_GUICtrlListView_SetItemSelected($hListView, Random(0, UBound($aItems) - 1, 1))

MsgBox(4160, "Information", "Delete Item Selected")
; This is already a handle
MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItemsSelected($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_Destroy

Function Reference

_GUICtrlListView_Destroy

Delete the listview control

#Include <GuiListView.au3>
_GUICtrlListView_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True, Handle is set to 0
Failure: | False

Remarks

Restricted to only be used on ListViews created with _GUICtrlListView_Create

Related

_GUICtrlListView_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $GUI, $HandleBefore, $hListView

$GUI = GUICreate("(UDF Created) ListView Destroy", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
$HandleBefore = $hListView
GUISetState()

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

MsgBox(4160, "Information", "Destroying the Control for Handle: " & $hListView)
MsgBox(4160, "Information", "Control Destroyed: " & _GUICtrlListView_Destroy($hListView) & @LF & _
"Handel Before Destroy: " & $HandleBefore & @LF & _
"Handle After Destroy: " & $hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_DrawDragImage

Function Reference

_GUICtrlListView_DrawDragImage

Draw the Drage Image

#Include <GuiListView.au3>
_GUICtrlListView_DrawDragImage(ByRef $hWnd, ByRef $aDrag)

Parameters

$hWnd | Handle to the control
$aDrag | Array with the following format: [0] - Handle to the drag image list [1] - X coordinate of the upper left corner of the image [2] - Y coordinate of the upper left corner of the image

Return Value

None.

Remarks

None.

Related

_GUICtrlListView_CreateDragImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created()

Func Example_UDF_Created()

Local $GUI, $hImage, $aDrag, $hListView

$GUI = GUICreate("(UDF Created) ListView Draw Drag Image", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)

; Create drag image
$aDrag = _GUICtrlListView_CreateDragImage($hListView, 0)
_GUICtrlListView_DrawDragImage($hListView, $aDrag)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_MOUSEMOVE
_GUICtrlListView_DrawDragImage($hListView, $aDrag)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

; Destory image list
_GUIImageList_Destroy($aDrag[0])

GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_EditLabel

Function Reference

_GUICtrlListView_EditLabel

Begins in place editing of the specified item text

#Include <GuiListView.au3>
_GUICtrlListView_EditLabel($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item to edit

Return Value

Success: | Returns the handle to the edit control that is used to edit the item
Failure: | 0

Remarks

When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid.
You can subclass the edit control, but you should not destroy it.

Related

_GUICtrlListView_CancelEditLabel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView

_Main()

Func _Main()
Local $hImage

GUICreate("ListView Edit Label", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Edit item 0 label with time out
_GUICtrlListView_EditLabel($hListView, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_BEGINLABELEDITA, $LVN_BEGINLABELEDITW ; Start of label editing for an item
$tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
_DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
"-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
"-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
"-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
"-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
"-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
"-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
Return False ; Allow the user to edit the label
;Return True ; Prevent the user from editing the label
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_DELETEITEM ; An item is about to be deleted
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_ENDLABELEDITA, $LVN_ENDLABELEDITW ; The end of label editing for an item
$tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
_DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
"-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
"-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
"-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
"-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
"-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
"-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
"-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
"-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
; If Text is empty the return value is ignored
If StringLen(DllStructGetData($tBuffer, "Text")) Then Return True
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_EnableGroupView

Function Reference

_GUICtrlListView_EnableGroupView

Enables or disables whether the items in the control display as a group

#Include <GuiListView.au3>
_GUICtrlListView_EnableGroupView($hWnd[, $fEnable = True])

Parameters

$hWnd | Handle to the control
$fEnable | [optional] Indicates whether to enable group displayed items True - Enable group view False - Disable group view

Return Value

0: The ability to display listview items as a group is already enabled or disabled
1: The state of the control was successfully changed

Remarks

Minimum OS - Windows XP.

This function is not supported under the $LVS_OWNERDATA style.

Related

_GUICtrlListView_GetGroupViewEnabled

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Enable Group View", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_EndUpdate

Function Reference

_GUICtrlListView_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiListView.au3>
_GUICtrlListView_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_BeginUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView End Update", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(32, 32)
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 32, 32))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)
Next
_GUICtrlListView_EndUpdate($hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_EnsureVisible

Function Reference

_GUICtrlListView_EnsureVisible

Ensures that a list-view item is either entirely or partially visible

#Include <GuiListView.au3>
_GUICtrlListView_EnsureVisible($hWnd, $iIndex[, $fPartialOK = False])

Parameters

$hWnd | Handle to the control
$iIndex | Index of the list-view item
$fPartialOK | [optional] Value specifying whether the item must be entirely visible

Return Value

Success: | True
Failure: | False

Remarks

If $fPartialOK parameter is TRUE, no scrolling occurs if the item is at least partially visible

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Ensure Visible", 400, 300)
$hListView = GUICtrlCreateListView("Items", 2, 2, 394, 268)
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
GUISetState()

_GUICtrlListView_BeginUpdate($hListView)
For $i = 1 To 100
GUICtrlCreateListViewItem("Item " & $i, $hListView)
Next
_GUICtrlListView_EndUpdate($hListView)

MsgBox(4160, "Information", "Making item 50 visible")
_GUICtrlListView_EnsureVisible($hListView, 49)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_FindInText

Function Reference

_GUICtrlListView_FindInText

Searches for an item that contains the specified text anywhere in its text

#Include <GuiListView.au3>
_GUICtrlListView_FindInText($hWnd, $sText[, $iStart = -1[, $fWrapOK = True[, $fReverse = False]]])

Parameters

$hWnd | Handle to the control
$sText | Text to match
$iStart | [optional] Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
$fWrapOK | [optional] If True, the search will continue with the first item if no match is found
$fReverse | [optional] If True, the search will start at $iStart - 1 to Zero. If $fWrapOK = True search will continue

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

The search is case insensitive. Unlike _GUICtrlListView_FindText, this function will search all subitems for the text
as well.

Related

_GUICtrlListView_FindText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iI, $hListView

GUICreate("ListView Find In Text", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 49
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_AddItem($hListView, "Target item")
For $iI = 51 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Search for target item
$iI = _GUICtrlListView_FindInText($hListView, "tArGeT")
MsgBox(4160, "Information", "Target Item Index: " & $iI)
_GUICtrlListView_EnsureVisible($hListView, $iI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_FindItem

Function Reference

_GUICtrlListView_FindItem

Searches for an item with the specified characteristics

#Include <GuiListView.au3>
_GUICtrlListView_FindItem($hWnd, $iStart, ByRef $tFindInfo[, $sText = ""])

Parameters

$hWnd | Handle to the control
$iStart | Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
$tFindInfo | $tagLVFINDINFO structure that contains the search information
$sText | [optional] String to compare with the item text. It is valid if $LVFI_STRING or $LVFI_PARTIAL is set in the Flags member

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

None.

Related

_GUICtrlListView_FindParam, _GUICtrlListView_FindNearest, $tagLVFINDINFO

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tInfo, $iI, $hListView

GUICreate("ListView Find Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set item 50 parameter value
_GUICtrlListView_SetItemParam($hListView, 49, 1234)

; Search for target item
$tInfo = DllStructCreate($tagLVFINDINFO)
DllStructSetData($tInfo, "Flags", $LVFI_PARAM)
DllStructSetData($tInfo, "Param", 1234)
$iI = _GUICtrlListView_FindItem($hListView, -1, $tInfo)
MsgBox(4160, "Information", "Target Item Index: " & $iI)
_GUICtrlListView_EnsureVisible($hListView, $iI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_FindNearest

Function Reference

_GUICtrlListView_FindNearest

Finds the item nearest to the position specified

#Include <GuiListView.au3>
_GUICtrlListView_FindNearest($hWnd, $iX, $iY[, $iDir = 0[, $iStart = -1[, $fWrapOK = True]]])

Parameters

$hWnd | Handle to the control
$iX | X position
$iY | Y position
$iDir | [optional] Specifies which direction to search: 0 - Left 1 - Right 2 - Up 3 - Down 4 - From start 5 - From end 6 - From prior item 7 - From next item
$iStart | [optional] Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
$fWrapOK | [optional] If True, the search will continue with the first item if no match is found

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

This function is supported only by large icon and small icon modes

Related

_GUICtrlListView_FindItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Global $hImage, $iIndex, $hListView

; Create GUI
GUICreate("ListView Find Nearest", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Find nearest items
$iIndex = _GUICtrlListView_FindNearest($hListView, 100, 10)
MsgBox(4160, "Information", "Item nearest [100, 10]: " & $iIndex)

$iIndex = _GUICtrlListView_FindNearest($hListView, 200, 10)
MsgBox(4160, "Information", "Item nearest [200, 10]: " & $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_FindParam

Function Reference

_GUICtrlListView_FindParam

Searches for an item with the specified lParam

#Include <GuiListView.au3>
_GUICtrlListView_FindParam($hWnd, $iParam[, $iStart = -1])

Parameters

$hWnd | Handle to the control
$iParam | Param value to search for
$iStart | [optional] Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

None.

Related

_GUICtrlListView_FindItem

Example

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

; Warning should not use SetItemParam on items created with GuiCtrlCreateListViewItem
; Param is the controlId of the item

_Main()

Func _Main()
Global $GUI, $iI, $hListView

; Create GUI
$GUI = GUICreate("(UDF Created) ListView Find Param", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set item 50 parameter value
_GUICtrlListView_SetItemParam($hListView, 49, 1234)

; Search for target item
$iI = _GUICtrlListView_FindParam($hListView, 1234)
MsgBox(4160, "Information", "Target Item Index: " & $iI)
_GUICtrlListView_EnsureVisible($hListView, $iI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_FindText

Function Reference

_GUICtrlListView_FindText

Searches for an item with the specified text

#Include <GuiListView.au3>
_GUICtrlListView_FindText($hWnd, $sText[, $iStart = -1[, $fPartialOK = True[, $fWrapOK = True]]])

Parameters

$hWnd | Handle to the control
$sText | Text to match
$iStart | [optional] Zero based index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
$fPartialOK | [optional] If True, a match will occur if the item text begins with the text
$fWrapOK | [optional] If True, the search will continue with the first item if no match is found

Return Value

Success: | The zero based index of the item
Failure: | -1

Remarks

The search is case insensitive. The search is performed on the item only. Use _GUICtrlListView_FindInText if you want
to search for the text in subitems.

Related

_GUICtrlListView_FindInText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Global $iI, $hListView

; Create GUI
GUICreate("ListView Find Text", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 49
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_AddItem($hListView, "Target item")
For $iI = 51 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Search for target item
$iI = _GUICtrlListView_FindText($hListView, "tArGeT")
MsgBox(4160, "Information", "Target Item Index: " & $iI)
_GUICtrlListView_EnsureVisible($hListView, $iI)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetBkColor

Function Reference

_GUICtrlListView_GetBkColor

Retrieves the background color of a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_GetBkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Hex RGB background color

Remarks

None.

Related

_GUICtrlListView_SetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get BkColor", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show colors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @LF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @LF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetBkImage

Function Reference

_GUICtrlListView_GetBkImage

Retrieves the background image in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetBkImage($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - One or more of the following flags:
0 - The control has no background
1 - The background is from a bitmap
2 - The background is from a URL
[1] - URL of the background image
[2] - Percentage of the client area that the image should be X offset
[3] - Percentage of the client area that the image should be Y offset

Remarks

None.

Related

_GUICtrlListView_SetBkImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created()

Func Example_UDF_Created()
Local $GUI, $hImage, $aImage, $hListView

$GUI = GUICreate("(UDF Created) ListView Get Background Image", 600, 550)
;=========================================================================================================
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 596, 500, -1, -1, True) ; Last option Calls CoInitializeEx
;=========================================================================================================
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Get the Image
Local $sURL = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_grey_800x600.jpg"
Local $sFilePath = @ScriptDir & "\AutoIt.jpg"
InetGet($sURL, $sFilePath)

; Set the Background Image
_GUICtrlListView_SetBkImage($hListView, $sFilePath)
$aImage = _GUICtrlListView_GetBkImage($hListView)

GUISetState()
MsgBox(4160, "Information", "Background Image: " & $aImage[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=========================================================================================================
DllCall('ole32.dll', 'long', 'CoUinitialize') ; Must call for each CoInitializeEx call made
;=========================================================================================================

GUIDelete()
FileDelete($sFilePath)
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_GetCallbackMask

Function Reference

_GUICtrlListView_GetCallbackMask

Retrieves the callback mask for the control

#Include <GuiListView.au3>
_GUICtrlListView_GetCallbackMask($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Value of the callback mask. The bits of the mask indicate the item states or images for which
the application stores the current state data. This value can be any combination of the following: 1 - The item is marked for a cut-and-paste operation
2 - The item is highlighted as a drag-and-drop target
4 - The item has the focus
8 - The item is selected
16 - The application stores the image list index of the current overlay image
32 - The application stores the image list index of the current state image

Remarks

The callback mask is a set of bit flags that specify the item states for which the application, rather than
the control, stores the current data.

The callback mask applies to all of the control's items, unlike the callback item designation, which applies
to a specific item. The callback mask is zero by default, meaning that the control stores all item state
information.

Related

_GUICtrlListView_SetCallBackMask

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created()

Func Example_UDF_Created()
Local $GUI, $hImage, $hListView

$GUI = GUICreate("(UDF Created) ListView Get CallBack Mask", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

_GUICtrlListView_SetCallBackMask($hListView, 32)
MsgBox(4160, "Information", "CallBackMask: " & _GUICtrlListView_GetCallbackMask($hListView))

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xC0C0C0, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF00FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFFFF00, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView, $hImage, 2)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items with callback for item text
_GUICtrlListView_AddItem($hListView, -1, 0)
_GUICtrlListView_AddItem($hListView, -1, 1)
_GUICtrlListView_AddItem($hListView, -1, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_GetColumn

Function Reference

_GUICtrlListView_GetColumn

Retrieves the attributes of a column

#Include <GuiListView.au3>
_GUICtrlListView_GetColumn($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of column

Return Value

Returns an Array with the following format:
[0] - Alignment of the column header and the subitem text in the column:
0 - Text is left-aligned
1 - Text is right-aligned
2 - Text is centered
[1] - True if item displays an image from an image list
[2] - True if bitmap appears to the right of text
[3] - True header contains an image
[4] - Width of the column, in pixels
[5] - Column header text
[6] - Index of subitem associated with the column
[7] - Zero-based index of an image within the image list
[8] - Zero-based column order

Remarks

None.

Related

_GUICtrlListView_SetColumn, _GUICtrlListView_JustifyColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hListView

GUICreate("ListView Get Column", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
GUISetState()

GUICtrlCreateListViewItem("index 0|data1|more1", $hListView)
GUICtrlCreateListViewItem("index 1|data2|more2", $hListView)
GUICtrlCreateListViewItem("index 2|data3|more3", $hListView)
GUICtrlCreateListViewItem("index 3|data4|more4", $hListView)
GUICtrlCreateListViewItem("index 4|data5|more5", $hListView)

; Change column
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Width: " & $aInfo[4])
_GUICtrlListView_SetColumn($hListView, 0, "New Column 1", 150)
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Width: " & $aInfo[4])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetColumnCount

Function Reference

_GUICtrlListView_GetColumnCount

Retrieve the number of columns

#Include <GuiListView.au3>
_GUICtrlListView_GetColumnCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Number of columns

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Column Count", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

MsgBox(4160, "Information", "Column Count: " & _GUICtrlListView_GetColumnCount($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetColumnOrder

Function Reference

_GUICtrlListView_GetColumnOrder

Retrieves the current left-to-right order of columns

#Include <GuiListView.au3>
_GUICtrlListView_GetColumnOrder($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | delimited string
Failure: | $LV_ERR

Remarks

None.

Related

_GUICtrlListView_SetColumnOrder, _GUICtrlListView_SetColumnOrderArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $a_order, $hListView

GUICreate("ListView Get Column Order", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_HEADERDRAGDROP)
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetColumnWidth($hListView, 2, 100)
_GUICtrlListView_SetColumnWidth($hListView, 3, 100)
GUISetState()

_GUICtrlListView_SetColumnOrder($hListView, "3|2|0|1")

$a_order = StringSplit(_GUICtrlListView_GetColumnOrder($hListView), "|")
MsgBox(4160, "Information", StringFormat("Column order: [%d, %d, %d, %d]", $a_order[1], $a_order[2], $a_order[3], $a_order[4]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetColumnOrderArray

Function Reference

_GUICtrlListView_GetColumnOrderArray

Retrieves the current left-to-right order of columns in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetColumnOrderArray($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - Number of items in array (n)
[1] - First column index
[2] - First column index
[n] - Last column index

Remarks

None.

Related

_GUICtrlListView_SetColumnOrderArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $a_order[5] = [4, 3, 2, 0, 1], $hListView

GUICreate("(Internal) ListView Get Column Order Array", 400, 325)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_HEADERDRAGDROP)
_GUICtrlListView_SetColumnWidth($hListView, 0, 100)
_GUICtrlListView_SetColumnWidth($hListView, 1, 100)
_GUICtrlListView_SetColumnWidth($hListView, 2, 100)
_GUICtrlListView_SetColumnWidth($hListView, 3, 100)
GUISetState()

_GUICtrlListView_SetColumnOrderArray($hListView, $a_order)

$a_order = _GUICtrlListView_GetColumnOrderArray($hListView)
MsgBox(4160, "Information", StringFormat("Column order: [%d, %d, %d, %d]", $a_order[1], $a_order[2], $a_order[3], $a_order[4]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetColumnWidth

Function Reference

_GUICtrlListView_GetColumnWidth

Retrieves the width of a column in report or list view

#Include <GuiListView.au3>
_GUICtrlListView_GetColumnWidth($hWnd, $iCol)

Parameters

$hWnd | Handle to the control
$iCol | The index of the column. This parameter is ignored in list view.

Return Value

Success: | Column width
Failure: | 0

Remarks

If this message is sent to a list-view control with the $LVS_REPORT style
and the specified column doesn't exist, the return value is undefined.

Related

_GUICtrlListView_SetColumnWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Column Width", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3", 2, 2, 394, 268)
GUISetState()

_GUICtrlListView_SetColumnWidth($hListView, 0, 100)

; Change column 1 width
MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))
_GUICtrlListView_SetColumnWidth($hListView, 0, 150)
MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetCounterPage

Function Reference

_GUICtrlListView_GetCounterPage

Calculates the number of items that can fit vertically in the visible area

#Include <GuiListView.au3>
_GUICtrlListView_GetCounterPage($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Return the number of fully visible items

Remarks

If the current view is icon or small icon view, the return value is the total number
of items in the list-view control.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Counter Page", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES))
GUISetState()

; Show item count per page
MsgBox(4160, "Information", "Items per page: " & _GUICtrlListView_GetCounterPage($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetEditControl

Function Reference

_GUICtrlListView_GetEditControl

Retrieves the handle to the edit control being used to edit an item's text

#Include <GuiListView.au3>
_GUICtrlListView_GetEditControl($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The handle to the edit control
Failure: | 0

Remarks

When label editing begins, an edit control is created, positioned, and initialized. Before displayed, the
control sends its parent window an $LVN_BEGINLABELEDIT notification message.

If you want to customize label editing implement a handler for $LVN_BEGINLABELEDITA, $LVN_BEGINLABELEDITAW
and have it send an $LVM_GETEDITCONTROL message to the control. If a label is being edited, the return value
will be a handle to the edit control. Use this handle to customize the edit control by sending the usual EM_XXX messages.

When the user completes or cancels editing, the edit control is destroyed and the handle is no longer valid.
You can subclass the edit control, but you should not destroy it. To cancel editing, send the control a
$WM_CANCELMODE message.

The control item being edited is the currently focused item. To find an item based on its state, use the
$LVM_GETNEXTITEM message.

Related

_GUICtrlListView_CancelEditLabel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView

_Main()

Func _Main()
Local $hImage

GUICreate("ListView Get Edit Control", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
_GUICtrlListView_SetUnicodeFormat($hListView, False)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Edit item 0 label with time out
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlListView_EditLabel($hListView, 0)
_DebugPrint("Edit Handle: " & _GUICtrlListView_GetEditControl($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo, $hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_BEGINLABELEDITA, $LVN_BEGINLABELEDITW ; Start of label editing for an item
$tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
_DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
"-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
"-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
"-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
"-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
"-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
"-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
Return False ; Allow the user to edit the label
;~ ;Return True ; Prevent the user from editing the label
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_ENDLABELEDITA, $LVN_ENDLABELEDITW ; The end of label editing for an item
$tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
If (DllStructGetData($tInfo, "Text") <> 0) Then
Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
_DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
"-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
"-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
"-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
"-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
"-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
"-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
"-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
"-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
Return True
EndIf
; If Text is empty the return value is ignored
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_GetExtendedListViewStyle

Function Reference

_GUICtrlListView_GetExtendedListViewStyle

Retrieves the extended styles that are currently in use

#Include <GuiListView.au3>
_GUICtrlListView_GetExtendedListViewStyle($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns a DWORD that represents the styles currently in use for a given list-view

Remarks

None.

Related

_GUICtrlListView_SetExtendedListViewStyle

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Extended List View Style", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

_GUICtrlListView_InsertItem($hListView, "Row 1: Col 1", -1, 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_InsertItem($hListView, "Row 2: Col 1", -1, 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_InsertItem($hListView, "Row 3: Col 1", -1, 2)

MsgBox(4160, "Information", "Extended List View Style(s): 0x" & _GUICtrlListView_GetExtendedListViewStyle($hListView) & @LF & _
_DisplayExtendStringList($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _DisplayExtendStringList($hListView)
Local $Styles = @LF & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_BORDERSELECT) = $LVS_EX_BORDERSELECT) Then $Styles &= "$LVS_EX_BORDERSELECT" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES) Then $Styles &= "$LVS_EX_CHECKBOXES" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_DOUBLEBUFFER) = $LVS_EX_DOUBLEBUFFER) Then $Styles &= "$LVS_EX_DOUBLEBUFFER" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_FLATSB) = $LVS_EX_FLATSB) Then $Styles &= "$LVS_EX_FLATSB" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_FULLROWSELECT) = $LVS_EX_FULLROWSELECT) Then $Styles &= "$LVS_EX_FULLROWSELECT" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_GRIDLINES) = $LVS_EX_GRIDLINES) Then $Styles &= "$LVS_EX_GRIDLINES" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_HEADERDRAGDROP) = $LVS_EX_HEADERDRAGDROP) Then $Styles &= "$LVS_EX_HEADERDRAGDROP" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_INFOTIP) = $LVS_EX_INFOTIP) Then $Styles &= "$LVS_EX_INFOTIP" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_LABELTIP) = $LVS_EX_LABELTIP) Then $Styles &= "$LVS_EX_LABELTIP" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_MULTIWORKAREAS) = $LVS_EX_MULTIWORKAREAS) Then $Styles &= "$LVS_EX_MULTIWORKAREAS" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_ONECLICKACTIVATE) = $LVS_EX_ONECLICKACTIVATE) Then $Styles &= "$LVS_EX_ONECLICKACTIVATE" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_REGIONAL) = $LVS_EX_REGIONAL) Then $Styles &= "$LVS_EX_REGIONAL" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_SIMPLESELECT) = $LVS_EX_SIMPLESELECT) Then $Styles &= "$LVS_EX_SIMPLESELECT" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_SUBITEMIMAGES) = $LVS_EX_SUBITEMIMAGES) Then $Styles &= "$LVS_EX_SUBITEMIMAGES" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_TRACKSELECT) = $LVS_EX_TRACKSELECT) Then $Styles &= "$LVS_EX_TRACKSELECT" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_TWOCLICKACTIVATE) = $LVS_EX_TWOCLICKACTIVATE) Then $Styles &= "$LVS_EX_TWOCLICKACTIVATE" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_UNDERLINECOLD) = $LVS_EX_UNDERLINECOLD) Then $Styles &= "$LVS_EX_UNDERLINECOLD" & @LF & @TAB
If (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_UNDERLINEHOT) = $LVS_EX_UNDERLINEHOT) Then $Styles &= "$LVS_EX_UNDERLINEHOT" & @LF & @TAB
Return $Styles
EndFunc ;==>_DisplayExtendStringList


Function _GUICtrlListView_GetFocusedGroup

Function Reference

_GUICtrlListView_GetFocusedGroup

Gets the group that has the focus

#Include <GuiListView.au3>
_GUICtrlListView_GetFocusedGroup($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the index of the group with state of $LVGS_FOCUSED, or -1 if there is no group with state of $LVGS_FOCUSED

Remarks

Minimum operating systems: Windows Vista

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Set Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

If @OSVersion = "WIN_VISTA" Then
_GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1", 0, $LVGS_FOCUSED)
MsgBox(4160, "Information", "Group has focus at Index: " & _GUICtrlListView_GetFocusedGroup($hListView))
Else
; Change group information
$aInfo = _GUICtrlListView_GetGroupInfo($hListView, 1)
MsgBox(4160, "Information", "Group 1 Text: " & $aInfo[0])
_GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1")
EndIf

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetGroupCount

Function Reference

_GUICtrlListView_GetGroupCount

Gets the number of groups

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the number of groups

Remarks

Minimum operating systems: Windows Vista

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Set Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

MsgBox(4160, "Information", "Group Count: " & _GUICtrlListView_GetGroupCount($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetGroupInfo

Function Reference

_GUICtrlListView_GetGroupInfo

Retrieves group information

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupInfo($hWnd, $iGroupID)

Parameters

$hWnd | Handle to the control
$iGroupID | ID that specifies the group whose information is retrieved

Return Value

Returns an Array with the following format:
[0] - Header text
[1] - Header alignment:
0 - Left
1 - Center
2 - Right

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_SetGroupInfo, _GUICtrlListView_GetGroupInfoByIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Get Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Change group information
$aInfo = _GUICtrlListView_GetGroupInfo($hListView, 1)
MsgBox(4160, "Information", "Group 1 Text: " & $aInfo[0])
_GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetGroupInfoByIndex

Function Reference

_GUICtrlListView_GetGroupInfoByIndex

Retrieves group information

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupInfoByIndex($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index that specifies the group whose information is retrieved

Return Value

Returns an Array with the following format:
[0] - Header text
[1] - Header alignment:
0 - Left
1 - Center
2 - Right

Remarks

Minimum operating systems: Windows Vista

Related

_GUICtrlListView_SetGroupInfo, _GUICtrlListView_GetGroupInfo

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Get Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Change group information
For $x = 0 To _GUICtrlListView_GetGroupCount($hListView) - 1
$aInfo = _GUICtrlListView_GetGroupInfoByIndex($hListView, $x)
MsgBox(4160, "Information", "Index " & $x + 1 & "Text: " & $aInfo[0])
Next
_GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetGroupRect

Function Reference

_GUICtrlListView_GetGroupRect

Gets the rectangle for a specified group

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupRect($hWnd, $iGroupID[, $iGet = $LVGGR_GROUP])

Parameters

$hWnd | Handle to the control
$iGroupID | ID that specifies the group whose information is retrieved
$iGet | [optional] Flag to specify the coordinates of the rectangle to get, can be one of the following: $LVGGR_GROUP - Coordinates of the entire expanded group $LVGGR_HEADER - Coordinates of the header only (collapsed group) $LVGGR_LABEL - Coordinates of the label only $LVGGR_SUBSETLINK - Coordinates of the subset link only (markup subset)

Return Value

Returns an Array with the following format:
[0] - Specifies the x-coordinate of the upper-left corner of the rectangle
[1] - Specifies the y-coordinate of the upper-left corner of the rectangle
[2] - Specifies the x-coordinate of the lower-right corner of the rectangle
[3] - Specifies the y-coordinate of the lower-right corner of the rectangle

Remarks

Minimum operating systems: Windows Vista

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Get Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Get rect of Group ID 2
$aInfo = _GUICtrlListView_GetGroupRect($hListView, 2)
MsgBox(4160, "Information", "Rect: " & @LF & _
@TAB & "Left..: " & $aInfo[0] & @LF & _
@TAB & "Top...: " & $aInfo[1] & @LF & _
@TAB & "Right.: " & $aInfo[2] & @LF & _
@TAB & "Bottom: " & $aInfo[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetGroupViewEnabled

Function Reference

_GUICtrlListView_GetGroupViewEnabled

Checks whether the control has group view enabled

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupViewEnabled($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Group view setting:
True - Group view is enabled
False - Group view is not enabled

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_EnableGroupView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Group View Enabled", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_FULLROWSELECT)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Is group view enabled
MsgBox(4160, "Information", "Group View Enabled: " & _GUICtrlListView_GetGroupViewEnabled($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetHeader

Function Reference

_GUICtrlListView_GetHeader

Retrieves the handle to the header control

#Include <GuiListView.au3>
_GUICtrlListView_GetHeader($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the handle to the header control

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Header", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

MsgBox(4160, "Information", "ListView Header Handle: " & _GUICtrlListView_GetHeader($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetHotCursor

Function Reference

_GUICtrlListView_GetHotCursor

Retrieves the HCURSOR value used when the pointer is over an item while hot tracking is enabled

#Include <GuiListView.au3>
_GUICtrlListView_GetHotCursor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns a HCURSOR value that is the handle to the cursor that the list-view
control uses when hot tracking is enabled.

Remarks

A list-view control uses hot tracking and hover selection when the $LVS_EX_TRACKSELECT style is set.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Hot Cursor", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Show hot cursor handle
MsgBox(4160, "Information", "Hot Cursor Handle: 0x" & Hex(_GUICtrlListView_GetHotCursor($hListView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetHotItem

Function Reference

_GUICtrlListView_GetHotItem

Retrieves the index of the hot item

#Include <GuiListView.au3>
_GUICtrlListView_GetHotItem($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the index of the item that is hot

Remarks

None.

Related

_GUICtrlListView_SetHotItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $hStatus

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("ListView Get Hot Item", 392, 322)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
$hListView = GUICtrlGetHandle($hListView)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_TRACKSELECT))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetSimple($hStatus, True)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

;Register WM_NOTIFY events
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func ListView_HOTTRACK($iSubItem)
Local $HotItem = _GUICtrlListView_GetHotItem($hListView)
If $HotItem <> -1 Then _GUICtrlStatusBar_SetText($hStatus, "Hot Item: " & $HotItem & " SubItem: " & $iSubItem)
EndFunc ;==>ListView_HOTTRACK

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_DELETEITEM ; An item is about to be deleted
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
ListView_HOTTRACK(DllStructGetData($tInfo, "SubItem"))
;~ _DebugPrint("$LVN_HOTTRACK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
Return 0 ; allow the list view to perform its normal track select processing.
;Return 1 ; the item will not be selected.
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_GetHoverTime

Function Reference

_GUICtrlListView_GetHoverTime

Retrieves the amount of time that the mouse cursor must hover over an item before it is selected

#Include <GuiListView.au3>
_GUICtrlListView_GetHoverTime($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the amount of time, in milliseconds, that the mouse cursor must hover over an item before it is selected. If the return value is (DWORD)-1, then the hover time is the default hover time.

Remarks

The hover time only affects list-view controls that have the $LVS_EX_TRACKSELECT, $LVS_EX_ONECLICKACTIVATE,
or $LVS_EX_TWOCLICKACTIVATE extended list-view style.

Related

_GUICtrlListView_SetHoverTime

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $hStatus

_Main()

Func _Main()
Local $hGUI

$hGUI = GUICreate("ListView Get Hover Time", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_TRACKSELECT))
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetSimple($hStatus, True)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

_GUICtrlListView_InsertItem($hListView, "Row 1: Col 1", -1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_InsertItem($hListView, "Row 2: Col 1", -1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_InsertItem($hListView, "Row 3: Col 1", -1)

; Set hover time
_GUICtrlListView_SetHoverTime($hListView, 1234)
MsgBox(4160, "Information", "Hover Time (milliseconds): " & _GUICtrlListView_GetHoverTime($hListView))

;Register WM_NOTIFY events
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func ListView_HOTTRACK($iSubItem)
Local $HotItem = _GUICtrlListView_GetHotItem($hListView)
If $HotItem <> -1 Then _GUICtrlStatusBar_SetText($hStatus, "Hot Item: " & $HotItem & " SubItem: " & $iSubItem)
EndFunc ;==>ListView_HOTTRACK

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_DELETEITEM ; An item is about to be deleted
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
ListView_HOTTRACK(DllStructGetData($tInfo, "SubItem"))
;~ _DebugPrint("$LVN_HOTTRACK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
;~ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
;~ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
;~ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
;~ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
;~ "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
Return 0 ; allow the list view to perform its normal track select processing.
;Return 1 ; the item will not be selected.
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_GetImageList

Function Reference

_GUICtrlListView_GetImageList

Retrieves the handle to an image list used for drawing listview items

#Include <GuiListView.au3>
_GUICtrlListView_GetImageList($hWnd, $iImageList)

Parameters

$hWnd | Handle to the control
$iImageList | Image list to retrieve: 0 - Image list with large icons 1 - Image list with small icons 2 - Image list with state images

Return Value

Success: | The handle to the specified image list
Failure: | 0

Remarks

None.

Related

_GUICtrlListView_SetImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Image List", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Get image list handle
MsgBox(4160, "Information", "Image List Handle: 0x" & Hex(_GUICtrlListView_GetImageList($hListView, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetISearchString

Function Reference

_GUICtrlListView_GetISearchString

Retrieves the incremental search string of the control

#Include <GuiListView.au3>
_GUICtrlListView_GetISearchString($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Incremental search string or a blank string if no search string exists

Remarks

The incremental search string is the character sequence that the user types while the list view
has the input focus. Each time the user types a character, the system appends the character to
the search string and then searches for a matching item. If the system finds a match, it selects
the item and, if necessary, scrolls it into view.

A time-out period is associated with each character that the user types. If the time-out period
elapses before the user types another character, the incremental search string is reset.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get ISearch", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

_GUICtrlListView_BeginUpdate($hListView)
For $x = 1 To 10
_GUICtrlListView_InsertItem($hListView, "Item " & $x, -1, 0)
Next
_GUICtrlListView_EndUpdate($hListView)

Send("Item 1")

; Get incremental search string
MsgBox(4160, "Information", "Incremental Search String: " & _GUICtrlListView_GetISearchString($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItem

Function Reference

_GUICtrlListView_GetItem

Retrieves an item's attributes

#Include <GuiListView.au3>
_GUICtrlListView_GetItem($hWnd, $iIndex[, $iSubItem = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$iSubItem | [optional] One based subitem index

Return Value

Returns an Array with the following format:
[0] - Item state, which can be a combination of the following:
1 - The item is marked for a cut-and-paste operation
2 - The item is highlighted as a drag-and-drop target
4 - The item has the focus
8 - The item is selected
[1] - One based item image overlay index
[2] - One based item state image index
[3] - Item text
[4] - Zero based item image index
[5] - Item application defined value
[6] - Number of image widths to indent the item
[7] - Identifier of the tile view group that receives the item

Remarks

None.

Related

_GUICtrlListView_SetItem, _GUICtrlListView_GetItemEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aItem, $hListView

GUICreate("ListView Get Item", 400, 300)

$hListView = GUICtrlCreateListView("Items", 2, 2, 394, 268)
GUISetState()

GUICtrlCreateListViewItem("Row 1", $hListView)
GUICtrlCreateListViewItem("Row 2", $hListView)
GUICtrlCreateListViewItem("Row 3", $hListView)

; Show item 2 text
$aItem = _GUICtrlListView_GetItem($hListView, 1)
MsgBox(4160, "Information", "Item 2 Text: " & $aItem[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemChecked

Function Reference

_GUICtrlListView_GetItemChecked

Returns the check state for a list-view control item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemChecked($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index to retrieve item check state from

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetItemChecked

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Checked State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Check item 2
_GUICtrlListView_SetItemChecked($hListView, 1)
MsgBox(4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemCount

Function Reference

_GUICtrlListView_GetItemCount

Retrieves the number of items in a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_GetItemCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the number of items

Remarks

None.

Related

_GUICtrlListView_SetItemCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Count", 400, 300)
$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUISetState()

GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
GUICtrlCreateListViewItem("line5|data5|more5", $hListView)

MsgBox(4160, "Information", "Item Count: " & _GUICtrlListView_GetItemCount($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemCut

Function Reference

_GUICtrlListView_GetItemCut

Determines whether the item is marked for a cut and paste operation

#Include <GuiListView.au3>
_GUICtrlListView_GetItemCut($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Success: | True: Item is marked for a cut and paste operation
Failure: | False: Item is not marked for a cut and paste operation

Remarks

None.

Related

_GUICtrlListView_SetItemCut

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Cut", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Cut item 2
_GUICtrlListView_SetItemCut($hListView, 1)
MsgBox(4160, "Information", "Item 2 Cut: " & _GUICtrlListView_GetItemCut($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemDropHilited

Function Reference

_GUICtrlListView_GetItemDropHilited

Determines whether the item is highlighted as a drag-and-drop target

#Include <GuiListView.au3>
_GUICtrlListView_GetItemDropHilited($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetItemDropHilited

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Drop Hilited", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Hilight item 2
_GUICtrlListView_SetItemDropHilited($hListView, 1)
MsgBox(4160, "Information", "Item 2 Drop Hilited: " & _GUICtrlListView_GetItemDropHilited($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemEx

Function Reference

_GUICtrlListView_GetItemEx

Retrieves some or all of an item's attributes

#Include <GuiListView.au3>
_GUICtrlListView_GetItemEx($hWnd, ByRef $tItem)

Parameters

$hWnd | Handle to the control
$tItem | $tagLVITEM structure that specifies the information to retrieve

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItem, $tagLVITEM

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tItem, $hListView

GUICreate("ListView Get ItemEX", 400, 300)

$hListView = GUICtrlCreateListView("Items", 2, 2, 394, 268)
GUISetState()

GUICtrlCreateListViewItem("Item 1", $hListView)
GUICtrlCreateListViewItem("Item 2", $hListView)
GUICtrlCreateListViewItem("Item 3", $hListView)

; Show item 1 raw state
$tItem = DllStructCreate($tagLVITEM)
DllStructSetData($tItem, "Mask", $LVIF_STATE)
DllStructSetData($tItem, "Item", 1)
DllStructSetData($tItem, "StateMask", -1)
_GUICtrlListView_GetItemEx($hListView, $tItem)
MsgBox(4160, "Information", "Item 2 State: " & DllStructGetData($tItem, "State"))

; Select item 2
_GUICtrlListView_SetItemSelected($hListView, 1)

; Show item 1 raw state
_GUICtrlListView_GetItemEx($hListView, $tItem)
MsgBox(4160, "Information", "Item 2 State: " & DllStructGetData($tItem, "State"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemFocused

Function Reference

_GUICtrlListView_GetItemFocused

Determines whether the item is highlighted as a drag-and-drop target

#Include <GuiListView.au3>
_GUICtrlListView_GetItemFocused($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetItemFocused

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Focused", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Focus item 2
_GUICtrlListView_SetItemFocused($hListView, 1)
MsgBox(4160, "Information", "Item 2 Focused: " & _GUICtrlListView_GetItemFocused($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemGroupID

Function Reference

_GUICtrlListView_GetItemGroupID

Gets the item group ID

#Include <GuiListView.au3>
_GUICtrlListView_GetItemGroupID($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Returns an Item group ID

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_SetItemGroupID

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Item Group ID", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Display Item 3 group ID
MsgBox(4160, "Information", "Item 3 Group ID: " & _GUICtrlListView_GetItemGroupID($hListView, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemImage

Function Reference

_GUICtrlListView_GetItemImage

Retrieves the index of the item's icon

#Include <GuiListView.au3>
_GUICtrlListView_GetItemImage($hWnd, $iIndex[, $iSubItem = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$iSubItem | [optional] One based item sub item index

Return Value

Success: | Zero based item image index
Failure: | -1

Remarks

None.

Related

_GUICtrlListView_SetItemImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView, $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ListView Get Item Image", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Set item 1, subitem 1 image
_GUICtrlListView_SetItemImage($hListView, 1, 1, 1)
MsgBox(4160, "Information", "Item 1, SubItem 1 Image: " & _GUICtrlListView_GetItemImage($hListView, 1, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemIndent

Function Reference

_GUICtrlListView_GetItemIndent

Retrieves the number of image widths the item is indented

#Include <GuiListView.au3>
_GUICtrlListView_GetItemIndent($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Returns an Item indention

Remarks

None.

Related

_GUICtrlListView_SetItemIndent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Item Indent", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Indent items
_GUICtrlListView_SetItemIndent($hListView, 1, 1)
_GUICtrlListView_SetItemIndent($hListView, 2, 2)
MsgBox(4160, "Information", "Item 2 Indent: " & _GUICtrlListView_GetItemIndent($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemParam

Function Reference

_GUICtrlListView_GetItemParam

Retrieves the application specific value of the item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemParam($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Returns an Application specific value

Remarks

None.

Related

_GUICtrlListView_SetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

; Warning do not use SetItemParam on items created with GuiCtrlCreateListViewItem
; Param is the controlId for items created with built-in function

Example_UDF_Created()

Func Example_UDF_Created()
Local $GUI, $hListView

$GUI = GUICreate("(UDF Created) ListView Get Item Param", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Set item 2 parameter
_GUICtrlListView_SetItemParam($hListView, 1, 1234)
MsgBox(4160, "Information", "Item 2 Parameter: " & _GUICtrlListView_GetItemParam($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_GetItemPosition

Function Reference

_GUICtrlListView_GetItemPosition

Retrieves the position of an item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemPosition($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Returns an Array with the following format:
[0] - X position of item
[1] - Y position of item

Remarks

None.

Related

_GUICtrlListView_SetItemPosition, _GUICtrlListView_GetItemPositionX, _GUICtrlListView_GetItemPositionY

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aPos, $hListView

GUICreate("ListView Get Item Position", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get item 2 position
$aPos = _GUICtrlListView_GetItemPosition($hListView, 1)
MsgBox(4160, "Information", StringFormat("Item 2 Position : [%d, %d]", $aPos[0], $aPos[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemPositionX

Function Reference

_GUICtrlListView_GetItemPositionX

Retrieves the X position of an item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemPositionX($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Returns a X position of item

Remarks

None.

Related

_GUICtrlListView_GetItemPosition

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hListView

GUICreate("ListView Get Item Position X", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get item 2 position
$iX = _GUICtrlListView_GetItemPositionX($hListView, 1)
$iY = _GUICtrlListView_GetItemPositionY($hListView, 1)
MsgBox(4160, "Information", StringFormat("Item 2 Position : [%d, %d]", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemPositionY

Function Reference

_GUICtrlListView_GetItemPositionY

Retrieves the Y position of an item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemPositionY($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Return an Y position of item

Remarks

None.

Related

_GUICtrlListView_GetItemPosition

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hListView

GUICreate("ListView Get Item Position Y", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get item 2 position
$iX = _GUICtrlListView_GetItemPositionX($hListView, 1)
$iY = _GUICtrlListView_GetItemPositionY($hListView, 1)
MsgBox(4160, "Information", StringFormat("Item 2 Position : [%d, %d]", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemRect

Function Reference

_GUICtrlListView_GetItemRect

Retrieves the bounding rectangle for all or part of an item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemRect($hWnd, $iIndex[, $iPart = 3])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iPart | [optional] The portion of the item to retrieve: 0 - The bounding rectangle of the entire item 1 - The bounding rectangle of the icon or small icon 2 - The bounding rectangle of the item text 3 - The union of 1 and 2, but excludes columns in report view

Return Value

Returns an Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlListView_GetItemRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hListView

GUICreate("ListView Get Item Rectangle", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get item 2 rectangle
$aRect = _GUICtrlListView_GetItemRect($hListView, 1)
MsgBox(4160, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemRectEx

Function Reference

_GUICtrlListView_GetItemRectEx

Retrieves the bounding rectangle for all or part of an item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemRectEx($hWnd, $iIndex[, $iPart = 3])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iPart | [optional] The portion of the item to retrieve: $LVIR_BOUNDS - Returns the bounding rectangle of the entire item, including the icon and label $LVIR_ICON - Returns the bounding rectangle of the icon or small icon $LVIR_LABEL - Returns the bounding rectangle of the item text $LVIR_SELECTBOUNDS - Returns the union of the $LVIR_ICON and $LVIR_LABEL rectangles, but excludes columns in report view.

Return Value

Returns a $tagRECT structure

Remarks

None.

Related

_GUICtrlListView_GetItemRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $hListView

GUICreate("ListView Get Item Rectangle Ex", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get item 2 rectangle
$tRect = _GUICtrlListView_GetItemRectEx($hListView, 1)
MsgBox(4160, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", DllStructGetData($tRect, "Left"), _
DllStructGetData($tRect, "Top"), DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemSelected

Function Reference

_GUICtrlListView_GetItemSelected

Determines whether the item is selected

#Include <GuiListView.au3>
_GUICtrlListView_GetItemSelected($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetItemSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Selected", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select item 2
_GUICtrlListView_SetItemSelected($hListView, 1)
MsgBox(4160, "Information", "Item 2 Selected: " & _GUICtrlListView_GetItemSelected($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemSpacing

Function Reference

_GUICtrlListView_GetItemSpacing

Determines the spacing between items in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetItemSpacing($hWnd[, $fSmall = False])

Parameters

$hWnd | Handle to the control
$fSmall | [optional] View for which to retrieve the item spacing: True - Small icon view False - Icon view

Return Value

Returns an Array with the following format:
[0] - Horizontal spacing
[1] - Vertical spacing

Remarks

None.

Related

_GUICtrlListView_GetItemSpacingX, _GUICtrlListView_GetItemSpacingY

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aSpace, $hListView

GUICreate("ListView Get Item Spacing", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show item spacing
$aSpace = _GUICtrlListView_GetItemSpacing($hListView)
MsgBox(4160, "Information", StringFormat("Item Spacing: X=%d, Y=%d", $aSpace[0], $aSpace[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemSpacingX

Function Reference

_GUICtrlListView_GetItemSpacingX

Determines the horizontal spacing between items in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetItemSpacingX($hWnd[, $fSmall = False])

Parameters

$hWnd | Handle to the control
$fSmall | [optional] View for which to retrieve the item spacing: True - Small icon view False - Icon view

Return Value

Returns the Horizontal spacing

Remarks

None.

Related

_GUICtrlListView_GetItemSpacing

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hListView

GUICreate("ListView Get Item Spacing X", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show item spacing
$iX = _GUICtrlListView_GetItemSpacingX($hListView)
$iY = _GUICtrlListView_GetItemSpacingY($hListView)
MsgBox(4160, "Information", StringFormat("Item Spacing: X=%d, Y=%d", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemSpacingY

Function Reference

_GUICtrlListView_GetItemSpacingY

Determines the vertical spacing between items in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetItemSpacingY($hWnd[, $fSmall = False])

Parameters

$hWnd | Handle to the control
$fSmall | [optional] View for which to retrieve the item spacing: True - Small icon view False - Icon view

Return Value

Returns the Vertical spacing

Remarks

None.

Related

_GUICtrlListView_GetItemSpacing

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hListView

GUICreate("ListView Get Item Spacing Y", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show item spacing
$iX = _GUICtrlListView_GetItemSpacingX($hListView)
$iY = _GUICtrlListView_GetItemSpacingY($hListView)
MsgBox(4160, "Information", StringFormat("Item Spacing: X=%d, Y=%d", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemState

Function Reference

_GUICtrlListView_GetItemState

Retrieves the state of a listview item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemState($hWnd, $iIndex, $iMask)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iMask | State information to retrieve. This can be a combination of: $LVIS_CUT - The item is marked for a cut-and-paste operation $LVIS_DROPHILITED - The item is highlighted as a drag-and-drop target $LVIS_FOCUSED - The item has the focus, so it is surrounded by a standard focus rectangle $LVIS_SELECTED - The item is selected $LVIS_OVERLAYMASK - Use this mask to retrieve the item's overlay image index $LVIS_STATEIMAGEMASK - Use this mask to retrieve the item's state image index

Return Value

Returns the current state for the specified item

Remarks

An items state information includes a set of bit flags as well as image list indexes that indicate the item's
state image and overlay image

Related

_GUICtrlListView_SetItemState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Item State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Get item 1 state
_GUICtrlListView_SetItemState($hListView, 0, $LVIS_FOCUSED, $LVIS_FOCUSED)
MsgBox(4160, "Information", "Item 1 State: " & _GUICtrlListView_GetItemState($hListView, 0, $LVIS_FOCUSED))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemStateImage

Function Reference

_GUICtrlListView_GetItemStateImage

Gets the state image that is displayed

#Include <GuiListView.au3>
_GUICtrlListView_GetItemStateImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Returns the One based overlay image index

Remarks

None.

Related

_GUICtrlListView_SetItemStateImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get Item State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView, $hImage, 2)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 120)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Set item 2 state image
_GUICtrlListView_SetItemStateImage($hListView, 1, 1)
MsgBox(4160, "Information", "Item 2 State Image: " & _GUICtrlListView_GetItemStateImage($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemText

Function Reference

_GUICtrlListView_GetItemText

Retrieves the text of an item or subitem

#Include <GuiListView.au3>
_GUICtrlListView_GetItemText($hWnd, $iIndex[, $iSubItem = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iSubItem | [optional] One based sub item index

Return Value

Returns the Item or subitem text

Remarks

To retrieve the item text, set iSubItem to zero. To retrieve the text of a subitem, set iSubItem to the one
based subitem's index.

Related

_GUICtrlListView_SetItemText, _GUICtrlListView_GetItemTextArray, _GUICtrlListView_GetItemTextString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Text", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Set item 2 text
_GUICtrlListView_SetItemText($hListView, 1, "New Item 2")
MsgBox(4160, "Information", "Item 2 Text: " & _GUICtrlListView_GetItemText($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemTextArray

Function Reference

_GUICtrlListView_GetItemTextArray

Retrieves all of a list-view item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemTextArray($hWnd[, $iItem = -1])

Parameters

$hWnd | Handle to the control
$iItem | [optional] Zero based index of item to retrieve

Return Value

Success: | Array with the following format:
 | [0] - Number of Columns in array (n)
 | [1] - First column index
 | [2] - Second column index
 | [n] - Last column index
Failure: | Array with the following format:
 | [0] - Number of Columns in array (0)

Remarks

If $iItem = -1 then will attempt to get the Currently Selected item.

Related

_GUICtrlListView_SetItemText, _GUICtrlListView_GetItemText, _GUICtrlListView_GetItemTextString

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aItem, $sText, $hListView

GUICreate("ListView Get Item Text Array", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
GUICtrlCreateListViewItem("line5|data5|more5", $hListView)

GUISetState()

; Get item 2 text
$aItem = _GUICtrlListView_GetItemTextArray($hListView, 1)
For $i = 1 To $aItem[0]
$sText &= StringFormat("Column[%2d] %s", $i, $aItem[$i]) & @LF
Next

MsgBox(4160, "Information", "Item 2 (All Columns) Text: " & @LF & @LF & $sText)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetItemTextString

Function Reference

_GUICtrlListView_GetItemTextString

Retrieves all of a list-view item

#Include <GuiListView.au3>
_GUICtrlListView_GetItemTextString($hWnd[, $iItem = -1])

Parameters

$hWnd | Handle to the control
$iItem | [optional] Zero based index of item to retrieve

Return Value

Success: | delimited string
Failure: | Empty string

Remarks

If $iItem = -1 then will attempt to get the Currently Selected item.

Related

_GUICtrlListView_SetItemText, _GUICtrlListView_GetItemText, _GUICtrlListView_GetItemTextArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Item Text String", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
GUICtrlCreateListViewItem("line5|data5|more5", $hListView)
GUISetState()

MsgBox(4160, "Information", "Item 2 Text: " & @LF & @LF & _GUICtrlListView_GetItemTextString($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetNextItem

Function Reference

_GUICtrlListView_GetNextItem

Searches for an item that has the specified properties

#Include <GuiListView.au3>
_GUICtrlListView_GetNextItem($hWnd[, $iStart = -1[, $iSearch = 0[, $iState = 8]]])

Parameters

$hWnd | Handle to the control
$iStart | [optional] Index of the item to begin the search with, or -1 to find the first item that matches the specified flags. The specified item itself is excluded from the search.
$iSearch | [optional] Relationship to the index of the item where the search is to begin: 0 - Searches for a subsequent item by index 1 - Searches for an item that is above the specified item 2 - Searches for an item that is below the specified item 3 - Searches for an item to the left of the specified item 4 - Searches for an item to the right of the specified item
$iState | [optional] State of the item to find. Can be a combination of: 1 - The item is cut 2 - The item is highlighted 4 - The item is focused 8 - The item is selected

Return Value

Success: | The zero based index of the next item
Failure: | -1

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Next Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select item 2
_GUICtrlListView_SetItemSelected($hListView, 1)

; Find selected item
MsgBox(4160, "Information", "Selected Item: " & _GUICtrlListView_GetNextItem($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetNumberOfWorkAreas

Function Reference

_GUICtrlListView_GetNumberOfWorkAreas

Retrieves the number of working areas in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetNumberOfWorkAreas($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Number of working areas

Remarks

None.

Related

_GUICtrlListView_SetWorkAreas

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Get # of Work Areas", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, 0, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Create work area
_GUICtrlListView_SetWorkAreas($hListView, 0, 0, 100, 100)
MsgBox(4160, "Information", "Work Areas: " & _GUICtrlListView_GetNumberOfWorkAreas($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetOrigin

Function Reference

_GUICtrlListView_GetOrigin

Retrieves the current view origin for the control

#Include <GuiListView.au3>
_GUICtrlListView_GetOrigin($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - View X position
[1] - View Y position

Remarks

None.

Related

_GUICtrlListView_GetOriginX, _GUICtrlListView_GetOriginY

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aOrigin, $hImage, $hListView

GUICreate("ListView Get Origin", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Get current origin
$aOrigin = _GUICtrlListView_GetOrigin($hListView)
MsgBox(4160, "Information", StringFormat("Success: %s Origin: X=%d, Y=%d", @extended = 1, $aOrigin[0], $aOrigin[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetOriginX

Function Reference

_GUICtrlListView_GetOriginX

Retrieves the current horizontal view origin for the control

#Include <GuiListView.au3>
_GUICtrlListView_GetOriginX($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the View X position

Remarks

None.

Related

_GUICtrlListView_GetOrigin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hImage, $hListView

GUICreate("ListView Get Origin X", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Get current origin
$iX = _GUICtrlListView_GetOriginX($hListView)
$iY = _GUICtrlListView_GetOriginY($hListView)
MsgBox(4160, "Information", StringFormat("Origin: X=%d, Y=%d", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetOriginY

Function Reference

_GUICtrlListView_GetOriginY

Retrieves the current horizontal view origin for the control

#Include <GuiListView.au3>
_GUICtrlListView_GetOriginY($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the View Y position

Remarks

None.

Related

_GUICtrlListView_GetOrigin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hImage, $hListView

GUICreate("ListView Get Origin Y", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Get current origin
$iX = _GUICtrlListView_GetOriginX($hListView)
$iY = _GUICtrlListView_GetOriginY($hListView)
MsgBox(4160, "Information", StringFormat("Origin: X=%d, Y=%d", $iX, $iY))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetOutlineColor

Function Reference

_GUICtrlListView_GetOutlineColor

Retrieves the color of the border of the control

#Include <GuiListView.au3>
_GUICtrlListView_GetOutlineColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Border color of the control

Remarks

Minimum OS - Windows XP.

Control must have the $LVS_EX_BORDERSELECT extended window style set

Related

_GUICtrlListView_SetOutlineColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hImage, $hListView

GUICreate("ListView Get Outline Color", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_BORDERSELECT)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Set outline color
_GUICtrlListView_SetOutlineColor($hListView, 0x0000FF)
MsgBox(4160, "Information", "Outline Color: " & Hex(_GUICtrlListView_GetOutlineColor($hListView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetSelectedColumn

Function Reference

_GUICtrlListView_GetSelectedColumn

Retrieves the index of the selected column

#Include <GuiListView.au3>
_GUICtrlListView_GetSelectedColumn($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The zero based index of the selected column
Failure: | -1

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_SetSelectedColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Selected Column", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3", 2, 2, 394, 268)
GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
GUICtrlCreateListViewItem("line5|data5|more5", $hListView)
GUISetState()

; Select column 2
_GUICtrlListView_SetSelectedColumn($hListView, 1)
MsgBox(4160, "Information", "Selected Column: " & _GUICtrlListView_GetSelectedColumn($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetSelectedCount

Function Reference

_GUICtrlListView_GetSelectedCount

Determines the number of selected items

#Include <GuiListView.au3>
_GUICtrlListView_GetSelectedCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the number of selected items

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Selected Count", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select multiple items
_GUICtrlListView_SetItemSelected($hListView, 1)
_GUICtrlListView_SetItemSelected($hListView, 2)
MsgBox(4160, "Information", "Selected Count: " & _GUICtrlListView_GetSelectedCount($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetSelectedIndices

Function Reference

_GUICtrlListView_GetSelectedIndices

Retrieve indices of selected item(s)

#Include <GuiListView.au3>
_GUICtrlListView_GetSelectedIndices($hWnd, $fArray = False)

Parameters

$hWnd | Handle to the control
$fArray | Return string or Array True - Returns array False - Returns pipe "|" delimited string

Return Value

Success: | Selected indices Based on $fArray:
 | Array - With the following format
 | [0] - Number of Items in array (n)
 | [1] - First item index
 | [2] - Second item index
 | [n] - Last item index
 | String - With the following format
 | "0|1|2|n"
Failure: | Based on $fArray
 | Array - With the following format
 | [0] - Number of Items in array (0)
 | String - Empty ("")

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Selected Indices", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select multiple items
_GUICtrlListView_SetItemSelected($hListView, 1)
_GUICtrlListView_SetItemSelected($hListView, 2)
MsgBox(4160, "Information", "Selected Indices: " & _GUICtrlListView_GetSelectedIndices($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetSelectionMark

Function Reference

_GUICtrlListView_GetSelectionMark

Retrieves the selection mark from the control

#Include <GuiListView.au3>
_GUICtrlListView_GetSelectionMark($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The zero based selection mark
Failure: | -1

Remarks

The selection mark is the item index from which a multiple selection starts

Related

_GUICtrlListView_SetSelectionMark

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Selection Mark", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select multiple items
_GUICtrlListView_SetSelectionMark($hListView, 1)
MsgBox(4160, "Information", "Selected Mark: " & _GUICtrlListView_GetSelectionMark($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetStringWidth

Function Reference

_GUICtrlListView_GetStringWidth

Determines the width of a specified string

#Include <GuiListView.au3>
_GUICtrlListView_GetStringWidth($hWnd, $sString)

Parameters

$hWnd | Handle to the control
$sString | String for which the width will be calculated

Return Value

Success: | The string width
Failure: | 0

Remarks

This function returns the exact width, in pixels, of the specified string. If you use the returned string
width as the column width in the SetColumnWidth function the string will be truncated. To retrieve the column
width that can contain the string without truncating it, you must add padding to the returned string width.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get String Width", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Get width of string
MsgBox(4160, "Information", 'Width of "Test": ' & _GUICtrlListView_GetStringWidth($hListView, "Test"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetSubItemRect

Function Reference

_GUICtrlListView_GetSubItemRect

Retrieves information about an item bounding rectangle

#Include <GuiListView.au3>
_GUICtrlListView_GetSubItemRect($hWnd, $iIndex, $iSubItem[, $iPart = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the subitem's parent item
$iSubItem | One based index of the subitem
$iPart | [optional] The portion of the subitem item to retrieve: 0 - The rectangle of the entire subitem, including the icon and label 1 - The rectangle of the icon or small icon

Return Value

Returns an Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

This function is used only with controls that use the $LVS_REPORT style

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hListView

GUICreate("ListView Get SubItem Rect", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

; Show item 2 sub item rect
$aRect = _GUICtrlListView_GetSubItemRect($hListView, 1, 1)
MsgBox(4160, "Information", StringFormat("Subitem Rectangle : [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetTextBkColor

Function Reference

_GUICtrlListView_GetTextBkColor

Retrieves the text background color of the control

#Include <GuiListView.au3>
_GUICtrlListView_GetTextBkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Text background color

Remarks

None.

Related

_GUICtrlListView_SetTextBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Text BkColor", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show clors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @CRLF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @CRLF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetTextColor

Function Reference

_GUICtrlListView_GetTextColor

Retrieves the text color of the control

#Include <GuiListView.au3>
_GUICtrlListView_GetTextColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Text color

Remarks

None.

Related

_GUICtrlListView_SetTextColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Text Color", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show clors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @CRLF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @CRLF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetToolTips

Function Reference

_GUICtrlListView_GetToolTips

Retrieves the ToolTip control handle

#Include <GuiListView.au3>
_GUICtrlListView_GetToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the handle of the ToolTip control

Remarks

None.

Related

_GUICtrlListView_SetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hToolTip, $hListView

GUICreate("ListView Get ToolTips", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show tooltip handle
$hToolTip = _GUICtrlListView_GetToolTips($hListView)
MsgBox(4160, "Information", "ToolTip Handle: 0x" & Hex($hToolTip))
_GUICtrlListView_SetToolTips($hListView, $hToolTip)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetTopIndex

Function Reference

_GUICtrlListView_GetTopIndex

Retrieves the index of the topmost visible item when in list or report view

#Include <GuiListView.au3>
_GUICtrlListView_GetTopIndex($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Zero based index of the item
Zero if the list-view control is in icon or small icon view

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Top Index", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Select item 50
_GUICtrlListView_SetItemSelected($hListView, 49)
_GUICtrlListView_EnsureVisible($hListView, 49)
MsgBox(4160, "Information", "Top Index: " & _GUICtrlListView_GetTopIndex($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetUnicodeFormat

Function Reference

_GUICtrlListView_GetUnicodeFormat

Retrieves the UNICODE character format flag

#Include <GuiListView.au3>
_GUICtrlListView_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True: Using Unicode characters
Failure: | False: Using ANSI characters

Remarks

None.

Related

_GUICtrlListView_SetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Unicode Format", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Set Unicode format
MsgBox(4160, "Information", "Unicode: " & _GUICtrlListView_GetUnicodeFormat($hListView))
_GUICtrlListView_SetUnicodeFormat($hListView, True)
MsgBox(4160, "Information", "Unicode: " & _GUICtrlListView_GetUnicodeFormat($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetView

Function Reference

_GUICtrlListView_GetView

Retrieves the current view of the control

#Include <GuiListView.au3>
_GUICtrlListView_GetView($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The current view:
 | 0 - Details
 | 1 - Large Icon
 | 2 - List
 | 3 - Small Icon
 | 4 - Tile
Failure: | -1

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_SetView, _GUICtrlListView_GetViewDetails, _GUICtrlListView_GetViewLarge, _GUICtrlListView_GetViewList, _GUICtrlListView_GetViewSmall, _GUICtrlListView_GetViewTile

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get View", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
MsgBox(4160, "Information", "View: " & _GUICtrlListView_GetView($hListView))
_GUICtrlListView_SetView($hListView, 4)
MsgBox(4160, "Information", "View: " & _GUICtrlListView_GetView($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewDetails

Function Reference

_GUICtrlListView_GetViewDetails

Determines whether the view mode is in detail mode

#Include <GuiListView.au3>
_GUICtrlListView_GetViewDetails($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | View is in detail mode
False: | View is not in detail mode

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get Details", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 0)
MsgBox(4160, "Information", "View Details: " & _GUICtrlListView_GetViewDetails($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewLarge

Function Reference

_GUICtrlListView_GetViewLarge

Determines whether the view mode is in large icon mode

#Include <GuiListView.au3>
_GUICtrlListView_GetViewLarge($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | View is in large icon mode
False: | View is not in large icon mode

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get View Large Icon", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 1)
MsgBox(4160, "Information", "View Large: " & _GUICtrlListView_GetViewLarge($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewList

Function Reference

_GUICtrlListView_GetViewList

Determines whether the view mode is in list mode

#Include <GuiListView.au3>
_GUICtrlListView_GetViewList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | View is in list mode
False: | View is not in list mode

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get View List", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 2)
MsgBox(4160, "Information", "View List: " & _GUICtrlListView_GetViewList($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewRect

Function Reference

_GUICtrlListView_GetViewRect

Retrieves the bounding rectangle of all items in the control

#Include <GuiListView.au3>
_GUICtrlListView_GetViewRect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

The control must be in icon or small icon view

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hListView

GUICreate("ListView Get View Rect", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 3)

; Get view rectangle
$aRect = _GUICtrlListView_GetViewRect($hListView)
MsgBox(4160, "Information", StringFormat("View Tile: [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewSmall

Function Reference

_GUICtrlListView_GetViewSmall

Determines whether the view mode is in small icon mode

#Include <GuiListView.au3>
_GUICtrlListView_GetViewSmall($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | View is in small icon mode
False: | View is not in small icon mode

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get View Small Icon", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 3)
MsgBox(4160, "Information", "View Small: " & _GUICtrlListView_GetViewSmall($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_GetViewTile

Function Reference

_GUICtrlListView_GetViewTile

Determines whether the view mode is in tile mode

#Include <GuiListView.au3>
_GUICtrlListView_GetViewTile($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | View is in tile mode
False: | View is not in tile mode

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Get View Tile", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
_GUICtrlListView_SetView($hListView, 4)
MsgBox(4160, "Information", "View Tile: " & _GUICtrlListView_GetViewTile($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_HideColumn

Function Reference

_GUICtrlListView_HideColumn

Hides the column "sets column width to zero"

#Include <GuiListView.au3>
_GUICtrlListView_HideColumn($hWnd, $iCol)

Parameters

$hWnd | Handle to the control
$iCol | Column to hide

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_SetColumnWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Hide Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

MsgBox(4160, "Information", "Hiding Column 2")
MsgBox(4160, "Information", "Column 2 Hid: " & _GUICtrlListView_HideColumn($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_HitTest

Function Reference

_GUICtrlListView_HitTest

Determines which item is at a specified position

#Include <GuiListView.au3>
_GUICtrlListView_HitTest($hWnd[, $iX = -1[, $iY = -1]])

Parameters

$hWnd | Handle to the control
$iX | [optional] X position, in client coordinates, to be tested or -1 to use the current mouse position
$iY | [optional] Y position, in client coordinates, to be tested or -1 to use the current mouse position

Return Value

Success: | Array with the following format:
 | [0] - Zero based index of the item at the specified position, or -1
 | [1] - If True, position is in control's client window but not on an item
 | [2] - If True, position is over item icon
 | [3] - If True, position is over item text
 | [4] - If True, position is over item state image
 | [5] - If True, position is somewhere on the item
 | [6] - If True, position is above the control's client area
 | [7] - If True, position is below the control's client area
 | [8] - If True, position is to the left of the client area
 | [9] - If True, position is to the right of the client area
Failure: | set @error

Remarks

None.

Related

_GUICtrlListView_SubItemHitTest

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $StatusBar, $iIndex = -1

_Main()

Func _Main()
Local $hImage, $GUI

; Create GUI
$GUI = GUICreate("ListView Hit Test", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
$hListView = GUICtrlGetHandle($hListView) ; get the handle for use in the notify events
$StatusBar = _GUICtrlStatusBar_Create($GUI, -1, "")

; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>_Main

Func _ListView_Click()
Local $aHit

$aHit = _GUICtrlListView_HitTest($hListView)
If ($aHit[0] <> -1) And ($aHit[0] <> $iIndex) Then
_GUICtrlStatusBar_SetText($StatusBar, @TAB & StringFormat("HitTest Item: %d", $aHit[0]))
$iIndex = $aHit[0]
EndIf
EndFunc ;==>_ListView_Click

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
_ListView_Click()
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_InsertColumn

Function Reference

_GUICtrlListView_InsertColumn

Inserts a new column in the control

#Include <GuiListView.au3>
_GUICtrlListView_InsertColumn($hWnd, $iIndex, $sText[, $iWidth = 50[, $iAlign = -1[, $iImage = -1[, $fOnRight = False]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of new column
$sText | Column header text
$iWidth | [optional] Width of the column, in pixels
$iAlign | [optional] Alignment of the column header and the subitem text in the column: 0 - Text is left aligned 1 - Text is right aligned 2 - Text is centered
$iImage | [optional] Zero based index of an image within the image list
$fOnRight | [optional] If True, the column image appears to the right of text

Return Value

Success: | The index of the new column
Failure: | -1

Remarks

The alignment of the leftmost column is always left-justified; it cannot be changed

Related

_GUICtrlListView_DeleteColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Insert Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Insert columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_InsertGroup

Function Reference

_GUICtrlListView_InsertGroup

Inserts a group

#Include <GuiListView.au3>
_GUICtrlListView_InsertGroup($hWnd, $iIndex, $iGroupID, $sHeader[, $iAlign = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Index where the group is to be added. If this is -1, the group is added at the end of the list.
$iGroupID | ID of the group
$sHeader | Header text
$iAlign | [optional] Alignment of the header text for the group: 0 - Left 1 - Center 2 - Right

Return Value

Success: | Returns the index of the item that the group was added to
Failure: | -1

Remarks

Minimum OS - Windows XP.

A group cannot be inserted into an empty control.

Related

_GUICtrlListView_SetItemGroupID

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Insert Group", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_InsertItem

Function Reference

_GUICtrlListView_InsertItem

Inserts a new item in the control

#Include <GuiListView.au3>
_GUICtrlListView_InsertItem($hWnd, $sText[, $iIndex = -1[, $iImage = -1[, $iParam = 0]]])

Parameters

$hWnd | Handle to the control
$sText | Item text. If set to -1, the item text is set via the $LVN_GETDISPINFO notification message.
$iIndex | [optional] Zero based index at which the new item should be inserted. If this value is greater than the number of items currently contained by the control, the new item will be appended to the end of the list and assigned the correct index.
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iParam | [optional] Application Defined Data

Return Value

Success: | The index of the new item
Failure: | -1

Remarks

You can not use this function to insert subitems. Use _GUICtrlListView_SetItemText to insert subitems.

Related

_GUICtrlListView_SetItemText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Insert Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Insert columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)

; Add items
_GUICtrlListView_InsertItem($hListView, "Item 1", 0)
_GUICtrlListView_InsertItem($hListView, "Item 2", 1)
_GUICtrlListView_InsertItem($hListView, "Item 3", 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_JustifyColumn

Function Reference

_GUICtrlListView_JustifyColumn

Set Justification of a column for a list-view control

#Include <GuiListView.au3>
_GUICtrlListView_JustifyColumn($hWnd, $iIndex[, $iAlign = -1])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of new column
$iAlign | [optional] Alignment of the column header and the subitem text in the column: 0 - Text is left aligned 1 - Text is right aligned 2 - Text is centered

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetColumn, _GUICtrlListView_SetColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hListView

GUICreate("ListView Justify Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Change column
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Justification: " & $aInfo[0])
_GUICtrlListView_JustifyColumn($hListView, 0, 2)
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Justification: " & $aInfo[0])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_MapIDToIndex

Function Reference

_GUICtrlListView_MapIDToIndex

Maps the ID of an item to an index

#Include <GuiListView.au3>
_GUICtrlListView_MapIDToIndex($hWnd, $iID)

Parameters

$hWnd | Handle to the control
$iID | ID of an item

Return Value

Returns the most current index

Remarks

Minimum OS - Windows XP.

ListView controls internally track items by index. This can present problems because indexes can change during
the control's lifetime.

The ListView control can tag an item with an ID when the item is created. You can use this ID to guarantee
uniqueness during the lifetime of the control.

Related

_GUICtrlListView_MapIndexToID

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iID, $hListView

GUICreate("ListView Map ID To Index", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add column
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show ID for item 2
$iID = _GUICtrlListView_MapIndexToID($hListView, 1)
MsgBox(4160, "Information", "Index to ID: " & $iID)
MsgBox(4160, "Information", "ID to Index: " & _GUICtrlListView_MapIDToIndex($hListView, $iID))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_MapIndexToID

Function Reference

_GUICtrlListView_MapIndexToID

Maps an index to an item ID

#Include <GuiListView.au3>
_GUICtrlListView_MapIndexToID($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of an item

Return Value

Returns the ID of the item

Remarks

Minimum OS - Windows XP.

ListView controls internally track items by index. This can present problems because indexes can change during
the control's lifetime.

The ListView control can tag an item with an ID when the item is created. You can use this ID to guarantee
uniqueness during the lifetime of the control.

Related

_GUICtrlListView_MapIDToIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iID, $hListView

GUICreate("ListView Map Index To ID", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add column
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show ID for item 2
$iID = _GUICtrlListView_MapIndexToID($hListView, 1)
MsgBox(4160, "Information", "Index to ID: " & $iID)
MsgBox(4160, "Information", "ID to Index: " & _GUICtrlListView_MapIDToIndex($hListView, $iID))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_RedrawItems

Function Reference

_GUICtrlListView_RedrawItems

Forces the control to redraw a range of items

#Include <GuiListView.au3>
_GUICtrlListView_RedrawItems($hWnd, $iFirst, $iLast)

Parameters

$hWnd | Handle to the control
$iFirst | Zero based index of the first item to redraw
$iLast | Zero based index of the last item to redraw

Return Value

Success: | True
Failure: | False

Remarks

The specified items are not actually redrawn until the control receives a $WM_PAINT message to repaint.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Redraw Items", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add column
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Redraw items
_GUICtrlListView_RedrawItems($hListView, 0, 9)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_RegisterSortCallBack

Function Reference

_GUICtrlListView_RegisterSortCallBack

Register the Simple Sort callback function

#Include <GuiListView.au3>
_GUICtrlListView_RegisterSortCallBack($hWnd[, $fNumbers = True[, $fArrows = True]])

Parameters

$hWnd | Handle of the control
$fNumbers | [optional] Treat number strings as numbers
$fArrows | [optional] Draws a down-arrow/up-arrow on column selected (Windows XP and above)

Return Value

Success: | True
Failure: | False

Remarks

For each call to _GUICtrlListView_RegisterSortCallBack there must be a call
to _GUICtrlListView_UnRegisterSortCallBack when done (before exit)

It is up to the user to call _GUICtrlListView_UnRegisterSortCallBack for each
_GUICtrlListView_RegisterSortCallBack call made.

This is an alternative to the _GUICtrlListView_SimpleSort.
This function will sort listviews that have icons, checkboxes, sub-item icons

Related

_GUICtrlListView_UnRegisterSortCallBack, _GUICtrlListView_SortItems

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hListView, $hListView2

_Example1()
_Example2()

Func _Example1()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Register Sort Callback", 300, 200)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $hListView
; Kick off the sort callback
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
GUIDelete()
EndFunc ;==>_Example1

Func _Example2()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Sort Treat Numbers as Strings", 300, 200, 100)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

GUICreate("ListView Sort Treat Numbers as Numbers", 300, 200, 400)

$hListView2 = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView2, $iExListViewStyle)
_GUICtrlListView_SetImageList($hListView2, $hImage, 1)

_AddRow($hListView2, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView2, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView2, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView, False)
_GUICtrlListView_RegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
_GUICtrlListView_UnRegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "")
EndFunc ;==>_Example2

Func _AddRow($hWnd, $sItem, $aIcons, $iPlus = 0)
Local $aItem = StringSplit($sItem, "|")
Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $aIcons[0] + $iPlus, _GUICtrlListView_GetItemCount($hWnd) + 9999)
_GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)

For $x = 2 To $aItem[0]
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $aIcons[$x - 1] + $iPlus)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
Next
EndFunc ;==>_AddRow

Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView2

$hWndListView = $hListView
$hWndListView2 = $hListView2
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
If Not IsHWnd($hListView2) Then $hWndListView2 = GUICtrlGetHandle($hListView2)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")

Switch $hWndFrom
Case $hWndListView, $hWndListView2
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)

; Kick off the sort callback
_GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem"))
; No return value
EndSwitch
EndSwitch
Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlListView_RemoveAllGroups

Function Reference

_GUICtrlListView_RemoveAllGroups

Removes all groups from the control

#Include <GuiListView.au3>
_GUICtrlListView_RemoveAllGroups($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_RemoveGroup

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Remove All Groups", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Remove all groups
MsgBox(4160, "Information", "Removing groups")
_GUICtrlListView_RemoveAllGroups($hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_RemoveGroup

Function Reference

_GUICtrlListView_RemoveGroup

Removes a group from the control

#Include <GuiListView.au3>
_GUICtrlListView_RemoveGroup($hWnd, $iGroupID)

Parameters

$hWnd | Handle to the control
$iGroupID | ID that specifies the group to remove

Return Value

Success: | The index of the group
Failure: | -1

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_RemoveAllGroups

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Remove Group", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Remove group
MsgBox(4160, "Information", "Removing group 1")
_GUICtrlListView_RemoveGroup($hListView, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_Scroll

Function Reference

_GUICtrlListView_Scroll

Scrolls the content of a list-view

#Include <GuiListView.au3>
_GUICtrlListView_Scroll($hWnd, $iDX, $iDY)

Parameters

$hWnd | Handle to the control
$iDX | Value of type int that specifies the amount of horizontal scrolling in pixels. If the list-view control is in list-view, this value specifies the number of columns to scroll
$iDY | Value of type int that specifies the amount of vertical scrolling in pixels

Return Value

Success: | True
Failure: | False

Remarks

When the list-view control is in report view, the control can only be scrolled vertically in whole
line increments. Therefore, the $iDY parameter will be rounded to the nearest number of pixels
that form a whole line increment. For example, if the height of a line is 16 pixels and 8 is passed
for $iDY, the list will be scrolled by 16 pixels (1 line). If 7 is passed for $iDY, the list will be
scrolled 0 pixels (0 lines).

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Scroll", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add column
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 100
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Scroll control 500 pixels
_GUICtrlListView_Scroll($hListView, 0, 500)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetBkColor

Function Reference

_GUICtrlListView_SetBkColor

Sets the background color of the control

#Include <GuiListView.au3>
_GUICtrlListView_SetBkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Background color to set or CLR_NONE value for no background color

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set BkColor", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show clors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @CRLF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @CRLF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetBkImage

Function Reference

_GUICtrlListView_SetBkImage

Sets the background image in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetBkImage($hWnd[, $sURL = ""[, $iStyle = 0[, $iXOffset = 0[, $iYOffset = 0]]]])

Parameters

$hWnd | Handle to the control
$sURL | [optional] URL of the background image. If blank, the control has no background
$iStyle | [optional] Determines the background image style: 0 - Normal 1 - Tiled
$iXOffset | [optional] Percentage of the control's client area that the image should be offset horizontally. Only valid when 0 is used in $iStyle.
$iYOffset | [optional] Percentage of the control's client area that the image should be offset vertically. Only valid when 0 is used in $iStyle.

Return Value

Success: | True
Failure: | False

Remarks

Call CoUninitialize when the application is terminating.
At this time this function only works with _GUICtrlListView_Create or External ListViews.

Related

_GUICtrlListView_Create, _GUICtrlListView_GetBkImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created() ;use UDF built listview

Func Example_UDF_Created()
Local $GUI, $hImage, $aImage, $hListView
Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER)

$GUI = GUICreate("(UDF Created) ListView Set Background Image", 600, 550)

;=========================================================================================================
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 596, 500, -1, -1, True) ; Last option Calls CoInitializeEx
;=========================================================================================================
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

;~ _GUICtrlListView_SetBkColor ($hListView, $CLR_NONE)
;~ _GUICtrlListView_SetTextColor ($hListView, $CLR_NONE)
;~ _GUICtrlListView_SetTextBkColor ($hListView, $CLR_NONE)

; Get the Image
Local $sURL = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_grey_800x600.jpg"
Local $sFilePath = @ScriptDir & "\AutoIt.jpg"
InetGet($sURL, $sFilePath)

; Set the Background Image
_GUICtrlListView_SetBkImage($hListView, $sFilePath)
$aImage = _GUICtrlListView_GetBkImage($hListView)

GUISetState()

MsgBox(4160, "Information", "Background Image: " & $aImage[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=========================================================================================================
DllCall('ole32.dll', 'long', 'CoUinitialize') ; Must call for each CoInitializeEx call made
;=========================================================================================================

GUIDelete()
FileDelete($sFilePath)
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_SetCallBackMask

Function Reference

_GUICtrlListView_SetCallBackMask

Changes the callback mask for the control

#Include <GuiListView.au3>
_GUICtrlListView_SetCallBackMask($hWnd, $iMask)

Parameters

$hWnd | Handle to the control
$iMask | Value of the callback mask. The bits of the mask indicate the item states or images for which the application stores the current state data. This value can be any combination of the following: 1 - The item is marked for a cut-and-paste operation 2 - The item is highlighted as a drag-and-drop target 4 - The item has the focus 8 - The item is selected 16 - The application stores the image list index of the current overlay image 32 - The application stores the image list index of the current state image

Return Value

Success: | True
Failure: | False

Remarks

The callback mask is a set of bit flags that specify the item states for which the application, rather than
the control, stores the current data. The callback mask applies to all of the control's items, unlike the
callback item designation, which applies to a specific item. The callback mask is zero by default, meaning
that the control stores all item state information.

Related

_GUICtrlListView_GetCallbackMask

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created()

Func Example_UDF_Created()
Local $GUI, $hImage, $hListView

$GUI = GUICreate("(UDF Created) ListView Set CallBack Mask", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()

_GUICtrlListView_SetCallBackMask($hListView, 32)
MsgBox(4160, "Information", "CallBackMask: " & _GUICtrlListView_GetCallbackMask($hListView))

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xC0C0C0, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF00FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFFFF00, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView, $hImage, 2)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items with callback for item text
_GUICtrlListView_AddItem($hListView, -1, 0)
_GUICtrlListView_AddItem($hListView, -1, 1)
_GUICtrlListView_AddItem($hListView, -1, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created


Function _GUICtrlListView_SetColumn

Function Reference

_GUICtrlListView_SetColumn

Sets the attributes of a column

#Include <GuiListView.au3>
_GUICtrlListView_SetColumn($hWnd, $iIndex, $sText[, $iWidth = -1[, $iAlign = -1[, $iImage = -1[, $fOnRight = False]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of new column
$sText | Column header text
$iWidth | [optional] Width of the column, in pixels
$iAlign | [optional] Alignment of the column header and the subitem text in the column: 0 - Text is left aligned 1 - Text is right aligned 2 - Text is centered
$iImage | [optional] Zero based index of an image within the image list
$fOnRight | [optional] If True, the column image appears to the right of text

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetColumn, _GUICtrlListView_JustifyColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hListView

GUICreate("ListView Set Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Change column
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Width: " & $aInfo[4])
_GUICtrlListView_SetColumn($hListView, 0, "New Column 1", 150, 1)
$aInfo = _GUICtrlListView_GetColumn($hListView, 0)
MsgBox(4160, "Information", "Column 1 Width: " & $aInfo[4])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetColumnOrder

Function Reference

_GUICtrlListView_SetColumnOrder

Sets the left-to-right order of columns

#Include <GuiListView.au3>
_GUICtrlListView_SetColumnOrder($hWnd, $sOrder)

Parameters

$hWnd | Handle to the control
$sOrder | Use Opt('GUIDataSeparatorChar', param) to set Separator Char, delimited column order, must be formated as follows: "2|0|3|1"

Return Value

None.

Remarks

Columns are zero-based

Related

_GUICtrlListView_GetColumnOrder, _GUICtrlListView_SetColumnOrderArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $a_order, $hListView

GUICreate("ListView Set Column Order", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
GUISetState()

; Set column order
MsgBox(4160, "Information", "Changing column order")
_GUICtrlListView_SetColumnOrder($hListView, "3|2|0|1")

; Show column order
$a_order = _GUICtrlListView_GetColumnOrderArray($hListView)
MsgBox(4160, "Information", StringFormat("Column order: [%d, %d, %d, %d]", $a_order[1], $a_order[2], $a_order[3], $a_order[4]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetColumnOrderArray

Function Reference

_GUICtrlListView_SetColumnOrderArray

Sets the left-to-right order of columns in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetColumnOrderArray($hWnd, $aOrder)

Parameters

$hWnd | Handle to the control
$aOrder | Array of integers that holds the index values of the columsn in the control. The array must be formatted as follows: [0] - Number of items in array [1] - First column index [2] - Second column index [n] - Last column index

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetColumnOrder, _GUICtrlListView_GetColumnOrderArray, _GUICtrlListView_SetColumnOrder

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $a_order[5] = [4, 3, 2, 0, 1], $hListView

GUICreate("ListView Set Column Order Array", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
GUISetState()

; Set column order
MsgBox(4160, "Information", "Changing column order")
_GUICtrlListView_SetColumnOrderArray($hListView, $a_order)

; Show column order
$a_order = _GUICtrlListView_GetColumnOrderArray($hListView)
MsgBox(4160, "Information", StringFormat("Column order: [%d, %d, %d, %d]", $a_order[1], $a_order[2], $a_order[3], $a_order[4]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetColumnWidth

Function Reference

_GUICtrlListView_SetColumnWidth

Changes the width of a column

#Include <GuiListView.au3>
_GUICtrlListView_SetColumnWidth($hWnd, $iCol, $iWidth)

Parameters

$hWnd | Handle to the control
$iCol | Zero-based index of a valid column. For list-view mode, this parameter must be set to zero
$iWidth | New width of the column, in pixels. For report-view mode, the following special values are supported: $LVSCW_AUTOSIZE - Automatically sizes the column. $LVSCW_AUTOSIZE_USEHEADER - Automatically sizes the column to fit the header text. If you use this value with the last column, its width is set to fill the remaining width of the list-view control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetColumnWidth, _GUICtrlListView_HideColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Column Width", 400, 300)
$hListView = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
GUISetState()

; Change column 1 width
MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))
_GUICtrlListView_SetColumnWidth($hListView, 0, 150)
MsgBox(4160, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($hListView, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetExtendedListViewStyle

Function Reference

_GUICtrlListView_SetExtendedListViewStyle

Sets extended styles

#Include <GuiListView.au3>
_GUICtrlListView_SetExtendedListViewStyle($hWnd, $iExStyle[, $iExMask = 0])

Parameters

$hWnd Handle to the control
$iExStyle Extended control styles:
$LVS_EX_BORDERSELECT - When an item is selected the border color of the item changes
$LVS_EX_CHECKBOXES - Enables check boxes for items in a list-view control
$LVS_EX_DOUBLEBUFFER - Paints via double-buffering, which reduces flicker
$LVS_EX_FLATSB - Enables flat scroll bars in the list view
$LVS_EX_FULLROWSELECT - When an item is selected, the item and all its subitems are highlighted
$LVS_EX_GRIDLINES - Displays gridlines around items and subitems
$LVS_EX_HEADERDRAGDROP - Enables drag-and-drop reordering of columns
$LVS_EX_INFOTIP - The $LVN_GETINFOTIP notification message is sent before displaying a ToolTip
$LVS_EX_LABELTIP - If not set, the unfolds partly hidden labels only for the large icon mode
$LVS_EX_MULTIWORKAREAS - The control will not autoarrange its icons until one or more work areas are defined
$LVS_EX_ONECLICKACTIVATE - The control sends an $LVN_ITEMACTIVATE messages when the user clicks an item
$LVS_EX_REGIONAL - Sets the control region to include only the item icons and text
$LVS_EX_SIMPLESELECT - In icon view moves the state image of the control to the top right
$LVS_EX_SUBITEMIMAGES - Allows images to be displayed for subitems
$LVS_EX_TRACKSELECT - Enables hot-track selection in the control
$LVS_EX_TWOCLICKACTIVATE - The control sends an $LVN_ITEMACTIVATE message when the user double-clicks an item
$LVS_EX_UNDERLINECOLD - Causes non-hot items that may be activated to be displayed with underlined text
$LVS_EX_UNDERLINEHOT - Causes hot items that may be activated to be displayed with underlined text
$iExMask [optional] Specifies which styles in $iExStyle are to be affected. This parameter can be a combination of
extended styles. Only the extended styles in $iExMask will be changed. All other styles will be maintained as
they are. If this parameter is zero, all of the styles in $iExStyle will be affected.

Return Value

Returns the previous extended styles

Remarks

None.

Related

_GUICtrlListView_GetExtendedListViewStyle

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

; Create GUI
GUICreate("ListView Set Extended Style", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetGroupInfo

Function Reference

_GUICtrlListView_SetGroupInfo

Sets group information

#Include <GuiListView.au3>
_GUICtrlListView_SetGroupInfo($hWnd, $iGroupID, $sHeader[, $iAlign = 0[, $iState = $LVGS_NORMAL]])

Parameters

$hWnd | Handle to the control
$iGroupID | ID of the group
$sHeader | Header text
$iAlign | [optional] Alignment of the header text for the group: 0 - Left 1 - Center 2 - Right
$iState | [optional] Vista and above, can have one of the following values: $LVGS_NORMAL - Groups are expanded, the group name is displayed, and all items in the group are displayed. $LVGS_COLLAPSED - The group is collapsed. $LVGS_HIDDEN - The group is hidden. $LVGS_NOHEADER - The group does not display a header. $LVGS_COLLAPSIBLE - The group can be collapsed. $LVGS_FOCUSED - The group has keyboard focus. $LVGS_SELECTED - The group is selected. $LVGS_SUBSETED - The group displays only a portion of its items. $LVGS_SUBSETLINKFOCUSED - The subset link of the group has keyboard focus

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetGroupInfo, _GUICtrlListView_GetGroupInfoByIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aInfo, $hImage, $hListView

GUICreate("ListView Set Group Info", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Change group information
$aInfo = _GUICtrlListView_GetGroupInfo($hListView, 1)
MsgBox(4160, "Information", "Group 1 Text: " & $aInfo[0])
_GUICtrlListView_SetGroupInfo($hListView, 1, "New Group 1")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetHotItem

Function Reference

_GUICtrlListView_SetHotItem

Sets the hot item

#Include <GuiListView.au3>
_GUICtrlListView_SetHotItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero-based index of the item to be set as the hot item

Return Value

Success: | Index of the item that was previously hot
Failure: | -1

Remarks

None.

Related

_GUICtrlListView_GetHotItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES), $hListView

GUICreate("ListView Set Hot Item", 400, 300)

$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
$hListView = GUICtrlGetHandle($hListView)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

; Set hot item
_GUICtrlListView_SetHotItem($hListView, 1)
MsgBox(4160, "Information", "Hot Item: " & _GUICtrlListView_GetHotItem($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetHoverTime

Function Reference

_GUICtrlListView_SetHoverTime

Sets the amount of time which the mouse cursor must hover over an item before it is selected

#Include <GuiListView.au3>
_GUICtrlListView_SetHoverTime($hWnd, $iTime)

Parameters

$hWnd | Handle to the control
$iTime | The new amount of time, in milliseconds, that the mouse cursor must hover over an item before it is selected. If this value is (DWORD)-1, then the hover time is set to the default hover time.

Return Value

Returns the previous hover time

Remarks

The hover time only affects list-view controls that have the $LVS_EX_TRACKSELECT,
$LVS_EX_ONECLICKACTIVATE, or $LVS_EX_TWOCLICKACTIVATE extended list-view style

Related

_GUICtrlListView_GetHoverTime

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $Status

_Main()

Func _Main()
Local $GUI
Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_TRACKSELECT)

$GUI = GUICreate("ListView Set Hover Time", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetHoverTime($hListView, 1000)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
$hListView = GUICtrlGetHandle($hListView)
$Status = _GUICtrlStatusBar_Create($GUI, -1, "")
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

_GUICtrlListView_InsertItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_InsertItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_InsertItem($hListView, "Row 3: Col 1")

; Get hover time
MsgBox(4160, "Information", "Previous Hover Time (milliseconds): " & _GUICtrlListView_GetHoverTime($hListView))

; Set hover time
_GUICtrlListView_SetHoverTime($hListView, 500)
MsgBox(4160, "Information", "Hover Time (milliseconds): " & _GUICtrlListView_GetHoverTime($hListView))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>_Main

Func ListView_HOTTRACK($iSubItem)
Local $HotItem = _GUICtrlListView_GetHotItem($hListView)
If $HotItem <> -1 Then _GUICtrlStatusBar_SetText($Status, @TAB & "Hot Item: " & $HotItem & " SubItem: " & $iSubItem)
EndFunc ;==>ListView_HOTTRACK

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_HOTTRACK ; Sent by a list-view control when the user moves the mouse over an item
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_HOTTRACK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
ListView_HOTTRACK(DllStructGetData($tInfo, "SubItem"))
Return 0 ; allow the list view to perform its normal track select processing.
;Return 1 ; the item will not be selected.
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_SetIconSpacing

Function Reference

_GUICtrlListView_SetIconSpacing

Sets the spacing between icons where the style is large icon

#Include <GuiListView.au3>
_GUICtrlListView_SetIconSpacing($hWnd, $iCX, $iCY)

Parameters

$hWnd | Handle to the control
$iCX | Distance, in pixels, to set between icons on the x-axis
$iCY | Distance, in pixels, to set between icons on the y-axis

Return Value

Returns an Array with the following format:
[0] - Previous CX value
[1] - Previous CY value

Remarks

Values for $iCX and $iCY are relative to the upper-left corner of an icon bitmap. To set spacing between icons
that do not overlap, the $iCX or $iCY values must include the size of the icon, plus the amount of empty space
desired between icons. Values that do not include the width of the icon will result in overlaps.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

; Create GUI
GUICreate("ListView Set Icon Spacing", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Change item spacing
MsgBox(4160, "Information", "Changing icon spacing")
_GUICtrlListView_SetIconSpacing($hListView, 32, 32)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetImageList

Function Reference

_GUICtrlListView_SetImageList

Assigns an image list to the control

#Include <GuiListView.au3>
_GUICtrlListView_SetImageList($hWnd, $hHandle[, $iType = 0])

Parameters

$hWnd | Handle to the control
$hHandle | Handle to the image list to assign
$iType | [optional] Type of image list: 0 - Image list with large icons 1 - Image list with small icons 2 - Image list with state images

Return Value

Success: | The handle to the previous image list
Failure: | 0

Remarks

The current image list will be destroyed when the control is destroyed unless you set the $LVS_SHAREIMAGELISTS
style. If you use this message to replace one image list with another your application must explicitly destroy
all image lists other than the current one.

Related

_GUICtrlListView_GetImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Set Image List", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Get image list handle
MsgBox(4160, "Information", "Image List Handle: 0x" & Hex(_GUICtrlListView_GetImageList($hListView, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItem

Function Reference

_GUICtrlListView_SetItem

Sets some or all of a item's attributes

#Include <GuiListView.au3>
_GUICtrlListView_SetItem($hWnd, $sText[, $iIndex = 0[, $iSubItem = 0[, $iImage = -1[, $iParam = -1[, $iIndent = -1]]]]])

Parameters

$hWnd | Handle to the control
$sText | Item text
$iIndex | [optional] The zero-based index of the item
$iSubItem | [optional] One based index of the subitem or zero if this refers to an item
$iImage | [optional] Zero base index of the item's icon in the control's image list
$iParam | [optional] Value specific to the item
$iIndent | [optional] Number of image widths to indent the item. A single indentation equals the width of an image.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItem, _GUICtrlListView_SetItemEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
GUICtrlCreateListViewItem("Item 1", $hListView)
GUICtrlCreateListViewItem("Item 2", $hListView)
GUICtrlCreateListViewItem("Item 3", $hListView)

; Change item 2
MsgBox(4160, "Information", "Changing item 2")
_GUICtrlListView_SetItem($hListView, "New Item 2", 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemChecked

Function Reference

_GUICtrlListView_SetItemChecked

Sets the checked state

#Include <GuiListView.au3>
_GUICtrlListView_SetItemChecked($hWnd, $iIndex[, $fCheck = True])

Parameters

$hWnd | Handle to the control
$iIndex | Zero-based index of the item, -1 sets all items
$fCheck | [optional] Value to set checked state to: True - Checked False - Not checked

Return Value

Success: | True
Failure: | False

Remarks

Use only on controls that have the $LVS_EX_CHECKBOXES extended style

Related

_GUICtrlListView_GetItemChecked

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES), $hListView

GUICreate("ListView Set Item Checked State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Check item 2
_GUICtrlListView_SetItemChecked($hListView, 1)
MsgBox(4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemCount

Function Reference

_GUICtrlListView_SetItemCount

Causes the list-view control to allocate memory for the specified number of items

#Include <GuiListView.au3>
_GUICtrlListView_SetItemCount($hWnd, $iItems)

Parameters

$hWnd | Handle to the control
$iItems | Number of items that the list-view control will ultimately contain

Return Value

Success: | True
Failure: | False

Remarks

Causes the control to allocate its internal data structures for the specified number of items.
This prevents the control from having to allocate the data structures every time an item is added.

Related

_GUICtrlListView_GetItemCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Count", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_SetItemCount($hListView, 100)
_GUICtrlListView_BeginUpdate($hListView)
For $x = 1 To 100
GUICtrlCreateListViewItem("Item " & $x, $hListView)
Next
_GUICtrlListView_EndUpdate($hListView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemCut

Function Reference

_GUICtrlListView_SetItemCut

Sets whether the item is marked for a cut-and-paste operation

#Include <GuiListView.au3>
_GUICtrlListView_SetItemCut($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$fEnabled | [optional] If True the item state is set, otherwise it is not set.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemCut

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Cut", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Cut item 2
_GUICtrlListView_SetItemCut($hListView, 1)
MsgBox(4160, "Information", "Item 2 Cut: " & _GUICtrlListView_GetItemCut($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemDropHilited

Function Reference

_GUICtrlListView_SetItemDropHilited

Sets whether the item is highlighted as a drag-and-drop target

#Include <GuiListView.au3>
_GUICtrlListView_SetItemDropHilited($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$fEnabled | [optional] If True the item state is set, otherwise it is not set.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemDropHilited

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Drop Hilited", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Hilight item 2
_GUICtrlListView_SetItemDropHilited($hListView, 1)
MsgBox(4160, "Information", "Item 2 Drop Hilited: " & _GUICtrlListView_GetItemDropHilited($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemEx

Function Reference

_GUICtrlListView_SetItemEx

Sets some or all of a item's attributes

#Include <GuiListView.au3>
_GUICtrlListView_SetItemEx($hWnd, ByRef $tItem)

Parameters

$hWnd | Handle to the control
$tItem | $tagLVITEM structure

Return Value

Success: | True
Failure: | False

Remarks

To set the attributes of an item set the Item member of the $tagLVITEM structure to the index of the item, and
set the SubItem member to zero. For an item, you can set the State, Text, Image, and Param members of the
$tagLVITEM structure.

To set the text of a subitem, set the Item and SubItem members to indicate the specific subitem, and use the
Text member to specify the text. You cannot set the State or Param members for subitems because subitems do
not have these attributes.

Related

_GUICtrlListView_SetItem, $tagLVITEM

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tText, $tItem, $hListView

GUICreate("ListView Set Item Ex", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
GUICtrlCreateListViewItem("Item 1", $hListView)
GUICtrlCreateListViewItem("Item 2", $hListView)
GUICtrlCreateListViewItem("Item 3", $hListView)

; Change item 2
MsgBox(4160, "Information", "Changing item 2")
$tText = DllStructCreate("wchar Text[11]")
$tItem = DllStructCreate($tagLVITEM)
DllStructSetData($tText, "Text", "New Item 2")
DllStructSetData($tItem, "Mask", $LVIF_TEXT)
DllStructSetData($tItem, "Item", 1)
DllStructSetData($tItem, "Text", DllStructGetPtr($tText))
_GUICtrlListView_SetItemEx($hListView, $tItem)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemFocused

Function Reference

_GUICtrlListView_SetItemFocused

Sets whether the item has the focus

#Include <GuiListView.au3>
_GUICtrlListView_SetItemFocused($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$fEnabled | [optional] If True the item state is set, otherwise it is not set.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemFocused

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Focused", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Focus item 2
_GUICtrlListView_SetItemFocused($hListView, 1)
MsgBox(4160, "Information", "Item 2 Focused: " & _GUICtrlListView_GetItemFocused($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemGroupID

Function Reference

_GUICtrlListView_SetItemGroupID

Sets the item group ID

#Include <GuiListView.au3>
_GUICtrlListView_SetItemGroupID($hWnd, $iIndex, $iGroupID)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iGroupID | Group ID

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetItemGroupID, _GUICtrlListView_InsertGroup

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Set Item Group ID", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Build groups
_GUICtrlListView_EnableGroupView($hListView)
_GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
_GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
_GUICtrlListView_SetItemGroupID($hListView, 0, 1)
_GUICtrlListView_SetItemGroupID($hListView, 1, 2)
_GUICtrlListView_SetItemGroupID($hListView, 2, 2)

; Display Item 3 group ID
MsgBox(4160, "Information", "Item 3 Group ID: " & _GUICtrlListView_GetItemGroupID($hListView, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemImage

Function Reference

_GUICtrlListView_SetItemImage

Sets the index of the item's icon in the control's image list

#Include <GuiListView.au3>
_GUICtrlListView_SetItemImage($hWnd, $iIndex, $iImage[, $iSubItem = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iImage | Zero based index into the control's image list
$iSubItem | [optional] One based index of the subitem

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView, $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

GUICreate("ListView Set Item Image", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Set item 1, subitem 1 image
_GUICtrlListView_SetItemImage($hListView, 1, 1, 1)
MsgBox(4160, "Information", "Item 1, SubItem 1 Image: " & _GUICtrlListView_GetItemImage($hListView, 1, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemIndent

Function Reference

_GUICtrlListView_SetItemIndent

Sets the number of image widths to indent the item

#Include <GuiListView.au3>
_GUICtrlListView_SetItemIndent($hWnd, $iIndex, $iIndent)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iIndent | Indention value

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemIndent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Set Item Indent", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Indent items
_GUICtrlListView_SetItemIndent($hListView, 1, 1)
_GUICtrlListView_SetItemIndent($hListView, 2, 2)
MsgBox(4160, "Information", "Item 2 Indent: " & _GUICtrlListView_GetItemIndent($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemParam

Function Reference

_GUICtrlListView_SetItemParam

Sets the value specific to the item

#Include <GuiListView.au3>
_GUICtrlListView_SetItemParam($hWnd, $iIndex, $iParam)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iParam | A value to associate with the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Param", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Set item 2 parameter
_GUICtrlListView_SetItemParam($hListView, 1, 1234)
MsgBox(4160, "Information", "Item 2 Parameter: " & _GUICtrlListView_GetItemParam($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemPosition

Function Reference

_GUICtrlListView_SetItemPosition

Moves an item to a specified position in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetItemPosition($hWnd, $iIndex, $iCX, $iCY)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iCX | New x-position of the item's upper-left corner, in view coordinates
$iCY | New y-position of the item's upper-left corner, in view coordinates

Return Value

Success: | True
Failure: | False

Remarks

If the control has the $LVS_AUTOARRANGE style, the items in the control are arranged after the position of the
item is set. The control must be in icon or small icon view mode.

Related

_GUICtrlListView_GetItemPosition, _GUICtrlListView_Arrange, _GUICtrlListView_SetItemPosition32

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aPos, $hListView

GUICreate("ListView Set Item Position", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set icon view
_GUICtrlListView_SetView($hListView, 3)
MsgBox(4160, "Information", "Moving item 2")
_GUICtrlListView_SetItemPosition($hListView, 1, 100, 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemPosition32

Function Reference

_GUICtrlListView_SetItemPosition32

Moves an item to a specified position in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetItemPosition32($hWnd, $iIndex, $iCX, $iCY)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iCX | New x-position of the item's upper-left corner, in view coordinates
$iCY | New y-position of the item's upper-left corner, in view coordinates

Return Value

Success: | True
Failure: | False

Remarks

If the control has the $LVS_AUTOARRANGE style, the items in the control are arranged after the position of the
item is set. The control must be in icon or small icon view mode.

This message differs from the _GUICtrlListView_SetItemPosition function in that it uses 32-bit coordinates.

Related

_GUICtrlListView_SetItemPosition

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aPos, $hListView

GUICreate("ListView Set Item Position32", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set icon view
_GUICtrlListView_SetView($hListView, 3)
MsgBox(4160, "Information", "Moving item 2")
_GUICtrlListView_SetItemPosition32($hListView, 1, 100, 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemSelected

Function Reference

_GUICtrlListView_SetItemSelected

Sets whether the item is selected

#Include <GuiListView.au3>
_GUICtrlListView_SetItemSelected($hWnd, $iIndex[, $fSelected = True[, $fFocused = False]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item, -1 to set selected state of all items
$fSelected | [optional] If True the item(s) are selected, otherwise not.
$fFocused | [optional] If True the item has focus, otherwise not.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Selected", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select item 2
_GUICtrlListView_SetItemSelected($hListView, 1)
MsgBox(4160, "Information", "Item 2 Selected: " & _GUICtrlListView_GetItemSelected($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemState

Function Reference

_GUICtrlListView_SetItemState

Changes the state of an item in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetItemState($hWnd, $iIndex, $iState, $iStateMask)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iState | Item state to be changed
$iStateMask | Bits that determine whether state is active or inactive

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES), $hListView

GUICreate("ListView Set Item State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Get item 1 state
_GUICtrlListView_SetItemState($hListView, 0, $LVIS_FOCUSED, $LVIS_FOCUSED)
MsgBox(4160, "Information", "Item 1 State: " & _GUICtrlListView_GetItemState($hListView, 0, $LVIS_FOCUSED))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemStateImage

Function Reference

_GUICtrlListView_SetItemStateImage

Sets the state image that is displayed

#Include <GuiListView.au3>
_GUICtrlListView_SetItemStateImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$iImage | One based overlay image index

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetItemStateImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Set Item State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView, $hImage, 2)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 120)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Set item 2 state image
_GUICtrlListView_SetItemStateImage($hListView, 1, 1)
MsgBox(4160, "Information", "Item 2 State Image: " & _GUICtrlListView_GetItemStateImage($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetItemText

Function Reference

_GUICtrlListView_SetItemText

Changes the text of an item or subitem

#Include <GuiListView.au3>
_GUICtrlListView_SetItemText($hWnd, $iIndex, $sText[, $iSubItem = 0])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item
$sText | Item or subitem text
$iSubItem | [optional] One based index of the subitem or 0 to set the item

Return Value

Success: | True
Failure: | False

Remarks

If $iSubItem = -1 row is set

Related

_GUICtrlListView_GetItemText, _GUICtrlListView_GetItemTextArray, _GUICtrlListView_GetItemTextString, _GUICtrlListView_InsertItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Item Text", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Set item 2 text
_GUICtrlListView_SetItemText($hListView, 1, "New Item 2")
MsgBox(4160, "Information", "Item 2 Text: " & _GUICtrlListView_GetItemText($hListView, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetOutlineColor

Function Reference

_GUICtrlListView_SetOutlineColor

Sets the color of the border

#Include <GuiListView.au3>
_GUICtrlListView_SetOutlineColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Color to set the border

Return Value

Returns the Previous outline color

Remarks

Minimum OS - Windows XP.

Control must have the $LVS_EX_BORDERSELECT extended window style set

Related

_GUICtrlListView_GetOutlineColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iX, $iY, $hImage, $hListView

GUICreate("ListView Set Outline Color", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_BORDERSELECT)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Set outline color
_GUICtrlListView_SetOutlineColor($hListView, 0x0000FF)
MsgBox(4160, "Information", "Outline Color: " & Hex(_GUICtrlListView_GetOutlineColor($hListView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetSelectedColumn

Function Reference

_GUICtrlListView_SetSelectedColumn

Sets the index of the selected column

#Include <GuiListView.au3>
_GUICtrlListView_SetSelectedColumn($hWnd, $iCol)

Parameters

$hWnd | Handle to the control
$iCol | Specifies the column index

Return Value

None.

Remarks

Columns are Zero based index

Related

_GUICtrlListView_GetSelectedColumn

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Selected Column", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select column 2
_GUICtrlListView_SetSelectedColumn($hListView, 1)
MsgBox(4160, "Information", "Selected Column: " & _GUICtrlListView_GetSelectedColumn($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetSelectionMark

Function Reference

_GUICtrlListView_SetSelectionMark

Sets the selection mark in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetSelectionMark($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the new selection mark. If -1,the selection mark is removed.

Return Value

Success: | The previous selection mark
Failure: | -1 if there is no previous selection mark

Remarks

The selection mark is the item index from which a multiple selection starts. This message does not affect the
selection state of the item.

Related

_GUICtrlListView_GetSelectionMark

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Selection Mark", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Select multiple items
_GUICtrlListView_SetSelectionMark($hListView, 1)
MsgBox(4160, "Information", "Selected Mark: " & _GUICtrlListView_GetSelectionMark($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetTextBkColor

Function Reference

_GUICtrlListView_SetTextBkColor

Sets the background color of text in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetTextBkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Text color

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetTextBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Text BkColor", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show clors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @CRLF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @CRLF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetTextColor

Function Reference

_GUICtrlListView_SetTextColor

Sets the color of text in the control

#Include <GuiListView.au3>
_GUICtrlListView_SetTextColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Text color

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlListView_GetTextColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Text Color", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Set colors
_GUICtrlListView_SetBkColor($hListView, $CLR_MONEYGREEN)
_GUICtrlListView_SetTextColor($hListView, $CLR_BLACK)
_GUICtrlListView_SetTextBkColor($hListView, $CLR_MONEYGREEN)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Show clors
MsgBox(4160, "Information", "Back Color ....: " & _GUICtrlListView_GetBkColor($hListView) & @CRLF & _
"Text Color ....: " & _GUICtrlListView_GetTextColor($hListView) & @CRLF & _
"Text Back Color: " & _GUICtrlListView_GetTextBkColor($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetToolTips

Function Reference

_GUICtrlListView_SetToolTips

Sets the ToolTip control that the control will use to display ToolTips

#Include <GuiListView.au3>
_GUICtrlListView_SetToolTips($hWnd, $hToolTip)

Parameters

$hWnd | Handle to the control
$hToolTip | Handle to the ToolTip control to be set

Return Value

Returns the handle to the previous ToolTip control

Remarks

None.

Related

_GUICtrlListView_GetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hToolTip, $hListView

GUICreate("ListView Set ToolTips", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1")
_GUICtrlListView_AddItem($hListView, "Item 2")
_GUICtrlListView_AddItem($hListView, "Item 3")

; Show tooltip handle
$hToolTip = _GUICtrlListView_GetToolTips($hListView)
MsgBox(4160, "Information", "ToolTip Handle: 0x" & Hex($hToolTip))
_GUICtrlListView_SetToolTips($hListView, $hToolTip)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetUnicodeFormat

Function Reference

_GUICtrlListView_SetUnicodeFormat

Sets the UNICODE character format flag for the control

#Include <GuiListView.au3>
_GUICtrlListView_SetUnicodeFormat($hWnd, $fUnicode)

Parameters

$hWnd | Handle to the control
$fUnicode | Determines the character set that is used by the control. If True, the control will use Unicode characters. If this value is zero, the control will use ANSI characters.

Return Value

Returns the previous Unicode format flag for the control

Remarks

None.

Related

_GUICtrlListView_GetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set Unicode Format", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Set Unicode format
_GUICtrlListView_SetUnicodeFormat($hListView, False)
MsgBox(4160, "Information", "Unicode: " & _GUICtrlListView_GetUnicodeFormat($hListView))
_GUICtrlListView_SetUnicodeFormat($hListView, True)
MsgBox(4160, "Information", "Unicode: " & _GUICtrlListView_GetUnicodeFormat($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetView

Function Reference

_GUICtrlListView_SetView

Sets the view of the control

#Include <GuiListView.au3>
_GUICtrlListView_SetView($hWnd, $iView)

Parameters

$hWnd | Handle to the control
$iView | View state for the control: 0 - Details 1 - Large Icon 2 - List 3 - Small Icon 4 - Tile

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlListView_GetView

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hListView

GUICreate("ListView Set View", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUISetState()

; Add columns
_GUICtrlListView_AddColumn($hListView, "Items", 100)

; Add items
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Item " & $iI)
Next
_GUICtrlListView_EndUpdate($hListView)

; Set view
MsgBox(4160, "Information", "View: " & _GUICtrlListView_GetView($hListView))
_GUICtrlListView_SetView($hListView, 4)
MsgBox(4160, "Information", "View: " & _GUICtrlListView_GetView($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SetWorkAreas

Function Reference

_GUICtrlListView_SetWorkAreas

Creates a work area within the control

#Include <GuiListView.au3>
_GUICtrlListView_SetWorkAreas($hWnd, $iLeft, $iTop, $iRight, $iBottom)

Parameters

$hWnd | Handle to the control
$iLeft | X coordinate of the upper left corner of the rectangle
$iTop | Y coordinate of the upper left corner of the rectangle
$iRight | X coordinate of the lower right corner of the rectangle
$iBottom | Y coordinate of the lower right corner of the rectangle

Return Value

None.

Remarks

None.

Related

_GUICtrlListView_GetNumberOfWorkAreas

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hImage, $hListView

GUICreate("ListView Set Work Areas", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)

; Add columns
_GUICtrlListView_AddColumn($hListView, 0, "Items", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)

; Create work area
_GUICtrlListView_SetWorkAreas($hListView, 0, 0, 100, 100)
MsgBox(4160, "Information", "Work Areas: " & _GUICtrlListView_GetNumberOfWorkAreas($hListView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlListView_SimpleSort

Function Reference

_GUICtrlListView_SimpleSort

Sorts a list-view control (limited)

#Include <GuiListView.au3>
_GUICtrlListView_SimpleSort($hWnd, ByRef $vDescending, $iCol)

Parameters

$hWnd | Handle to the control
$vDescending | Can be: True - Sort Descending False - Sort Ascending Array - With the following format: [0] - First Column [1] - Second Column [n] - Last Column
$iCol | Column number

Return Value

None.

Remarks

This is a basic sort fuction, for advanced sort see GUICtrlRegisterListViewSort

Related

GUICtrlRegisterListViewSort

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $B_DESCENDING

_Main()

Func _Main()

GUICreate("ListView SimpleSort", 400, 300)

$hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUICtrlSendMsg($hListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
GUICtrlCreateListViewItem("line4|5|more_a", $hListView)
GUICtrlCreateListViewItem("line5|4.50 |more_c", $hListView)
GUICtrlCreateListViewItem("line5|4.0 |more_c", $hListView)
GUICtrlCreateListViewItem("line3|23|more_e", $hListView)
GUICtrlCreateListViewItem("line2|0.34560 |more_d", $hListView)
GUICtrlCreateListViewItem("line1|1.0 |more_b", $hListView)
GUICtrlCreateListViewItem("line1|0.1 |more_b", $hListView)
GUICtrlCreateListViewItem("line1|10|more_b", $hListView)
_GUICtrlListView_SetColumnWidth($hListView, 0, 75)
_GUICtrlListView_SetColumnWidth($hListView, 1, 75)
_GUICtrlListView_SetColumnWidth($hListView, 2, 75)

GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Global $B_DESCENDING[_GUICtrlListView_GetColumnCount($hListView)]

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()

EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
_GUICtrlListView_SimpleSort($hWndListView, $B_DESCENDING, DllStructGetData($tInfo, "SubItem"))
; No return value
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_SortItems

Function Reference

_GUICtrlListView_SortItems

Starts the sort call back, also sets the Arrow in the Header

#Include <GuiListView.au3>
_GUICtrlListView_SortItems($hWnd, $iCol)

Parameters

$hWnd | Handle of the control
$iCol | Column clicked

Return Value

None.

Remarks

For use only in conjunction with _GUICtrlListView_RegisterSortCallBack

A down-arrow/up-arrow is drawn on column selected for Windows XP and above if the option was set
when calling _GUICtrlListView_RegisterSortCallBack

Related

_GUICtrlListView_RegisterSortCallBack

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hListView, $hListView2

_Example1()
_Example2()

Func _Example1()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Sort", 300, 200)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $hListView
; Kick off the sort callback
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
GUIDelete()
EndFunc ;==>_Example1

Func _Example2()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Sort Treat Numbers as Strings", 300, 200, 100)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

GUICreate("ListView Sort Treat Numbers as Numbers", 300, 200, 400)

$hListView2 = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView2, $iExListViewStyle)
_GUICtrlListView_SetImageList($hListView2, $hImage, 1)

_AddRow($hListView2, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView2, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView2, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView, False)
_GUICtrlListView_RegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
_GUICtrlListView_UnRegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "")
EndFunc ;==>_Example2

Func _AddRow($hWnd, $sItem, $aIcons, $iPlus = 0)
Local $aItem = StringSplit($sItem, "|")
Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $aIcons[0] + $iPlus, _GUICtrlListView_GetItemCount($hWnd) + 9999)
_GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)

For $x = 2 To $aItem[0]
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $aIcons[$x - 1] + $iPlus)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
Next
EndFunc ;==>_AddRow

Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView2

$hWndListView = $hListView
$hWndListView2 = $hListView2
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
If Not IsHWnd($hListView2) Then $hWndListView2 = GUICtrlGetHandle($hListView2)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")

Switch $hWndFrom
Case $hWndListView, $hWndListView2
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)

; Kick off the sort callback
_GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem"))
; No return value
EndSwitch
EndSwitch
Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlListView_SubItemHitTest

Function Reference

_GUICtrlListView_SubItemHitTest

Determines which listview item or subitem is at a given position

#Include <GuiListView.au3>
_GUICtrlListView_SubItemHitTest($hWnd[, $iX = -1[, $iY = -1]])

Parameters

$hWnd | Handle to the control
$iX | [optional] X position to test or -1 to use the current mouse position
$iY | [optional] Y position to test or -1 to use the current mouse position

Return Value

Returns an Array with the following format:
[ 0] - Zero based index of the item at the specified position, or -1
[ 1] - Zero based index of the subitem at the specified position, or -1
[ 2] - If True, position is in control's client window but not on an item
[ 3] - If True, position is over item icon
[ 4] - If True, position is over item text
[ 5] - If True, position is over item state image
[ 6] - If True, position is somewhere on the item
[ 7] - If True, the position is above the control's client area
[ 8] - If True, the position is below the control's client area
[ 9] - If True, the position is to the left of the client area
[10] - If True, the position is to the right of the client area

Remarks

None.

Related

_GUICtrlListView_HitTest

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiStatusBar.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Global $hListView, $StatusBar, $iIndex = -1, $iSubIndex = -1

_Main()

Func _Main()
Local $hImage, $GUI

; Create GUI
$GUI = GUICreate("ListView SubItem Hit Test", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
$hListView = GUICtrlGetHandle($hListView) ; get the handle for use in the notify events
$StatusBar = _GUICtrlStatusBar_Create($GUI, -1, "")

; Enable extended control styles
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_SUBITEMIMAGES)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func ListView_Click()
Local $aHit

$aHit = _GUICtrlListView_SubItemHitTest($hListView)
If ($aHit[0] <> -1) And (($aHit[0] <> $iIndex) Or ($aHit[1] <> $iSubIndex)) Then
_GUICtrlStatusBar_SetText($StatusBar, @TAB & StringFormat("HitTest Item: %d, SubItem: %d", $aHit[0], $aHit[1]))
$iIndex = $aHit[0]
$iSubIndex = $aHit[1]
EndIf
EndFunc ;==>ListView_Click

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
$hWndListView = $hListView
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
$tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
_DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
; No return value
Case $LVN_KEYDOWN ; A key has been pressed
$tInfo = DllStructCreate($tagNMLVKEYDOWN, $ilParam)
_DebugPrint("$LVN_KEYDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->VKey:" & @TAB & DllStructGetData($tInfo, "VKey") & @LF & _
"-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags"))
; No return value
Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
ListView_Click()
; No return value
Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_KILLFOCUS ; The control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
;Return 1 ; not to allow the default processing
Return 0 ; allow the default processing
Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
"-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
"-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
"-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
"-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
"-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
"-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
"-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
; No return value
Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_SETFOCUS ; The control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlListView_UnRegisterSortCallBack

Function Reference

_GUICtrlListView_UnRegisterSortCallBack

UnRegister the Sort callback function

#Include <GuiListView.au3>
_GUICtrlListView_UnRegisterSortCallBack($hWnd)

Parameters

$hWnd Handle of the control

Return Value

None.

Remarks

None.

Related

_GUICtrlListView_RegisterSortCallBack

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hListView, $hListView2

_Example1()
_Example2()

Func _Example1()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Sort", 300, 200)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $hListView
; Kick off the sort callback
_GUICtrlListView_SortItems($hListView, GUICtrlGetState($hListView))
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
GUIDelete()
EndFunc ;==>_Example1

Func _Example2()
Local $hImage, $aIcons[3] = [0, 3, 6]
Local $iExWindowStyle = BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE)
Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

GUICreate("ListView Sort Treat Numbers as Strings", 300, 200, 100)

$hListView = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView, $iExListViewStyle)

; Load images
$hImage = _GUIImageList_Create(18, 18, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -7)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -12)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -4)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -5)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -6)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -9)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -10)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", -11)
_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_AddRow($hListView, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

GUICreate("ListView Sort Treat Numbers as Numbers", 300, 200, 400)

$hListView2 = GUICtrlCreateListView("Column1|Col2|Col3", 10, 10, 280, 180, -1, $iExWindowStyle)
_GUICtrlListView_SetExtendedListViewStyle($hListView2, $iExListViewStyle)
_GUICtrlListView_SetImageList($hListView2, $hImage, 1)

_AddRow($hListView2, "ABC|000666|10.05.2004", $aIcons)
_AddRow($hListView2, "DEF|444|11.05.2005", $aIcons, 1)
_AddRow($hListView2, "CDE|555|12.05.2004", $aIcons, 2)

GUISetState()

_GUICtrlListView_RegisterSortCallBack($hListView, False)
_GUICtrlListView_RegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

_GUICtrlListView_UnRegisterSortCallBack($hListView)
_GUICtrlListView_UnRegisterSortCallBack($hListView2)
GUIRegisterMsg($WM_NOTIFY, "")
EndFunc ;==>_Example2

Func _AddRow($hWnd, $sItem, $aIcons, $iPlus = 0)
Local $aItem = StringSplit($sItem, "|")
Local $iIndex = _GUICtrlListView_AddItem($hWnd, $aItem[1], $aIcons[0] + $iPlus, _GUICtrlListView_GetItemCount($hWnd) + 9999)
_GUICtrlListView_SetColumnWidth($hWnd, 0, $LVSCW_AUTOSIZE_USEHEADER)

For $x = 2 To $aItem[0]
_GUICtrlListView_AddSubItem($hWnd, $iIndex, $aItem[$x], $x - 1, $aIcons[$x - 1] + $iPlus)
_GUICtrlListView_SetColumnWidth($hWnd, $x - 1, $LVSCW_AUTOSIZE)
Next
EndFunc ;==>_AddRow

Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iCode, $tNMHDR, $hWndListView, $hWndListView2

$hWndListView = $hListView
$hWndListView2 = $hListView2
If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)
If Not IsHWnd($hListView2) Then $hWndListView2 = GUICtrlGetHandle($hListView2)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")

Switch $hWndFrom
Case $hWndListView, $hWndListView2
Switch $iCode
Case $LVN_COLUMNCLICK ; A column was clicked
Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)

; Kick off the sort callback
_GUICtrlListView_SortItems($hWndFrom, DllStructGetData($tInfo, "SubItem"))
; No return value
EndSwitch
EndSwitch
Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


User Defined Functions

GuiMenu user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiMenu.au3>.

User Defined Function | Description
_GUICtrlMenu_AddMenuItem | Adds a new menu item to the end of the menu
_GUICtrlMenu_AppendMenu | Appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu
_GUICtrlMenu_CheckMenuItem | Sets the state of the specified menu item's check mark attribute to either selected or clear
_GUICtrlMenu_CheckRadioItem | Checks a specified menu item and makes it a radio item
_GUICtrlMenu_CreateMenu | Creates a menu
_GUICtrlMenu_CreatePopup | Creates a drop down menu, submenu, or shortcut menu
_GUICtrlMenu_DeleteMenu | Deletes an item from the specified menu
_GUICtrlMenu_DestroyMenu | Destroys the specified menu and frees any memory that the menu occupies
_GUICtrlMenu_DrawMenuBar | Redraws the menu bar of the specified window
_GUICtrlMenu_EnableMenuItem | Enables, disables, or grays the specified menu item
_GUICtrlMenu_FindItem | Retrieves a menu item based on it's text
_GUICtrlMenu_FindParent | Retrieves the window to which a menu belongs
_GUICtrlMenu_GetItemBmp | Retrieves the bitmap displayed for the item
_GUICtrlMenu_GetItemBmpChecked | Retrieves the bitmap displayed if the item is selected
_GUICtrlMenu_GetItemBmpUnchecked | Retrieves the bitmap displayed if the item is not selected
_GUICtrlMenu_GetItemChecked | Retrieves the status of the menu item checked state
_GUICtrlMenu_GetItemCount | Retrieves the number of items in the specified menu
_GUICtrlMenu_GetItemData | Retrieves the application defined value associated with the menu item
_GUICtrlMenu_GetItemDefault | Retrieves the status of the menu item default state
_GUICtrlMenu_GetItemDisabled | Retrieves the status of the menu item disabled state
_GUICtrlMenu_GetItemEnabled | Retrieves the status of the menu item enabled state
_GUICtrlMenu_GetItemGrayed | Retrieves the status of the menu item grayed state
_GUICtrlMenu_GetItemHighlighted | Retrieves the status of the menu item highlighted state
_GUICtrlMenu_GetItemID | Retrieves the menu item ID
_GUICtrlMenu_GetItemInfo | Retrieves information about a menu item
_GUICtrlMenu_GetItemRect | Retrieves the bounding rectangle for the specified menu item
_GUICtrlMenu_GetItemRectEx | Retrieves the bounding rectangle for the specified menu item
_GUICtrlMenu_GetItemState | Retrieves the menu item state
_GUICtrlMenu_GetItemStateEx | Retrieves the menu flags associated with the specified menu item
_GUICtrlMenu_GetItemSubMenu | Retrieves a the submenu activated by a specified item
_GUICtrlMenu_GetItemText | Retrieves the text of the specified menu item
_GUICtrlMenu_GetItemType | Retrieves the menu item type
_GUICtrlMenu_GetMenu | Retrieves the handle of the menu assigned to the given window
_GUICtrlMenu_GetMenuBackground | Retrieves the brush to use for the menu's background
_GUICtrlMenu_GetMenuBarInfo | Retrieves information about the specified menu bar
_GUICtrlMenu_GetMenuContextHelpID | Retrieves the context help identifier
_GUICtrlMenu_GetMenuData | Retrieves the application defined value
_GUICtrlMenu_GetMenuDefaultItem | Retrieves the default menu item on the specified menu
_GUICtrlMenu_GetMenuHeight | Retrieves the maximum height of a menu
_GUICtrlMenu_GetMenuInfo | Retrieves information about a specified menu
_GUICtrlMenu_GetMenuStyle | Retrieves the style information for a menu
_GUICtrlMenu_GetSystemMenu | Allows the application to access the window menu for copying and modifying
_GUICtrlMenu_InsertMenuItem | Inserts a new menu item at the specified position
_GUICtrlMenu_InsertMenuItemEx | Inserts a new menu item at the specified position in a menu
_GUICtrlMenu_IsMenu | Determines whether a handle is a menu handle
_GUICtrlMenu_LoadMenu | Loads the specified menu resource from the executable file associated with an application instance
_GUICtrlMenu_MapAccelerator | Maps a menu accelerator key to it's position in the menu
_GUICtrlMenu_MenuItemFromPoint | Determines which menu item is at the specified location.
_GUICtrlMenu_RemoveMenu | Deletes a menu item or detaches a submenu from the specified menu
_GUICtrlMenu_SetItemBitmaps | Associates the specified bitmap with a menu item
_GUICtrlMenu_SetItemBmp | Sets the bitmap displayed for the item
_GUICtrlMenu_SetItemBmpChecked | Sets the bitmap displayed if the item is selected
_GUICtrlMenu_SetItemBmpUnchecked | Sets the bitmap displayed if the item is not selected
_GUICtrlMenu_SetItemChecked | Sets the checked state of a menu item
_GUICtrlMenu_SetItemData | Sets the application defined value for a menu item
_GUICtrlMenu_SetItemDefault | Sets the status of the menu item default state
_GUICtrlMenu_SetItemDisabled | Sets the disabled state of a menu item
_GUICtrlMenu_SetItemEnabled | Sets the enabled state of a menu item
_GUICtrlMenu_SetItemGrayed | Sets the grayed state of a menu item
_GUICtrlMenu_SetItemHighlighted | Sets the highlighted state of a menu item
_GUICtrlMenu_SetItemID | Sets the menu item ID
_GUICtrlMenu_SetItemInfo | Changes information about a menu item
_GUICtrlMenu_SetItemState | Sets the state of a menu item
_GUICtrlMenu_SetItemSubMenu | Sets the drop down menu or submenu associated with the menu item
_GUICtrlMenu_SetItemText | Sets the text for a menu item
_GUICtrlMenu_SetItemType | Sets the menu item type
_GUICtrlMenu_SetMenu | Assigns a new menu to the specified window
_GUICtrlMenu_SetMenuBackground | Sets the background brush for the menu
_GUICtrlMenu_SetMenuContextHelpID | Sets the context help identifier for the menu
_GUICtrlMenu_SetMenuData | Sets the application defined for the menu
_GUICtrlMenu_SetMenuDefaultItem | Sets the default menu item
_GUICtrlMenu_SetMenuHeight | Sets the maximum height of the menu
_GUICtrlMenu_SetMenuInfo | Sets information for a specified menu
_GUICtrlMenu_SetMenuStyle | Sets the menu style
_GUICtrlMenu_TrackPopupMenu | Displays a shortcut menu at the specified location


Function _GUICtrlMenu_AddMenuItem

Function Reference

_GUICtrlMenu_AddMenuItem

Adds a new menu item to the end of the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_AddMenuItem($hMenu, $sText[, $iCmdID = 0[, $hSubMenu = 0]])

Parameters

$hMenu | Handle of the menu
$sText | Menu item text. If blank, a separator will be added.
$iCmdID | [optional] Command ID to assign to the item
$hSubMenu | [optional] Handle to the submenu associated with the menu item

Return Value

Success: | Zero based menu item index
Failure: | -1

Remarks

None.

Related

_GUICtrlMenu_InsertMenuItem

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_AddMenuItem ($hFile, "&New", $idNew)
_GUICtrlMenu_AddMenuItem ($hFile, "&Open", $idOpen)
_GUICtrlMenu_AddMenuItem ($hFile, "&Save", $idSave)
_GUICtrlMenu_AddMenuItem ($hFile, "", 0)
_GUICtrlMenu_AddMenuItem ($hFile, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_AddMenuItem ($hEdit, "&Cut", $idCut)
_GUICtrlMenu_AddMenuItem ($hEdit, "C&opy", $idCopy)
_GUICtrlMenu_AddMenuItem ($hEdit, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_AddMenuItem ($hHelp, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_AddMenuItem ($hMain, "&File", 0, $hFile)
_GUICtrlMenu_AddMenuItem ($hMain, "&Edit", 0, $hEdit)
_GUICtrlMenu_AddMenuItem ($hMain, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_AppendMenu

Function Reference

_GUICtrlMenu_AppendMenu

Appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu

#Include <GuiMenu.au3>
_GUICtrlMenu_AppendMenu($hMenu, $iFlags, $iNewItem, $pNewItem)

Parameters

$hMenu Handle of the menu
$iFlags Specifies flags to control the appearance and behavior of the new menu item:
$MF_BITMAP - Uses a bitmap as the menu item
$MF_CHECKED - Places a check mark next to the menu item. If the application provides check-mark bitmaps,
this flag displays the check-mark bitmap next to the menu item.
$MF_DISABLED - Disables the menu item so that it cannot be selected, but the flag does not gray it.
$MF_ENABLED - Enables the menu item so that it can be selected, and restores it from its grayed state.
$MF_GRAYED - Disables the menu item and grays it so that it cannot be selected.
$MF_MENUBARBREAK - Functions the same as $MF_MENUBREAK for a menu bar. For a drop down menu, submenu, or
shortcut menu, the new column is separated from the old column by a vertical line.
$MF_MENUBREAK - Places the item on a new line (for a menu bar) or in a new column (for a drop down menu,
submenu, or shortcut menu) without separating columns.
$MF_OWNERDRAW - Specifies that the item is an owner drawn item. Before the menu is displayed for the first
time, the window that owns the menu receives a $WM_MEASUREITEM message to retrieve the width and height of
the menu item. The $WM_DRAWITEM message is then sent to the window procedure of the owner window whenever the
appearance of the menu item must be updated.
$MF_POPUP - Specifies that the menu item opens a drop down menu or submenu. The iNewItem parameter
specifies a handle to the drop down menu or submenu. This flag is used to add a menu name to a menu bar, or a
menu item that opens a submenu to a drop down menu, submenu, or shortcut menu.
$MF_SEPARATOR - Draws a horizontal dividing line. This flag is used only in a drop down menu, submenu, or
shortcut menu. The line cannot be grayed, disabled, or highlighted. The pNewItem and iNewItem parameters are
ignored.
$MF_STRING - Specifies that the menu item is a text string. The pNewItem parameter is a string.
$MF_UNCHECKED - Does not place a check mark next to the item. If the application supplies check mark
bitmaps, this flag displays the clear bitmap next to the menu item.
$iNewItem Specifies either the identifier of the new menu item or, if the $iFlags parameter is set to a
popup, a handle to the drop down menu or submenu.
$pNewItem Specifies the content of the new menu item. The interpretation of pNewItem depends on whether
the iFlags parameter includes the $MF_BITMAP, $MF_OWNERDRAW, or $MF_STRING flag:
$MF_BITMAP - Contains a bitmap handle
$MF_OWNERDRAW - Contains an application supplied value that can be used to maintain additional data related
to the menu item. The value is in the ItemData member of the structure pointed to by the lParam parameter of
the $WM_MEASUREITEM or $WM_DRAWITEM message sent when the menu is created or its appearance is updated.
$MF_STRING - Contains a string

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_InsertMenuItem

See Also

Search AppendMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Add About menu item
_GUICtrlMenu_AppendMenu ($hHelp, $MF_STRING, $idAbout, "&About")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_CheckMenuItem

Function Reference

_GUICtrlMenu_CheckMenuItem

Sets the state of the specified menu item's check mark attribute to either selected or clear

#Include <GuiMenu.au3>
_GUICtrlMenu_CheckMenuItem($hMenu, $iItem[, $fCheck = True[, $fByPos = True]])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item to check
$fCheck | [optional] True to set the check mark, False to remove it
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | The previous state of the menu item (either $MF_CHECKED or $MF_UNCHECKED)
Failure: | -1

Remarks

An item in a menu bar cannot have a check mark. The $iItem parameter identifies a item that opens a submenu or
a command item. For an item that opens a submenu, the $Item parameter must specify the position of the item.
For a command item, the $Item parameter can specify either the item's position or its identifier.

Related

_GUICtrlMenu_CheckRadioItem

See Also

Search CheckMenuItem in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Check About menu item
_GUICtrlMenu_CheckMenuItem ($hHelp, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_CheckRadioItem

Function Reference

_GUICtrlMenu_CheckRadioItem

Checks a specified menu item and makes it a radio item

#Include <GuiMenu.au3>
_GUICtrlMenu_CheckRadioItem($hMenu, $iFirst, $iLast, $iCheck[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iFirst | Identifier or position of the first menu item in the group
$iLast | Identifier or position of the last menu item in the group
$iCheck | Identifier or position of the menu item to check
$fByPos | [optional] Menu identifier flag: True - $iFirst, $iLast and $iCheck are a zero based item position False - $iFirst, $iLast and $iCheck are a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

This function sets the $MFT_RADIOCHECK type flag and the $MFS_CHECKED state for the item specified by $iCheck
and, at the same time, clears both flags for all other items in the group. The checked item is displayed using
a bullet bitmap instead of a check-mark bitmap.

Related

_GUICtrlMenu_CheckMenuItem

See Also

Search CheckMenuRadioItem in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Check Open menu item
_GUICtrlMenu_CheckRadioItem ($hFile, 0, 4, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_CreateMenu

Function Reference

_GUICtrlMenu_CreateMenu

Creates a menu

#Include <GuiMenu.au3>
_GUICtrlMenu_CreateMenu([$iStyle = 8])

Parameters

$iStyle [optional] Style of the menu. It can be one or more of the following values:
1 - Menu automatically ends when mouse is outside the menu for 10 seconds
2 - The same space is reserved for the check mark and the bitmap
4 - Menu items are OLE drop targets or drag sources
8 - Menu is modeless
16 - No space is reserved to the left of an item for a check mark
32 - Menu owner receives a WM_MENUCOMMAND message instead of a WM_COMMAND message for selections

Return Value

Success: | Handle to the newly created menu
Failure: | 0

Remarks

Menu resources that are assigned to a window are freed automatically. If the menu is not assigned to a window,
an application must free system resources associated with the menu before closing. An application frees menu
resources by calling the _GUICtrlMenu_DestroyMenu function.

Related

_GUICtrlMenu_CreatePopup, _GUICtrlMenu_DestroyMenu

See Also

Search CreateMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo
Global Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Loop until user exits
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Handle menu commands
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch _WinAPI_LoWord ($iwParam)
Case $idNew
MemoWrite("New")
Case $idOpen
MemoWrite("Open")
Case $idSave
MemoWrite("Save")
Case $idExit
Exit
Case $idCut
MemoWrite("Cut")
Case $idCopy
MemoWrite("Copy")
Case $idPaste
MemoWrite("Paste")
Case $idAbout
MemoWrite("About")
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_CreatePopup

Function Reference

_GUICtrlMenu_CreatePopup

Creates a drop down menu, submenu, or shortcut menu

#Include <GuiMenu.au3>
_GUICtrlMenu_CreatePopup([$iStyle = 8])

Parameters

$iStyle [optional] Style of the menu. It can be one or more of the following values:
1 - Menu automatically ends when mouse is outside the menu for 10 seconds
2 - The same space is reserved for the check mark and the bitmap
4 - Menu items are OLE drop targets or drag sources
8 - Menu is modeless
16 - No space is reserved to the left of an item for a check mark
32 - Menu owner receives a WM_MENUCOMMAND message instead of a WM_COMMAND message for selections

Return Value

Success: | Handle to the newly created menu
Failure: | 0

Remarks

Menu resources that are assigned to a window are freed automatically. If the menu is not assigned to a window,
an application must free system resources associated with the menu before closing. An application frees menu
resources by calling the _GUICtrlMenu_DestroyMenu function.

Related

_GUICtrlMenu_CreateMenu, _GUICtrlMenu_DestroyMenu

See Also

Search CreatePopupMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global Enum $idOpen = 1000, $idSave, $idInfo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)
GUISetState()

; Register message handlers
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Handle WM_COMMAND messages
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch $iwParam
Case $idOpen
_WinAPI_ShowMsg ("Open")
Case $idSave
_WinAPI_ShowMsg ("Save")
Case $idInfo
_WinAPI_ShowMsg ("Info")
EndSwitch
EndFunc ;==>WM_COMMAND

; Handle WM_CONTEXTMENU messages
Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
Local $hMenu

$hMenu = _GUICtrlMenu_CreatePopup ()
_GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "Info", $idInfo)
_GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
_GUICtrlMenu_DestroyMenu ($hMenu)
Return True
EndFunc ;==>WM_CONTEXTMENU


Function _GUICtrlMenu_DeleteMenu

Function Reference

_GUICtrlMenu_DeleteMenu

Deletes an item from the specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_DeleteMenu($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_DestroyMenu

See Also

Search DeleteMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Delete About menu item
_GUICtrlMenu_DeleteMenu ($hHelp, 0)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_DestroyMenu

Function Reference

_GUICtrlMenu_DestroyMenu

Destroys the specified menu and frees any memory that the menu occupies

#Include <GuiMenu.au3>
_GUICtrlMenu_DestroyMenu($hMenu)

Parameters

$hMenu Menu handle

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_DeleteMenu, _GUICtrlMenu_CreateMenu, _GUICtrlMenu_CreatePopup

See Also

Search DestroyMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global Enum $idOpen = 1000, $idSave, $idInfo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)
GUISetState()

; Register message handlers
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Handle WM_COMMAND messages
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch $iwParam
Case $idOpen
_WinAPI_ShowMsg ("Open")
Case $idSave
_WinAPI_ShowMsg ("Save")
Case $idInfo
_WinAPI_ShowMsg ("Info")
EndSwitch
EndFunc ;==>WM_COMMAND

; Handle WM_CONTEXTMENU messages
Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
Local $hMenu

$hMenu = _GUICtrlMenu_CreatePopup ()
_GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "Info", $idInfo)
_GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
_GUICtrlMenu_DestroyMenu ($hMenu)
Return True
EndFunc ;==>WM_CONTEXTMENU


Function _GUICtrlMenu_DrawMenuBar

Function Reference

_GUICtrlMenu_DrawMenuBar

Redraws the menu bar of the specified window

#Include <GuiMenu.au3>
_GUICtrlMenu_DrawMenuBar($hWnd)

Parameters

$hWnd Handle to the window whose menu bar needs redrawing

Return Value

Success: | True
Failure: | False

Remarks

If the menu bar changes after Windows has created the window, this function must be called to draw the menu bar.

Related

See Also

Search DrawMenuBar in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hItem1, $hItem2

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Create subitem menu
$hItem1 = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hItem1, 0, "SubItem &1", 0x1000)
_GUICtrlMenu_InsertMenuItem($hItem1, 1, "SubItem &2", 0x1001)

; Create menu
$hItem2 = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hItem2, 0, "Item &1", 0x2000, $hItem1)
_GUICtrlMenu_InsertMenuItem($hItem2, 1, "Item &2", 0x2001)
_GUICtrlMenu_InsertMenuItem($hItem2, 2, "", 0)
_GUICtrlMenu_InsertMenuItem($hItem2, 3, "Item &3", 0x2002)
_GUICtrlMenu_InsertMenuItem($hItem2, 4, "Item &4", 0x2003)

; Insert new menu into Notepad
_GUICtrlMenu_InsertMenuItem($hMain, 6, "&AutoIt", 0, $hItem2)
_GUICtrlMenu_DrawMenuBar($hWnd)

EndFunc ;==>_Main


Function _GUICtrlMenu_EnableMenuItem

Function Reference

_GUICtrlMenu_EnableMenuItem

Enables, disables, or grays the specified menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_EnableMenuItem($hMenu, $iItem[, $iState = 0[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$iState | [optional] Indicates whether the menu item is enabled, disabled, or grayed: 0 - Enabled 1 - Grayed 2 - Disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search EnableMenuItem in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain

Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Disable/Gray Help menu
_GUICtrlMenu_EnableMenuItem($hMain, 4, 3)

EndFunc ;==>_Main


Function _GUICtrlMenu_FindItem

Function Reference

_GUICtrlMenu_FindItem

Retrieves a menu item based on it's text

#Include <GuiMenu.au3>
_GUICtrlMenu_FindItem($hMenu, $sText[, $fInStr = False[, $iStart = 0]])

Parameters

$hMenu | Menu handle
$sText | Text to search for
$fInStr | [optional] If True, the text can be anywhere in the item's text.
$iStart | [optional] Item to start searching from

Return Value

Success: | The zero based index of the first item that contains the text
Failure: | -1

Remarks

The search is case insensitive

Related

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $iIndex
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)
GUISetState()

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Click Help menu item
$iIndex = _GUICtrlMenu_FindItem ($hMain, "Help")
MsgBox(4096, "Information", "Index for Help Menu: " & $iIndex)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_FindParent

Function Reference

_GUICtrlMenu_FindParent

Retrieves the window to which a menu belongs

#Include <GuiMenu.au3>
_GUICtrlMenu_FindParent($hMenu)

Parameters

$hMenu Menu handle

Return Value

Success: | Window handle
Failure: | 0

Remarks

None.

Related

_GUICtrlMenu_GetMenu

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain

Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Show that Menu handle belongs to Notepad
Writeln("Notepad handle: 0x" & Hex($hWnd))
Writeln("Menu Parent ..: 0x" & Hex(_GUICtrlMenu_FindParent($hMain)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemBmp

Function Reference

_GUICtrlMenu_GetItemBmp

Retrieves the bitmap displayed for the item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemBmp($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Handle to the bitmap to be displayed

Remarks

None.

Related

_GUICtrlMenu_SetItemBmp

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp ($hFile, 0, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_GetItemBmpChecked

Function Reference

_GUICtrlMenu_GetItemBmpChecked

Retrieves the bitmap displayed if the item is selected

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemBmpChecked($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Handle to the bitmap to display next to the item if it is selected

Remarks

None.

Related

_GUICtrlMenu_SetItemBmpChecked

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $hBmp1, $hBmp2
Global Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set File menu checked/unchecked bitmaps
$hBmp1 = _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)
$hBmp2 = _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 0, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 1, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 2, $hBmp1)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 0, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 1, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 2, $hBmp2)

; Check Open menu item
_GUICtrlMenu_CheckMenuItem ($hFile, 1)

; Show that bitmap handles match
MemoWrite("Checked handle ......: 0x" & Hex($hBmp1))
MemoWrite("Unchecked handle ....: 0x" & Hex($hBmp2))
MemoWrite("Open checked handle .: 0x" & Hex(_GUICtrlMenu_GetItemBmpChecked ($hFile, 0)))
MemoWrite("Open unchecked handle: 0x" & Hex(_GUICtrlMenu_GetItemBmpUnchecked ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_GetItemBmpUnchecked

Function Reference

_GUICtrlMenu_GetItemBmpUnchecked

Retrieves the bitmap displayed if the item is not selected

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemBmpUnchecked($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Handle to the bitmap to display next to the item if it is not selected

Remarks

None.

Related

_GUICtrlMenu_SetItemBmpUnchecked

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $hBmp1, $hBmp2
Global Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set File menu checked/unchecked bitmaps
$hBmp1 = _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)
$hBmp2 = _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 0, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 1, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 2, $hBmp1)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 0, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 1, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 2, $hBmp2)

; Check Open menu item
_GUICtrlMenu_CheckMenuItem ($hFile, 1)

; Show that bitmap handles match
MemoWrite("Checked handle ......: 0x" & Hex($hBmp1))
MemoWrite("Unchecked handle ....: 0x" & Hex($hBmp2))
MemoWrite("Open checked handle .: 0x" & Hex(_GUICtrlMenu_GetItemBmpChecked ($hFile, 0)))
MemoWrite("Open unchecked handle: 0x" & Hex(_GUICtrlMenu_GetItemBmpUnchecked ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_GetItemChecked

Function Reference

_GUICtrlMenu_GetItemChecked

Retrieves the status of the menu item checked state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemChecked($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is checked
False: | Item is not checked

Remarks

None.

Related

_GUICtrlMenu_SetItemChecked

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Check Open menu item
Writeln("Open is checked: " & _GUICtrlMenu_GetItemChecked($hFile, 1))
_GUICtrlMenu_SetItemChecked($hFile, 1)
Writeln("Open is checked: " & _GUICtrlMenu_GetItemChecked($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemCount

Function Reference

_GUICtrlMenu_GetItemCount

Retrieves the number of items in the specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemCount($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Success: | The number of items in the menu
Failure: | -1

Remarks

None.

Related

See Also

Search GetMenuItemCount in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Show Main menu item count
Writeln("Main menu item count: " & _GUICtrlMenu_GetItemCount($hMain))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemData

Function Reference

_GUICtrlMenu_GetItemData

Retrieves the application defined value associated with the menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemData($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Application defined value associated with the menu item

Remarks

None.

Related

_GUICtrlMenu_SetItemData

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Get/Set File menu item data
Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))
_GUICtrlMenu_SetItemData($hMain, 0, 1234)
Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemDefault

Function Reference

_GUICtrlMenu_GetItemDefault

Retrieves the status of the menu item default state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemDefault($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is the default item
False: | Item is not the default item

Remarks

None.

Related

_GUICtrlMenu_SetItemDefault

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File default item
Writeln("Open is default: " & _GUICtrlMenu_GetItemDefault($hFile, 1))
_GUICtrlMenu_SetItemDefault($hFile, 1)
Writeln("Open is default: " & _GUICtrlMenu_GetItemDefault($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemDisabled

Function Reference

_GUICtrlMenu_GetItemDisabled

Retrieves the status of the menu item disabled state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemDisabled($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is disabled
False: | Item is not disabled

Remarks

None.

Related

_GUICtrlMenu_SetItemDisabled

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open enabled
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemDisabled($hFile, 1)
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemEnabled($hFile, 1)
Writeln("Open is enabled : " & _GUICtrlMenu_GetItemEnabled($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemEnabled

Function Reference

_GUICtrlMenu_GetItemEnabled

Retrieves the status of the menu item enabled state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemEnabled($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is enabled
False: | Item is not enabled

Remarks

None.

Related

_GUICtrlMenu_SetItemEnabled

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open enabled
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemDisabled($hFile, 1)
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemEnabled($hFile, 1)
Writeln("Open is enabled : " & _GUICtrlMenu_GetItemEnabled($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemGrayed

Function Reference

_GUICtrlMenu_GetItemGrayed

Retrieves the status of the menu item grayed state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemGrayed($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is grayed
False: | Item is not grayed

Remarks

None.

Related

_GUICtrlMenu_SetItemGrayed

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open grayed
Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))
_GUICtrlMenu_SetItemGrayed($hFile, 1)
Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemHighlighted

Function Reference

_GUICtrlMenu_GetItemHighlighted

Retrieves the status of the menu item highlighted state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemHighlighted($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

True: | Item is highlighted
False: | Item is not highlighted

Remarks

None.

Related

_GUICtrlMenu_SetItemHighlighted

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open highlighted
Writeln("Open is highlighted: " & _GUICtrlMenu_GetItemHighlighted($hFile, 1))
_GUICtrlMenu_SetItemHighlighted($hFile, 1)
Writeln("Open is highlighted: " & _GUICtrlMenu_GetItemHighlighted($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemID

Function Reference

_GUICtrlMenu_GetItemID

Retrieves the menu item ID

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemID($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Application defined value associated with the menu item

Remarks

None.

Related

_GUICtrlMenu_SetItemID

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open command ID
Writeln("Open command ID: " & _GUICtrlMenu_GetItemID($hFile, 1))
_GUICtrlMenu_SetItemID($hFile, 1, 0)
Writeln("Open command ID: " & _GUICtrlMenu_GetItemID($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemInfo

Function Reference

_GUICtrlMenu_GetItemInfo

Retrieves information about a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemInfo($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | $tagMENUITEMINFO structure
Failure: | Set @error

Remarks

None.

Related

_GUICtrlMenu_SetItemInfo, $tagMENUITEMINFO

See Also

Search GetMenuItemInfo in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $tInfo

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open command ID
$tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))
DllStructSetData($tInfo, "ID", 0)
_GUICtrlMenu_SetItemInfo($hFile, 1, $tInfo)
$tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemRect

Function Reference

_GUICtrlMenu_GetItemRect

Retrieves the bounding rectangle for the specified menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemRect($hWnd, $hMenu, $iItem)

Parameters

$hWnd | Handle to the window containing the menu
$hMenu | Handle of the menu
$iItem | Zero based position of the menu item

Return Value

Returns an Array with the following format:
[0] = X coordinate of the upper left corner of the rectangle
[1] = Y coordinate of the upper left corner of the rectangle
[2] = X coordinate of the lower right corner of the rectangle
[3] = Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlMenu_GetItemRectEx

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $aRect

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Get File menu rectangle
$aRect = _GUICtrlMenu_GetItemRect($hWnd, $hMain, 0)

Writeln("File X1: " & $aRect[0])
Writeln("File Y1: " & $aRect[1])
Writeln("File X2: " & $aRect[2])
Writeln("File Y2: " & $aRect[3])

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemRectEx

Function Reference

_GUICtrlMenu_GetItemRectEx

Retrieves the bounding rectangle for the specified menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemRectEx($hWnd, $hMenu, $iItem)

Parameters

$hWnd | Handle to the window containing the menu
$hMenu | Handle of the menu
$iItem | Zero based position of the menu item

Return Value

Success: | tagRECT structure
Failure: | Set @error

Remarks

None.

Related

_GUICtrlMenu_GetItemRect

See Also

Search GetMenuItemRect in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $tRect

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Get File menu rectangle
$tRect = _GUICtrlMenu_GetItemRectEx($hWnd, $hMain, 0)

Writeln("File X1: " & DllStructGetData($tRect, "Left"))
Writeln("File Y1: " & DllStructGetData($tRect, "Top"))
Writeln("File X2: " & DllStructGetData($tRect, "Right"))
Writeln("File Y2: " & DllStructGetData($tRect, "Bottom"))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemState

Function Reference

_GUICtrlMenu_GetItemState

Retrieves the menu item state

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemState($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Menu item type. Can be one or more of the following:
1 - Item is checked
2 - Item is the default item
4 - Item is disabled
8 - Item is disabled
16 - Item is highlighted

Remarks

None.

Related

_GUICtrlMenu_GetItemStateEx, _GUICtrlMenu_SetItemState

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get Open item state
_GUICtrlMenu_SetItemChecked($hFile, 1)
Writeln("Open item state: " & _GUICtrlMenu_GetItemState($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemStateEx

Function Reference

_GUICtrlMenu_GetItemStateEx

Retrieves the menu flags associated with the specified menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemStateEx($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | If the menu item opens a submenu the low-order byte of the return value contains the menu flags associated with the item, and the high-order byte contains the number of items in the submenu opened by the item. Otherwise, the return value is a mask of the menu flags.
Failure: | -1

Remarks

None.

Related

_GUICtrlMenu_SetItemState, _GUICtrlMenu_GetItemState

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get Open item state
_GUICtrlMenu_SetItemState($hFile, 1, $MFS_CHECKED)
Writeln("Open item state: " & _GUICtrlMenu_GetItemStateEx($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemSubMenu

Function Reference

_GUICtrlMenu_GetItemSubMenu

Retrieves a the submenu activated by a specified item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemSubMenu($hMenu, $iItem)

Parameters

$hMenu | Handle of the menu
$iItem | Zero based position of the menu item

Return Value

Success: | A handle to the drop down menu or submenu activated by the menu item
Failure: | 0

Remarks

None.

Related

_GUICtrlMenu_SetItemSubMenu, _GUICtrlMenu_RemoveMenu

See Also

Search GetSubMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, 0)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Help menu
MemoWrite("Help submenu handle: " & _GUICtrlMenu_GetItemSubMenu ($hMain, 2))
_GUICtrlMenu_SetItemSubMenu ($hMain, 2, $hHelp)
MemoWrite("Help submenu handle: " & _GUICtrlMenu_GetItemSubMenu ($hMain, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_GetItemText

Function Reference

_GUICtrlMenu_GetItemText

Retrieves the text of the specified menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemText($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | Menu item text
Failure: | set @error

Remarks

None.

Related

_GUICtrlMenu_SetItemText

See Also

Search GetMenuString in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open item text
Writeln("Open item text: " & _GUICtrlMenu_GetItemText($hFile, 1))
_GUICtrlMenu_SetItemText($hFile, 1, "&Closed")
Writeln("Open item text: " & _GUICtrlMenu_GetItemText($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetItemType

Function Reference

_GUICtrlMenu_GetItemType

Retrieves the menu item type

#Include <GuiMenu.au3>
_GUICtrlMenu_GetItemType($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Returns the Menu item type. Can be one or more of the following:
$MFT_BITMAP - Item is displayed using a bitmap
$MFT_MENUBARBREAK - Item is placed on a new line. A vertical line separates the new column from the old.
$MFT_MENUBREAK - Item is placed on a new line. The columns are not separated by a vertical line.
$MFT_OWNERDRAW - Item is owner drawn
$MFT_RADIOCHECK - Item is displayed using a radio button mark
$MFT_RIGHTJUSTIFY - Item is right justified
$MFT_RIGHTORDER - Item cascades from right to left
$MFT_SEPARATOR - Item is a separator

Remarks

None.

Related

_GUICtrlMenu_SetItemType

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Change Open item type
Writeln("Open item type: 0x" & Hex(_GUICtrlMenu_GetItemType($hFile, 1)))
_GUICtrlMenu_SetItemType($hFile, 1, $MFT_RADIOCHECK)
_GUICtrlMenu_CheckRadioItem($hFile, 0, 8, 1)
Writeln("Open item type: 0x" & Hex(_GUICtrlMenu_GetItemType($hFile, 1)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenu

Function Reference

_GUICtrlMenu_GetMenu

Retrieves the handle of the menu assigned to the given window

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenu($hWnd)

Parameters

$hWnd Identifies the window whose menu handle is retrieved

Return Value

Success: | The handle of the menu
Failure: | 0

Remarks

_GUICtrlMenu_GetMenu does not work on floating menu bars. Floating menu bars are custom controls that mimic standard
menus, but are not menus.

Related

_GUICtrlMenu_SetMenu, _GUICtrlMenu_FindParent

See Also

Search GetMenu in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hItem1, $hItem2

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Create subitem menu
$hItem1 = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hItem1, 0, "SubItem &1", 0x1000)
_GUICtrlMenu_InsertMenuItem($hItem1, 1, "SubItem &2", 0x1001)

; Create menu
$hItem2 = _GUICtrlMenu_CreateMenu()
_GUICtrlMenu_InsertMenuItem($hItem2, 0, "Item &1", 0x2000, $hItem1)
_GUICtrlMenu_InsertMenuItem($hItem2, 1, "Item &2", 0x2001)
_GUICtrlMenu_InsertMenuItem($hItem2, 2, "", 0)
_GUICtrlMenu_InsertMenuItem($hItem2, 3, "Item &3", 0x2002)
_GUICtrlMenu_InsertMenuItem($hItem2, 4, "Item &4", 0x2003)

; Insert new menu into Notepad
_GUICtrlMenu_InsertMenuItem($hMain, 6, "&AutoIt", 0, $hItem2)
_GUICtrlMenu_DrawMenuBar($hWnd)

EndFunc ;==>_Main


Function _GUICtrlMenu_GetMenuBackground

Function Reference

_GUICtrlMenu_GetMenuBackground

Retrieves the brush to use for the menu's background

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuBackground($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Returns the Brush used for the menu's background

Remarks

None.

Related

_GUICtrlMenu_SetMenuBackground

Example

#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $hBrush

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; File menu background
Writeln("File menu background: 0x" & Hex(_GUICtrlMenu_GetMenuBackground($hFile)))
$hBrush = _WinAPI_GetSysColorBrush($COLOR_INFOBK)
_GUICtrlMenu_SetMenuBackground($hFile, $hBrush)
Writeln("File menu background: 0x" & Hex(_GUICtrlMenu_GetMenuBackground($hFile)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuBarInfo

Function Reference

_GUICtrlMenu_GetMenuBarInfo

Retrieves information about the specified menu bar

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuBarInfo($hWnd[, $iItem = 0[, $iObject = 1]])

Parameters

$hWnd | Handle to the window whose information is to be retrieved
$iItem | [optional] Specifies the item for which to retrieve information. If 0, the function retrieves information about the menu itself. If 1, the function retrieves information about the first item on the menu, and so on.
$iObject | [optional] Specifies the menu object: 0 - The popup menu associated with the window 1 - The menu bar associated with the window 2 - The system menu associated with the window

Return Value

Success: | Array with the following format:
 | [0] - X coordinate of the upper left corner of the rectangle
 | [1] - Y coordinate of the upper left corner of the rectangle
 | [2] - X coordinate of the lower right corner of the rectangle
 | [3] - Y coordinate of the lower right corner of the rectangle
 | [4] - Handle to the menu bar or popup menu
 | [5] - Handle to the submenu
 | [6] - True if the menu bar has focus, otherwise False
 | [7] - True if the menu item has focus, otherwise False
Failure: | set @error

Remarks

None.

Related

See Also

Search GetMenuBarInfo in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $aInfo

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")

; Get menu bar info
$aInfo = _GUICtrlMenu_GetMenuBarInfo($hWnd)
Writeln("Left ............: " & $aInfo[0])
Writeln("Top .............: " & $aInfo[1])
Writeln("Right ...........: " & $aInfo[2])
Writeln("Bottom ..........: " & $aInfo[3])
Writeln("Menu handle .....: 0x" & Hex($aInfo[4]))
Writeln("Submenu Handle ..: 0x" & Hex($aInfo[5]))
Writeln("Menu bar focused : " & $aInfo[6])
Writeln("Menu item focused: " & $aInfo[7])

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuContextHelpID

Function Reference

_GUICtrlMenu_GetMenuContextHelpID

Retrieves the context help identifier

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuContextHelpID($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Returns the Context help identifier

Remarks

None.

Related

_GUICtrlMenu_SetMenuContextHelpID

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu help context ID
Writeln("File help context ID: " & _GUICtrlMenu_GetMenuContextHelpID($hFile))
_GUICtrlMenu_SetMenuContextHelpID($hFile, 1234)
Writeln("File help context ID: " & _GUICtrlMenu_GetMenuContextHelpID($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuData

Function Reference

_GUICtrlMenu_GetMenuData

Retrieves the application defined value

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuData($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Returns the Application defined value

Remarks

None.

Related

_GUICtrlMenu_SetMenuData

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu data
Writeln("File data: " & _GUICtrlMenu_GetMenuData($hFile))
_GUICtrlMenu_SetMenuData($hFile, 1234)
Writeln("File data: " & _GUICtrlMenu_GetMenuData($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuDefaultItem

Function Reference

_GUICtrlMenu_GetMenuDefaultItem

Retrieves the default menu item on the specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuDefaultItem($hMenu[, $fByPos = True[, $iFlags = 0]])

Parameters

$hMenu | Handle of the menu
$fByPos | [optional] Determines whether to retrive the menu items's identifer of it's position: True - Return menu item position False - Return menu item identifier
$iFlags | [optional] Specifies how the function searches for menu items: 0 - No special search parameters 1 - Specifies that the function will return a default item even if it is disabled 2 - Specifies that if the default item is one that opens a submenu the function is to search recursively in the corresponding submenu.

Return Value

Success: | The identifier or position of the menu item
Failure: | -1

Remarks

None.

Related

_GUICtrlMenu_SetMenuDefaultItem

See Also

Search GetMenuDefaultItem in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu default item
Writeln("File menu default item: " & _GUICtrlMenu_GetMenuDefaultItem($hFile))
_GUICtrlMenu_SetMenuDefaultItem($hFile, 1)
Writeln("File menu default item: " & _GUICtrlMenu_GetMenuDefaultItem($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuHeight

Function Reference

_GUICtrlMenu_GetMenuHeight

Retrieves the maximum height of a menu

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuHeight($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Returns the Maximum height of the menu in pixels

Remarks

When the menu items exceed the space available, scroll bars are automatically used. The default (0) is the screen height.

Related

_GUICtrlMenu_SetMenuHeight

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu max height
Writeln("File menu max height: " & _GUICtrlMenu_GetMenuHeight($hFile))
_GUICtrlMenu_SetMenuHeight($hFile, 100)
Writeln("File menu max height: " & _GUICtrlMenu_GetMenuHeight($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuInfo

Function Reference

_GUICtrlMenu_GetMenuInfo

Retrieves information about a specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuInfo($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Success: | $tagMENUINFO structure
Failure: | set @error

Remarks

None.

Related

_GUICtrlMenu_SetMenuInfo, $tagMENUINFO

See Also

Search GetMenuInfo in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $tInfo

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu information
$tInfo = _GUICtrlMenu_GetMenuInfo($hFile)
Writeln("Menu style ..........: " & DllStructGetData($tInfo, "Style"))
Writeln("Menu max height .....: " & DllStructGetData($tInfo, "YMax"))
Writeln("Menu background brush: " & DllStructGetData($tInfo, "hBack"))
Writeln("Menu context help ID : " & DllStructGetData($tInfo, "ContextHelpID"))
Writeln("Menu data ...........: " & DllStructGetData($tInfo, "MenuData"))
Writeln("")
$tInfo = DllStructCreate($tagMENUINFO)
DllStructSetData($tInfo, "Size", DllStructGetSize($tInfo))
DllStructSetData($tInfo, "Mask", BitOR($MIM_HELPID, $MIM_MAXHEIGHT, $MIM_MENUDATA))
DllStructSetData($tInfo, "YMax", 100)
DllStructSetData($tInfo, "ContextHelpID", 1234)
DllStructSetData($tInfo, "MenuData", 4567)
_GUICtrlMenu_SetMenuInfo($hFile, $tInfo)
$tInfo = _GUICtrlMenu_GetMenuInfo($hFile)
Writeln("Menu style ..........: " & DllStructGetData($tInfo, "Style"))
Writeln("Menu max height .....: " & DllStructGetData($tInfo, "YMax"))
Writeln("Menu background brush: " & DllStructGetData($tInfo, "hBack"))
Writeln("Menu context help ID : " & DllStructGetData($tInfo, "ContextHelpID"))
Writeln("Menu data ...........: " & DllStructGetData($tInfo, "MenuData"))
Writeln("")

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetMenuStyle

Function Reference

_GUICtrlMenu_GetMenuStyle

Retrieves the style information for a menu

#Include <GuiMenu.au3>
_GUICtrlMenu_GetMenuStyle($hMenu)

Parameters

$hMenu Handle of the menu

Return Value

Returns the Style of the menu. It can be one or more of the following values:
$MNS_AUTODISMISS - Menu automatically ends when mouse is outside the menu for 10 seconds
$MNS_CHECKORBMP - The same space is reserved for the check mark and the bitmap
$MNS_DRAGDROP - Menu items are OLE drop targets or drag sources
$MNS_MODELESS - Menu is modeless
$MNS_NOCHECK - No space is reserved to the left of an item for a check mark
$MNS_NOTIFYBYPOS - Menu owner receives a $WM_MENUCOMMAND message instead of a $WM_COMMAND message when a selection is made.

Remarks

None.

Related

_GUICtrlMenu_SetMenuStyle

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu style
Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))
_GUICtrlMenu_SetMenuStyle($hFile, $MNS_NOCHECK)
Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_GetSystemMenu

Function Reference

_GUICtrlMenu_GetSystemMenu

Allows the application to access the window menu for copying and modifying

#Include <GuiMenu.au3>
_GUICtrlMenu_GetSystemMenu($hWnd[, $fRevert = False])

Parameters

$hWnd | Handle to the window that will own a copy of the window menu
$fRevert | [optional] Specifies the action to be taken. If this parameter is False, the function returns a handle to the copy of the window menu currently in use. The copy is initially identical to the window menu, but it can be modified. If this parameter is True, the function resets the window menu back to the default state. The previous window menu, if any, is destroyed.

Return Value

Returns If the $fRevert parameter is False, the return value is a handle to a copy of the window menu.
If the $fRevert parameter is True, the return value is 0.

Remarks

Any window that does not use the GetSystemMenu function to make its own copy of the window menu receives the
standard window menu. The window menu initially contains items with various identifier values, such as
$SC_CLOSE, $SC_MOVE, and $SC_SIZE. Menu items on the window menu send $WM_SYSCOMMAND messages. All predefined
window menu items have identifier numbers greater than 0xF000. If an application adds commands to the window
menu, it should use identifier numbers less than 0xF000. The system automatically grays items on the standard
window menu, depending on the situation. The application can perform its own checking or graying by responding
to the $WM_INITMENU message that is sent before any menu is displayed.

Related

See Also

Search GetSystemMenu in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMenu, $iCount, $iI

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMenu = _GUICtrlMenu_GetSystemMenu($hWnd)

; Play with system menu
_GUICtrlMenu_InsertMenuItem($hMenu, 5, "&AutoIt")

; Display system menu
$iCount = _GUICtrlMenu_GetItemCount($hMenu)
Writeln("System menu handle: 0x" & Hex($hMenu))
Writeln("Item count .......: " & $iCount)
For $iI = 0 To $iCount - 1
Writeln("Item " & $iI & " text ......: " & _GUICtrlMenu_GetItemText($hMenu, $iI))
Next

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("Untitled - Notepad", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_InsertMenuItem

Function Reference

_GUICtrlMenu_InsertMenuItem

Inserts a new menu item at the specified position

#Include <GuiMenu.au3>
_GUICtrlMenu_InsertMenuItem($hMenu, $iIndex, $sText[, $iCmdID = 0[, $hSubMenu = 0]])

Parameters

$hMenu | Handle of the menu
$iIndex | Zero based position of the menu item before which to insert the new item
$sText | Menu item text. If blank, a separator will be inserted.
$iCmdID | [optional] Command ID to assign to the item
$hSubMenu | [optional] Handle to the submenu associated with the menu item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_InsertMenuItemEx, _GUICtrlMenu_AddMenuItem, _GUICtrlMenu_AppendMenu

See Also

Search InsertMenuItem in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main


Function _GUICtrlMenu_InsertMenuItemEx

Function Reference

_GUICtrlMenu_InsertMenuItemEx

Inserts a new menu item at the specified position in a menu

#Include <GuiMenu.au3>
_GUICtrlMenu_InsertMenuItemEx($hMenu, $iIndex, ByRef $tMenu[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iIndex | Position of the menu item before which to insert the new item
$tMenu | $tagMENUITEMINFO structure
$fByPos | [optional] Menu identifier flag: True - $iIndex is a zero based item position False - $iIndex is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_InsertMenuItem, $tagMENUITEMINFO

See Also

Search InsertMenuItem in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
InsertItem($hFile, 0, "&New", $idNew)
InsertItem($hFile, 1, "&Open", $idOpen)
InsertItem($hFile, 2, "&Save", $idSave)
InsertItem($hFile, 3, "", 0)
InsertItem($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
InsertItem($hEdit, 0, "&Cut", $idCut)
InsertItem($hEdit, 1, "C&opy", $idCopy)
InsertItem($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
InsertItem($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
InsertItem($hMain, 0, "&File", 0, $hFile)
InsertItem($hMain, 1, "&Edit", 0, $hEdit)
InsertItem($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)
GUISetState()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Insert menu item (the hard way)
Func InsertItem($hMenu, $iIndex, $sText, $iCmdID = 0, $hSubMenu = 0)
Local $tMenu, $tText, $aResult

$tMenu = DllStructCreate($tagMENUITEMINFO)
DllStructSetData($tMenu, "Size", DllStructGetSize($tMenu))
DllStructSetData($tMenu, "Mask", BitOR($MIIM_ID, $MIIM_STRING, $MIIM_SUBMENU))
DllStructSetData($tMenu, "ID", $iCmdID)
DllStructSetData($tMenu, "SubMenu", $hSubMenu)
If $sText = "" Then
DllStructSetData($tMenu, "Mask", $MIIM_FTYPE)
DllStructSetData($tMenu, "Type", $MFT_SEPARATOR)
Else
DllStructSetData($tMenu, "Mask", BitOR($MIIM_ID, $MIIM_STRING, $MIIM_SUBMENU))
$tText = DllStructCreate("wchar Text[" & StringLen($sText) + 1 & "]")
DllStructSetData($tText, "Text", $sText)
DllStructSetData($tMenu, "TypeData", DllStructGetPtr($tText))
EndIf
_GUICtrlMenu_InsertMenuItemEx ($hMenu, $iIndex, $tMenu)
EndFunc ;==>InsertItem


Function _GUICtrlMenu_IsMenu

Function Reference

_GUICtrlMenu_IsMenu

Determines whether a handle is a menu handle

#Include <GuiMenu.au3>
_GUICtrlMenu_IsMenu($hMenu)

Parameters

$hMenu Handle to be tested

Return Value

True: Handle is a menu handle
False: Handle is not a menu handle

Remarks

None.

Related

See Also

Search IsMenu in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Check return value
Writeln("Is Menu: " & _GUICtrlMenu_IsMenu($hWnd))
Writeln("Is Menu: " & _GUICtrlMenu_IsMenu($hMain))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_LoadMenu

Function Reference

_GUICtrlMenu_LoadMenu

Loads the specified menu resource from the executable file associated with an application instance

#Include <GuiMenu.au3>
_GUICtrlMenu_LoadMenu($hInst, $sMenuName)

Parameters

$hInst | Handle to the module containing the menu resource to be loaded
$sMenuName | String that contains the name of the menu resource. Alternatively, this parameter can consist of the resource identifier in the low order word and 0 in the high order word.

Return Value

Success: | Handle to the menu resource
Failure: | 0

Remarks

None.

Related

See Also

Search LoadMenu in MSDN Library


Function _GUICtrlMenu_MapAccelerator

Function Reference

_GUICtrlMenu_MapAccelerator

Maps a menu accelerator key to it's position in the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_MapAccelerator($hMenu, $cAccel)

Parameters

$hMenu | Handle to menu
$cAccel | Accelerator key

Return Value

Success: | The zero based position of the item in the menu
Failure: | -1

Remarks

None.

Related

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Map Open accelerator ID
Writeln("Open command ID: " & _GUICtrlMenu_MapAccelerator($hFile, "O"))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_MenuItemFromPoint

Function Reference

_GUICtrlMenu_MenuItemFromPoint

Determines which menu item is at the specified location.

#Include <GuiMenu.au3>
_GUICtrlMenu_MenuItemFromPoint($hWnd, $hMenu[, $iX = -1[, $iY = -1]])

Parameters

$hWnd | Handle to the window containing the menu. If this value is 0 and $hMenu represents a popup menu, the function will find the menu window.
$hMenu | Handle to the menu containing the menu items to hit test
$iX | [optional] X position to test. If -1, the current mouse X position will be used.
$iY | [optional] Y position to test. If -1, the current mouse Y position will be used.

Return Value

Success: | The zero based position of the menu item at the specified location
Failure: | -1

Remarks

If $hMenu specifies a menu bar the coordinates are window coordinates. Otherwise, they are client coordinates.

Related

See Also

Search MenuItemFromPoint in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $tRect, $tPoint, $iX, $iY, $iIndex

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Open File menu
Send("!f")
Sleep(1000)

; Move mouse over Open menu item
$tRect = _GUICtrlMenu_GetItemRectEx($hWnd, $hFile, 1)
$tPoint = _Lib_PointFromRect($tRect, True)
_Lib_GetXYFromPoint($tPoint, $iX, $iY)
MouseMove($iX, $iY, 1)
Sleep(1000)

; Get menu item from current mouse position
$iIndex = _GUICtrlMenu_MenuItemFromPoint($hWnd, $hFile)
Send("{ESC 2}")
Writeln("Menu item under cursor was: " & $iIndex)

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln

Func _Lib_PointFromRect(ByRef $tRect, $fCenter = True)
Local $iX1, $iY1, $iX2, $iY2, $tPoint

$iX1 = DllStructGetData($tRect, "Left")
$iY1 = DllStructGetData($tRect, "Top")
$iX2 = DllStructGetData($tRect, "Right")
$iY2 = DllStructGetData($tRect, "Bottom")
If $fCenter Then
$iX1 = $iX1 + (($iX2 - $iX1) / 2)
$iY1 = $iY1 + (($iY2 - $iY1) / 2)
EndIf
$tPoint = DllStructCreate($tagPOINT)
DllStructSetData($tPoint, "X", $iX1)
DllStructSetData($tPoint, "Y", $iY1)
Return $tPoint
EndFunc ;==>_Lib_PointFromRect

Func _Lib_GetXYFromPoint(ByRef $tPoint, ByRef $iX, ByRef $iY)
$iX = DllStructGetData($tPoint, "X")
$iY = DllStructGetData($tPoint, "Y")
EndFunc ;==>_Lib_GetXYFromPoint


Function _GUICtrlMenu_RemoveMenu

Function Reference

_GUICtrlMenu_RemoveMenu

Deletes a menu item or detaches a submenu from the specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_RemoveMenu($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Handle to the menu to be changed
$iItem | Identifier or position of the menu item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

If the menu item opens a drop down menu or submenu, _GUICtrlMenu_RemoveMenu does not destroy the menu or its handle,
allowing the menu to be reused. Before this function is called, the _GUICtrlMenu_GetItemSubMenu function should be
used retrieve a handle to the drop-down menu or submenu.

Related

_GUICtrlMenu_GetItemSubMenu

See Also

Search RemoveMenu in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Remove Help menu
_GUICtrlMenu_RemoveMenu($hMain, 4)

EndFunc ;==>_Main


Function _GUICtrlMenu_SetItemBitmaps

Function Reference

_GUICtrlMenu_SetItemBitmaps

Associates the specified bitmap with a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemBitmaps($hMenu, $iItem, $hChecked, $hUnChecked[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$hChecked | Handle to the bitmap displayed when the menu item is selected
$hUnChecked | Handle to the bitmap displayed when the menu item is not selected
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

If either the hBitmapUnchecked or hBitmapChecked parameter is 0, the system displays nothing next to the menu
item for the corresponding check state. If both parameters are 0, the system displays the default check mark
bitmap when the item is selected, and removes the bitmap when the item is not selected.

Related

_GUICtrlMenu_SetItemBmpChecked, _GUICtrlMenu_SetItemBmpUnchecked

See Also

Search SetMenuItemBitmaps in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $hBmp1, $hBmp2
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set File menu checked/unchecked bitmaps
$hBmp1 = _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)
$hBmp2 = _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11)
_GUICtrlMenu_SetItemBitmaps ($hFile, 0, $hBmp1, $hBmp2)
_GUICtrlMenu_SetItemBitmaps ($hFile, 1, $hBmp1, $hBmp2)
_GUICtrlMenu_SetItemBitmaps ($hFile, 2, $hBmp1, $hBmp2)

; Check Open menu item
_GUICtrlMenu_CheckMenuItem ($hFile, 1)

; Show that bitmap handles match
MemoWrite("Checked handle ......: 0x" & Hex($hBmp1))
MemoWrite("Unchecked handle ....: 0x" & Hex($hBmp2))
MemoWrite("Open checked handle .: 0x" & Hex(_GUICtrlMenu_GetItemBmpChecked ($hFile, 0)))
MemoWrite("Open unchecked handle: 0x" & Hex(_GUICtrlMenu_GetItemBmpUnchecked ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetItemBmp

Function Reference

_GUICtrlMenu_SetItemBmp

Sets the bitmap displayed for the item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemBmp($hMenu, $iItem, $hBmp[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$hBmp | Handle to the item bitmap
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemBmp

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set New menu item to have a bitmap
_GUICtrlMenu_SetItemBmp ($hFile, 0, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
MemoWrite("Item bitmap handle: 0x" & Hex(_GUICtrlMenu_GetItemBmp ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetItemBmpChecked

Function Reference

_GUICtrlMenu_SetItemBmpChecked

Sets the bitmap displayed if the item is selected

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemBmpChecked($hMenu, $iItem, $hBmp[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$hBmp | Handle to the bitmap to display next to the item if it is selected
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemBmpChecked, _GUICtrlMenu_SetItemBitmaps

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $hBmp1, $hBmp2
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set File menu checked/unchecked bitmaps
$hBmp1 = _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)
$hBmp2 = _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 0, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 1, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 2, $hBmp1)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 0, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 1, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 2, $hBmp2)

; Check Open menu item
_GUICtrlMenu_CheckMenuItem ($hFile, 1)

; Show that bitmap handles match
MemoWrite("Checked handle ......: 0x" & Hex($hBmp1))
MemoWrite("Unchecked handle ....: 0x" & Hex($hBmp2))
MemoWrite("Open checked handle .: 0x" & Hex(_GUICtrlMenu_GetItemBmpChecked ($hFile, 0)))
MemoWrite("Open unchecked handle: 0x" & Hex(_GUICtrlMenu_GetItemBmpUnchecked ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetItemBmpUnchecked

Function Reference

_GUICtrlMenu_SetItemBmpUnchecked

Sets the bitmap displayed if the item is not selected

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemBmpUnchecked($hMenu, $iItem, $hBmp[, $fByPos = True])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$hBmp | Handle to the bitmap to display next to the item if it is not selected
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemBmpUnchecked, _GUICtrlMenu_SetItemBitmaps

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain, $hBmp1, $hBmp2
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set File menu checked/unchecked bitmaps
$hBmp1 = _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11)
$hBmp2 = _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 0, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 1, $hBmp1)
_GUICtrlMenu_SetItemBmpChecked ($hFile, 2, $hBmp1)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 0, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 1, $hBmp2)
_GUICtrlMenu_SetItemBmpUnChecked ($hFile, 2, $hBmp2)

; Check Open menu item
_GUICtrlMenu_CheckMenuItem ($hFile, 1)

; Show that bitmap handles match
MemoWrite("Checked handle ......: 0x" & Hex($hBmp1))
MemoWrite("Unchecked handle ....: 0x" & Hex($hBmp2))
MemoWrite("Open checked handle .: 0x" & Hex(_GUICtrlMenu_GetItemBmpChecked ($hFile, 0)))
MemoWrite("Open unchecked handle: 0x" & Hex(_GUICtrlMenu_GetItemBmpUnchecked ($hFile, 0)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetItemChecked

Function Reference

_GUICtrlMenu_SetItemChecked

Sets the checked state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemChecked($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fState | [optional] True to set state, otherwise False
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemChecked

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Check Open menu item
Writeln("Open is checked: " & _GUICtrlMenu_GetItemChecked($hFile, 1))
_GUICtrlMenu_SetItemChecked($hFile, 1)
Writeln("Open is checked: " & _GUICtrlMenu_GetItemChecked($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemData

Function Reference

_GUICtrlMenu_SetItemData

Sets the application defined value for a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemData($hMenu, $iItem, $iData[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$iData | Application defined value
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemData

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)

; Get/Set File menu item data
Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))
_GUICtrlMenu_SetItemData($hMain, 0, 1234)
Writeln("File menu item data: " & _GUICtrlMenu_GetItemData($hMain, 0))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemDefault

Function Reference

_GUICtrlMenu_SetItemDefault

Sets the status of the menu item default state

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemDefault($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Handle of the menu
$iItem | Identifier or position of the menu item
$fState | [optional] Item state to set: True - State is enabled False - State is disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemDefault

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File default item
Writeln("Open is default: " & _GUICtrlMenu_GetItemDefault($hFile, 1))
_GUICtrlMenu_SetItemDefault($hFile, 1)
Writeln("Open is default: " & _GUICtrlMenu_GetItemDefault($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemDisabled

Function Reference

_GUICtrlMenu_SetItemDisabled

Sets the disabled state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemDisabled($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fState | [optional] True to set state, otherwise False
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemDisabled

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open enabled
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemDisabled($hFile, 1)
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemEnabled($hFile, 1)
Writeln("Open is enabled : " & _GUICtrlMenu_GetItemEnabled($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemEnabled

Function Reference

_GUICtrlMenu_SetItemEnabled

Sets the enabled state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemEnabled($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fState | [optional] Item state to set: True - State is enabled False - State is disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemEnabled

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open enabled
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemDisabled($hFile, 1)
Writeln("Open is disabled: " & _GUICtrlMenu_GetItemDisabled($hFile, 1))
_GUICtrlMenu_SetItemEnabled($hFile, 1)
Writeln("Open is enabled : " & _GUICtrlMenu_GetItemEnabled($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemGrayed

Function Reference

_GUICtrlMenu_SetItemGrayed

Sets the grayed state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemGrayed($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fState | [optional] Item state to set: True - State is enabled False - State is disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemGrayed

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open grayed
Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))
_GUICtrlMenu_SetItemGrayed($hFile, 1)
Writeln("Open is grayed: " & _GUICtrlMenu_GetItemGrayed($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemHighlighted

Function Reference

_GUICtrlMenu_SetItemHighlighted

Sets the highlighted state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemHighlighted($hMenu, $iItem[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$fState | [optional] Item state to set: True - State is enabled False - State is disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemHighlighted

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open highlighted
Writeln("Open is highlighted: " & _GUICtrlMenu_GetItemHighlighted($hFile, 1))
_GUICtrlMenu_SetItemHighlighted($hFile, 1)
Writeln("Open is highlighted: " & _GUICtrlMenu_GetItemHighlighted($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemID

Function Reference

_GUICtrlMenu_SetItemID

Sets the menu item ID

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemID($hMenu, $iItem, $iID[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$iID | Menu item ID
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemID

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open command ID
Writeln("Open command ID: " & _GUICtrlMenu_GetItemID($hFile, 1))
_GUICtrlMenu_SetItemID($hFile, 1, 0)
Writeln("Open command ID: " & _GUICtrlMenu_GetItemID($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemInfo

Function Reference

_GUICtrlMenu_SetItemInfo

Changes information about a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemInfo($hMenu, $iItem, ByRef $tInfo[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$tInfo | $tagMENUITEMINFO structure
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemInfo, $tagMENUITEMINFO

See Also

Search SetMenuItemInfo in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $tInfo

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open command ID
$tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))
DllStructSetData($tInfo, "ID", 0)
_GUICtrlMenu_SetItemInfo($hFile, 1, $tInfo)
$tInfo = _GUICtrlMenu_GetItemInfo($hFile, 1)
Writeln("Open command ID: " & DllStructGetData($tInfo, "ID"))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemState

Function Reference

_GUICtrlMenu_SetItemState

Sets the state of a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemState($hMenu, $iItem, $iState[, $fState = True[, $fByPos = True]])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$iState | Menu item state: $MFS_CHECKED - Item is checked $MFS_DEFAULT - Item is the default item $MFS_DISABLED - Item is disabled $MFS_GRAYED - Item is disabled $MFS_HILITE - Item is highlighted
$fState | [optional] Item state to set: True - State is enabled False - State is disabled
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemState, _GUICtrlMenu_GetItemStateEx

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get Open item state
_GUICtrlMenu_SetItemState($hFile, 1, $MFS_CHECKED)
Writeln("Open item state: " & _GUICtrlMenu_GetItemStateEx($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemSubMenu

Function Reference

_GUICtrlMenu_SetItemSubMenu

Sets the drop down menu or submenu associated with the menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemSubMenu($hMenu, $iItem, $hSubMenu[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$hSubMenu | Handle to the drop down menu or submenu
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemSubMenu

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain
Local Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, 0)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Help menu
MemoWrite("Help submenu handle: " & _GUICtrlMenu_GetItemSubMenu ($hMain, 2))
_GUICtrlMenu_SetItemSubMenu ($hMain, 2, $hHelp)
MemoWrite("Help submenu handle: " & _GUICtrlMenu_GetItemSubMenu ($hMain, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetItemText

Function Reference

_GUICtrlMenu_SetItemText

Sets the text for a menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemText($hMenu, $iItem, $sText[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$sText | Menu item text
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemText

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set Open item text
Writeln("Open item text: " & _GUICtrlMenu_GetItemText($hFile, 1))
_GUICtrlMenu_SetItemText($hFile, 1, "&Closed")
Writeln("Open item text: " & _GUICtrlMenu_GetItemText($hFile, 1))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetItemType

Function Reference

_GUICtrlMenu_SetItemType

Sets the menu item type

#Include <GuiMenu.au3>
_GUICtrlMenu_SetItemType($hMenu, $iItem, $iType[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the menu item
$iType | Menu item type. This can be one or more of the following values: $MFT_BITMAP - Item is displayed using a bitmap $MFT_MENUBARBREAK - Item is placed on a new line. A vertical line separates the new column from the old. $MFT_MENUBREAK - Item is placed on a new line. The columns are not separated by a vertical line. $MFT_OWNERDRAW - Item is owner drawn $MFT_RADIOCHECK - Item is displayed using a radio button mark $MFT_RIGHTJUSTIFY - Item is right justified $MFT_RIGHTORDER - Item cascades from right to left $MFT_SEPARATOR - Item is a separator
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetItemType

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Change Open item type
Writeln("Open item type: 0x" & Hex(_GUICtrlMenu_GetItemType($hFile, 1)))
_GUICtrlMenu_SetItemType($hFile, 1, $MFT_RADIOCHECK)
_GUICtrlMenu_CheckRadioItem($hFile, 0, 8, 1)
Writeln("Open item type: 0x" & Hex(_GUICtrlMenu_GetItemType($hFile, 1)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenu

Function Reference

_GUICtrlMenu_SetMenu

Assigns a new menu to the specified window

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenu($hWnd, $hMenu)

Parameters

$hWnd | Handle to the window to which the menu is to be assigned
$hMenu | Handle to the new menu. If 0, the window's current menu is removed.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenu

See Also

Search SetMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo
Global Enum $idNew = 1000, $idOpen, $idSave, $idExit, $idCut, $idCopy, $idPaste, $idAbout

_Main()

Func _Main()
Local $hGUI, $hFile, $hEdit, $hHelp, $hMain

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)

; Create File menu
$hFile = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $idNew)
_GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hFile, 4, "E&xit", $idExit)

; Create Edit menu
$hEdit = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hEdit, 0, "&Cut", $idCut)
_GUICtrlMenu_InsertMenuItem ($hEdit, 1, "C&opy", $idCopy)
_GUICtrlMenu_InsertMenuItem ($hEdit, 2, "&Paste", $idPaste)

; Create Help menu
$hHelp = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hHelp, 0, "&About", $idAbout)

; Create Main menu
$hMain = _GUICtrlMenu_CreateMenu ()
_GUICtrlMenu_InsertMenuItem ($hMain, 0, "&File", 0, $hFile)
_GUICtrlMenu_InsertMenuItem ($hMain, 1, "&Edit", 0, $hEdit)
_GUICtrlMenu_InsertMenuItem ($hMain, 2, "&Help", 0, $hHelp)

; Set window menu
_GUICtrlMenu_SetMenu ($hGUI, $hMain)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 276, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Loop until user exits
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Handle menu commands
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch _WinAPI_LoWord ($iwParam)
Case $idNew
MemoWrite("New")
Case $idOpen
MemoWrite("Open")
Case $idSave
MemoWrite("Save")
Case $idExit
Exit
Case $idCut
MemoWrite("Cut")
Case $idCopy
MemoWrite("Copy")
Case $idPaste
MemoWrite("Paste")
Case $idAbout
MemoWrite("About")
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMenu_SetMenuBackground

Function Reference

_GUICtrlMenu_SetMenuBackground

Sets the background brush for the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuBackground($hMenu, $hBrush)

Parameters

$hMenu | Handle of the menu
$hBrush | Brush to use for the background

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuBackground

Example

#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $hBrush

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; File menu background
Writeln("File menu background: 0x" & Hex(_GUICtrlMenu_GetMenuBackground($hFile)))
$hBrush = _WinAPI_GetSysColorBrush($COLOR_INFOBK)
_GUICtrlMenu_SetMenuBackground($hFile, $hBrush)
Writeln("File menu background: 0x" & Hex(_GUICtrlMenu_GetMenuBackground($hFile)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuContextHelpID

Function Reference

_GUICtrlMenu_SetMenuContextHelpID

Sets the context help identifier for the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuContextHelpID($hMenu, $iHelpID)

Parameters

$hMenu | Handle of the menu
$iHelpID | Context help ID

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuContextHelpID

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu help context ID
Writeln("File help context ID: " & _GUICtrlMenu_GetMenuContextHelpID($hFile))
_GUICtrlMenu_SetMenuContextHelpID($hFile, 1234)
Writeln("File help context ID: " & _GUICtrlMenu_GetMenuContextHelpID($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuData

Function Reference

_GUICtrlMenu_SetMenuData

Sets the application defined for the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuData($hMenu, $iData)

Parameters

$hMenu | Handle of the menu
$iData | Application defined data

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuData

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu data
Writeln("File data: " & _GUICtrlMenu_GetMenuData($hFile))
_GUICtrlMenu_SetMenuData($hFile, 1234)
Writeln("File data: " & _GUICtrlMenu_GetMenuData($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuDefaultItem

Function Reference

_GUICtrlMenu_SetMenuDefaultItem

Sets the default menu item

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuDefaultItem($hMenu, $iItem[, $fByPos = True])

Parameters

$hMenu | Menu handle
$iItem | Identifier or position of the default menu item or -1 for no default item
$fByPos | [optional] Menu identifier flag: True - $iItem is a zero based item position False - $iItem is a menu item identifier

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuDefaultItem

See Also

Search SetMenuDefaultItem in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu default item
Writeln("File menu default item: " & _GUICtrlMenu_GetMenuDefaultItem($hFile))
_GUICtrlMenu_SetMenuDefaultItem($hFile, 1)
Writeln("File menu default item: " & _GUICtrlMenu_GetMenuDefaultItem($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuHeight

Function Reference

_GUICtrlMenu_SetMenuHeight

Sets the maximum height of the menu

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuHeight($hMenu, $iHeight)

Parameters

$hMenu | Handle of the menu
$iHeight | Maximum height of the menu

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuHeight

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu max height
Writeln("File menu max height: " & _GUICtrlMenu_GetMenuHeight($hFile))
_GUICtrlMenu_SetMenuHeight($hFile, 100)
Writeln("File menu max height: " & _GUICtrlMenu_GetMenuHeight($hFile))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuInfo

Function Reference

_GUICtrlMenu_SetMenuInfo

Sets information for a specified menu

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuInfo($hMenu, ByRef $tInfo)

Parameters

$hMenu | Menu handle
$tInfo | $tagMENUINFO structure

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuInfo, $tagMENUINFO

See Also

Search SetMenuInfo in MSDN Library

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile, $tInfo

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu information
$tInfo = _GUICtrlMenu_GetMenuInfo($hFile)
Writeln("Menu style ..........: " & DllStructGetData($tInfo, "Style"))
Writeln("Menu max height .....: " & DllStructGetData($tInfo, "YMax"))
Writeln("Menu background brush: " & DllStructGetData($tInfo, "hBack"))
Writeln("Menu context help ID : " & DllStructGetData($tInfo, "ContextHelpID"))
Writeln("Menu data ...........: " & DllStructGetData($tInfo, "MenuData"))
Writeln("")
$tInfo = DllStructCreate($tagMENUINFO)
DllStructSetData($tInfo, "Size", DllStructGetSize($tInfo))
DllStructSetData($tInfo, "Mask", BitOR($MIM_HELPID, $MIM_MAXHEIGHT, $MIM_MENUDATA))
DllStructSetData($tInfo, "YMax", 100)
DllStructSetData($tInfo, "ContextHelpID", 1234)
DllStructSetData($tInfo, "MenuData", 4567)
_GUICtrlMenu_SetMenuInfo($hFile, $tInfo)
$tInfo = _GUICtrlMenu_GetMenuInfo($hFile)
Writeln("Menu style ..........: " & DllStructGetData($tInfo, "Style"))
Writeln("Menu max height .....: " & DllStructGetData($tInfo, "YMax"))
Writeln("Menu background brush: " & DllStructGetData($tInfo, "hBack"))
Writeln("Menu context help ID : " & DllStructGetData($tInfo, "ContextHelpID"))
Writeln("Menu data ...........: " & DllStructGetData($tInfo, "MenuData"))
Writeln("")

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_SetMenuStyle

Function Reference

_GUICtrlMenu_SetMenuStyle

Sets the menu style

#Include <GuiMenu.au3>
_GUICtrlMenu_SetMenuStyle($hMenu, $iStyle)

Parameters

$hMenu | Handle of the menu
$iStyle | Style of the menu. It can be one or more of the following values: $MNS_AUTODISMISS - Menu automatically ends when mouse is outside the menu for 10 seconds $MNS_CHECKORBMP - The same space is reserved for the check mark and the bitmap $MNS_DRAGDROP - Menu items are OLE drop targets or drag sources $MNS_MODELESS - Menu is modeless $MNS_NOCHECK - No space is reserved to the left of an item for a check mark $MNS_NOTIFYBYPOS - Menu owner receives a $WM_MENUCOMMAND message instead of a $WM_COMMAND message when a selection is made

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlMenu_GetMenuStyle

Example

#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hWnd, $hMain, $hFile

; Open Notepad
Run("Notepad.exe")
WinWaitActive("[CLASS:Notepad]")
$hWnd = WinGetHandle("[CLASS:Notepad]")
$hMain = _GUICtrlMenu_GetMenu($hWnd)
$hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0)

; Get/Set File menu style
Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))
_GUICtrlMenu_SetMenuStyle($hFile, $MNS_NOCHECK)
Writeln("File menu style: 0x" & Hex(_GUICtrlMenu_GetMenuStyle($hFile)))

EndFunc ;==>_Main

; Write a line of text to Notepad
Func Writeln($sText)
ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR)
EndFunc ;==>Writeln


Function _GUICtrlMenu_TrackPopupMenu

Function Reference

_GUICtrlMenu_TrackPopupMenu

Displays a shortcut menu at the specified location

#Include <GuiMenu.au3>
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd[, $iX = -1[, $iY = -1[, $iAlignX = 1[, $iAlignY = 1[, $iNotify = 0[, $iButtons = 0]]]]]])

Parameters

$hMenu | Handle to the shortcut menu to be displayed
$hWnd | Handle to the window that owns the shortcut menu
$iX | [optional] Specifies the horizontal location of the shortcut menu, in screen coordinates. If this is -1, the current mouse position is used.
$iY | [optional] Specifies the vertical location of the shortcut menu, in screen coordinates. If this is -1, the current mouse position is used.
$iAlignX | [optional] Specifies how to position the menu horizontally: 0 - Center the menu horizontally relative to $iX 1 - Position the menu so that its left side is aligned with $iX 2 - Position the menu so that its right side is aligned with $iX
$iAlignY | [optional] Specifies how to position the menu vertically: 0 - Position the menu so that its bottom side is aligned with $iY 1 - Position the menu so that its top side is aligned with $iY 2 - Center the menu vertically relative to $iY
$iNotify | [optional] Use to determine the selection withouta parent window: 1 - Do not send notification messages 2 - Return the menu item identifier of the user's selection
$iButtons | [optional] Mouse button the shortcut menu tracks: 0 - The user can select items with only the left mouse button 1 - The user can select items with both left and right buttons

Return Value

Success: | If $iNotify is set to 2, the return value is the menu item identifier of the item that the user selected. If the user cancels the menu without making a selection or if an error occurs, then the return value is zero. If $iNotify is not set to 2, the return value is 1.
Failure: | 0

Remarks

None.

Related

See Also

Search TrackPopupMenu in MSDN Library

Example

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global Enum $idOpen = 1000, $idSave, $idInfo

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Menu", 400, 300)
GUISetState()

; Register message handlers
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Handle WM_COMMAND messages
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Switch $iwParam
Case $idOpen
_WinAPI_ShowMsg ("Open")
Case $idSave
_WinAPI_ShowMsg ("Save")
Case $idInfo
_WinAPI_ShowMsg ("Info")
EndSwitch
EndFunc ;==>WM_COMMAND

; Handle WM_CONTEXTMENU messages
Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
Local $hMenu

$hMenu = _GUICtrlMenu_CreatePopup ()
_GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Open", $idOpen)
_GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Save", $idSave)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "", 0)
_GUICtrlMenu_InsertMenuItem ($hMenu, 3, "Info", $idInfo)
_GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
_GUICtrlMenu_DestroyMenu ($hMenu)
Return True
EndFunc ;==>WM_CONTEXTMENU


User Defined Functions

GuiMonthCal user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiMonthCal.au3>.

User Defined Function | Description
_GUICtrlMonthCal_Create | Creates a Month Calendar control
_GUICtrlMonthCal_Destroy | Delete the MonthCal control
_GUICtrlMonthCal_GetCalendarBorder | Gets the size of the border, in pixels
_GUICtrlMonthCal_GetCalendarCount | Gets the number of calendars currently displayed in the calendar control
_GUICtrlMonthCal_GetColor | Retrieves a given color for the control
_GUICtrlMonthCal_GetColorArray | Retrieves the color for a given portion of a month calendar control
_GUICtrlMonthCal_GetCurSel | Retrieves the currently selected date
_GUICtrlMonthCal_GetCurSelStr | Retrieves the currently selected date in string format
_GUICtrlMonthCal_GetFirstDOW | Retrieves the first day of the week
_GUICtrlMonthCal_GetFirstDOWStr | Retrieves the first day of the week as a string
_GUICtrlMonthCal_GetMaxSelCount | Retrieves the maximum date range that can be selected in a month calendar control
_GUICtrlMonthCal_GetMaxTodayWidth | Retrieves the maximum width of the "today" string in a month calendar control
_GUICtrlMonthCal_GetMinReqHeight | Retrieves the minimum height required to display a full month
_GUICtrlMonthCal_GetMinReqRect | Retrieves the minimum size required to display a full month
_GUICtrlMonthCal_GetMinReqRectArray | Retrieves the minimum size required to display a full month in a month calendar control
_GUICtrlMonthCal_GetMinReqWidth | Retrieves the minimum width required to display a full month
_GUICtrlMonthCal_GetMonthDelta | Retrieves the scroll rate for a month calendar control
_GUICtrlMonthCal_GetMonthRange | Retrieves date information that represents the high and low display limits
_GUICtrlMonthCal_GetMonthRangeMax | Retrieves date information that represents the high limit of the controls display
_GUICtrlMonthCal_GetMonthRangeMaxStr | Retrieves date information that represents the high limit of the controls display in string format
_GUICtrlMonthCal_GetMonthRangeMin | Retrieves date information that represents the low limit of the controls display
_GUICtrlMonthCal_GetMonthRangeMinStr | Retrieves date information that represents the low limit of the controls display in string format
_GUICtrlMonthCal_GetMonthRangeSpan | Returns a value that represents the range, in months, spanned
_GUICtrlMonthCal_GetRange | Retrieves the minimum and maximum allowable dates
_GUICtrlMonthCal_GetRangeMax | Retrieves the upper limit date range
_GUICtrlMonthCal_GetRangeMaxStr | Retrieves the upper limit date range in string format
_GUICtrlMonthCal_GetRangeMin | Retrieves the lower limit date range
_GUICtrlMonthCal_GetRangeMinStr | Retrieves the lower limit date range in string form
_GUICtrlMonthCal_GetSelRange | Retrieves the upper and lower limits of the date range currently selected
_GUICtrlMonthCal_GetSelRangeMax | Retrieves the upper date range currently selected by the user
_GUICtrlMonthCal_GetSelRangeMaxStr | Retrieves the upper date range currently selected by the user in string form
_GUICtrlMonthCal_GetSelRangeMin | Retrieves the lower date range currently selected by the user
_GUICtrlMonthCal_GetSelRangeMinStr | Retrieves the lower date range currently selected by the user in string form
_GUICtrlMonthCal_GetToday | Retrieves the date information for the date specified as "today"
_GUICtrlMonthCal_GetTodayStr | Retrieves the date information for the date specified as "today" in string format
_GUICtrlMonthCal_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlMonthCal_HitTest | Determines which portion of a month calendar control is at a given point
_GUICtrlMonthCal_SetCalendarBorder | Sets the size of the border, in pixels
_GUICtrlMonthCal_SetColor | Sets the color for a given portion of the month calendar
_GUICtrlMonthCal_SetCurSel | Sets the currently selected date
_GUICtrlMonthCal_SetDayState | Sets the day states for all months that are currently visible
_GUICtrlMonthCal_SetFirstDOW | Sets the first day of the week for a month calendar control
_GUICtrlMonthCal_SetMaxSelCount | Sets the maximum number of days that can be selected in a month calendar control
_GUICtrlMonthCal_SetMonthDelta | Sets the scroll rate for a month calendar control
_GUICtrlMonthCal_SetRange | Sets date information that represents the high and low limits
_GUICtrlMonthCal_SetSelRange | Sets the selection for a month calendar control to a given date range
_GUICtrlMonthCal_SetToday | Sets the date information for the date specified as "today"
_GUICtrlMonthCal_SetUnicodeFormat | Sets the Unicode character format flag for the control


Function _GUICtrlMonthCal_Create

Function Reference

_GUICtrlMonthCal_Create

Creates a Month Calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_Create($hWnd, $iX, $iY[, $iStyle = 0x00000000[, $iExStyle = 0x00000000]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iStyle | [optional] Control styles: $MCS_DAYSTATE - The month calendar will send $MCN_GETDAYSTATE notifications to request information about which days should be displayed in bold. $MCS_MULTISELECT - The month calendar will allow the user to select a range of dates within the control $MCS_WEEKNUMBERS - The month calendar control will display week numbers to the left of each row of days $MCS_NOTODAYCIRCLE - The month calendar control will not circle the "today" date $MCS_NOTODAY - The month calendar control will not display the "today" date at the bottom
 | Forced: $WS_CHILD, $WS_VISIBLE
$iExStyle | [optional] Control extended styles

Return Value

Success: | The handle to the month calendar window
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlMonthCal_Destroy, _GUICtrlMonthCal_GetColorArray

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $hMonthCal

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Month Calendar Create", 400, 300)
$hMonthCal = _GUICtrlMonthCal_Create($hGUI, 4, 4, $WS_BORDER)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hMonthCal
Switch $iCode
Case $MCN_GETDAYSTATE ; Sent by a month calendar control to request information about how individual days should be displayed
$tInfo = DllStructCreate($tagNMDAYSTATE, $ilParam)
_DebugPrint("$MCN_GETDAYSTATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->Year:" & @TAB & DllStructGetData($tInfo, "Year") & @LF & _
"-->Month:" & @TAB & DllStructGetData($tInfo, "Month") & @LF & _
"-->DOW:" & @TAB & DllStructGetData($tInfo, "DOW") & @LF & _
"-->Day:" & @TAB & DllStructGetData($tInfo, "Day") & @LF & _
"-->Hour:" & @TAB & DllStructGetData($tInfo, "Hour") & @LF & _
"-->Minute:" & @TAB & DllStructGetData($tInfo, "Minute") & @LF & _
"-->Second:" & @TAB & DllStructGetData($tInfo, "Second") & @LF & _
"-->MSecond:" & @TAB & DllStructGetData($tInfo, "MSecond") & @LF & _
"-->DayState:" & @TAB & DllStructGetData($tInfo, "DayState") & @LF & _
"-->pDayState:" & @TAB & DllStructGetData($tInfo, "pDayState"))
; Address of an array of MONTHDAYSTATE (DWORD bit field that holds the state of each day in a month)
; Each bit (1 through 31) represents the state of a day in a month. If a bit is on, the corresponding day will
; be displayed in bold; otherwise it will be displayed with no emphasis.
; No return value
Case $MCN_SELCHANGE ; Sent by a month calendar control when the currently selected date or range of dates changes
$tInfo = DllStructCreate($tagNMSELCHANGE, $ilParam)
_DebugPrint("$MCN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->BegYear:" & @TAB & DllStructGetData($tInfo, "BegYear") & @LF & _
"-->BegMonth:" & @TAB & DllStructGetData($tInfo, "BegMonth") & @LF & _
"-->BegDOW:" & @TAB & DllStructGetData($tInfo, "BegDOW") & @LF & _
"-->BegDay:" & @TAB & DllStructGetData($tInfo, "BegDay") & @LF & _
"-->BegHour:" & @TAB & DllStructGetData($tInfo, "BegHour") & @LF & _
"-->BegMinute:" & @TAB & DllStructGetData($tInfo, "BegMinute") & @LF & _
"-->BegSecond:" & @TAB & DllStructGetData($tInfo, "BegSecond") & @LF & _
"-->BegMSeconds:" & @TAB & DllStructGetData($tInfo, "BegMSeconds") & @LF & _
"-->EndYear:" & @TAB & DllStructGetData($tInfo, "EndYear") & @LF & _
"-->EndMonth:" & @TAB & DllStructGetData($tInfo, "EndMonth") & @LF & _
"-->EndDOW:" & @TAB & DllStructGetData($tInfo, "EndDOW") & @LF & _
"-->EndDay:" & @TAB & DllStructGetData($tInfo, "EndDay") & @LF & _
"-->EndHour:" & @TAB & DllStructGetData($tInfo, "EndHour") & @LF & _
"-->EndMinute:" & @TAB & DllStructGetData($tInfo, "EndMinute") & @LF & _
"-->EndSecond:" & @TAB & DllStructGetData($tInfo, "EndSecond") & @LF & _
"-->EndMSeconds:" & @TAB & DllStructGetData($tInfo, "EndMSeconds"))
; No return value
Case $MCN_SELECT ; Sent by a month calendar control when the user makes an explicit date selection within a month calendar control
$tInfo = DllStructCreate($tagNMSELCHANGE, $ilParam)
_DebugPrint("$MCN_SELECT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->BegYear:" & @TAB & DllStructGetData($tInfo, "BegYear") & @LF & _
"-->BegMonth:" & @TAB & DllStructGetData($tInfo, "BegMonth") & @LF & _
"-->BegDOW:" & @TAB & DllStructGetData($tInfo, "BegDOW") & @LF & _
"-->BegDay:" & @TAB & DllStructGetData($tInfo, "BegDay") & @LF & _
"-->BegHour:" & @TAB & DllStructGetData($tInfo, "BegHour") & @LF & _
"-->BegMinute:" & @TAB & DllStructGetData($tInfo, "BegMinute") & @LF & _
"-->BegSecond:" & @TAB & DllStructGetData($tInfo, "BegSecond") & @LF & _
"-->BegMSeconds:" & @TAB & DllStructGetData($tInfo, "BegMSeconds") & @LF & _
"-->EndYear:" & @TAB & DllStructGetData($tInfo, "EndYear") & @LF & _
"-->EndMonth:" & @TAB & DllStructGetData($tInfo, "EndMonth") & @LF & _
"-->EndDOW:" & @TAB & DllStructGetData($tInfo, "EndDOW") & @LF & _
"-->EndDay:" & @TAB & DllStructGetData($tInfo, "EndDay") & @LF & _
"-->EndHour:" & @TAB & DllStructGetData($tInfo, "EndHour") & @LF & _
"-->EndMinute:" & @TAB & DllStructGetData($tInfo, "EndMinute") & @LF & _
"-->EndSecond:" & @TAB & DllStructGetData($tInfo, "EndSecond") & @LF & _
"-->EndMSeconds:" & @TAB & DllStructGetData($tInfo, "EndMSeconds"))
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlMonthCal_Destroy

Function Reference

_GUICtrlMonthCal_Destroy

Delete the MonthCal control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Month Calendars created with _GUICtrlMonthCal_Create

Related

_GUICtrlMonthCal_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $HandleBefore, $hMonthCal

; Create GUI
$hGUI = GUICreate("Month Calendar Destroy", 400, 300)
$hMonthCal = _GUICtrlMonthCal_Create($hGUI, 4, 4, $WS_BORDER)
GUISetState()

$HandleBefore = $hMonthCal
MsgBox(4160, "Information", "Destroying the Control for Handle: " & $hMonthCal)
MsgBox(4160, "Information", "Control Destroyed: " & _GUICtrlMonthCal_Destroy($hMonthCal) & @LF & _
"Handel Before Destroy: " & $HandleBefore & @LF & _
"Handle After Destroy: " & $hMonthCal)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlMonthCal_GetCalendarBorder

Function Reference

_GUICtrlMonthCal_GetCalendarBorder

Gets the size of the border, in pixels

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetCalendarBorder($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Border size, in pixels

Remarks

Minimum Operating Systems: Windows Vista

Related

_GUICtrlMonthCal_SetCalendarBorder

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set calendar border
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
Sleep(3000)
GUISetState(@SW_LOCK)
_GUICtrlMonthCal_SetCalendarBorder($hMonthCal, 2)
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
GUISetState(@SW_UNLOCK)
Sleep(3000)
GUISetState(@SW_LOCK)
_GUICtrlMonthCal_SetCalendarBorder($hMonthCal, 0, False)
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
GUISetState(@SW_UNLOCK)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetCalendarCount

Function Reference

_GUICtrlMonthCal_GetCalendarCount

Gets the number of calendars currently displayed in the calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetCalendarCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Number of calendars currently displayed in the calendar control. The maximum number of allowed calendars is 12

Remarks

Minimum Operating Systems: Windows Vista

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set calendar border
MemoWrite("Calendar Count: " & _GUICtrlMonthCal_GetCalendarCount($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetColor

Function Reference

_GUICtrlMonthCal_GetColor

Retrieves a given color for the control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetColor($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Indicates which month calendar color to retrieve: $MCSC_BACKGROUND - Background color displayed between months $MCSC_TEXT - Color used to display text within a month $MCSC_TITLEBK - Background color displayed in the calendar title $MCSC_TITLETEXT - Color used to display text within the calendar title $MCSC_MONTHBK - Background color displayed within the month $MCSC_TRAILINGTEXT - Color used to display header day and trailing day text

Return Value

Success: Indicated color
Failure: -1

Remarks

None.

Related

_GUICtrlMonthCal_SetColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Color", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set calendar color
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
_GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetColorArray

Function Reference

_GUICtrlMonthCal_GetColorArray

Retrieves the color for a given portion of a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetColorArray($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Value of type int specifying which month calendar color to retrieve This value can be one of the following: $MCSC_BACKGROUND - Retrieve the background color displayed between months. $MCSC_MONTHBK - Retrieve the background color displayed within the month. $MCSC_TEXT - Retrieve the color used to display text within a month. $MCSC_TITLEBK - Retrieve the background color displayed in the calendar's title. $MCSC_TITLETEXT - Retrieve the color used to display text within the calendar's title. $MCSC_TRAILINGTEXT - Retrieve the color used to display header day and trailing day text.

Return Value

Success: Array in the following format:
[0] - contains the number returned
[1] - contains COLORREF rgbcolor
[2] - contains Hex BGR color
[3] - contains Hex RGB color
Failure: False

Remarks

Header and trailing days are the days from the previous and following
months that appear on the current month calendar.

Related

_GUICtrlMonthCal_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Color Array", 425, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 417, 128, BitOR($WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
GUISetState()

_GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)

; Get/Set calendar colors
MemoWrite(_FormatOutPut("Background color displayed between months:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_BACKGROUND)))
MemoWrite(_FormatOutPut(@CRLF & "Background color displayed within the month:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_MONTHBK)))
MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within a month:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TEXT)))
MemoWrite(_FormatOutPut(@CRLF & "Background color displayed in the calendar's title:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TITLEBK)))
MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within the calendar's title:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TITLETEXT)))
MemoWrite(_FormatOutPut(@CRLF & "Color used to display header day and trailing day text:", _GUICtrlMonthCal_GetColorArray($hMonthCal, $MCSC_TRAILINGTEXT)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _FormatOutPut($sText, $aColors)
Return $sText & _
@CRLF & @TAB & "COLORREF rgbcolor:" & @TAB & $aColors[1] & _
@CRLF & @TAB & "Hex BGR color:" & @TAB & @TAB & $aColors[2] & _
@CRLF & @TAB & "Hex RGB color:" & @TAB & @TAB & $aColors[3]
EndFunc ;==>_FormatOutPut

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetCurSel

Function Reference

_GUICtrlMonthCal_GetCurSel

Retrieves the currently selected date

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetCurSel($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME structure

Remarks

None.

Related

_GUICtrlMonthCal_SetCurSel, _GUICtrlMonthCal_GetCurSelStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tTime, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Cur Sel", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set current selection
_GUICtrlMonthCal_SetCurSel($hMonthCal, @YEAR, 8, 19)
$tTime = _GUICtrlMonthCal_GetCurSel($hMonthCal)
MemoWrite("Current selection : " & StringFormat("%02d/%02d/%04d", DllStructGetData($tTime, "Month"), _
DllStructGetData($tTime, "Day"), _
DllStructGetData($tTime, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetCurSelStr

Function Reference

_GUICtrlMonthCal_GetCurSelStr

Retrieves the currently selected date in string format

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetCurSelStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Cur Sel String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get current selection
MemoWrite("Current selection : " & _GUICtrlMonthCal_GetCurSelStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetFirstDOW

Function Reference

_GUICtrlMonthCal_GetFirstDOW

Retrieves the first day of the week

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetFirstDOW($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: One of the following values:
0 - Monday
1 - Tuesday
2 - Wednesday
3 - Thursday
4 - Friday
5 - Saturday
6 - Sunday

Remarks

None.

Related

_GUICtrlMonthCal_SetFirstDOW, _GUICtrlMonthCal_GetFirstDOWStr

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get First DOW", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set first DOW
_GUICtrlMonthCal_SetFirstDOW($hMonthCal, 0)
MemoWrite("First DOW : " & _GUICtrlMonthCal_GetFirstDOW($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetFirstDOWStr

Function Reference

_GUICtrlMonthCal_GetFirstDOWStr

Retrieves the first day of the week as a string

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetFirstDOWStr($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: One of the following values:
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

Remarks

None.

Related

_GUICtrlMonthCal_GetFirstDOW

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get First DOW String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set first DOW
_GUICtrlMonthCal_SetFirstDOW($hMonthCal, 0)
MemoWrite("First DOW : " & _GUICtrlMonthCal_GetFirstDOWStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMaxSelCount

Function Reference

_GUICtrlMonthCal_GetMaxSelCount

Retrieves the maximum date range that can be selected in a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMaxSelCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: INT value that represents the total number of days that can be selected for the control

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Count", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set maximum selection count
_GUICtrlMonthCal_SetMaxSelCount($hMonthCal, 7)
MemoWrite("Maximum selction count: " & _GUICtrlMonthCal_GetMaxSelCount($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMaxTodayWidth

Function Reference

_GUICtrlMonthCal_GetMaxTodayWidth

Retrieves the maximum width of the "today" string in a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMaxTodayWidth($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The width of the "today" string, in pixels

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Max Today Width", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get maximum today width
MemoWrite("Maximum today width: " & _GUICtrlMonthCal_GetMaxTodayWidth($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMinReqHeight

Function Reference

_GUICtrlMonthCal_GetMinReqHeight

Retrieves the minimum height required to display a full month

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMinReqHeight($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Minimum height, in pixels

Remarks

None.

Related

_GUICtrlMonthCal_GetMinReqRect, _GUICtrlMonthCal_GetMinReqWidth

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Min Req Height", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get minimum required height/width
MemoWrite("Minimum required height: " & _GUICtrlMonthCal_GetMinReqHeight($hMonthCal))
MemoWrite("Minimum required width : " & _GUICtrlMonthCal_GetMinReqWidth($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMinReqRect

Function Reference

_GUICtrlMonthCal_GetMinReqRect

Retrieves the minimum size required to display a full month

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMinReqRect($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagRECT structure

Remarks

None.

Related

_GUICtrlMonthCal_GetMinReqHeight, _GUICtrlMonthCal_GetMinReqWidth, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRect, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Min Req Rect", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get minimum required height/width
$tRect = _GUICtrlMonthCal_GetMinReqRect($hMonthCal)
MemoWrite("Minimum required height: " & DllStructGetData($tRect, "Bottom"))
MemoWrite("Minimum required width : " & DllStructGetData($tRect, "Right"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMinReqRectArray

Function Reference

_GUICtrlMonthCal_GetMinReqRectArray

Retrieves the minimum size required to display a full month in a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMinReqRectArray($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

The minimum required window size for a month calendar control depends on the currently selected font,
control styles, system metrics, and regional settings.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Min Req Rect Array", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, BitOR($WS_VSCROLL, $ES_MULTILINE))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
GUISetState()

; Get minimum required height/width
MemoWrite(_FormatOutPut(_GUICtrlMonthCal_GetMinReqRectArray($hMonthCal)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _FormatOutPut($aRect)
Return "Minimum required Width: " & @TAB & $aRect[3] & @CRLF & "Minimum required Height:" & @TAB & $aRect[4]
EndFunc ;==>_FormatOutPut

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMinReqWidth

Function Reference

_GUICtrlMonthCal_GetMinReqWidth

Retrieves the minimum width required to display a full month

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMinReqWidth($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Minimum width, in pixels

Remarks

None.

Related

_GUICtrlMonthCal_GetMinReqHeight, _GUICtrlMonthCal_GetMinReqRect

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Min Req Width", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get minimum required height/width
MemoWrite("Minimum required height: " & _GUICtrlMonthCal_GetMinReqHeight($hMonthCal))
MemoWrite("Minimum required width : " & _GUICtrlMonthCal_GetMinReqWidth($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthDelta

Function Reference

_GUICtrlMonthCal_GetMonthDelta

Retrieves the scroll rate for a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthDelta($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: If the month delta was previously set using the _GUICtrlMonthCal_SetMonthDelta,
returns an INT value that represents the month calendar's current scroll rate. If the month delta was not previously set using the _GUICtrlMonthCal_SetMonthDelta, or the month delta was reset to the default, returns an INT value that represents the current number of months visible.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Delta", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set month delta
_GUICtrlMonthCal_SetMonthDelta($hMonthCal, 2)
MemoWrite("Month delta: " & _GUICtrlMonthCal_GetMonthDelta($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRange

Function Reference

_GUICtrlMonthCal_GetMonthRange

Retrieves date information that represents the high and low display limits

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRange($hWnd[, $fPartial = False])

Parameters

$hWnd | Handle to control
$fPartial | [optional] Specifies the scope of the range limits to be retrieved: True - Preceding and trailing months are included False - Only months that are entirely displayed are included

Return Value

Success: $tagMCMONTHRANGE structure

Remarks

None.

Related

_GUICtrlMonthCal_GetMonthRangeMax, _GUICtrlMonthCal_GetMonthRangeMin, $tagMCMONTHRANGE

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRange, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range
$tRange = _GUICtrlMonthCal_GetMonthRange($hMonthCal)
MemoWrite("Month range minimum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
DllStructGetData($tRange, "MinDay"), _
DllStructGetData($tRange, "MinYear")))
MemoWrite("Month range maximum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
DllStructGetData($tRange, "MaxDay"), _
DllStructGetData($tRange, "MaxYear")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRangeMax

Function Reference

_GUICtrlMonthCal_GetMonthRangeMax

Retrieves date information that represents the high limit of the controls display

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRangeMax($hWnd[, $fPartial = False])

Parameters

$hWnd | Handle to control
$fPartial | [optional] Specifies the scope of the range limits to be retrieved: True - Preceding and trailing months are included False - Only months that are entirely displayed are included

Return Value

Success: $tagSYSTEMTIME structure

Remarks

None.

Related

_GUICtrlMonthCal_GetMonthRange, _GUICtrlMonthCal_GetMonthRangeMin, _GUICtrlMonthCal_GetMonthRangeMaxStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range Max", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range
$tMin = _GUICtrlMonthCal_GetMonthRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetMonthRangeMax($hMonthCal)
MemoWrite("Month range minimum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("Month range maximum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRangeMaxStr

Function Reference

_GUICtrlMonthCal_GetMonthRangeMaxStr

Retrieves date information that represents the high limit of the controls display in string format

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRangeMaxStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetMonthRangeMax

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range Max String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range
MemoWrite("Month range minimum: " & _GUICtrlMonthCal_GetMonthRangeMinStr($hMonthCal))
MemoWrite("Month range maximum: " & _GUICtrlMonthCal_GetMonthRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRangeMin

Function Reference

_GUICtrlMonthCal_GetMonthRangeMin

Retrieves date information that represents the low limit of the controls display

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRangeMin($hWnd[, $fPartial = False])

Parameters

$hWnd | Handle to control
$fPartial | [optional] Specifies the scope of the range limits to be retrieved: True - Preceding and trailing months are included False - Only months that are entirely displayed are included

Return Value

Success: $tagSYSTEMTIME structure

Remarks

None.

Related

_GUICtrlMonthCal_GetMonthRange, _GUICtrlMonthCal_GetMonthRangeMax, _GUICtrlMonthCal_GetMonthRangeMinStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range Min", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range
$tMin = _GUICtrlMonthCal_GetMonthRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetMonthRangeMax($hMonthCal)
MemoWrite("Month range minimum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("Month range maximum: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRangeMinStr

Function Reference

_GUICtrlMonthCal_GetMonthRangeMinStr

Retrieves date information that represents the low limit of the controls display in string format

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRangeMinStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetMonthRangeMin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range Min String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range
MemoWrite("Month range minimum: " & _GUICtrlMonthCal_GetMonthRangeMinStr($hMonthCal))
MemoWrite("Month range maximum: " & _GUICtrlMonthCal_GetMonthRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetMonthRangeSpan

Function Reference

_GUICtrlMonthCal_GetMonthRangeSpan

Returns a value that represents the range, in months, spanned

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetMonthRangeSpan($hWnd[, $fPartial = False])

Parameters

$hWnd | Handle to control
$fPartial | [optional] Specifies the scope of the range limits to be retrieved: True - Preceding and trailing months are included False - Only months that are entirely displayed are included

Return Value

Success: Spanned months

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Month Range Span", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get month range span
MemoWrite("Month range span: " & _GUICtrlMonthCal_GetMonthRangeSpan($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetRange

Function Reference

_GUICtrlMonthCal_GetRange

Retrieves the minimum and maximum allowable dates

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetRange($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagMCRANGE structure

Remarks

None.

Related

_GUICtrlMonthCal_SetRange, _GUICtrlMonthCal_GetRangeMax, _GUICtrlMonthCal_GetRangeMaxStr, _GUICtrlMonthCal_GetRangeMin, _GUICtrlMonthCal_GetRangeMinStr, $tagMCRANGE

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRange, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Range", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
$tRange = _GUICtrlMonthCal_GetRange($hMonthCal)
MemoWrite("Minimum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
DllStructGetData($tRange, "MinDay"), _
DllStructGetData($tRange, "MinYear")))
MemoWrite("Maximum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
DllStructGetData($tRange, "MaxDay"), _
DllStructGetData($tRange, "MaxYear")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetRangeMax

Function Reference

_GUICtrlMonthCal_GetRangeMax

Retrieves the upper limit date range

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetRangeMax($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME

Remarks

None.

Related

_GUICtrlMonthCal_GetRange, _GUICtrlMonthCal_GetRangeMin, _GUICtrlMonthCal_GetRangeMaxStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Range Max", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
$tMin = _GUICtrlMonthCal_GetRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetRangeMax($hMonthCal)
MemoWrite("Minimum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("Maximum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetRangeMaxStr

Function Reference

_GUICtrlMonthCal_GetRangeMaxStr

Retrieves the upper limit date range in string format

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetRangeMaxStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetRange, _GUICtrlMonthCal_GetRangeMax

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Range Max String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
MemoWrite("Minimum selectable date: " & _GUICtrlMonthCal_GetRangeMinStr($hMonthCal))
MemoWrite("Maximum selectable date: " & _GUICtrlMonthCal_GetRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetRangeMin

Function Reference

_GUICtrlMonthCal_GetRangeMin

Retrieves the lower limit date range

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetRangeMin($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME

Remarks

None.

Related

_GUICtrlMonthCal_GetRange, _GUICtrlMonthCal_GetRangeMax, _GUICtrlMonthCal_GetRangeMinStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Range Min", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
$tMin = _GUICtrlMonthCal_GetRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetRangeMax($hMonthCal)
MemoWrite("Minimum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("Maximum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetRangeMinStr

Function Reference

_GUICtrlMonthCal_GetRangeMinStr

Retrieves the lower limit date range in string form

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetRangeMinStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetRange, _GUICtrlMonthCal_GetRangeMin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Range Min String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
MemoWrite("Minimum selectable date: " & _GUICtrlMonthCal_GetRangeMinStr($hMonthCal))
MemoWrite("Maximum selectable date: " & _GUICtrlMonthCal_GetRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetSelRange

Function Reference

_GUICtrlMonthCal_GetSelRange

Retrieves the upper and lower limits of the date range currently selected

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetSelRange($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagMCSELRANGE structure

Remarks

None.

Related

_GUICtrlMonthCal_SetSelRange, $tagMCSELRANGE

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRange, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Range", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
$tRange = _GUICtrlMonthCal_GetSelRange($hMonthCal)
MemoWrite("Start date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
DllStructGetData($tRange, "MinDay"), _
DllStructGetData($tRange, "MinYear")))
MemoWrite("End date .: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
DllStructGetData($tRange, "MaxDay"), _
DllStructGetData($tRange, "MaxYear")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetSelRangeMax

Function Reference

_GUICtrlMonthCal_GetSelRangeMax

Retrieves the upper date range currently selected by the user

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetSelRangeMax($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME

Remarks

None.

Related

_GUICtrlMonthCal_GetSelRangeMin, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Range Max", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
$tMin = _GUICtrlMonthCal_GetSelRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetSelRangeMax($hMonthCal)
MemoWrite("Start date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("End date .: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetSelRangeMaxStr

Function Reference

_GUICtrlMonthCal_GetSelRangeMaxStr

Retrieves the upper date range currently selected by the user in string form

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetSelRangeMaxStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetSelRangeMinStr

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Range Max String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
MemoWrite("Start date: " & _GUICtrlMonthCal_GetSelRangeMinStr($hMonthCal))
MemoWrite("End date .: " & _GUICtrlMonthCal_GetSelRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetSelRangeMin

Function Reference

_GUICtrlMonthCal_GetSelRangeMin

Retrieves the lower date range currently selected by the user

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetSelRangeMin($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME

Remarks

None.

Related

_GUICtrlMonthCal_GetSelRangeMax, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tMin, $tMax, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Range Min", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
$tMin = _GUICtrlMonthCal_GetSelRangeMin($hMonthCal)
$tMax = _GUICtrlMonthCal_GetSelRangeMax($hMonthCal)
MemoWrite("Start date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMin, "Month"), _
DllStructGetData($tMin, "Day"), _
DllStructGetData($tMin, "Year")))
MemoWrite("End date .: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tMax, "Month"), _
DllStructGetData($tMax, "Day"), _
DllStructGetData($tMax, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetSelRangeMinStr

Function Reference

_GUICtrlMonthCal_GetSelRangeMinStr

Retrieves the lower date range currently selected by the user in string form

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetSelRangeMinStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetSelRangeMaxStr

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Sel Range Min String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
MemoWrite("Start date: " & _GUICtrlMonthCal_GetSelRangeMinStr($hMonthCal))
MemoWrite("End date .: " & _GUICtrlMonthCal_GetSelRangeMaxStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetToday

Function Reference

_GUICtrlMonthCal_GetToday

Retrieves the date information for the date specified as "today"

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetToday($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagSYSTEMTIME

Remarks

None.

Related

_GUICtrlMonthCal_SetToday, _GUICtrlMonthCal_GetTodayStr, $tagSYSTEMTIME

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tToday, $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Today", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set today
_GUICtrlMonthCal_SetToday($hMonthCal, @YEAR, 8, 19)
$tToday = _GUICtrlMonthCal_GetToday($hMonthCal)
MemoWrite("Today: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tToday, "Month"), _
DllStructGetData($tToday, "Day"), _
DllStructGetData($tToday, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetTodayStr

Function Reference

_GUICtrlMonthCal_GetTodayStr

Retrieves the date information for the date specified as "today" in string format

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetTodayStr($hWnd[, $sFormat = "%02d/%02d/%04d"])

Parameters

$hWnd | Handle to control
$sFormat | [optional] StringFormat string used to format the date

Return Value

Success: Date in the specified format

Remarks

None.

Related

_GUICtrlMonthCal_GetToday

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Today String", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get today
MemoWrite("Today: " & _GUICtrlMonthCal_GetTodayStr($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_GetUnicodeFormat

Function Reference

_GUICtrlMonthCal_GetUnicodeFormat

Retrieves the Unicode character format flag for the control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Control is using Unicode characters
False: Control is using ANSI characters

Remarks

None.

Related

_GUICtrlMonthCal_SetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Get Unicode Format", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Unicode setting
_GUICtrlMonthCal_SetUnicodeFormat($hMonthCal, False)
MemoWrite("Unicode: " & _GUICtrlMonthCal_GetUnicodeFormat($hMonthCal))
_GUICtrlMonthCal_SetUnicodeFormat($hMonthCal, True)
MemoWrite("Unicode: " & _GUICtrlMonthCal_GetUnicodeFormat($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_HitTest

Function Reference

_GUICtrlMonthCal_HitTest

Determines which portion of a month calendar control is at a given point

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_HitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to control
$iX | X position to test
$iY | Y position to test

Return Value

Success: $tagMCHITTESTINFO structure

Remarks

None.

Related

$tagMCHITTESTINFO

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $hMonthCal, $iMemo, $hGUI

_Main()

Func _Main()

; Create GUI
$hGUI = GUICreate("Month Calendar Hit Test", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_MOUSEMOVE
DoHitTest()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>_Main

; Perform hit test
Func DoHitTest()
Local $tHit

$tHit = _GUICtrlMonthCal_HitTest($hMonthCal, _WinAPI_GetMousePosX(True, $hGUI), _WinAPI_GetMousePosY(True, $hGUI))
If BitAND(DllStructGetData($tHit, "Hit"), $MCHT_CALENDARDATE) <> 0 Then
MemoWrite("Date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tHit, "Month"), _
DllStructGetData($tHit, "Day"), _
DllStructGetData($tHit, "Year")))
EndIf
EndFunc ;==>DoHitTest

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetCalendarBorder

Function Reference

_GUICtrlMonthCal_SetCalendarBorder

Sets the size of the border, in pixels

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetCalendarBorder($hWnd[, $iBorderSize = 4[, $fSetBorder = True]])

Parameters

$hWnd | Handle to control
$iBorderSize | [optional] Number of pixels of the border size
$fSetBorder | [optional] One of the Following: True - The border size is set to the number of pixels that $iBorderSize specifies False - The border size is reset to the default value specified by the theme, or zero if themes are not being used

Return Value

None.

Remarks

Minimum Operating Systems: Windows Vista

Related

_GUICtrlMonthCal_GetCalendarBorder

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set calendar border
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
Sleep(3000)
GUISetState(@SW_LOCK)
_GUICtrlMonthCal_SetCalendarBorder($hMonthCal, 2)
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
GUISetState(@SW_UNLOCK)
Sleep(3000)
GUISetState(@SW_LOCK)
_GUICtrlMonthCal_SetCalendarBorder($hMonthCal, 0, False)
MemoWrite("Border in pixels: " & _GUICtrlMonthCal_GetCalendarBorder($hMonthCal))
GUISetState(@SW_UNLOCK)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetColor

Function Reference

_GUICtrlMonthCal_SetColor

Sets the color for a given portion of the month calendar

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetColor($hWnd, $iIndex, $iColor)

Parameters

$hWnd | Handle to control
$iIndex | Indicates which month calendar color to set: $MCSC_BACKGROUND - Background color displayed between months $MCSC_TEXT - Color used to display text within a month $MCSC_TITLEBK - Background color displayed in the calendar title $MCSC_TITLETEXT - Color used to display text within the calendar title $MCSC_MONTHBK - Background color displayed within the month $MCSC_TRAILINGTEXT - Color used to display header day and trailing day text
$iColor | Color value

Return Value

Success: The previous color setting for the specified portion of the control
Failure: -1

Remarks

None.

Related

_GUICtrlMonthCal_GetColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Color", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set calendar color
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
_GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetCurSel

Function Reference

_GUICtrlMonthCal_SetCurSel

Sets the currently selected date

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetCurSel($hWnd, $iYear, $iMonth, $iDay)

Parameters

$hWnd | Handle to control
$iYear | Year value
$iMonth | Month value
$iDay | Day value

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlMonthCal_GetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tTime, $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Cur Sel", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set current selection
_GUICtrlMonthCal_SetCurSel($hMonthCal, @YEAR, 8, 19)
$tTime = _GUICtrlMonthCal_GetCurSel($hMonthCal)
MemoWrite("Current selection : " & StringFormat("%02d/%02d/%04d", DllStructGetData($tTime, "Month"), _
DllStructGetData($tTime, "Day"), _
DllStructGetData($tTime, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetDayState

Function Reference

_GUICtrlMonthCal_SetDayState

Sets the day states for all months that are currently visible

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetDayState($hWnd, $aMasks)

Parameters

$hWnd | Handle to control
$aMasks | An array of integers that corresponds to the months that are visible in the calendar

Return Value

Success: True
Failure: False

Remarks

You must create the calendar control with the $MCS_DAYSTATE style if you want to use this function

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Day State", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_DAYSTATE), 0x00000000)

; Get the number of months that we must supply masks for. Normally, this number will be 3.
Local $aMasks[_GUICtrlMonthCal_GetMonthRangeSpan($hMonthCal, True)]

; Make the 1st, 8th and the 16th of the current month bolded. This results in a binary mask of 1000 0000 1000 0001 or
; 0x8081 in hex.
$aMasks[1] = 0x8081
_GUICtrlMonthCal_SetDayState($hMonthCal, $aMasks)

GUISetState()

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlMonthCal_SetFirstDOW

Function Reference

_GUICtrlMonthCal_SetFirstDOW

Sets the first day of the week for a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetFirstDOW($hWnd, $sDay)

Parameters

$hWnd | Handle to the control
$sDay | In the following format: 0 or "Monday" 1 or "Tuesday" 2 or "Wednesday" 3 or "Thursday" 4 or "Friday" 5 or "Saturday" 6 or "Sunday"

Return Value

Success: The previous first day of the week
Failure: -1

Remarks

None.

Related

_GUICtrlMonthCal_GetFirstDOW

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set First DOW", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set first DOW
_GUICtrlMonthCal_SetFirstDOW($hMonthCal, 0)
MemoWrite("First DOW : " & _GUICtrlMonthCal_GetFirstDOW($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetMaxSelCount

Function Reference

_GUICtrlMonthCal_SetMaxSelCount

Sets the maximum number of days that can be selected in a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetMaxSelCount($hWnd, $iMaxSel)

Parameters

$hWnd | Handle to the control
$iMaxSel | Value of type int that will be set to represent the maximum number of days that can be selected

Return Value

Success: True
Failure: False

Remarks

This will fail if applied to a month calendar control that does not use the $MCS_MULTISELECT style

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Sel Count", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set maximum selection count
_GUICtrlMonthCal_SetMaxSelCount($hMonthCal, 7)
MemoWrite("Maximum selction count: " & _GUICtrlMonthCal_GetMaxSelCount($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetMonthDelta

Function Reference

_GUICtrlMonthCal_SetMonthDelta

Sets the scroll rate for a month calendar control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetMonthDelta($hWnd, $iDelta)

Parameters

$hWnd | Handle to the control
$iDelta | Value representing the number of months to be set as the control's scroll rate If this value is zero, the month delta is reset to the default which is the number of months displayed in the control

Return Value

Success: INT value that represents the previous scroll rate

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Month Delta", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set month delta
_GUICtrlMonthCal_SetMonthDelta($hMonthCal, 2)
MemoWrite("Month delta: " & _GUICtrlMonthCal_GetMonthDelta($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetRange

Function Reference

_GUICtrlMonthCal_SetRange

Sets date information that represents the high and low limits

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetRange($hWnd, $iMinYear, $iMinMonth, $iMinDay, $iMaxYear, $iMaxMonth, $iMaxDay)

Parameters

$hWnd | Handle to control
$iMinYear | Minimum year
$iMinMonth | Minimum month
$iMinDay | Minimum day
$iMaxYear | Maximum year
$iMaxMonth | Maximum month
$iMaxDay | Maximum day

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlMonthCal_GetRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRange, $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Range", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set range
_GUICtrlMonthCal_SetRange($hMonthCal, @YEAR, 1, 1, @YEAR, 12, 31)
$tRange = _GUICtrlMonthCal_GetRange($hMonthCal)
MemoWrite("Minimum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
DllStructGetData($tRange, "MinDay"), _
DllStructGetData($tRange, "MinYear")))
MemoWrite("Maximum selectable date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
DllStructGetData($tRange, "MaxDay"), _
DllStructGetData($tRange, "MaxYear")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetSelRange

Function Reference

_GUICtrlMonthCal_SetSelRange

Sets the selection for a month calendar control to a given date range

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetSelRange($hWnd, $iMinYear, $iMinMonth, $iMinDay, $iMaxYear, $iMaxMonth, $iMaxDay)

Parameters

$hWnd | Handle to control
$iMinYear | Minimum year
$iMinMonth | Minimum month
$iMinDay | Minimum day
$iMaxYear | Maximum year
$iMaxMonth | Maximum month
$iMaxDay | Maximum day

Return Value

Success: True
Failure: False

Remarks

This message will fail if applied to a month calendar control that does not use the $MCS_MULTISELECT style

Related

_GUICtrlMonthCal_GetSelRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tRange, $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Sel Range", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, BitOR($WS_BORDER, $MCS_MULTISELECT), 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set selection
_GUICtrlMonthCal_SetSelRange($hMonthCal, @YEAR, @MON, 1, @YEAR, @MON, 7)
$tRange = _GUICtrlMonthCal_GetSelRange($hMonthCal)
MemoWrite("Start date: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MinMonth"), _
DllStructGetData($tRange, "MinDay"), _
DllStructGetData($tRange, "MinYear")))
MemoWrite("End date .: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tRange, "MaxMonth"), _
DllStructGetData($tRange, "MaxDay"), _
DllStructGetData($tRange, "MaxYear")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetToday

Function Reference

_GUICtrlMonthCal_SetToday

Sets the date information for the date specified as "today"

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetToday($hWnd, $iYear, $iMonth, $iDay)

Parameters

$hWnd | Handle to control
$iYear | Year
$iMonth | Month
$iDay | Day

Return Value

None.

Remarks

None.

Related

_GUICtrlMonthCal_GetToday

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $tToday, $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Today", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set today
_GUICtrlMonthCal_SetToday($hMonthCal, @YEAR, 8, 19)
$tToday = _GUICtrlMonthCal_GetToday($hMonthCal)
MemoWrite("Today: " & StringFormat("%02d/%02d/%04d", DllStructGetData($tToday, "Month"), _
DllStructGetData($tToday, "Day"), _
DllStructGetData($tToday, "Year")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlMonthCal_SetUnicodeFormat

Function Reference

_GUICtrlMonthCal_SetUnicodeFormat

Sets the Unicode character format flag for the control

#Include <GuiMonthCal.au3>
_GUICtrlMonthCal_SetUnicodeFormat($hWnd[, $fUnicode = False])

Parameters

$hWnd | Handle to control
$fUnicode | [optional] Unicode format flag: True - Control uses Unicode characters False - Control uses ANSI characters

Return Value

Success: The previous Unicode format flag

Remarks

None.

Related

_GUICtrlMonthCal_GetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_MC = False ; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hMonthCal

; Create GUI
GUICreate("Month Calendar Set Unicode Format", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Unicode setting
_GUICtrlMonthCal_SetUnicodeFormat($hMonthCal, False)
MemoWrite("Unicode: " & _GUICtrlMonthCal_GetUnicodeFormat($hMonthCal))
_GUICtrlMonthCal_SetUnicodeFormat($hMonthCal, True)
MemoWrite("Unicode: " & _GUICtrlMonthCal_GetUnicodeFormat($hMonthCal))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

GuiReBar user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiReBar.au3>.

User Defined Function | Description
_GUICtrlRebar_AddBand | Adds a new band in a rebar control
_GUICtrlRebar_AddToolBarBand | Adds a new band in a rebar control
_GUICtrlRebar_BeginDrag | Adds a new band in a rebar control
_GUICtrlRebar_Create | Create a Rebar control
_GUICtrlRebar_DeleteBand | Deletes a band from a rebar control
_GUICtrlRebar_Destroy | Delete the control
_GUICtrlRebar_DragMove | Updates the drag position in the rebar control after a previous _GUICtrlRebar_BeginDrag message
_GUICtrlRebar_EndDrag | Terminates the rebar control's drag-and-drop operation. This message does not cause an $RBN_ENDDRAG notification to be sent
_GUICtrlRebar_GetBandBackColor | Retrieves the Band background color
_GUICtrlRebar_GetBandBorders | Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band
_GUICtrlRebar_GetBandBordersEx | Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band
_GUICtrlRebar_GetBandChildHandle | Retrieves the Handle to the child window contained in the band, if any
_GUICtrlRebar_GetBandChildSize | Retrieves the Child size settings
_GUICtrlRebar_GetBandCount | Retrieves the count of bands currently in the rebar control
_GUICtrlRebar_GetBandForeColor | Retrieves the Band foreground color
_GUICtrlRebar_GetBandHeaderSize | Retrieves the size of the band's header, in pixels
_GUICtrlRebar_GetBandID | Get the value that the control uses to identify this band for custom draw notification messages
_GUICtrlRebar_GetBandIdealSize | Get Ideal width of the band, in pixels.
_GUICtrlRebar_GetBandLength | Get Length of the band, in pixels
_GUICtrlRebar_GetBandLParam | Get Application-defined value
_GUICtrlRebar_GetBandMargins | Get Length of the band, in pixels
_GUICtrlRebar_GetBandMarginsEx | Get Length of the band, in pixels
_GUICtrlRebar_GetBandRect | Retrieves the bounding rectangle for a given band in a rebar control
_GUICtrlRebar_GetBandRectEx | Retrieves the bounding rectangle for a given band in a rebar control
_GUICtrlRebar_GetBandStyle | Get the band style Flags
_GUICtrlRebar_GetBandStyleBreak | Determine if flag is set
_GUICtrlRebar_GetBandStyleChildEdge | Determine if flag is set
_GUICtrlRebar_GetBandStyleFixedBMP | Determine if flag is set
_GUICtrlRebar_GetBandStyleFixedSize | Determine if flag is set
_GUICtrlRebar_GetBandStyleGripperAlways | Determine if flag is set
_GUICtrlRebar_GetBandStyleHidden | Determine if flag is set
_GUICtrlRebar_GetBandStyleHideTitle | Determine if flag is set
_GUICtrlRebar_GetBandStyleNoGripper | Determine if flag is set
_GUICtrlRebar_GetBandStyleTopAlign | Determine if flag is set
_GUICtrlRebar_GetBandStyleUseChevron | Determine if flag is set
_GUICtrlRebar_GetBandStyleVariableHeight | Determine if flag is set
_GUICtrlRebar_GetBandText | Retrieves the display text for the band
_GUICtrlRebar_GetBarHeight | Retrieves the height of the rebar control
_GUICtrlRebar_GetBarInfo | Retrieves information about the rebar control and the image list it uses
_GUICtrlRebar_GetBKColor | Retrieves a rebar control's default background color
_GUICtrlRebar_GetColorScheme | Retrieves the color scheme information from the rebar control
_GUICtrlRebar_GetRowCount | Retrieves the number of rows of bands in a rebar control
_GUICtrlRebar_GetRowHeight | Retrieves the height of a specified row in a rebar control
_GUICtrlRebar_GetTextColor | Retrieves a rebar control's default text color
_GUICtrlRebar_GetToolTips | Retrieves the handle to any ToolTip control associated with the rebar control
_GUICtrlRebar_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlRebar_HitTest | Determines which item is at a specified position
_GUICtrlRebar_IDToIndex | Converts a band identifier to a band index in a rebar control
_GUICtrlRebar_MaximizeBand | Resizes a band in a rebar control to either its ideal or largest size
_GUICtrlRebar_MinimizeBand | Resizes a band in a rebar control to its smallest size
_GUICtrlRebar_MoveBand | Moves a band from one index to another
_GUICtrlRebar_SetBandBackColor | Set the Band background color
_GUICtrlRebar_SetBandForeColor | Set the Band foreground color
_GUICtrlRebar_SetBandHeaderSize | Set the size of the band's header, in pixels
_GUICtrlRebar_SetBandID | Set the value that the control uses to identify this band for custom draw notification messages
_GUICtrlRebar_SetBandIdealSize | Set Ideal width of the band, in pixels.
_GUICtrlRebar_SetBandLength | Set Application-defined value
_GUICtrlRebar_SetBandLParam | Set Application-defined value
_GUICtrlRebar_SetBandStyle | Set the band style Flags
_GUICtrlRebar_SetBandStyleBreak | Set whether the band is on a new line
_GUICtrlRebar_SetBandStyleChildEdge | Set whether the band has an edge at the top and bottom of the child window
_GUICtrlRebar_SetBandStyleFixedBMP | Set whether the band background bitmap does not move when the band is resized
_GUICtrlRebar_SetBandStyleFixedSize | Set whether the band can't be sized. With this style, the sizing grip is not displayed on the band
_GUICtrlRebar_SetBandStyleGripperAlways | Set whether the band will always have a sizing grip, even if it is the only band in the rebar
_GUICtrlRebar_SetBandStyleHidden | Set whether the band will not be visible
_GUICtrlRebar_SetBandStyleHideTitle | Set whether to keep band title hidden
_GUICtrlRebar_SetBandStyleNoGripper | Set whether the band will never have a sizing grip, even if there is more than one band in the rebar
_GUICtrlRebar_SetBandStyleTopAlign | Set whether to keep band in top row
_GUICtrlRebar_SetBandStyleUseChevron | Set whether to display drop-down button
_GUICtrlRebar_SetBandStyleVariableHeight | Set whether the band can be resized by the rebar control
_GUICtrlRebar_SetBandText | Retrieves the display text for the band
_GUICtrlRebar_SetBarInfo | Sets the characteristics of a rebar control
_GUICtrlRebar_SetBKColor | Retrieves a rebar control's default background color
_GUICtrlRebar_SetColorScheme | Retrieves a rebar control's default background color
_GUICtrlRebar_SetTextColor | Sets a rebar control's default text color
_GUICtrlRebar_SetToolTips | Associates a ToolTip control with the rebar control
_GUICtrlRebar_SetUnicodeFormat | Sets the Unicode character format flag for the control
_GUICtrlRebar_ShowBand | Shows or hides a given band in a rebar control


Function _GUICtrlRebar_AddBand

Function Reference

_GUICtrlRebar_AddBand

Adds a new band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_AddBand($hwndRebar, $hwndChild[, $iMinWidth = 100[, $iDefaultWidth = 100[, $sText = ""[, $iIndex = -1[, $fStyle = -1]]]]])

Parameters

$hwndRebar | Handle to rebar control
$hwndChild | Handle of control to add
$iMinWidth | [optional] Minimum width for the band
$iDefaultWidth | [optional] Length of the band, in pixels
$sText | [optional] Display text for the band
$iIndex [optional] Zero-based index of the location where the band will be inserted.
If you set this parameter to -1, the control will add the new band at the last location
$fStyle [optional] Flags that specify the band style. This value can be a combination of the following:
$RBBS_BREAK - The band is on a new line.
$RBBS_CHILDEDGE - The band has an edge at the top and bottom of the child window.
$RBBS_FIXEDBMP - The background bitmap does not move when the band is resized.
$RBBS_FIXEDSIZE - The band can't be sized. With this style, the sizing grip is not displayed on the band.
$RBBS_GRIPPERALWAYS - Version 4.71. The band will always have a sizing grip, even if it is the only band in the rebar.
$RBBS_HIDDEN - The band will not be visible.
$RBBS_NOGRIPPER - Version 4.71. The band will never have a sizing grip, even if there is more than one band in the rebar.
$RBBS_USECHEVRON - Version 5.80. Show a chevron button if the band is smaller than cxIdeal.
$RBBS_VARIABLEHEIGHT - Version 4.71. The band can be resized by the rebar control;
cyIntegral and cyMaxChild affect how the rebar will resize the band.
$RBBS_NOVERT - Don't show when vertical.
$RBBS_USECHEVRON - Display drop-down button.
$RBBS_HIDETITLE - Keep band title hidden.
$RBBS_TOPALIGN - Keep band in top row.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_AddToolBarBand, _GUICtrlRebar_DeleteBand

Example

#include <GuiReBar.au3>
#include <GuiComboBox.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hCombo, $hReBar, $hDTP, $hInput

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)

_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a date time picker to put in the rebar
$hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band with control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir *.exe")

; add and force to second row
_GUICtrlReBar_AddBand($hReBar, $hDTP, 120)
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

; add to begining of rebar
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_AddToolBarBand

Function Reference

_GUICtrlRebar_AddToolBarBand

Adds a new band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_AddToolBarBand($hwndRebar, $hwndToolbar[, $sText = ""[, $iIndex = -1[, $fStyle = -1]]])

Parameters

$hwndRebar | Handle to rebar control
$hwndToolbar | Handle of the Toolbar control to add
$sText | [optional] Display text for the band
$iIndex [optional] Zero-based index of the location where the band will be inserted.
If you set this parameter to -1, the control will add the new band at the last location
$fStyle [optional] Flags that specify the band style. This value can be a combination of the following:
$RBBS_BREAK - The band is on a new line.
$RBBS_CHILDEDGE - The band has an edge at the top and bottom of the child window.
$RBBS_FIXEDBMP - The background bitmap does not move when the band is resized.
$RBBS_FIXEDSIZE - The band can't be sized. With this style, the sizing grip is not displayed on the band.
$RBBS_GRIPPERALWAYS - Version 4.71. The band will always have a sizing grip, even if it is the only band in the rebar.
$RBBS_HIDDEN - The band will not be visible.
$RBBS_NOGRIPPER - Version 4.71. The band will never have a sizing grip, even if there is more than one band in the rebar.
$RBBS_USECHEVRON - Version 5.80. Show a chevron button if the band is smaller than cxIdeal.
$RBBS_VARIABLEHEIGHT - Version 4.71. The band can be resized by the rebar control;
cyIntegral and cyMaxChild affect how the rebar will resize the band.
$RBBS_NOVERT - Don't show when vertical.
$RBBS_USECHEVRON - Display drop-down button.
$RBBS_HIDETITLE - Keep band title hidden.
$RBBS_TOPALIGN - Keep band in top row.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_AddBand, _GUICtrlRebar_DeleteBand

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hToolbar, $hReBar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_BeginDrag

Function Reference

_GUICtrlRebar_BeginDrag

Adds a new band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_BeginDrag($hWnd, $iIndex[, $dwPos = -1])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band that the drag-and-drop operation will affect
$dwPos | [optional] DWORD value that contains the starting mouse coordinates. The horizontal coordinate is contained in the LOWORD and the vertical coordinate is contained in the HIWORD. If you pass (DWORD)-1, the rebar control will use the position of the mouse the last time the control's thread called GetMessage or PeekMessage

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_DragMove, _GUICtrlRebar_EndDrag

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $btnBeginDrag
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnBeginDrag = GUICtrlCreateButton("Begin Drag", 150, 330, 100, 25)
$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
Case $btnBeginDrag
_GUICtrlRebar_BeginDrag($hReBar, 0)
_GUICtrlRebar_DragMove($hReBar)
_GUICtrlRebar_EndDrag($hReBar)
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_Create

Function Reference

_GUICtrlRebar_Create

Create a Rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_Create($hWnd[, $iStyles = 0x513])

Parameters

$hWnd Handle to parent or owner window
$iStyles [optional] Rebar controls support a variety of control styles in addition to standard window styles:
$RBS_AUTOSIZE - Version 4.71. The rebar control will automatically change the layout of the bands when
the size or position of the control changes. An $RBN_AUTOSIZE notification will be sent when this occurs
$RBS_BANDBORDERS - Version 4.71. The rebar control displays narrow lines to separate adjacent bands
$RBS_DBLCLKTOGGLE - Version 4.71. The rebar band will toggle its maximized or minimized state when the user
double-clicks the band. Without this style, the maximized or minimized state is toggled when the user
single-clicks on the band
$RBS_FIXEDORDER - Version 4.70. The rebar control always displays bands in the same order. You can move
bands to different rows, but the band order is static
$RBS_REGISTERDROP - Version 4.71. The rebar control generates $RBN_GETOBJECT notification messages when an
object is dragged over a band in the control
$RBS_TOOLTIPS - Version 4.71. Not yet supported
$RBS_VARHEIGHT - Version 4.71. The rebar control displays bands at the minimum required height, when
possible. Without this style, the rebar control displays all bands at the same height, using the height of
the tallest visible band to determine the height of other bands
$RBS_VERTICALGRIPPER - Version 4.71. The size grip will be displayed vertically instead of horizontally in a
vertical rebar control. This style is ignored for rebar controls that do not have the $CCS_VERT style
$CCS_LEFT - Version 4.70. Causes the control to be displayed vertically on the left side of the parent window
$CCS_NODIVIDER - Prevents a two-pixel highlight from being drawn at the top of the control
$CCS_RIGHT - Version 4.70. Causes the control to be displayed vertically on the right side of the parent window
$CCS_VERT - Version 4.70. Causes the control to be displayed vertically
Default: $CCS_TOP, $RBS_VARHEIGHT
Forced: $WS_CHILD, $WS_VISIBLE, $WS_CLIPCHILDREN, $WS_CLIPSIBLINGS

Return Value

Success: | Handle to the Rebar control
Failure: | set @error

Remarks

None.

Related

_GUICtrlRebar_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <GuiDateTimePicker.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiConstantsEx.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $hReBar

_Main()

Func _Main()
Local $hgui, $btnExit, $hToolbar, $hCombo, $hDTP, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)

_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a date time picker to put in the rebar
$hDTP = _GUICtrlDTP_Create($hgui, 0, 0, 190)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; default for add is append

; add band with control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir *.exe")

; add band with date time picker
_GUICtrlReBar_AddBand($hReBar, $hDTP, 120)

; add band with toolbar to begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

;add another control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
Local $tAUTOBREAK, $tAUTOSIZE, $tNMREBAR, $tCHEVRON, $tCHILDSIZE, $tOBJECTNOTIFY

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hReBar
Switch $iCode
Case $RBN_AUTOBREAK
; Notifies a rebar's parent that a break will appear in the bar. The parent determines whether to make the break
$tAUTOBREAK = DllStructCreate($tagNMREBARAUTOBREAK, $ilParam)
_DebugPrint("$RBN_AUTOBREAK" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tAUTOBREAK, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tAUTOBREAK, "Code") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tAUTOBREAK, "uBand") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tAUTOBREAK, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tAUTOBREAK, "lParam") & @LF & _
"-->uMsg:" & @TAB & DllStructGetData($tAUTOBREAK, "uMsg") & @LF & _
"-->fStyleCurrent:" & @TAB & DllStructGetData($tAUTOBREAK, "fStyleCurrent") & @LF & _
"-->fAutoBreak:" & @TAB & DllStructGetData($tAUTOBREAK, "fAutoBreak"))
; Return value not used
Case $RBN_AUTOSIZE
; Sent by a rebar control created with the $RBS_AUTOSIZE style when the rebar automatically resizes itself
$tAUTOSIZE = DllStructCreate($tagNMRBAUTOSIZE, $ilParam)
_DebugPrint("$RBN_AUTOSIZE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tAUTOSIZE, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tAUTOSIZE, "Code") & @LF & _
"-->fChanged:" & @TAB & DllStructGetData($tAUTOSIZE, "fChanged") & @LF & _
"-->TargetLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetLeft") & @LF & _
"-->TargetTop:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetTop") & @LF & _
"-->TargetRight:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetRight") & @LF & _
"-->TargetBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "TargetBottom") & @LF & _
"-->ActualLeft:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualLeft") & @LF & _
"-->ActualTop:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualTop") & @LF & _
"-->ActualRight:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualRight") & @LF & _
"-->ActualBottom:" & @TAB & DllStructGetData($tAUTOSIZE, "ActualBottom"))
; Return value not used
Case $RBN_BEGINDRAG
; Sent by a rebar control when the user begins dragging a band
$tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
_DebugPrint("$RBN_BEGINDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
"-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
"-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
Return 0 ; to allow the rebar to continue the drag operation
;~ Return 1 ; nonzero to abort the drag operation
Case $RBN_CHEVRONPUSHED
; Sent by a rebar control when a chevron is pushed
; When an application receives this notification, it is responsible for displaying a popup menu with items for each hidden tool.
; Use the rc member of the NMREBARCHEVRON structure to find the correct position for the popup menu
$tCHEVRON = DllStructCreate($tagNMREBARCHEVRON, $ilParam)
_DebugPrint("$RBN_CHEVRONPUSHED" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHEVRON, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tCHEVRON, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tCHEVRON, "Code") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tCHEVRON, "uBand") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tCHEVRON, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tCHEVRON, "lParam") & @LF & _
"-->Left:" & @TAB & DllStructGetData($tCHEVRON, "Left") & @LF & _
"-->Top:" & @TAB & DllStructGetData($tCHEVRON, "Top") & @LF & _
"-->Right:" & @TAB & DllStructGetData($tCHEVRON, "Right") & @LF & _
"-->lParamNM:" & @TAB & DllStructGetData($tCHEVRON, "lParamNM"))
; Return value not used
Case $RBN_CHILDSIZE
; Sent by a rebar control when a band's child window is resized
$tCHILDSIZE = DllStructCreate($tagNMREBARCHILDSIZE, $ilParam)
_DebugPrint("$RBN_CHILDSIZE" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tCHILDSIZE, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tCHILDSIZE, "Code") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tCHILDSIZE, "uBand") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tCHILDSIZE, "wID") & @LF & _
"-->CLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "CLeft") & @LF & _
"-->CTop:" & @TAB & DllStructGetData($tCHILDSIZE, "CTop") & @LF & _
"-->CRight:" & @TAB & DllStructGetData($tCHILDSIZE, "CRight") & @LF & _
"-->CBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "CBottom") & @LF & _
"-->BLeft:" & @TAB & DllStructGetData($tCHILDSIZE, "BandLeft") & @LF & _
"-->BTop:" & @TAB & DllStructGetData($tCHILDSIZE, "BTop") & @LF & _
"-->BRight:" & @TAB & DllStructGetData($tCHILDSIZE, "BRight") & @LF & _
"-->BBottom:" & @TAB & DllStructGetData($tCHILDSIZE, "BBottom"))
; Return value not used
Case $RBN_DELETEDBAND
; Sent by a rebar control after a band has been deleted
$tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
_DebugPrint("$RBN_DELETEDBAND" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
"-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
"-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
; Return value not used
Case $RBN_DELETINGBAND
; Sent by a rebar control when a band is about to be deleted
$tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
_DebugPrint("$RBN_DELETINGBAND" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
"-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
"-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
; Return value not used
Case $RBN_ENDDRAG
; Sent by a rebar control when the user stops dragging a band
$tNMREBAR = DllStructCreate($tagNMREBAR, $ilParam)
_DebugPrint("$RBN_ENDDRAG" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tNMREBAR, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tNMREBAR, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tNMREBAR, "Code") & @LF & _
"-->dwMask:" & @TAB & DllStructGetData($tNMREBAR, "dwMask") & @LF & _
"-->uBand:" & @TAB & DllStructGetData($tNMREBAR, "uBand") & @LF & _
"-->fStyle:" & @TAB & DllStructGetData($tNMREBAR, "fStyle") & @LF & _
"-->wID:" & @TAB & DllStructGetData($tNMREBAR, "wID") & @LF & _
"-->lParam:" & @TAB & DllStructGetData($tNMREBAR, "lParam"))
; Return value not used
Case $RBN_GETOBJECT
; Sent by a rebar control created with the $RBS_REGISTERDROP style when an object is dragged over a band in the control
$tOBJECTNOTIFY = DllStructCreate($tagNMOBJECTNOTIFY, $ilParam)
_DebugPrint("$RBN_GETOBJECT" & @LF & "--> hWndFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "hWndFrom") & @LF & _
"-->IDFrom:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "IDFrom") & @LF & _
"-->Code:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Code") & @LF & _
"-->Item:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Item") & @LF & _
"-->piid:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "piid") & @LF & _
"-->pObject:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "pObject") & @LF & _
"-->Result:" & @TAB & DllStructGetData($tOBJECTNOTIFY, "Result"))
; Return value not used
Case $RBN_HEIGHTCHANGE
; Sent by a rebar control when its height has changed
; Rebar controls that use the $CCS_VERT style send this notification message when their width changes
_DebugPrint("$RBN_HEIGHTCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; Return value not used
Case $RBN_LAYOUTCHANGED
; Sent by a rebar control when the user changes the layout of the control's bands
_DebugPrint("$RBN_LAYOUTCHANGED" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; Return value not used
Case $RBN_MINMAX
; Sent by a rebar control prior to maximizing or minimizing a band
_DebugPrint("$RBN_MINMAX" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; a non-zero value to prevent the operation from taking place
Return 0 ; zero to allow it to continue
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlRebar_DeleteBand

Function Reference

_GUICtrlRebar_DeleteBand

Deletes a band from a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_DeleteBand($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band to be deleted

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_AddBand, _GUICtrlRebar_AddToolBarBand

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "About to Delete Band Index 1")
_GUICtrlRebar_DeleteBand($hReBar, 1)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_Destroy

Function Reference

_GUICtrlRebar_Destroy

Delete the control

#Include <GuiRebar.au3>
_GUICtrlRebar_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True, Handle is set to 0
Failure: | False

Remarks

Restricted to only be used on control created with _GUICtrlRebar_Create

Related

_GUICtrlRebar_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "About to Destroy the Rebar")
_GUICtrlRebar_Destroy($hReBar)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_DragMove

Function Reference

_GUICtrlRebar_DragMove

Updates the drag position in the rebar control after a previous _GUICtrlRebar_BeginDrag message

#Include <GuiRebar.au3>
_GUICtrlRebar_DragMove($hWnd[, $dwPos = -1])

Parameters

$hWnd | Handle to rebar control
$dwPos | [optional] DWORD value that contains the new mouse coordinates. The horizontal coordinate is contained in the LOWORD and the vertical coordinate is contained in the HIWORD If you pass (DWORD)-1, the rebar control will use the position of the mouse the last time the control's thread called GetMessage or PeekMessage

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_BeginDrag

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $btnBeginDrag
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnBeginDrag = GUICtrlCreateButton("Begin Drag", 150, 330, 100, 25)
$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
Case $btnBeginDrag
_GUICtrlRebar_BeginDrag($hReBar, 0)
_GUICtrlRebar_DragMove($hReBar)
_GUICtrlRebar_EndDrag($hReBar)
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_EndDrag

Function Reference

_GUICtrlRebar_EndDrag

Terminates the rebar control's drag-and-drop operation. This message does not cause an $RBN_ENDDRAG notification to be sent

#Include <GuiRebar.au3>
_GUICtrlRebar_EndDrag($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_BeginDrag

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $btnBeginDrag
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnBeginDrag = GUICtrlCreateButton("Begin Drag", 150, 330, 100, 25)
$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
Case $btnBeginDrag
_GUICtrlRebar_BeginDrag($hReBar, 0)
_GUICtrlRebar_DragMove($hReBar)
_GUICtrlRebar_EndDrag($hReBar)
EndSwitch
WEnd
EndFunc ;==>_Main


Function _GUICtrlRebar_GetBandBackColor

Function Reference

_GUICtrlRebar_GetBandBackColor

Retrieves the Band background color

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandBackColor($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the Band background color

Remarks

None.

Related

_GUICtrlRebar_SetBandBackColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("======================")
MemoWrite("Band Index " & $x)
MemoWrite("======================")
MemoWrite("Back Color: " & _GUICtrlRebar_GetBandBackColor($hReBar, $x))
MemoWrite("Fore Color: " & _GUICtrlRebar_GetBandForeColor($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandBorders

Function Reference

_GUICtrlRebar_GetBandBorders

Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandBorders($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band for which the borders will be retrieved

Return Value

Returns an Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlRebar_GetBandBordersEx, _GUICtrlRebar_GetBandRect, _GUICtrlRebar_GetBandRectEx

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aBorders
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
$aBorders = _GUICtrlRebar_GetBandBorders($hReBar, $x)
MemoWrite("Band Index " & $x)
MemoWrite("==== Band Borders ====")
MemoWrite("Left..: " & $aBorders[0])
MemoWrite("Top...: " & $aBorders[1])
MemoWrite("Right.: " & $aBorders[2])
MemoWrite("Bottom: " & $aBorders[3])
MemoWrite("======================")
$aBorders = _GUICtrlRebar_GetBandRect($hReBar, $x)
MemoWrite("====== Band Rect =====")
MemoWrite("Left..: " & $aBorders[0])
MemoWrite("Top...: " & $aBorders[1])
MemoWrite("Right.: " & $aBorders[2])
MemoWrite("Bottom: " & $aBorders[3])
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandBordersEx

Function Reference

_GUICtrlRebar_GetBandBordersEx

Retrieves the borders of a band. The result of this message can be used to calculate the usable area in a band

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandBordersEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band for which the borders will be retrieved

Return Value

Returns a $tagRECT structure

Remarks

None.

Related

_GUICtrlRebar_GetBandBorders, _GUICtrlRebar_GetBandRect, _GUICtrlRebar_GetBandRectEx, $tagRECT

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $tBorders
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
$tBorders = _GUICtrlRebar_GetBandBordersEx($hReBar, $x)
MemoWrite("Band Index " & $x)
MemoWrite("==== Band Borders ====")
MemoWrite("Left..: " & DllStructGetData($tBorders, "Left"))
MemoWrite("Top...: " & DllStructGetData($tBorders, "Top"))
MemoWrite("Right.: " & DllStructGetData($tBorders, "Right"))
MemoWrite("Bottom: " & DllStructGetData($tBorders, "Bottom"))
MemoWrite("======================")
$tBorders = _GUICtrlRebar_GetBandRectEx($hReBar, $x)
MemoWrite("====== Band Rect =====")
MemoWrite("Left..: " & DllStructGetData($tBorders, "Left"))
MemoWrite("Top...: " & DllStructGetData($tBorders, "Top"))
MemoWrite("Right.: " & DllStructGetData($tBorders, "Right"))
MemoWrite("Bottom: " & DllStructGetData($tBorders, "Bottom"))
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandChildHandle

Function Reference

_GUICtrlRebar_GetBandChildHandle

Retrieves the Handle to the child window contained in the band, if any

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandChildHandle($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band for which the borders will be retrieved

Return Value

Returns the Handle to the child window contained in the band

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x)
MemoWrite("Child Handle: " & _GUICtrlRebar_GetBandChildHandle($hReBar, $x))
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandChildSize

Function Reference

_GUICtrlRebar_GetBandChildSize

Retrieves the Child size settings

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandChildSize($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns an Array with the following format:
[0] - Minimum width of the child window, in pixels.
[1] - Minimum height of the child window, in pixels.
[2] - Initial height of the band, in pixels.
[3] - Maximum height of the band, in pixels.
[4] - Step value by which the band can grow or shrink, in pixels.

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aChildSize
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
$aChildSize = _GUICtrlRebar_GetBandChildSize($hReBar, $x)
MemoWrite("Band Index " & $x)
MemoWrite("==== Child Size ======")
MemoWrite("cxMinChild: " & $aChildSize[0])
MemoWrite("cyMinChild: " & $aChildSize[1])
MemoWrite("cyChild...: " & $aChildSize[2])
MemoWrite("cyMaxChild: " & $aChildSize[3])
MemoWrite("cyIntegral: " & $aChildSize[4])
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandCount

Function Reference

_GUICtrlRebar_GetBandCount

Retrieves the count of bands currently in the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandCount($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns the number of bands assigned to the control

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

MemoWrite("Number of Bands: " & _GUICtrlRebar_GetBandCount($hReBar))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandForeColor

Function Reference

_GUICtrlRebar_GetBandForeColor

Retrieves the Band foreground color

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandForeColor($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Retuens the Band foreground color

Remarks

None.

Related

_GUICtrlRebar_SetBandForeColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("======================")
MemoWrite("Band Index " & $x)
MemoWrite("======================")
MemoWrite("Back Color: " & _GUICtrlRebar_GetBandBackColor($hReBar, $x))
MemoWrite("Fore Color: " & _GUICtrlRebar_GetBandForeColor($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandHeaderSize

Function Reference

_GUICtrlRebar_GetBandHeaderSize

Retrieves the size of the band's header, in pixels

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandHeaderSize($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the Size of the band's header

Remarks

None.

Related

_GUICtrlRebar_SetBandHeaderSize

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "Header Size: " & _GUICtrlRebar_GetBandHeaderSize($hReBar, $x))
Next

MsgBox(4096, "Information", "Setting Band Header Size")
_GUICtrlRebar_SetBandHeaderSize($hReBar, 1, 50)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "Header Size: " & _GUICtrlRebar_GetBandHeaderSize($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandID

Function Reference

_GUICtrlRebar_GetBandID

Get the value that the control uses to identify this band for custom draw notification messages

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandID($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the id of the band

Remarks

None.

Related

_GUICtrlRebar_SetBandID

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandID($hReBar, 0, 2246)

MemoWrite("Moved Band Index 0 -> 2: " & _GUICtrlRebar_MoveBand($hReBar, 0, 2))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "ID: " & _GUICtrlRebar_GetBandID($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandIdealSize

Function Reference

_GUICtrlRebar_GetBandIdealSize

Get Ideal width of the band, in pixels.

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandIdealSize($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the ideal width of the band

Remarks

If the band is maximized to the ideal width (see _GUICtrlRebar_MaximizeBand), the rebar control will attempt to make the band this width.

Related

_GUICtrlRebar_SetBandIdealSize, _GUICtrlRebar_MaximizeBand

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandIdealSize($hReBar, 1, 150)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Ideal Size: "& _GUICtrlRebar_GetBandIdealSize($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandLength

Function Reference

_GUICtrlRebar_GetBandLength

Get Length of the band, in pixels

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandLength($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the Length of the band, in pixels

Remarks

None.

Related

_GUICtrlRebar_SetBandLength

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
;~ $hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 90, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 90, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 100, 120, "Dir *.exe:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 100, 100, "Name:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Length: " & _GUICtrlRebar_GetBandLength($hReBar, $x))
Next

MemoWrite("============================================")

MsgBox(4096, "Information", "Setting Band Width")

_GUICtrlRebar_SetBandLength($hReBar, 0, 200)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Length: " & _GUICtrlRebar_GetBandLength($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
_GUICtrlEdit_AppendText($iMemo, $sMessage & @CRLF)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandLParam

Function Reference

_GUICtrlRebar_GetBandLParam

Get Application-defined value

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandLParam($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns the Application-defined value

Remarks

None.

Related

_GUICtrlRebar_SetBandLParam

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandLParam($hReBar, 0, 150)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "LParam: " & _GUICtrlRebar_GetBandLParam($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandMargins

Function Reference

_GUICtrlRebar_GetBandMargins

Get Length of the band, in pixels

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandMargins($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns an Array in the following:
[0] - Width of the left border that retains its size
[1] - Width of the right border that retains its size
[2] - Height of the top border that retains its size
[3] - Height of the bottom border that retains its size

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlRebar_GetBandMarginsEx

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aMargins
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$aMargins = _GUICtrlRebar_GetBandMargins($hReBar)
MemoWrite("==== Band Margins ====")
MemoWrite("===================================")
MemoWrite("Minimum OS -> Win XP")
MemoWrite("Margins are set Depending on Themes")
MemoWrite("===================================")
MemoWrite("Left Width.........: " & $aMargins[0])
MemoWrite("Right Width........: " & $aMargins[1])
MemoWrite("Top Height.........: " & $aMargins[2])
MemoWrite("Bottom Height......: " & $aMargins[3])
MemoWrite("======================")

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandMarginsEx

Function Reference

_GUICtrlRebar_GetBandMarginsEx

Get Length of the band, in pixels

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandMarginsEx($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns a $tagMargins structure

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlRebar_GetBandMargins, $tagMargins

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $tMargins
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$tMargins = _GUICtrlRebar_GetBandMargins($hReBar)
MemoWrite("==== Band Margins ====")
MemoWrite("===================================")
MemoWrite("Minimum OS -> Win XP")
MemoWrite("Margins are set Depending on Themes")
MemoWrite("===================================")
MemoWrite("Left Width.........: " & DllStructGetData($tMargins, "cxLeftWidth"))
MemoWrite("Right Width........: " & DllStructGetData($tMargins, "cxRightWidth"))
MemoWrite("Top Height.........: " & DllStructGetData($tMargins, "cyTopHeight"))
MemoWrite("Bottom Height......: " & DllStructGetData($tMargins, "cyBottomHeight"))
MemoWrite("======================")

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandRect

Function Reference

_GUICtrlRebar_GetBandRect

Retrieves the bounding rectangle for a given band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandRect($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of a band in the rebar control

Return Value

Returns an Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlRebar_GetBandRectEx, _GUICtrlRebar_GetBandBorders, _GUICtrlRebar_GetBandBordersEx

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aBorders
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
$aBorders = _GUICtrlRebar_GetBandBorders($hReBar, $x)
MemoWrite("Band Index " & $x)
MemoWrite("==== Band Borders ====")
MemoWrite("Left..: " & $aBorders[0])
MemoWrite("Top...: " & $aBorders[1])
MemoWrite("Right.: " & $aBorders[2])
MemoWrite("Bottom: " & $aBorders[3])
MemoWrite("======================")
$aBorders = _GUICtrlRebar_GetBandRect($hReBar, $x)
MemoWrite("====== Band Rect =====")
MemoWrite("Left..: " & $aBorders[0])
MemoWrite("Top...: " & $aBorders[1])
MemoWrite("Right.: " & $aBorders[2])
MemoWrite("Bottom: " & $aBorders[3])
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandRectEx

Function Reference

_GUICtrlRebar_GetBandRectEx

Retrieves the bounding rectangle for a given band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandRectEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of a band in the rebar control

Return Value

Returns a $tagRECT structure

Remarks

None.

Related

_GUICtrlRebar_GetBandRect, _GUICtrlRebar_GetBandBorders, _GUICtrlRebar_GetBandBordersEx

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $tBorders
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
$tBorders = _GUICtrlRebar_GetBandBordersEx($hReBar, $x)
MemoWrite("Band Index " & $x)
MemoWrite("==== Band Borders ====")
MemoWrite("Left..: " & DllStructGetData($tBorders, "Left"))
MemoWrite("Top...: " & DllStructGetData($tBorders, "Top"))
MemoWrite("Right.: " & DllStructGetData($tBorders, "Right"))
MemoWrite("Bottom: " & DllStructGetData($tBorders, "Bottom"))
MemoWrite("======================")
$tBorders = _GUICtrlRebar_GetBandRectEx($hReBar, $x)
MemoWrite("====== Band Rect =====")
MemoWrite("Left..: " & DllStructGetData($tBorders, "Left"))
MemoWrite("Top...: " & DllStructGetData($tBorders, "Top"))
MemoWrite("Right.: " & DllStructGetData($tBorders, "Right"))
MemoWrite("Bottom: " & DllStructGetData($tBorders, "Bottom"))
MemoWrite("======================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyle

Function Reference

_GUICtrlRebar_GetBandStyle

Get the band style Flags

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyle($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

Returns a value of band flags, see fStyle of $tagREBARBANDINFO

Remarks

None.

Related

_GUICtrlRebar_SetBandStyle, $tagREBARBANDINFO, _GUICtrlRebar_GetBandStyleBreak, _GUICtrlRebar_GetBandStyleChildEdge, _GUICtrlRebar_GetBandStyleFixedBMP, _GUICtrlRebar_GetBandStyleFixedSize, _GUICtrlRebar_GetBandStyleGripperAlways, _GUICtrlRebar_GetBandStyleHidden, _GUICtrlRebar_GetBandStyleHideTitle, _GUICtrlRebar_GetBandStyleNoGripper, _GUICtrlRebar_GetBandStyleTopAlign, _GUICtrlRebar_GetBandStyleUseChevron, _GUICtrlRebar_GetBandStyleVariableHeight

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandStyle($hReBar, 1, BitOR($RBBS_CHILDEDGE, $RBBS_GRIPPERALWAYS, $RBBS_NOVERT))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("==== Styles Used =====")
MemoWrite("Band Index " & $x & @TAB & "fStyle: " & _GUICtrlRebar_GetBandStyle($hReBar, $x))
MemoWrite("============================================")
MemoWrite("$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("$RBBS_NOVERT........: " & _GUICtrlRebar_GetBandStyleNoVert($hReBar, $x))
MemoWrite("$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleBreak

Function Reference

_GUICtrlRebar_GetBandStyleBreak

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleBreak($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band is on a new line)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleBreak, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Break Style")
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Break Style")
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleChildEdge

Function Reference

_GUICtrlRebar_GetBandStyleChildEdge

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleChildEdge($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band has an edge at the top and bottom of the child window)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleChildEdge, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MsgBox(4096, "Information", "Setting Child Edge Style")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
_GUICtrlRebar_SetBandStyleChildEdge($hReBar, $x, False)
MemoWrite("Band Index " & $x & @TAB & "$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Child Edge Style")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
_GUICtrlRebar_SetBandStyleChildEdge($hReBar, $x)
MemoWrite("Band Index " & $x & @TAB & "$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleFixedBMP

Function Reference

_GUICtrlRebar_GetBandStyleFixedBMP

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleFixedBMP($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The background bitmap does not move when the band is resized)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleFixedBMP, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

#include <WindowsConstants.au3>
#include <Constants.au3>
$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MsgBox(4096, "Information", "Setting Fixed BMP Style")
_GUICtrlRebar_SetBandStyleFixedBMP($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Fixed BMP Style")
_GUICtrlRebar_SetBandStyleFixedBMP($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleFixedSize

Function Reference

_GUICtrlRebar_GetBandStyleFixedSize

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleFixedSize($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band can't be sized. With this style, the sizing grip is not displayed on the band)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleFixedSize, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Fixed Size Style")
_GUICtrlRebar_SetBandStyleFixedSize($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Fixed Size Style")
_GUICtrlRebar_SetBandStyleFixedSize($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleGripperAlways

Function Reference

_GUICtrlRebar_GetBandStyleGripperAlways

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleGripperAlways($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band will always have a sizing grip, even if it is the only band in the rebar)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleGripperAlways, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Gripper Always Style")
_GUICtrlRebar_SetBandStyleGripperAlways($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Gripper Always Style")
_GUICtrlRebar_SetBandStyleGripperAlways($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleHidden

Function Reference

_GUICtrlRebar_GetBandStyleHidden

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleHidden($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band will not be visible)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleHidden, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Hidden Style")
_GUICtrlRebar_SetBandStyleHidden($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Hidden Style")
_GUICtrlRebar_SetBandStyleHidden($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleHideTitle

Function Reference

_GUICtrlRebar_GetBandStyleHideTitle

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleHideTitle($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (Keep band title hidden)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleHideTitle, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Hide Title Style")
_GUICtrlRebar_SetBandStyleHideTitle($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Hide Title Style")
_GUICtrlRebar_SetBandStyleHideTitle($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleNoGripper

Function Reference

_GUICtrlRebar_GetBandStyleNoGripper

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleNoGripper($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band will never have a sizing grip, even if there is more than one band in the rebar)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleNoGripper, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting No Gripper Style")
_GUICtrlRebar_SetBandStyleNoGripper($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting No Gripper Style")
_GUICtrlRebar_SetBandStyleNoGripper($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleTopAlign

Function Reference

_GUICtrlRebar_GetBandStyleTopAlign

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleTopAlign($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (Keep band in top row)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleTopAlign, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Top Align Style")
_GUICtrlRebar_SetBandStyleTopAlign($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Top Align Style")
_GUICtrlRebar_SetBandStyleTopAlign($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleUseChevron

Function Reference

_GUICtrlRebar_GetBandStyleUseChevron

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleUseChevron($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (Display drop-down button)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleUseChevron, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Use Chevron Style")
_GUICtrlRebar_SetBandStyleUseChevron($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Use Chevron Style")
_GUICtrlRebar_SetBandStyleUseChevron($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandStyleVariableHeight

Function Reference

_GUICtrlRebar_GetBandStyleVariableHeight

Determine if flag is set

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandStyleVariableHeight($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

True: Flag is set (The band can be resized by the rebar control)
False: Flag not set

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleVariableHeight, _GUICtrlRebar_GetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Variable Height Style")
_GUICtrlRebar_SetBandStyleVariableHeight($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Variable Height Style")
_GUICtrlRebar_SetBandStyleVariableHeight($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBandText

Function Reference

_GUICtrlRebar_GetBandText

Retrieves the display text for the band

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBandText($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band for which the information will be retrieved

Return Value

Returns the display text for the band

Remarks

None.

Related

_GUICtrlRebar_SetBandText

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Text: " & _GUICtrlRebar_GetBandText($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Band Text")
_GUICtrlRebar_SetBandText($hReBar, 1, "Your Name:")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Text: " & _GUICtrlRebar_GetBandText($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBarHeight

Function Reference

_GUICtrlRebar_GetBarHeight

Retrieves the height of the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBarHeight($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns the Value that represents the height, in pixels, of the control

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MemoWrite("Bar Height: " & _GUICtrlRebar_GetBarHeight($hReBar))

MsgBox(4096, "Information", "Force height to change")
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("Bar Height: " & _GUICtrlRebar_GetBarHeight($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBarInfo

Function Reference

_GUICtrlRebar_GetBarInfo

Retrieves information about the rebar control and the image list it uses

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBarInfo($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns the Handle to an image list. The rebar control will use the specified image list to obtain images

Remarks

Currently, rebar controls support only image list handle

Related

_GUICtrlRebar_SetBarInfo

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $hImage
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlRebar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolbar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x)
Next
_GUICtrlRebar_SetBarInfo($hReBar, $hImage)

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlRebar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MemoWrite("Image List Handle: " & _GUICtrlRebar_GetBarInfo($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetBKColor

Function Reference

_GUICtrlRebar_GetBKColor

Retrieves a rebar control's default background color

#Include <GuiRebar.au3>
_GUICtrlRebar_GetBKColor($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns a COLORREF value that represent the current default background color

Remarks

None.

Related

_GUICtrlRebar_SetBKColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

#include <WindowsConstants.au3>
#include <Constants.au3>
$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Bar Color ==========")
MemoWrite("Previous BK Color..: " & _GUICtrlRebar_SetBKColor($hReBar, Int(0x00008B)))
MemoWrite("BK Color...........: " & _GUICtrlRebar_GetBKColor($hReBar))
MemoWrite("Previous Text Color: " & _GUICtrlRebar_SetTextColor($hReBar, Int(0xFFFFFF)))
MemoWrite("Text Color.........: " & _GUICtrlRebar_GetTextColor($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetColorScheme

Function Reference

_GUICtrlRebar_GetColorScheme

Retrieves the color scheme information from the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetColorScheme($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns an Array of the following:
[0] - The COLORREF value that represents the highlight color of the buttons
[1] - The COLORREF value that represents the shadow color of the buttons

Remarks

None.

Related

_GUICtrlRebar_SetColorScheme

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aColors
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Color Scheme ==========")
$aColors = _GUICtrlRebar_GetColorScheme($hReBar)
MemoWrite("BtnHighlight.......: " & $aColors[0])
MemoWrite("BtnShadow..........: " & $aColors[1])

MsgBox(4096, "Information", "Setting Color Scheme")
_GUICtrlRebar_SetColorScheme($hReBar, Int(0x00008B), Int(0xFFFFFF))

MemoWrite(@CRLF & "========== Color Scheme ==========")
$aColors = _GUICtrlRebar_GetColorScheme($hReBar)
MemoWrite("BtnHighlight.......: " & $aColors[0])
MemoWrite("BtnShadow..........: " & $aColors[1])

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetRowCount

Function Reference

_GUICtrlRebar_GetRowCount

Retrieves the number of rows of bands in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetRowCount($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns A value that represents the number of band rows in the control

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("Row Count: " & _GUICtrlRebar_GetRowCount($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetRowHeight

Function Reference

_GUICtrlRebar_GetRowHeight

Retrieves the height of a specified row in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetRowHeight($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of a band. The height of the row that contains the specified band will be retrieved

Return Value

Returns A value that represents the row height, in pixels

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)
For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Row Height: " & _GUICtrlRebar_GetRowHeight($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetTextColor

Function Reference

_GUICtrlRebar_GetTextColor

Retrieves a rebar control's default text color

#Include <GuiRebar.au3>
_GUICtrlRebar_GetTextColor($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Returns A value that represent the current default text color

Remarks

None.

Related

_GUICtrlRebar_SetTextColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Bar Color ==========")
MemoWrite("Previous BK Color..: " & _GUICtrlRebar_SetBKColor($hReBar, Int(0x00008B)))
MemoWrite("BK Color...........: " & _GUICtrlRebar_GetBKColor($hReBar))
MemoWrite("Previous Text Color: " & _GUICtrlRebar_SetTextColor($hReBar, Int(0xFFFFFF)))
MemoWrite("Text Color.........: " & _GUICtrlRebar_GetTextColor($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetToolTips

Function Reference

_GUICtrlRebar_GetToolTips

Retrieves the handle to any ToolTip control associated with the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetToolTips($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

Success: | The handle to the ToolTip control associated with the rebar control
Failure: | 0 if no ToolTip control is associated with the rebar control

Remarks

None.

Related

_GUICtrlRebar_SetToolTips

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiToolTip.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $hToolTip
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

$hToolTip = _GUIToolTip_Create($hReBar)

MemoWrite("ToolTips Handle: " & _GUICtrlRebar_GetToolTips($hReBar))

MsgBox(4096, "Information", "Setting ToolTips Handle")
_GUICtrlRebar_SetToolTips($hReBar, $hToolTip)

MemoWrite("ToolTips Handle: " & _GUICtrlRebar_GetToolTips($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_GetUnicodeFormat

Function Reference

_GUICtrlRebar_GetUnicodeFormat

Retrieves the Unicode character format flag for the control

#Include <GuiRebar.au3>
_GUICtrlRebar_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to rebar control

Return Value

True: The control is using Unicode characters
False: The control is using ANSI characters

Remarks

None.

Related

_GUICtrlRebar_SetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("Unicode: " & _GUICtrlRebar_GetUnicodeFormat($hReBar))

MsgBox(4096, "Information", "Setting Unicode")
_GUICtrlRebar_SetUnicodeFormat($hReBar)

MemoWrite("Unicode: " & _GUICtrlRebar_GetUnicodeFormat($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_HitTest

Function Reference

_GUICtrlRebar_HitTest

Determines which item is at a specified position

#Include <GuiRebar.au3>
_GUICtrlRebar_HitTest($hWnd[, $iX = -1[, $iY = -1]])

Parameters

$hWnd | Handle to the control
$iX | [optional] X position, in client coordinates, to be tested or -1 to use the current mouse position
$iY | [optional] Y position, in client coordinates, to be tested or -1 to use the current mouse position

Return Value

Success: | Array with the following format:
 | [0] - Zero based index of the band at the specified position, or -1
 | [1] - If True, position is in control's client window but not on an band
 | [2] - If True, position is in control's client window
 | [3] - If True, position is over the rebar band's caption
 | [4] - If True, position is over the rebar band's chevron (version 5.80 and greater)
 | [5] - If True, position is over the rebar band's gripper
Failure: | Set @error

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aHitTest
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

$aHitTest = _GUICtrlRebar_HitTest($hReBar, 150, 25)
MemoWrite("iBand........: " & $aHitTest[0])
MemoWrite("$RBHT_NOWHERE: " & $aHitTest[5])
MemoWrite("$RBHT_CLIENT.: " & $aHitTest[3])
MemoWrite("$RBHT_CAPTION: " & $aHitTest[1])
MemoWrite("$RBHT_CHEVRON: " & $aHitTest[2])
MemoWrite("$RBHT_GRABBER: " & $aHitTest[4])

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_IDToIndex

Function Reference

_GUICtrlRebar_IDToIndex

Converts a band identifier to a band index in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_IDToIndex($hWnd, $iID)

Parameters

$hWnd | Handle to rebar control
$iID | The application-defined identifier of the band in question

Return Value

Success: | zero-based band index
Failure: | -1

Remarks

If duplicate band identifiers exist, the first one is returned

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandID($hReBar, 0, 2246)
MemoWrite("Set Band Index 0 ID: " & _GUICtrlRebar_GetBandID($hReBar, 0))

MemoWrite("Moved Band Index 0 -> 2: " & _GUICtrlRebar_MoveBand($hReBar, 0, 2))

MemoWrite("ID 2246, Index: " & _GUICtrlRebar_IDToIndex($hReBar, 2246))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_MaximizeBand

Function Reference

_GUICtrlRebar_MaximizeBand

Resizes a band in a rebar control to either its ideal or largest size

#Include <GuiRebar.au3>
_GUICtrlRebar_MaximizeBand($hWnd, $iIndex[, $fIdeal = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fIdeal | [optional] Indicates if the ideal width of the band should be used when the band is maximized

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_GetBandIdealSize

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Minimize Band")
_GUICtrlRebar_MinimizeBand($hReBar, 1)
MsgBox(4096, "Information", "Maximize Band 1 to largest Size")
_GUICtrlRebar_MaximizeBand($hReBar, 1, False)
MsgBox(4096, "Information", "Maximize Band 0 to Ideal Size")
_GUICtrlRebar_MaximizeBand($hReBar, 0)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_MinimizeBand

Function Reference

_GUICtrlRebar_MinimizeBand

Resizes a band in a rebar control to its smallest size

#Include <GuiRebar.au3>
_GUICtrlRebar_MinimizeBand($hWnd, $iIndex)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band

Return Value

None.

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Minimize Band")
_GUICtrlRebar_MinimizeBand($hReBar, 1)
MsgBox(4096, "Information", "Maximize Band 1 to largest Size")
_GUICtrlRebar_MaximizeBand($hReBar, 1, False)
MsgBox(4096, "Information", "Maximize Band 0 to Ideal Size")
_GUICtrlRebar_MaximizeBand($hReBar, 0)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_MoveBand

Function Reference

_GUICtrlRebar_MoveBand

Moves a band from one index to another

#Include <GuiRebar.au3>
_GUICtrlRebar_MoveBand($hWnd, $iIndexFrom, $iIndexTo)

Parameters

$hWnd | Handle to rebar control
$iIndexFrom | Zero-based index of the band to be moved
$iIndexTo | Zero-based index of the new band position

Return Value

Success: | True
Failure: | False

Remarks

This message will most likely change the index of other bands in the rebar control.
If a band is moved from index 6 to index 0, all of the bands in between will have their index incremented by one.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandID($hReBar, 0, 2246)

MemoWrite("Moved Band Index 0 -> 2: " & _GUICtrlRebar_MoveBand($hReBar, 0, 2))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "ID: " & _GUICtrlRebar_GetBandID($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandBackColor

Function Reference

_GUICtrlRebar_SetBandBackColor

Set the Band background color

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandBackColor($hWnd, $iIndex, $iColor)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$iColor | New color for band background

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandBackColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("======================")
MemoWrite("Band Index " & $x)
MemoWrite("======================")
MemoWrite("Back Color: " & _GUICtrlRebar_GetBandBackColor($hReBar, $x))
MemoWrite("Fore Color: " & _GUICtrlRebar_GetBandForeColor($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandForeColor

Function Reference

_GUICtrlRebar_SetBandForeColor

Set the Band foreground color

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandForeColor($hWnd, $iIndex, $iColor)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$iColor | New color for band foreground

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandForeColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("======================")
MemoWrite("Band Index " & $x)
MemoWrite("======================")
MemoWrite("Back Color: " & _GUICtrlRebar_GetBandBackColor($hReBar, $x))
MemoWrite("Fore Color: " & _GUICtrlRebar_GetBandForeColor($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandHeaderSize

Function Reference

_GUICtrlRebar_SetBandHeaderSize

Set the size of the band's header, in pixels

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandHeaderSize($hWnd, $iIndex, $iNewSize)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$iNewSize | New size of the band's header

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandHeaderSize

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "Header Size: " & _GUICtrlRebar_GetBandHeaderSize($hReBar, $x))
Next

MsgBox(4096, "Information", "Setting Band Header Size")
_GUICtrlRebar_SetBandHeaderSize($hReBar, 1, 50)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "Header Size: " & _GUICtrlRebar_GetBandHeaderSize($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandID

Function Reference

_GUICtrlRebar_SetBandID

Set the value that the control uses to identify this band for custom draw notification messages

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandID($hWnd, $iIndex, $iID)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$iID | value that the control uses to identify this band for custom draw notification messages

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandID

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 120, 200, "Dir " & @WindowsDir & "\*.exe:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandID($hReBar, 0, 2246)

MemoWrite("Moved Band Index 0 -> 2: " & _GUICtrlRebar_MoveBand($hReBar, 0, 2))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("============================================")
MemoWrite("Band Index " & $x & @TAB & "ID: " & _GUICtrlRebar_GetBandID($hReBar, $x))
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandIdealSize

Function Reference

_GUICtrlRebar_SetBandIdealSize

Set Ideal width of the band, in pixels.

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandIdealSize($hWnd, $iIndex, $iNewSize)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$iNewSize | Ideal width of the band, in pixels

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandIdealSize

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandIdealSize($hReBar, 1, 150)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Ideal Size: "& _GUICtrlRebar_GetBandIdealSize($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandLength

Function Reference

_GUICtrlRebar_SetBandLength

Set Application-defined value

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandLength($hWnd, $iIndex, $icx)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$icx | Length of the band, in pixels

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandLength

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiComboBox.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hCombo, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
;~ $hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a combobox to put in the rebar
$hCombo = _GUICtrlComboBox_Create($hgui, "", 0, 0, 90, 120)
_GUICtrlComboBox_BeginUpdate($hCombo)
_GUICtrlComboBox_AddDir($hCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($hCombo)

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 90, 20)

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, $hCombo, 100, 120, "Dir *.exe:")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 100, 100, "Name:")

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Length: " & _GUICtrlRebar_GetBandLength($hReBar, $x))
Next

MemoWrite("============================================")

MsgBox(4096, "Information", "Setting Band Width")

_GUICtrlRebar_SetBandLength($hReBar, 0, 200)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Length: " & _GUICtrlRebar_GetBandLength($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
_GUICtrlEdit_AppendText($iMemo, $sMessage & @CRLF)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandLParam

Function Reference

_GUICtrlRebar_SetBandLParam

Set Application-defined value

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandLParam($hWnd, $iIndex, $ilParam)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$ilParam | Application-defined value

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandLParam

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandLParam($hReBar, 0, 150)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "LParam: " & _GUICtrlRebar_GetBandLParam($hReBar, $x))
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyle

Function Reference

_GUICtrlRebar_SetBandStyle

Set the band style Flags

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyle($hWnd, $iIndex, $fStyle)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fStyle | see $tagREBARBANDINFO

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyle, $tagREBARBANDINFO, _GUICtrlRebar_SetBandStyleBreak, _GUICtrlRebar_SetBandStyleChildEdge, _GUICtrlRebar_SetBandStyleFixedBMP, _GUICtrlRebar_SetBandStyleFixedSize, _GUICtrlRebar_SetBandStyleGripperAlways, _GUICtrlRebar_SetBandStyleHidden, _GUICtrlRebar_SetBandStyleHideTitle, _GUICtrlRebar_SetBandStyleNoGripper, _GUICtrlRebar_SetBandStyleTopAlign, _GUICtrlRebar_SetBandStyleUseChevron, _GUICtrlRebar_SetBandStyleVariableHeight

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

_GUICtrlRebar_SetBandStyle($hReBar, 1, BitOR($RBBS_CHILDEDGE, $RBBS_GRIPPERALWAYS, $RBBS_NOVERT))

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("==== Styles Used =====")
MemoWrite("Band Index " & $x & @TAB & "fStyle: " & _GUICtrlRebar_GetBandStyle($hReBar, $x))
MemoWrite("============================================")
MemoWrite("$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("$RBBS_NOVERT........: " & _GUICtrlRebar_GetBandStyleNoVert($hReBar, $x))
MemoWrite("$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleBreak

Function Reference

_GUICtrlRebar_SetBandStyleBreak

Set whether the band is on a new line

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleBreak($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleBreak, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Break Style")
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Break Style")
_GUICtrlRebar_SetBandStyleBreak($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_BREAK.........: " & _GUICtrlRebar_GetBandStyleBreak($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleChildEdge

Function Reference

_GUICtrlRebar_SetBandStyleChildEdge

Set whether the band has an edge at the top and bottom of the child window

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleChildEdge($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleChildEdge, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MsgBox(4096, "Information", "Setting Child Edge Style")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
_GUICtrlRebar_SetBandStyleChildEdge($hReBar, $x, False)
MemoWrite("Band Index " & $x & @TAB & "$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Child Edge Style")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
_GUICtrlRebar_SetBandStyleChildEdge($hReBar, $x)
MemoWrite("Band Index " & $x & @TAB & "$RBBS_CHILDEDGE.....: " & _GUICtrlRebar_GetBandStyleChildEdge($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleFixedBMP

Function Reference

_GUICtrlRebar_SetBandStyleFixedBMP

Set whether the band background bitmap does not move when the band is resized

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleFixedBMP($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleFixedBMP, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MsgBox(4096, "Information", "Setting Fixed BMP Style")
_GUICtrlRebar_SetBandStyleFixedBMP($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Fixed BMP Style")
_GUICtrlRebar_SetBandStyleFixedBMP($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDBMP......: " & _GUICtrlRebar_GetBandStyleFixedBMP($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleFixedSize

Function Reference

_GUICtrlRebar_SetBandStyleFixedSize

Set whether the band can't be sized. With this style, the sizing grip is not displayed on the band

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleFixedSize($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleFixedSize, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Fixed Size Style")
_GUICtrlRebar_SetBandStyleFixedSize($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Fixed Size Style")
_GUICtrlRebar_SetBandStyleFixedSize($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_FIXEDSIZE.....: " & _GUICtrlRebar_GetBandStyleFixedSize($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleGripperAlways

Function Reference

_GUICtrlRebar_SetBandStyleGripperAlways

Set whether the band will always have a sizing grip, even if it is the only band in the rebar

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleGripperAlways($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleGripperAlways, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Gripper Always Style")
_GUICtrlRebar_SetBandStyleGripperAlways($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Gripper Always Style")
_GUICtrlRebar_SetBandStyleGripperAlways($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_GRIPPERALWAYS.: " & _GUICtrlRebar_GetBandStyleGripperAlways($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleHidden

Function Reference

_GUICtrlRebar_SetBandStyleHidden

Set whether the band will not be visible

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleHidden($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleHidden, _GUICtrlRebar_SetBandStyle, _GUICtrlRebar_ShowBand

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Hidden Style")
_GUICtrlRebar_SetBandStyleHidden($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Hidden Style")
_GUICtrlRebar_SetBandStyleHidden($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDDEN........: " & _GUICtrlRebar_GetBandStyleHidden($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleHideTitle

Function Reference

_GUICtrlRebar_SetBandStyleHideTitle

Set whether to keep band title hidden

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleHideTitle($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleHideTitle, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Hide Title Style")
_GUICtrlRebar_SetBandStyleHideTitle($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Hide Title Style")
_GUICtrlRebar_SetBandStyleHideTitle($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_HIDETITLE.....: " & _GUICtrlRebar_GetBandStyleHideTitle($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleNoGripper

Function Reference

_GUICtrlRebar_SetBandStyleNoGripper

Set whether the band will never have a sizing grip, even if there is more than one band in the rebar

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleNoGripper($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleNoGripper, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting No Gripper Style")
_GUICtrlRebar_SetBandStyleNoGripper($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting No Gripper Style")
_GUICtrlRebar_SetBandStyleNoGripper($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_NOGRIPPER.....: " & _GUICtrlRebar_GetBandStyleNoGripper($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleTopAlign

Function Reference

_GUICtrlRebar_SetBandStyleTopAlign

Set whether to keep band in top row

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleTopAlign($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleTopAlign, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Top Align Style")
_GUICtrlRebar_SetBandStyleTopAlign($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Top Align Style")
_GUICtrlRebar_SetBandStyleTopAlign($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_TOPALIGN......: " & _GUICtrlRebar_GetBandStyleTopAlign($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleUseChevron

Function Reference

_GUICtrlRebar_SetBandStyleUseChevron

Set whether to display drop-down button

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleUseChevron($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

Version 5.80. Show a chevron button if the band is smaller than cxIdeal

Related

_GUICtrlRebar_GetBandStyleUseChevron, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Use Chevron Style")
_GUICtrlRebar_SetBandStyleUseChevron($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Use Chevron Style")
_GUICtrlRebar_SetBandStyleUseChevron($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_USECHEVRON....: " & _GUICtrlRebar_GetBandStyleUseChevron($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandStyleVariableHeight

Function Reference

_GUICtrlRebar_SetBandStyleVariableHeight

Set whether the band can be resized by the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandStyleVariableHeight($hWnd, $iIndex[, $fEnabled = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fEnabled | [optional] If True the item state is set, otherwise it is not set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandStyleVariableHeight, _GUICtrlRebar_SetBandStyle

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Setting Variable Height Style")
_GUICtrlRebar_SetBandStyleVariableHeight($hReBar, 1)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Variable Height Style")
_GUICtrlRebar_SetBandStyleVariableHeight($hReBar, 1, False)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "$RBBS_VARIABLEHEIGHT: " & _GUICtrlRebar_GetBandStyleVariableHeight($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBandText

Function Reference

_GUICtrlRebar_SetBandText

Retrieves the display text for the band

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBandText($hWnd, $iIndex, $sText)

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band for which the information will be set
$sText | New display text for the band

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlRebar_GetBandText

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Text: " & _GUICtrlRebar_GetBandText($hReBar, $x))
MemoWrite("============================================")
Next

MsgBox(4096, "Information", "Setting Band Text")
_GUICtrlRebar_SetBandText($hReBar, 1, "Your Name:")

For $x = 0 To _GUICtrlRebar_GetBandCount($hReBar) - 1
MemoWrite("Band Index " & $x & @TAB & "Text: " & _GUICtrlRebar_GetBandText($hReBar, $x))
MemoWrite("============================================")
Next

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBarInfo

Function Reference

_GUICtrlRebar_SetBarInfo

Sets the characteristics of a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBarInfo($hWnd, $himl)

Parameters

$hWnd | Handle to rebar control
$himl | Handle to the Image list

Return Value

Success: | True
Failure: | False

Remarks

Currently, rebar controls support only image list handle

Related

_GUICtrlRebar_GetBarInfo

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiImageList.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $hImage
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlRebar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolbar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x)
Next
_GUICtrlRebar_SetBarInfo($hReBar, $hImage)

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlRebar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlRebar_AddToolBarBand($hReBar, $hToolbar, "", 0)

_GUICtrlRebar_SetBandBackColor($hReBar, 1, Int(0x00008B))
_GUICtrlRebar_SetBandForeColor($hReBar, 1, Int(0xFFFFFF))

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MemoWrite("Image List Handle: " & _GUICtrlRebar_GetBarInfo($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetBKColor

Function Reference

_GUICtrlRebar_SetBKColor

Retrieves a rebar control's default background color

#Include <GuiRebar.au3>
_GUICtrlRebar_SetBKColor($hWnd, $iColor)

Parameters

$hWnd | Handle to rebar control
$iColor | COLORREF value that represents the new default background color

Return Value

Returns A COLORREF value that represents the previous default background color

Remarks

None.

Related

_GUICtrlRebar_GetBKColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Bar Color ==========")
MemoWrite("Previous BK Color..: " & _GUICtrlRebar_SetBKColor($hReBar, Int(0x00008B)))
MemoWrite("BK Color...........: " & _GUICtrlRebar_GetBKColor($hReBar))
MemoWrite("Previous Text Color: " & _GUICtrlRebar_SetTextColor($hReBar, Int(0xFFFFFF)))
MemoWrite("Text Color.........: " & _GUICtrlRebar_GetTextColor($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetColorScheme

Function Reference

_GUICtrlRebar_SetColorScheme

Retrieves a rebar control's default background color

#Include <GuiRebar.au3>
_GUICtrlRebar_SetColorScheme($hWnd, $BtnHighlight, $BtnShadow)

Parameters

$hWnd | Handle to rebar control
$BtnHighlight | COLORREF value that represents the highlight color of the buttons
$BtnShadow | COLORREF value that represents the shadow color of the buttons

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_GetColorScheme

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $aColors
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Color Scheme ==========")
$aColors = _GUICtrlRebar_GetColorScheme($hReBar)
MemoWrite("BtnHighlight.......: " & $aColors[0])
MemoWrite("BtnShadow..........: " & $aColors[1])

MsgBox(4096, "Information", "Setting Color Scheme")
_GUICtrlRebar_SetColorScheme($hReBar, Int(0x00008B), Int(0xFFFFFF))

MemoWrite(@CRLF & "========== Color Scheme ==========")
$aColors = _GUICtrlRebar_GetColorScheme($hReBar)
MemoWrite("BtnHighlight.......: " & $aColors[0])
MemoWrite("BtnShadow..........: " & $aColors[1])

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetTextColor

Function Reference

_GUICtrlRebar_SetTextColor

Sets a rebar control's default text color

#Include <GuiRebar.au3>
_GUICtrlRebar_SetTextColor($hWnd, $iColor)

Parameters

$hWnd | Handle to rebar control
$iColor | COLORREF value that represents the new default text color

Return Value

Returns A COLORREF value that represents the previous default text color

Remarks

None.

Related

_GUICtrlRebar_GetTextColor

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("========== Bar Color ==========")
MemoWrite("Previous BK Color..: " & _GUICtrlRebar_SetBKColor($hReBar, Int(0x00008B)))
MemoWrite("BK Color...........: " & _GUICtrlRebar_GetBKColor($hReBar))
MemoWrite("Previous Text Color: " & _GUICtrlRebar_SetTextColor($hReBar, Int(0xFFFFFF)))
MemoWrite("Text Color.........: " & _GUICtrlRebar_GetTextColor($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetToolTips

Function Reference

_GUICtrlRebar_SetToolTips

Associates a ToolTip control with the rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_SetToolTips($hWnd, $hToolTip)

Parameters

$hWnd | Handle to rebar control
$hToolTip | Handle to the ToolTip control to be set

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_GetToolTips

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <GuiToolTip.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput, $hToolTip
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

$hToolTip = _GUIToolTip_Create($hReBar)

MemoWrite("ToolTips Handle: " & _GUICtrlRebar_GetToolTips($hReBar))

MsgBox(4096, "Information", "Setting ToolTips Handle")
_GUICtrlRebar_SetToolTips($hReBar, $hToolTip)

MemoWrite("ToolTips Handle: " & _GUICtrlRebar_GetToolTips($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_SetUnicodeFormat

Function Reference

_GUICtrlRebar_SetUnicodeFormat

Sets the Unicode character format flag for the control

#Include <GuiRebar.au3>
_GUICtrlRebar_SetUnicodeFormat($hWnd[, $fUnicode = True])

Parameters

$hWnd | Handle to rebar control
$fUnicode | [optional] Determines the character set that is used by the control: True - The control will use Unicode characters False - The control will use ANSI characters

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_GetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

_GUICtrlRebar_SetBandStyleBreak($hReBar, 1)

MemoWrite("Unicode: " & _GUICtrlRebar_GetUnicodeFormat($hReBar))

MsgBox(4096, "Information", "Setting Unicode")
_GUICtrlRebar_SetUnicodeFormat($hReBar)

MemoWrite("Unicode: " & _GUICtrlRebar_GetUnicodeFormat($hReBar))

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlRebar_ShowBand

Function Reference

_GUICtrlRebar_ShowBand

Shows or hides a given band in a rebar control

#Include <GuiRebar.au3>
_GUICtrlRebar_ShowBand($hWnd, $iIndex[, $fShow = True])

Parameters

$hWnd | Handle to rebar control
$iIndex | Zero-based index of the band
$fShow | [optional] indicates if the band should be shown or hidden: True - Show False - Hide

Return Value

None.

Remarks

None.

Related

_GUICtrlRebar_SetBandStyleHidden

Example

#include <GuiConstantsEx.au3>
#include <GuiReBar.au3>
#include <GuiToolBar.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt("MustDeclareVars", 1)

$Debug_RB = False

Global $iMemo

_Main()

Func _Main()
Local $hgui, $btnExit, $hReBar, $hToolbar, $hInput
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

$hgui = GUICreate("Rebar", 400, 396, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_MAXIMIZEBOX))

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hgui, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 100, 396, 250, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

; create a toolbar to put in the rebar
$hToolbar = _GUICtrlToolBar_Create($hgui, BitOR($TBSTYLE_FLAT, $CCS_NORESIZE, $CCS_NOPARENTALIGN))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; create a input box to put in the rebar
$hInput = GUICtrlCreateInput("Input control", 0, 0, 120, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "Name:")

; add band containing the control to the begining of rebar
_GUICtrlReBar_AddToolBarBand($hReBar, $hToolbar, "", 0)

$btnExit = GUICtrlCreateButton("Exit", 150, 360, 100, 25)
GUICtrlSetState($btnExit, $GUI_DEFBUTTON)
GUICtrlSetState($btnExit, $GUI_FOCUS)

GUISetState(@SW_SHOW)

MsgBox(4096, "Information", "Hide Band using _GUICtrlRebar_ShowBand")
_GUICtrlRebar_ShowBand($hReBar, 0, False)

MsgBox(4096, "Information", "Show Band using _GUICtrlRebar_ShowBand")
_GUICtrlRebar_ShowBand($hReBar, 0)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $btnExit
Exit
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

GuiRichEdit user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiRichEdit.au3>.

User Defined Function | Description
_GUICtrlRichEdit_AppendText | Appends text at the end of the client area
_GUICtrlRichEdit_AutoDetectURL | Enables or disables automatic detection of URLS
_GUICtrlRichEdit_CanPaste | Can the contents of the clipboard be pasted into the control?
_GUICtrlRichEdit_CanPasteSpecial | Can the contents of the clipboard be pasted into the control in both formats?
_GUICtrlRichEdit_CanRedo | Can an undone action be redone?
_GUICtrlRichEdit_CanUndo | Can an action be undone?
_GUICtrlRichEdit_ChangeFontSize | Increment or decrement font size(s) of selected text
_GUICtrlRichEdit_Copy | Copy text to clipboard
_GUICtrlRichEdit_Create | Create a Edit control
_GUICtrlRichEdit_Cut | Cut text to clipboard
_GUICtrlRichEdit_Deselect | Deselects text, leaving none selected
_GUICtrlRichEdit_Destroy | Delete the Rich Edit control
_GUICtrlRichEdit_EmptyUndoBuffer | Resets the undo flag of the control
_GUICtrlRichEdit_FindText | Search for a text starting at insertion point or at anchor point of selection
_GUICtrlRichEdit_FindTextInRange | Search for a text in a range of inter-character positions
_GUICtrlRichEdit_GetCharAttributes | Returns attributes of selected text
_GUICtrlRichEdit_GetCharBkColor | Retrieves the background color of the selected text or, if none selected, of the character to the right of the insertion point
_GUICtrlRichEdit_GetCharColor | Retrieves the color of the selected text or, if none selected, of the character to the right of the insertion point
_GUICtrlRichEdit_GetCharPosFromXY | Gets inter-character position closest to a specified point in the client area
_GUICtrlRichEdit_GetCharPosOfNextWord | Gets inter-character position before the next word
_GUICtrlRichEdit_GetCharPosOfPreviousWord | Gets inter-character position before the Previous word
_GUICtrlRichEdit_GetCharWordBreakInfo | Gets inter-character position before the Previous word
_GUICtrlRichEdit_GetBkColor | Gets the background color of the control
_GUICtrlRichEdit_GetFont | Gets the font attributes of a selection or, if no selection, at the insertion point
_GUICtrlRichEdit_GetRECT | Retrieves the formatting rectangle of a control
_GUICtrlRichEdit_GetText | Get all of the text in the control
_GUICtrlRichEdit_GetTextLength | Get the length of the whole text in the control
_GUICtrlRichEdit_GetZoom | Gets the zoom level of the control
_GUICtrlRichEdit_GetFirstCharPosOnLine | Retrieves the inter-character position preceding the first character of a line
_GUICtrlRichEdit_GetLineCount | Retrieves the number of lines in a multi-line edit control
_GUICtrlRichEdit_GetLineLength | Retrieves the length of a line
_GUICtrlRichEdit_GetLineNumberFromCharPos | Retrieves the line number on which an inter-character position is found
_GUICtrlRichEdit_GetNextRedo | Retrieves the name or type ID of the next possible redo action
_GUICtrlRichEdit_GetNextUndo | Retrieves the name or type ID of the next possible Undo action
_GUICtrlRichEdit_GetNumberOfFirstVisibleLine | Gets number of the first line which is visible in the control
_GUICtrlRichEdit_GetParaAlignment | Gets the alignment of selected paragraph(s), or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaAttributes | Gets the attributes of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaBorder | Gets the border settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaIndents | Gets the border indent settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaNumbering | Gets the numbering style of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaShading | Gets the shading settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaSpacing | Gets the spacing settings of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetParaTabStops | Gets the tabstops of (first) selected paragraph or (if no selection) of the current paragraph
_GUICtrlRichEdit_GetPasswordChar | Gets the password character that a rich edit control displays when the user enters text
_GUICtrlRichEdit_GetScrollPos | Gets the Scrolling position of the control
_GUICtrlRichEdit_GetSel | Gets the low and high inter-character positions of a selection
_GUICtrlRichEdit_GetSelAA | Gets the anchor and active inter-character positions of a selection, in that order
_GUICtrlRichEdit_GetSelText | Retrieves the currently selected text
_GUICtrlRichEdit_GetSpaceUnit | Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions
_GUICtrlRichEdit_GetTextInLine | Gets a line of text
_GUICtrlRichEdit_GetTextInRange | Gets the text from from one inter-character position to another
_GUICtrlRichEdit_GetVersion | Retrieves the version of Rich Edit
_GUICtrlRichEdit_GetXYFromCharPos | Retrieves the XY coordinates of an inter-character position
_GUICtrlRichEdit_GotoCharPos | Moves the insertion point to an inter-character position
_GUICtrlRichEdit_HideSelection | Hides (or shows) a selection
_GUICtrlRichEdit_InsertText | Inserts text at insertion point or anchor point of selection
_GUICtrlRichEdit_IsModified | Retrieves the state of a rich edit control's modification flag
_GUICtrlRichEdit_IsTextSelected | Is text selected?
_GUICtrlRichEdit_Paste | Paste RTF or RTF with Objects from clipboard
_GUICtrlRichEdit_PasteSpecial | Paste RTF or RTF and Objects from clipboard
_GUICtrlRichEdit_PauseRedraw | Pauses redrawing of the control
_GUICtrlRichEdit_Redo | Redoes last undone action
_GUICtrlRichEdit_ReplaceText | Replaces selected text
_GUICtrlRichEdit_ResumeRedraw | Resumes redrawing of the control
_GUICtrlRichEdit_ScrollLineOrPage | Scrolls the text down or up a line or a page
_GUICtrlRichEdit_ScrollLines | Scrolls the text down or up a number of lines
_GUICtrlRichEdit_ScrollToCaret | Scrolls to show line on which caret (insertion point) is
_GUICtrlRichEdit_SetCharAttributes | Turns an attribute on or off for selected text or, if none selected, for text inserted at the insertion point
_GUICtrlRichEdit_SetCharBkColor | Sets the background color of selected text or, if none selected, sets the background color of text inserted at the insertion point
_GUICtrlRichEdit_SetCharColor | Sets the color of selected text or, if none selected, sets the background color of text inserted at the insertion point
_GUICtrlRichEdit_SetBkColor | Sets the background color of the control
_GUICtrlRichEdit_SetEventMask | Specifies which notification messages are sent to the parent window
_GUICtrlRichEdit_SetFont | Sets the font attributes of selected text or, if none selected, sets those of text inserted at the insertion point
_GUICtrlRichEdit_SetLimitOnText | Change number of characters that can be typed, pasted or streamed in as Rich Text Format
_GUICtrlRichEdit_SetModified | Sets or clears the modification flag
_GUICtrlRichEdit_SetRECT | Sets or clears the modification flag
_GUICtrlRichEdit_SetTabStops | Sets tab stops for the control
_GUICtrlRichEdit_SetZoom | Sets zoom level of the control
_GUICtrlRichEdit_SetParaAlignment | Sets alignment of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaAttributes | Sets attributes of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaBorder | Sets the border of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaIndents | Sets indents of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaNumbering | Sets numbering of paragraph(s) in the current selection or, if no selection, of paragraph(s) inserted at the insertion point
_GUICtrlRichEdit_SetParaShading | Sets the shading of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point
_GUICtrlRichEdit_SetParaSpacing | Sets paragraph spacing of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point
_GUICtrlRichEdit_SetParaTabStops | Sets tab stops of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point
_GUICtrlRichEdit_SetPasswordChar | Sets the characters to be displayed instead of those typed, or causes typed characters to show
_GUICtrlRichEdit_SetReadOnly | Sets or removes the read-only state
_GUICtrlRichEdit_SetScrollPos | Scrolls the display such that ($ix,$iY) is in the upper left corner of the control
_GUICtrlRichEdit_SetSel | Sets the low and high character position of a selection
_GUICtrlRichEdit_SetSpaceUnit | Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions
_GUICtrlRichEdit_SetText | Sets the text of a control
_GUICtrlRichEdit_SetUndoLimit | Sets the maximum number of actions that can stored in the undo queue
_GUICtrlRichEdit_StreamFromFile | Sets text in a control from a file
_GUICtrlRichEdit_StreamFromVar | Sets text in a control from a variable
_GUICtrlRichEdit_StreamToFile | Writes contens of a control to a file
_GUICtrlRichEdit_StreamToVar | Writes contents of a control to a variable
_GUICtrlRichEdit_Undo | Undoes the last edit control operation in the control's undo queue


Function _GUICtrlRichEdit_AppendText

Function Reference

_GUICtrlRichEdit_AppendText

Appends text at the end of the client area

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_AppendText($hWnd, $sText)

Parameters

$hWnd | Handle to the control
$sText | Text to be appended

Return Value

Success: | True
Failure: | False, and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_ReplaceText, _GUICtrlRichEdit_SetText, _GUICtrlRichEdit_GetText

See Also

Search EM_SETTEXTEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_AutoDetectURL

Function Reference

_GUICtrlRichEdit_AutoDetectURL

Enables or disables automatic detection of URLS

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_AutoDetectURL($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to detect URLs in text, False not to

Return Value

Success: | True
Failure: | False, and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fState is neither True nor False
 | 700 - internal error, e.g. insufficient memory

Remarks

If enabled, any modified text is scanned for text that matches the format of a URL. It recognizes strings
starting with the following as URLs: http:, file:, mailto:, ftp:, https:, gopher:, nntp:, prospero:,
telnet:, news:, wais:. When a URL is detected, Windows sets the link attribute for all characters in the
URL string, and highlights the string.

When automatic URL detection is on and a URL is detected, Windows removes the link attribute of all
characters that are not URLs.

For notification to happen, call _GUICtrlRichEdit_SetEventMask with $ENM_LINK

Related

_GUICtrlRichEdit_SetEventMask

See Also

Search notification in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)

_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GuiDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $hWnd, $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tEnLink, $cpMin, $cpMax, $tMsgFilter
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_LINK
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_LBUTTONUP Then
$tEnLink = DllStructCreate($tagENLINK, $iLparam)
$cpMin = DllStructGetData($tEnLink, "cpMin")
$cpMax = DllStructGetData($tEnLink, "cpMax")
MsgBox(0, "", "Invoke your web browser here and point it to " & _
_GuiCtrlRichEdit_GetTextInRange($hRichEdit, $cpMin, $cpMax))
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlRichEdit_CanPaste

Function Reference

_GUICtrlRichEdit_CanPaste

Can the contents of the clipboard be pasted into the control?

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_CanPaste($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True or False
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Data in two clipboard formats can be pasted: RTF and RTF with Objects.
This function determines whether data in either format is on the clipboard.

Related

_GUICtrlRichEdit_Paste

See Also

Search EM_CANPASTE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GuiDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_CanPasteSpecial

Function Reference

_GUICtrlRichEdit_CanPasteSpecial

Can the contents of the clipboard be pasted into the control in both formats?

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_CanPasteSpecial($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True or False
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Data in two clipboard formats can be pasted: RTF and RTF with Objects.
This function determines whether data in both formats is on the clipboard.

Related

_GUICtrlRichEdit_PasteSpecial

See Also

Search EM_CANPASTE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_CanRedo

Function Reference

_GUICtrlRichEdit_CanRedo

Can an undone action be redone?

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_CanRedo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True or False
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Redo, _GUICtrlRichEdit_SetUndoLimit

See Also

Search EM_CANREDO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_CanUndo

Function Reference

_GUICtrlRichEdit_CanUndo

Can an action be undone?

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_CanUndo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True - there are action(s) in the undo queue
Failure: | False and may set @error
@error: | 0 - there are no actions in the undo queue
 | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Undo, _GUICtrlRichEdit_SetUndoLimit

See Also

Search EM_CANUNDO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_ChangeFontSize

Function Reference

_GUICtrlRichEdit_ChangeFontSize

Increment or decrement font size(s) of selected text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement)

Parameters

$hWnd | Handle to the control
$iIncrement | Positive to increase, negative to decrease

Return Value

Succcess: | True - Font sizes were changed
Failure: | False and may set @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iIncrement is not a number
 | -1 - no text selected

Remarks

If there are several font sizes in the selected text, all are incremented/decremented

For $iIncrement positive, font sizes are rounded up; for $iIncrement negative, they are rounded down.

Rich Edit first adds $iIncrement to the existing font size. It then rounds up (or down) as follows:
<= 12 points: 1 e.g. 7 + 1 => 8 points, 14 - 3 => 10 points
12.05 to 28 points: 20 + 2.25 => 24 points
28.05 to 80 points: rounded to next of 28, 36, 48, 72 or 80, e.g. 28 + 1 => 36 points, 80 - 1 => 72 points
> 80 points: 10, e.g. 80 + 1 => 90

Related

_GUICtrlRichEdit_SetFont

See Also

Search EM_SETFONTSIZE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnDoIt
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnDoIt = GUICtrlCreateButton("Do it", 270, 310, 40, 30)
GUISetState()

_GUICtrlRichEdit_SetSel($hRichEdit, 0, -1) ; select all

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnDoIt
ChangeFontSize()
EndSelect
WEnd
EndFunc ;==>Main

Func ChangeFontSize()
Local $av, $iOld, $iNew
$av = _GuiCtrlRichEdit_GetFont($hRichEdit)
$iOld = $av[0]
_GuiCtrlRichEdit_ChangeFontSize($hRichEdit, 2)
$av = _GuiCtrlRichEdit_GetFont($hRichEdit)
$iNew = $av[0]
Report("Was " & $iOld & " points; is now " & $iNew & " points")
EndFunc ;==>ChangeFontSize

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_Copy

Function Reference

_GUICtrlRichEdit_Copy

Copy text to clipboard

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Copy($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Paste, _GUICtrlRichEdit_Cut, _GUICtrlRichEdit_PasteSpecial

See Also

Search WM_COPY in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
_SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>_SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_Create

Function Reference

_GUICtrlRichEdit_Create

Create a Edit control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop[, $iWidth = 150[, $iHeight = 150[, $iStyle = -1[, $iExStyle = -1]]]])

Parameters

$hWnd | Handle to parent or owner window
$sText | Text to be displayed in the control
$iLeft | Horizontal position of the control
$iTop | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle | [optional] Control styles: $ES_AUTOHSCROLL - Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. $ES_AUTOVSCROLL - Automatically scrolls text up one page when the user presses the ENTER key on the last line. $WS_HSCROLL - Control has horizontal scroll bar $WS_VSCROLL - Control has vertical scroll bar $ES_CENTER - Centers text in a edit control. $ES_LEFT - Aligns text with the left margin. $ES_MULTILINE - Generates a multi-line control (Default) $ES_NOHIDESEL - The selected text is inverted, even if the control does not have the focus. $ES_NUMBER - Allows only digits to be entered into the edit control. $ES_READONLY - Prevents the user from typing or editing text in the edit control. $ES_RIGHT - Right-aligns text edit control. $ES_WANTRETURN - Specifies that a carriage return be inserted when the user presses the ENTER key. (Default) $ES_PASSWORD - Displays an asterisk (*) for each character that is typed into the edit control
 | Default: 0 Forced : WS_CHILD, $WS_VISIBLE, $WS_TABSTOP unless $ES_READONLY
$iExStyle | [optional] Control extended style. These correspond to the standard $WS_EX_ constants.

Return Value

Success: | Handle to the Rich Edit control
Failure: | 0 and sets @error
@error: | 103 - $iLeft is neither a positive number nor zero
 | 104 - $iTop is is neither a positive number nor zero
 | 105 - $iWidth is neither a positive number nor -1
 | 106 - $iHeight is neither a positive number nor -1
 | 107 - $iStyle is is neither a positive number nor zero nor -1
 | 108 - $iExStyle is is neither a positive number nor zero nor -1

Remarks

You must call _GUICtrlRichEdit_Destroy() before the script closes.

Related

_GUICtrlRichEdit_Destroy

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
_GUICtrlRichEdit_AppendText($hRichEdit, @CR & "This is more text")
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_Cut

Function Reference

_GUICtrlRichEdit_Cut

Cut text to clipboard

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Cut($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Copy, _GUICtrlRichEdit_Paste, _GUICtrlRichEdit_PasteSpecial

See Also

Search WM_CUT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Opt('MustDeclareVars', 1)

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
_SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>_SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_Deselect

Function Reference

_GUICtrlRichEdit_Deselect

Deselects text, leaving none selected

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Deselect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Leaves the insertion point at the anchor point of the selection

Related

_GUICtrlRichEdit_SetSel, _GUICtrlRichEdit_GetSel, _GUICtrlRichEdit_IsTextSelected

See Also

Search EM_SETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $ai, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 5, 12)
$ai = _GuiCtrlRichEdit_GetSel($hRichEdit)
Report("1.Text is selected from inter-character position " & $ai[0] & " to " & $ai[1])
Case 2
_GuiCtrlRichEdit_DeSelect($hRichEdit)
$ai = _GuiCtrlRichEdit_GetSel($hRichEdit)
If $ai[0] = $ai[1] Then Report("2.No text is selected now")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_Destroy

Function Reference

_GUICtrlRichEdit_Destroy

Delete the Rich Edit control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True, Handle is set to 0
Failure: | 0 and sets @error
@error: | 1 - attempt to destroy a control belonging to another application

Remarks

Only be used on Rich Edit controls created with _GUICtrlRichEdit_Create

Related

_GUICtrlRichEdit_Create

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnDoIt
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$btnDoIt = GUICtrlCreateButton("Do it", 10, 260, 90, 25)

GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
Exit
Case $iMsg = $btnDoIt
_GUICtrlRichEdit_Destroy($hRichEdit)
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_EmptyUndoBuffer

Function Reference

_GUICtrlRichEdit_EmptyUndoBuffer

Resets the undo flag of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_EmptyUndoBuffer($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Undo, _GUICtrlRichEdit_Redo, _GUICtrlRichEdit_SetText

See Also

Search EM_SETEMPTYUNDOBUFFER in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuEmpty

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuEmpty = GUICtrlCreateMenuItem("Empty Undo buffer", $mnu)

_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuEmpty
_GuiCtrlRichEdit_EmptyUndoBuffer($hRichEdit)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuEmpty, True, False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuEmpty, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
EndFunc ;==>SetMenuTexts


Function _GUICtrlRichEdit_FindText

Function Reference

_GUICtrlRichEdit_FindText

Search for a text starting at insertion point or at anchor point of selection

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_FindText($hWnd, $sText [, $fForward = True [, $fMatchCase = False [, $fWholeWord = False [, $iBehavior = 0]]]])

Parameters

$hWnd | Handle to the control
$sText | Text to find
$fForward | [optional] Search direction (Win 95: search is always forward)
$fMatchCase | [optional] Search is case-sensitive Default: case-insensitive
$fWholeWord | [optional] Search only for text as a whole word Default: partial or full word
$iBehavior | [optional] Any BitOr combination of $FR_MATCHALEFHAMZA, $FR_MATCHDIAC and $FR_MATCHKASHIDA Default: 0

Return Value

Success: | If found, inter-character position before start of matching text, else -1
Failure: | -1 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $sText = ""
 | 103 - $fForward is neither True nor False
 | 104 - $fMatchCase is neither True nor False
 | 105 - $fWholeWord is neither True nor False
 | 1061 - $iBehavior is not a number
 | 1062 - $iBehavior is invalid

Remarks

None.

Related

_GUICtrlRichEdit_FindTextInRange

See Also

Search EM_FINDTEXT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetSel($hRichEdit, 8, 8)
Report("1.set starting position ")
Case 2
Report('2."appended" found just after inter-character position ' & _
_GUICtrlRichEdit_FindText($hRichEdit, "appended"))
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_FindTextInRange

Function Reference

_GUICtrlRichEdit_FindTextInRange

Search for a text in a range of inter-character positions

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_FindTextInRange($hWnd, $sText [, $iStart = 0 [, $iEnd = -1 [, $fMatchCase = False [, $fwholeWord = False [, $iBehavior = 0]]]]])

Parameters

$hWnd | Handle to the control
$sText | Text to find
$iStart | [optional] Starting inter-character position of search Default: beginning of control
$iEnd | [optional] Ending inter-character position of search Default: end of control
$fMatchCase | [optional] Search is case-sensitive Default: case-insensitive
$fWholeWord | [optional] Search only for text as a whole word Default: partial or full word
$iBehavior | [optional] Any BitOr combination of $FR_MATCHALEFHAMZA, $FR_MATCHDIAC and $FR_MATCHKASHIDA Default: 0

Return Value

Success: | an array[2] containing values
 | If target string found, range of inter-character positions containing the matching text, e.g. [45, 52]
 | If not found, [-1, -1]
Failure: | 0 and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - $sText = ""
 | 103 - $iStart is neither a positive number nor zero nor -1
 | 104 - $iEnd is neither a positive number nor zero nor -1
 | 105 - $fMatchCase must be True or False
 | 106 - $fwholeWord must be True or False
 | 1071 - $iBehavior is not a number
 | 1072 - $iBehavior is invalid

Remarks

The inter-character position at the beginning of the control is 0.
The default character range, 0 to -1, searches the whole text downwwards.
Setting $iEnd to -1 searches down to the end of the control
Setting $iStart to -1 searches up to the start of the control

Related

_GUICtrlRichEdit_FindText

See Also

Search EM_FINDTEXTEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $ai
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

$ai = _GUICtrlRichEdit_FindTextinRange($hRichEdit, "test", 20, 6)
Report('"test" found between inter-character positions ' & $ai[0] & " and " & $ai[1])

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetCharAttributes

Function Reference

_GUICtrlRichEdit_GetCharAttributes

Returns attributes of selected text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharAttributes($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | a string consisting of three-character groups. Each group consists of:
 | first and second character: any of:
 | bo - bolded
 | di - disabled - characters displayed with a shadow [nd]
 | em - embossed [nd]
 | hi - hidden, i.e. not displayed
 | im - imprinted [nd]
 | it - italcized
 | li - EN_LINK messages are sent when mouse is over text with this attribute
 | ou - outlined [nd]
 | pr - EN_PROTECT sent when user attempts to modify
 | re - marked as revised [nd]
 | sh - shadowed [nd]
 | sm - small capital letters [nd]
 | st - struck out
 | sb - subscript [nd]
 | sp - superscript [nd]
 | un - underlined
 | third character: + for on, ~ for mixed
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle
 | -1 - no text is selected

Remarks

Some attributes do not display in a Rich Edit control; they are marked with [nd] above.

Returns "" if no attributes are on

Related

_GUICtrlRichEdit_SetCharAttributes

See Also

Search EM_GETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iCp1
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
$iCp1 = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp1, $iCp1 + 3)
Report("Character attributes at start of line 2 are " & _
_GuiCtrlRichEdit_GetCharAttributes($hRichEdit))
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetCharBkColor

Function Reference

_GUICtrlRichEdit_GetCharBkColor

Retrieves the background color of the selected text or, if none selected, of the character to the right of the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharBkColor($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | COLORREF value an @extended set to 1 if the color is the same throught the selection
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_SetCharBkColor

See Also

Search EM_GETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GUICtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GUICtrlRichEdit_SetCharColor($hRichEdit, "304050")
Report("2. Setting is now")
Case 3
_GUICtrlRichEdit_SetSel($hRichEdit, 1, 5)
_GUICtrlRichEdit_SetCharColor($hRichEdit, "sys")
_GUICtrlRichEdit_SetSel($hRichEdit, 0, 0)
Report("3. Background of a few characters changed")
Case 4
_GUICtrlRichEdit_Deselect($hRichEdit)
; Stream all text to the Desktop so you can look at settings in Word
_GUICtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iColor = _GUICtrlRichEdit_GetCharBkColor($hRichEdit)
Local $aRet = _ColorGetRGB($iColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " BkColor=0x" & Hex($iColor)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetCharColor

Function Reference

_GUICtrlRichEdit_GetCharColor

Retrieves the color of the selected text or, if none selected, of the character to the right of the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharColor($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | COLORREF value an @extended set to 1 if the color is the same throught the selection
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_SetCharColor

See Also

Search EM_GETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GUICtrlRichEdit_SetCharColor($hRichEdit, "304050")
Report("2. Setting is now")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 1, 5)
_GuiCtrlRichEdit_SetCharColor($hRichEdit, "sys")
Report("3. Background of a few characters changed")
Case 4
_GuiCtrlRichEdit_Deselect($hRichEdit)
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
Report("4. Written to file")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iColor = _GuiCtrlRichEdit_GetCharColor($hRichEdit)
Local $aRet = _ColorGetRGB($iColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " Color=0x" & Hex($iColor)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetCharPosFromXY

Function Reference

_GUICtrlRichEdit_GetCharPosFromXY

Gets inter-character position closest to a specified point in the client area

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharPosFromXY($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | horizontal screen coordinate relative to left side of control
$iY | vertical screen coordinate relative to top of control

Return Value

Success: | one-based character index of the character nearest the specified point
 | (index of last character in the control if the specified point is beyond text)
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iX is not a number
 | 103 - $iY is not a number
 | -1 - ($iX,$iY) outside client area

Remarks

None.

Related

_GUICtrlRichEdit_GetXYFromCharPos

See Also

Search EM_CHARFROMPOS in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $ai, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
$ai = _GuiCtrlRichEdit_GetXYFromCharPos($hRichEdit, 20)
Report("1.The coordinates of inter-character position 20 are (" & $ai[0] & "," & $ai[1] & ")")
Case 2
Report("2.The inter-character position at or nearest coordinates (" & $ai[0] & "," & $ai[1] & ")" & @CR & _
"is " & _GuiCtrlRichEdit_GetCharPosFromXY($hRichEdit, $ai[0], $ai[1]))
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetCharPosOfNextWord

Function Reference

_GUICtrlRichEdit_GetCharPosOfNextWord

Gets inter-character position before the next word

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharPosOfNextWord($hWnd, $iCpStart)

Parameters

$hWnd | Handle to the control
$iCPStart | inter-character position to start from

Return Value

Success: | inter-character position before next word
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iCpStart is not a number

Remarks

"Word" is defined broadly; it includes punctuation, parentheses and hyphens.

Related

_GUICtrlRichEdit_GetCharPosOfPreviousWord, _GUICtrlRichEdit_GetCharWordBreakInfo

See Also

Search EM_FINDWORDBREAK in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iCp = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "AutoIt v3 is a freeware BASIC-like scripting language designed for " _
& "automating the Windows GUI and general scripting.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iCp = _GuiCtrlRichEdit_GetCharPosOfNextWord($hRichEdit, $iCp)
GUICtrlSetData($lblMsg, $iCp)
ControlFocus($hRichEdit,"","")
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, $iCp)
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_GetCharPosOfPreviousWord

Function Reference

_GUICtrlRichEdit_GetCharPosOfPreviousWord

Gets inter-character position before the Previous word

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharPosOfPreviousWord($hWnd, $iCpStart)

Parameters

$hWnd | Handle to the control
$iCPStart | inter-character position to start from

Return Value

Success: | inter-character position before Previous word
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iCpStart is not a number

Remarks

"Word" is defined broadly; it includes punctuation, parentheses and hyphens.

Related

_GUICtrlRichEdit_GetCharPosOfNextWord, _GUICtrlRichEdit_GetCharWordBreakInfo

See Also

Search EM_FINDWORDBREAK in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iCp = 200
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "AutoIt v3 is a freeware BASIC-like scripting language designed for " _
& "automating the Windows GUI and general scripting.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iCp = _GuiCtrlRichEdit_GetCharPosOfPreviousWord($hRichEdit, $iCp)
GUICtrlSetData($lblMsg, $iCp)
ControlFocus($hRichEdit,"","")
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, $iCp)
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_GetCharWordBreakInfo

Function Reference

_GUICtrlRichEdit_GetCharWordBreakInfo

Gets inter-character position before the Previous word

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetCharWordBreakInfo($hWnd, $iCp)

Parameters

$hWnd | Handle to the control
$iCP | inter-character position to left of character of interest

Return Value

Success: | string consisting of comma-separated values:
 | value 1 - word-break flag(s):
 | c - line may be broken after this character
 | d - character is an end-of-word delimiter. Lines may be broken after delimiters
 | w - character is white-space. (Trailing white-spaces are not included in line length.)
 | value 2 - character class: a number
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iCp is not a number

Remarks

Lines may be broken at delimiters or between characters od different classes.

Character classes are defined in word-break procedures. The classes in the default
procedure are: 0 = alphanumeric character, 1 = other printing character (except hyphen),
2 = space, 3 = tab, 4 = hyphen or end-of-paragraph.

Related

_GUICtrlRichEdit_GetCharPosOfNextWord, _GUICtrlRichEdit_GetCharPosOfPreviousWord

See Also

Search EM_FINDWORDBREAK in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iCp = -1, $s
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

$s = Chr(9)
For $i = 32 To 126
$s &= Chr($i)
Next
_GuiCtrlRichEdit_AppendText($hRichEdit, $s & @CR)
_GuiCtrlRichEdit_AppendText($hRichEdit, "AutoIt v3 is a (freeware) BASIC-like scripting language designed for " _
& "automating the Windows GUI and general scripting.")
_GuiCtrlRichEdit_AppendText($hRichEdit, @CRLF & "Another paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iCp += 1
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, $iCp)
GUICtrlSetData($lblMsg, _GuiCtrlRichEdit_GetCharWordBreakInfo($hRichEdit, $iCp))
ControlFocus($hRichEdit, "", "")
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report

Func GetWord($hWnd, $iCp, $fForward, $fStartOfWord, $fClass = False)
Local $iRet, $iWparam
If $fClass Then
If $fForward Then
$iWparam = $WB_MOVEWORDRIGHT
Else
$iWparam = $WB_MOVEWORDLEFT
EndIf
Else
If $fForward Then
If $fStartOfWord Then
$iWparam = $WB_RIGHT
Else
$iWparam = $WB_LEFT
EndIf
Else
If $fStartOfWord Then
$iWparam = $WB_RIGHTBREAK
Else
$iWparam = $wb_LEFTBREAK
EndIf
EndIf
EndIf
$iRet = _SendMessage($hWnd, $EM_FINDWORDBREAK, $iWparam, $iCp)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iWparam = ' & $iWparam & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
Return $iRet
EndFunc ;==>GetWord


Function _GUICtrlRichEdit_GetBkColor

Function Reference

_GUICtrlRichEdit_GetBkColor

Gets the background color of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetBkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | COLORREF value
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Related

_GUICtrlRichEdit_SetBkColor

See Also

Search EM_SETBKGNDCOLOR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetBkColor($hRichEdit, 0xE8CCCC)
Report("1. Colored background")
Case 2
_GUICtrlRichEdit_SetBkColor($hRichEdit)
Report("2. Back to white")
Case 3
_GUICtrlRichEdit_SetBkColor($hRichEdit, 0xB3B3C7)
Report("3. Colored background again")
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iBngColor = _GUICtrlRichEdit_GetBkColor($hRichEdit)
Local $aRet = _ColorGetRGB($iBngColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " BngColor=0x" & Hex($iBngColor)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetFont

Function Reference

_GUICtrlRichEdit_GetFont

Gets the font attributes of a selection or, if no selection, at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetFont($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | an array containing values:
 | [0] - point size
 | 0 if sizes are mixed in selection
 | [1] - the name of the font
 | "" if fonts are mixed in selection
 | [2] - the character set
 | $ANSI_CHARSET - 0
 | $BALTIC_CHARSET - 186
 | $CHINESEBIG5_CHARSET - 136
 | $EASTEUROPE_CHARSET - 238
 | $GB2312_CHARSET - 134
 | $GREEK_CHARSET - 161
 | $HANGEUL_CHARSET - 129
 | $MAC_CHARSET - 77
 | $OEM_CHARSET - 255
 | $RUSSIAN_CHARSET - 204
 | $SHIFTJIS_CHARSET - 128
 | $SYMBOL_CHARSET - 2
 | $TURKISH_CHARSET - 162
 | $VIETNAMESE_CHARSET - 163
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_SetFont

See Also

Search http://www.hep.wisc.edu/~pinghc/books/apirefeng/l/logfont.html in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial")
Case 2
_GUICtrlRichEdit_SetFont($hRichEdit, 15, "Times Roman")
Report("2. Set Font")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRet = _GUICtrlRichEdit_GetFont($hRichEdit)
$sMsg = $sMsg & @CR & @CR & $aRet[1] & " " & $aRet[0] & " points"
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetRECT

Function Reference

_GUICtrlRichEdit_GetRECT

Retrieves the formatting rectangle of a control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetRECT($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | an array consisting of x and y coordinates - [;;;]
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

The formatting rectangle is the area in which text is drawn, part of which may not be visible.

All returned values are in dialog units referenced to the control

Per MSDN, the values returned by this function may not be exactly what may be set by _GUICtrlRichEdit_SetRECT()

Related

_GUICtrlRichEdit_SetRECT

See Also

Search EM_GETRECT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Default settings ")
Case 2
_GuiCtrlRichEdit_SetRECT($hRichEdit, 10, 10, 100, 100)
Report("2. Settings ")
Case 3
_GuiCtrlRichEdit_SetRECT($hRichEdit)
Report("3. ReSettings to default")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRect = _GUICtrlRichEdit_GetRECT($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Left=" & $aRect[0] & " Top=" & $aRect[1] & " Right=" & $aRect[2] & " Bottom=" & $aRect[3]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetText

Function Reference

_GUICtrlRichEdit_GetText

Get all of the text in the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetText($hWnd [, $fCrToCrLf = False [, $iCodePage = 0 [, $sReplChar = ""]]])

Parameters

$hWnd | Handle to control
$fCrToCrLf | [optional] Convert each CR to a CrLf True - do it don't (Default)
$iCodePage | [optional] code page used in translation Default: use system default CP_ACP for ANSI, 1200 for Unicode
$sReplChar | [optional] Character used if $iCodePage is not 1200 and a wide character cannot be represented in specified code page

Return Value

Success: | the text
Failure: | "" and sets @error:
@error: | 101 - $hWnd is not a handle
 | 102 - $fCrToCrLf must be True or False
 | 103 - $iCodePage is not a number
 | 700 - internal error

Remarks

On success, if $sReplChar set, @extended contains whether this character was used

Call _GUICtrlRichEdit_IsModified() to determine whether the text has changed

Related

_GUICtrlRichEdit_SetText, _GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_IsModified

See Also

Search EM_GETTEXTEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

Report("Text Appended: "& @CR & @CR & _GUICtrlRichEdit_GetText($hRichEdit))

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetTextLength

Function Reference

_GUICtrlRichEdit_GetTextLength

Get the length of the whole text in the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetTextLength($hWnd [, $fExact = True [, $fChars = False]])

Parameters

$hWnd | Handle to control
$fExact | [optional] True Return the exact length - = False return at least the number of characters in the control (faster) Default: exact length
$fChars | [optional] True - return length in characters = False - return length in bytes Default: bytes

Return Value

Success: | length, in bytes or characters
Failure: | 0 and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fExact must be True or False
 | 103 - $fChars must be True or False

Remarks

None.

Related

See Also

Search EM_GETTEXTLENGTHEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

Report("There are " & _GUICtrlRichEdit_GetTextLength($hRichEdit, True, True) & _
" characters in the control")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetZoom

Function Reference

_GUICtrlRichEdit_GetZoom

Gets the zoom level of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetZoom($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | zoom level, in percent
Failure: | 0 and sets @error
@error: | 700 - internal error

Remarks

None.

Related

_GUICtrlRichEdit_SetZoom

See Also

Search EM_GETZOOM in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
Case 2
_GUICtrlRichEdit_SetZoom($hRichEdit, 250)
Report("2.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetFirstCharPosOnLine

Function Reference

_GUICtrlRichEdit_GetFirstCharPosOnLine

Retrieves the inter-character position preceding the first character of a line

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetFirstCharPosOnLine($hWnd [, $iLine = -1])

Parameters

$hWnd | Handle to control
$iLine | [optional] Line number Default: current line

Return Value

Success: | Character position of the first character of the line
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iLine is neither positive nor -1
 | 1022 - $iLine greater than number of lines of text

Remarks

A control that contains no text has one line.

The first line is line 1. The first character position in the client area is 0.

Related

See Also

Search EM_GETLINEINDEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iCp1
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
$iCp1 = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp1, $iCp1 + 3)
Report("Character attributes at start of line 2 are " & _
_GuiCtrlRichEdit_GetCharAttributes($hRichEdit))

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetLineCount

Function Reference

_GUICtrlRichEdit_GetLineCount

Retrieves the number of lines in a multi-line edit control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetLineCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | Total number of text lines
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

A control that contains no text has one line

Lines that are not currently visible are included in the count

If Wordwrap is enabled, the number of lines can change when the dimensions of the editing window change.

Related

See Also

Search EM_GETLINECOUNT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

For $i = 2 To 10
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Line " & $i)
Next

Report("The control contains " & _GUICtrlRichEdit_GetLineCount($hRichEdit) & " lines")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetLineLength

Function Reference

_GUICtrlRichEdit_GetLineLength

Retrieves the length of a line

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetLineLength($hWnd, $iLine)

Parameters

$hWnd | Handle to control
$iLine | line number Special value: -1 - return number of unselected characters on lines containing selected characters

Return Value

Success: | Multi-line control - Length of the line (in characters)
 | Single-line control - number of characters in the control
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iLine is neither positive nor -1
 | 1022 - $iLine is greater than number of characters in the control

Remarks

A control that contains no text has one line
The first inter-character position in a control is 0.

The result does not include carriage-return characters at the end of the line.

Related

See Also

Search EM_GETLINELENGTH in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

Report("The current line contains " & _GUICtrlRichEdit_GetLineLength($hRichEdit, -1) & " characters")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetLineNumberFromCharPos

Function Reference

_GUICtrlRichEdit_GetLineNumberFromCharPos

Retrieves the line number on which an inter-character position is found

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetLineNumberFromCharPos($hWnd, $iCharPos)

Parameters

$hWnd | Handle to control
$iCharPos | Inter-character position

Return Value

Success: | Line number (one-based)
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iCharPos is not a positive number

Remarks

A control that contains no text has one line
The first inter-character position in a control is 0.

The first line is line 1.

If $iCharPos is negative or more than the number of characters in the control,
returns the number of lines in the control

Related

See Also

Search EM_EXLINEFROMCHAR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text")
Report("Inter-character position 30 is on line " & _GuiCtrlRichEdit_GetLineNUmberFromCharPos($hRichEdit, 30))

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetNextRedo

Function Reference

_GUICtrlRichEdit_GetNextRedo

Retrieves the name or type ID of the next possible redo action

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetNextRedo($hWnd, $fName = True)

Parameters

$hWnd | Handle to the control
$fName | True (return name, default) or False (return ID number)

Return Value

Success: | depends on value of $fName:
 | If $fName is True: "Unknown", "Typing", "Delete", "Drag and drop", "Cut" or "Paste"
 | If $Name is False: the corresponding number (0 to 5)
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fName is neither True nor False

Remarks

Note that EM_GETREDONAME does not distinguish between Unknown and redo queue empty

Related

_GUICtrlRichEdit_Redo, _GUICtrlRichEdit_Undo, _GUICtrlRichEdit_SetUndoLimit

See Also

Search EM_GETREDONAME in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
_SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>_SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_GetNextUndo

Function Reference

_GUICtrlRichEdit_GetNextUndo

Retrieves the name or type ID of the next possible Undo action

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetNextUndo($hWnd, $fName = True)

Parameters

$hWnd | Handle to the control
$fName | True (return name, default) or False (return ID number)

Return Value

Success: | depends on value of $fName:
 | If $fName is True: "Unknown", "Typing", "Delete", "Drag and drop", "Cut" or "Paste"
 | If $Name is False: the corresponding number (0 to 5)
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fName is neither True nor False

Remarks

Note that EM_GETUNDONAME does not distinguish between Unknown and Undo queue empty

Related

_GUICtrlRichEdit_Undo, _GUICtrlRichEdit_Undo

See Also

Search EM_GETUNDONAME in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
_SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>_SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_GetNumberOfFirstVisibleLine

Function Reference

_GUICtrlRichEdit_GetNumberOfFirstVisibleLine

Gets number of the first line which is visible in the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetNumberOfFirstVisibleLine($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | line number (one-based)
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

The first line is numbered 1

Related

See Also

Search EM_GETFIRSTVISIBLELINE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

For $i = 2 To 50
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Line " & $i)
Next

Report("First visible line is number " & _GUICtrlRichEdit_GetNumberOfFirstVisibleLine($hRichEdit))

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaAlignment

Function Reference

_GUICtrlRichEdit_GetParaAlignment

Gets the alignment of selected paragraph(s), or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaAlignment($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | a string consisting of a value, a semicolon (;), and a scope character:
 | alignment:
 | l - aligned with the left margin.
 | r - aligned with the right margin.
 | c - centered between margins
 | j - justified between margins
 | f - justified between margins
 | w - justified between margins by only expanding spaces
 | scope:
 | a - all (or only) selected paragraphs have this alignment
 | f - the first selected paragraph has this alignment, but other(s) don't
 | c - the current paragraph has this alignment
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

In Richedit 2.0, justify does not display

Related

_GUICtrlRichEdit_SetParaAlignment

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iCp, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "r")
Report("First paragraph")
Case 2
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "c")
Report("Second paragraph")
Case 3
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Third paragraph")
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "l")
Report("Third paragraph")
Case 4
$iCp = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp, -1)
Report("Alignment of paragraphs in selection")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaAlignment($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaAttributes

Function Reference

_GUICtrlRichEdit_GetParaAttributes

Gets the attributes of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaAttributes($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | a string consisting of values separated by semicolons (;}.
 | Values 1 to 10: a group consisting of:
 | Characters 1 to 3 - attribute
 | fpg - force this/these paragraphs on to new page(s) (Initially off)
 | hyp - automatic hypthenation (Initially on)
 | kpt - keep this/these paragraph(s) together on a page (Initially off}
 | kpn - keep this/these paragraph(s) and the next together on a page (Initially off)
 | pwo - prevent widows and orphans, i.e. avoid a single line of this/these paragraph(s)
 | on a page (Initially off)
 | r2l - display text using right-to-left reading order (Initially off)
 | sbs - display paragraphs side by side (Initially off)
 | sln - suppress line numbers in documents or sections with line numbers (Initially off)
 | tbl - paragraph(s) is/are table row(s) (Initially off)
 | Character 4 - state:
 | + - attribute is on
 | - - attribute is off
 | Value 11 - scope:
 | f - the first selected paragraph has these attributes
 | c - the current paragraph has these attributes
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_SetParaAttributes

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "First paragraph")
Report("First paragraph: default attributes")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaAttributes($hRichEdit, "-hyp")
Report("Second paragraph: hyphenation off")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, -1)
_GUICtrlRichEdit_SetParaAttributes($hRichEdit, "-hyp;+fpg;+kpn")
Report("Attributes of first paragraph in selection")
Case 3
; Stream all text to the Desktop so you can look at attributes in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaAttributes($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaBorder

Function Reference

_GUICtrlRichEdit_GetParaBorder

Gets the border settings of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaBorder($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | settings of first selected paragraph - a string consisting of values separated by semicolons (:):
 | Value 1 | one or more of:
 | l - left border
 | r - right border
 | t - top border
 | b - bottom border
 | i - inside border
 | o - outside border
 | or empty - no border
 | Value 2 - line style - one of:
 | none - no line
 | .75 - 3/4 point
 | 1.5 - 1 1/2 points
 | 2.25 - 2 1/4 points
 | 3 - 3 points
 | 4.5 - 4 1/2 points
 | 6 - 6 points
 | .75d - 1/2 points, double
 | 1.5d - 1 1/2 points, double
 | 2.25d - 2 1/4 points, double
 | .75g - 3/4 point grey
 | .75gd - 3/4 point grey dashed
 | Value 3 - one of:
 | aut - autocolor
 | blk - black
 | blu - blue
 | cyn - cyan
 | grn - green
 | mag - magenta
 | red - red
 | yel - yellow
 | whi - white
 | dbl - dark blue
 | dgn - dark green
 | dmg - dark magenta
 | drd - dark red
 | dyl - dark yellow
 | dgy - dark grey
 | lgy - light grey
 | Value 4 - space between the border and the text (in space units)
 | Value 5 - scope:
 | a - all (or only) selected paragraphs have these settings
 | f - the first selected paragraph has these settings, but other(s) don't
 | c - the current paragraph has these settings
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Borders do not show in Rich Edit, but borders created here will show in Word

Related

_GUICtrlRichEdit_SetParaBorder

See Also

Search EM_GETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iStep = 0, $btnNext
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "First paragraph")
Report("0. First paragraph: default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "o", 3, "mag", 0.25)
Report("1. Second paragraph: with border (should show in Word)")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, -1)
Report("2. Settings of first paragraph in selection")
Case 3
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "l", 6, "blu")
Report("3. Settings of both paragraphs changed")
Case 4
_GUICtrlRichEdit_SetParaBorder($hRichEdit, Default, ".75gd")
Report("4. Line style changed")
Case 5
; Stream all text to the Desktop so you can look at border settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaBorder($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaIndents

Function Reference

_GUICtrlRichEdit_GetParaIndents

Gets the border indent settings of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaIndents($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | settings - a string consisting of values separated by semicolons (:):
 | Value 1 - Left - indentation of left side of the body of the paragraph (of lines after the first) (in space units)
 | Value 2 - Right - indentation of right side of the paragraph (in space units)
 | Value 3 - FirstLine - indentation of the first line relative to other lines (in space units)
 | Value 4 - scope:
 | a - all (or only) selected paragraphs have these settings
 | f - the first selected paragraph has these settings, but other(s) don't
 | c - the current paragraph has these settings
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Postive values of $iLeft, $iRight and $iFirstLine indent towards the center of the paragraph

Related

_GUICtrlRichEdit_SetParaIndents

See Also

Search EM_GETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("Para with default indent settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
Report("Added second paragraph")
Case 2
_GUICtrlRichEdit_SetParaIndents($hRichEdit, 0.25, .1)
Report("Changed indent settings of second paragraph")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaIndents($hRichEdit, Default, 0, .2)
Report("Change settings of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at Indents settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaIndents($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaNumbering

Function Reference

_GUICtrlRichEdit_GetParaNumbering

Gets the numbering style of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaNumbering($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | values separated by semicolons (;):
 | value 1 - a string showing the style and starting "number"
 | e.g. "." (bullet), "1)","(b)", "C.", "iv", "V)"
 | Trailing spaces indicate the minimum spaces between the number and the paragraph
 | Special cases:
 | "=" - This paragraph is an unnumbered paragraph within the preceding list element
 | "" - removed the numbering from the selected paragraph(s)
 | value 2 - If Roman numbers, "Roman" else ""
 | value 3 - space between number/bullet and paragraph (in space units)
 | Value 4 - scope:
 | a - all (or only) selected paragraphs have these settings
 | f - the first selected paragraph has these settings, but other(s) don't
 | c - the current paragraph has these settings
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Related

_GUICtrlRichEdit_SetParaNumbering

See Also

Search EM_GETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 1)
Report("Para with default indent settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, ".")
Report("Added second paragraph")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("Style of first paragraph in the selection")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "v) ", Default, True)
Report("Change settings of both paragraphs")
Case 4
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "2. ", Default, True)
Report("Changed settings for both paragraphs")
Case 5
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaNumbering($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaShading

Function Reference

_GUICtrlRichEdit_GetParaShading

Gets the shading settings of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaShading($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | settings of first selected paragraph - a string consisting of values separated by semicolons (:):
 | value 1 - Weight - percent of foreground color, the rest being background color
 | value 2 - style - a string containing one of the following:
 | non - none
 | dhz - dark horizontal
 | dvt - dark vertical
 | ddd - dark down diagonal
 | dud - dark up diagonal
 | dgr - dark grid
 | dtr - dark trellis
 | lhz - light horizontal
 | lvt - light vertical
 | ldd - light down diagonal
 | lud - light up diagonal
 | lgr - light grid
 | ltr - light trellis
 | value 3 - Foreground color - one of the following:
 | "blk" - black
 | "blu" - blue
 | "cyn" - cyan
 | "grn" - green
 | "mag" - magenta
 | "red" - red
 | "yel" - yellow
 | "whi" - white
 | "dbl" - dark blue
 | "dgn" - dark green
 | "dmg" - dark magenta
 | "drd" - dark red
 | "dyl" - dark yellow
 | "dgy" - dark grey
 | "lgy" - light grey
 | value 4 - Background color - same values as for Foreground color
 | Value 5 - scope:
 | a - all (or only) selected paragraphs have these settings
 | f - the first selected paragraph has these settings, but other(s) don't
 | c - the current paragraph has these settings
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Shading does not show in Rich Edit, but shading created here will show in Word

Related

_GUICtrlRichEdit_SetParaShading

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaShading($hRichEdit, 60, "ddd", "blu", "dmg")
Report("1. Shading of second paragraph is ")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Style of first paragraph in the selection is ")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaShading($hRichEdit, Default, "dgr")
Report("3. Change shading of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaShading($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaSpacing

Function Reference

_GUICtrlRichEdit_GetParaSpacing

Gets the spacing settings of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaSpacing($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | a string consisting of the settings separated by semicolons (;):
 | value 1 - inter-line spacing:
 | either a number - in space units
 | or " lines" - in lines
 | Value 2 - scope of value 1:
 | a - all (or only) selected paragraph(s) have the above setting
 | f - the first selected paragraph has this setting, but other(s) don't
 | c - the current paragraph has this setting
 | value 3 - spacing before paragraphs (in space units)
 | value 4 - scope of value 3 - see above
 | value 5 - spacing after paragraphs (in space units)
 | value 6 - scope of value 5 - see above
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Related

_GUICtrlRichEdit_SetParaSpacing

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaSpacing($hRichEdit, "2 lines", .2, .25)
Report("1. Spacing of second paragraph is ")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Settings of first paragraph in the selection are ")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaSpacing($hRichEdit, Default, .1)
Report("3. Change spacing of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at Indents settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaSpacing($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetParaTabStops

Function Reference

_GUICtrlRichEdit_GetParaTabStops

Gets the tabstops of (first) selected paragraph or (if no selection) of the current paragraph

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetParaTabStops($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | A string consisting of values separated by ; (semicolons).
 | value 1 - number of tabstops
 | values 2 to + 1 - description of a tabstop:
 | absolute position of a tab stop (in space units)
 | kind of tab
 | l - left tab
 | c - center tab
 | r - decimal tab
 | b - bar tab (a vertical bar, as in Word)
 | kind of dot leader
 | . - dotted leader
 | - - dashed leader
 | _ - underline leader
 | = - double line leader
 | t - thick-line leader
 | a space - no leader
 | Value + 2 - scope:
 | a - all (or only) selected paragraphs have these settings
 | f - the first selected paragraph has these settings, but other(s) don't
 | c - the current paragraph has these settings
Failure: | "" and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

To enter a tab into a control, press Ctrl_Tab

Related

_GUICtrlRichEdit_SetParaTabStops

See Also

Search EM_GETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaTabStops($hRichEdit, ".3l ;1c ;2.5r.")
Report("1. TabStops of second paragraph")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Tabstops of first paragraph")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
Report("Tabstops of first paragraph in selection")
Case 4
_GUICtrlRichEdit_SetParaTabStops($hRichEdit, "2.3r=")
Report("3. Change tabstops of both paragraphs")
Case 5
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaTabStops($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetPasswordChar

Function Reference

_GUICtrlRichEdit_GetPasswordChar

Gets the password character that a rich edit control displays when the user enters text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetPasswordChar($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The character to be displayed in place of any characters typed by the user
 | Special case: 0 - there is no password character, so the control displays the characters typed by the user
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_SetPasswordChar

See Also

Search EM_GETPASSWORDCHAR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

Report("Initial state after creation:")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetPasswordChar($hRichEdit, "*")
Report("Changed password character. Type some text")
Case 2
_GUICtrlRichEdit_SetPasswordChar($hRichEdit, "")
Report("Changed it back")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $ch
$ch = _GUICtrlRichEdit_GetPasswordChar($hRichEdit)
If $ch = "" Then
$sMsg &= @CR & "Characters appear as typed"
Else
$sMsg = $sMsg & @CR & "Typed characters appear as " & $ch & "s"
EndIf
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetScrollPos

Function Reference

_GUICtrlRichEdit_GetScrollPos

Gets the Scrolling position of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetScrollPos($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | an array containing [x, y]
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

The scrolling position is the upper left corner of the control

Related

_GUICtrlRichEdit_SetScrollPos, _GUICtrlRichEdit_GetSelAA

See Also

Search EM_GETSCROLLPOS in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
For $i = 2 To 20
_GuiCtrlRichEdit_AppendText($hRichEdit, @CRLF & "Paragraph " & $i)
Next
Report("0. Initially scrolled to show insertion point")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetScrollPos($hRichEdit, 0, 0)
Report("1. Scrolled to top")
Case 2
_GUICtrlRichEdit_SetScrollPos($hRichEdit, 7, 22)
Report("2. Scrolled down a bit, and to the right")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aPos = _GUICtrlRichEdit_GetScrollPos($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & $aPos[0] & ";" & $aPos[1]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetSel

Function Reference

_GUICtrlRichEdit_GetSel

Gets the low and high inter-character positions of a selection

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetSel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | an array in the format [, ]
Failure: | sets @error
@error: | 101 - $hWnd is not a handle

Remarks

The first character of the text is after inter-character position 0.
If high = low, no text is selected

Related

_GUICtrlRichEdit_SetSel, _GUICtrlRichEdit_GetSelText, _GUICtrlRichEdit_GetSelAA, _GUICtrlRichEdit_GetTextInLine, _GUICtrlRichEdit_Deselect, _GUICtrlRichEdit_IsTextSelected

See Also

Search EM_EXGETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetSel($hRichEdit, 2 , 10)

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Text is selected from inter-character position")
Case 2
_GuiCtrlRichEdit_DeSelect($hRichEdit)
Report("2. No text is selected now")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aPos = _GuiCtrlRichEdit_GetSel($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & $aPos[0] & "," & $aPos[1]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetSelAA

Function Reference

_GUICtrlRichEdit_GetSelAA

Gets the anchor and active inter-character positions of a selection, in that order

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetSelAA($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | an array in the format [, ]
Failure: | sets @error
@error: | -1 - no text is selected
 | 101 - $hWnd is not a handle

Remarks

The first character of the text is after inter-character position 0.

Related

_GUICtrlRichEdit_SetSel, _GUICtrlRichEdit_GetSel, _GUICtrlRichEdit_GetScrollPos

See Also

Search EM_EXGETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
_GuiCtrlRichEdit_SetSel($hRichEdit, 7, 2)
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Selection is high to low")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 7)
Report("2. Selection is low to high")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRet = _GUICtrlRichEdit_GetSelAA($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & $aRet[0] & "," & $aRet[1]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetSelText

Function Reference

_GUICtrlRichEdit_GetSelText

Retrieves the currently selected text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetSelText($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | the selected text
Failure: | False and sets @error
@error: | -1 - no text is selected
 | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_GetSel

See Also

Search EM_EXGETSELTEXT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 4)

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("Selected text is" & @CR & _GuiCtrlRichEdit_GetSelText($hRichEdit))
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRet = _GUICtrlRichEdit_GetSelAA($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & $aRet[0] & "," & $aRet[1]
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetSpaceUnit

Function Reference

_GUICtrlRichEdit_GetSpaceUnit

Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetSpaceUnit()

Parameters

None.

Return Value

Returns "in", "cm", "mm", "pt" (points), or "tw" (twips, 1/1440 inches, 1/567 centimetres)

Remarks

Initially, space is measured in inches

Related

_GUICtrlRichEdit_SetSpaceUnit

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GuiCtrlRichEdit_SetSpaceUnit("cm")
Report("2. Setting is now")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & _GUICtrlRichEdit_GetSpaceUnit()
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetTextInLine

Function Reference

_GUICtrlRichEdit_GetTextInLine

Gets a line of text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetTextInLine($hWnd, $iLine)

Parameters

$hWnd | Handle to the control
$iLine | Line number

Return Value

Success: | the text
Failure: | False, and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iLine is not a positive number
 | 1022 - $iLine exceeds number of lines in control
 | 700 - internal error

Remarks

The first line in a control is 1

Related

_GUICtrlRichEdit_GetTextInRange, _GUICtrlRichEdit_GetSel

See Also

Search EM_GETLINE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "This is a test." & @CR & "More text in another line")
Report(_GUICtrlRichEdit_GetTextInLine($hRichEdit, 1))

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GetTextInRange

Function Reference

_GUICtrlRichEdit_GetTextInRange

Gets the text from from one inter-character position to another

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetTextInRange($hWnd, $iStart, $iEnd)

Parameters

$hWnd | Handle to the control
$iStart | Inter-character position before the text
$iEnd | Inter-character position after the text Special value: -1 - end of text

Return Value

Success: | the text
Failure: | False, and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iStart is neither positive nor zero
 | 1031 - $iEnd is neither positive nor zero nor -1
 | 1032 - $iStart < $iEnd and $iEnd &l;> -1

Remarks

The first character position in the control is 0

Related

_GUICtrlRichEdit_GetTextinLine

See Also

Search EM_GETTEXTRANGE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)

_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $hWnd, $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tEnLink, $cpMin, $cpMax, $tMsgFilter
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_LINK
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_LBUTTONUP Then
$tEnLink = DllStructCreate($tagENLINK, $iLparam)
$cpMin = DllStructGetData($tEnLink, "cpMin")
$cpMax = DllStructGetData($tEnLink, "cpMax")
MsgBox(0, "", "Invoke your web browser here and point it to " & _
_GuiCtrlRichEdit_GetTextInRange($hRichEdit, $cpMin, $cpMax))
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlRichEdit_GetVersion

Function Reference

_GUICtrlRichEdit_GetVersion

Retrieves the version of Rich Edit

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetVersion()

Parameters

None.

Return Value

None.

Remarks

The versions of Rich Edit included in versions of Windows are:
3.0 - Windows 2000, XP
3.1 - Windows Vista
4.0 - Windows XP SP1
4.1 - Windows Vista

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "This is a test.")
MsgBox(0, "", _GuiCtrlRichEdit_GetVersion())

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_GetXYFromCharPos

Function Reference

_GUICtrlRichEdit_GetXYFromCharPos

Retrieves the XY coordinates of an inter-character position

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetXYFromCharPos($hWnd, $iCharPos)

Parameters

$hWnd | Handle to the control
$iCharPos | Inter-character position

Return Value

Success: | an array [, ] - coordinates of the inter-character position, relative to the top-left corner of the client area
Failure: | sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iCharPos is neither a positive number nor zero
 | 1022 - $iCharPos exceeds the number of characters in the control

Remarks

The first inter-character position is numbered 0

With a multi-line control, coordinates are returned even for inter-character positions
that are not visible.

Related

_GUICtrlRichEdit_GetCharPosFromXY

See Also

Search EM_POSFROMCHAR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg, $ai, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "This is appended text.")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
$ai = _GuiCtrlRichEdit_GetXYFromCharPos($hRichEdit, 20)
Report("1.The coordinates of inter-character position 20 are (" & $ai[0] & "," & $ai[1] & ")")
Case 2
Report("2.The inter-character position at or nearest coordinates (" & $ai[0] & "," & $ai[1] & ") is " & _
_GuiCtrlRichEdit_GetCharPosFromXY($hRichEdit, $ai[0], $ai[1]))
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_GotoCharPos

Function Reference

_GUICtrlRichEdit_GotoCharPos

Moves the insertion point to an inter-character position

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_GotoCharPos($hWnd, $iCharPos)

Parameters

$hWnd | Handle to the control
$iCharPos | the inter character position Special value: -1 - end of text

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iCharPos is neither a positive number nor zero nor -1

Remarks

The first character of the text in a control is at character position 1

Cancels text selection (if any)

Related

_GUICtrlRichEdit_SetSel

See Also

Search EM_EXSETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "This is a test.")
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, 8)

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_HideSelection

Function Reference

_GUICtrlRichEdit_HideSelection

Hides (or shows) a selection

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_HideSelection($hWnd[, $fHide = True])

Parameters

$hWnd | Handle to the control
$fHide | [optional] True - hide False - show Default: hide

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fHide must be True or False

Remarks

None.

Related

See Also

Search EM_HIDESELECTION in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 5)
Report("Text is selected")
Case 2
_GuiCtrlRichEdit_HideSelection($hRichEdit, True)
Report("Selection is hidden")
Case 3
_GuiCtrlRichEdit_HideSelection($hRichEdit, False)
Report("Selection is not hidden")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $sRet = _GuiCtrlRichEdit_GetCharAttributes($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Char Attributes=" & $sRet
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_InsertText

Function Reference

_GUICtrlRichEdit_InsertText

Inserts text at insertion point or anchor point of selection

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_InsertText($hWnd, $sText)

Parameters

$hWnd | Handle to the control
$sText | Text to be inserted

Return Value

Succcess: | True
Failure: | False, and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $sText = ""
 | 700 - Operation failed

Remarks

None.

Related

_GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_ReplaceText, _GUICtrlRichEdit_SetText, _GUICtrlRichEdit_GetText

See Also

Search EM_SETTEXTEX in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 5, 2)
Case 2
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_1")
GUICtrlSetData($lblMsg, "Text is inserted at active point of selection")
Case 3
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, 20)
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_2")
GUICtrlSetData($lblMsg, "Text is inserted at insertion point")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_IsModified

Function Reference

_GUICtrlRichEdit_IsModified

Retrieves the state of a rich edit control's modification flag

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_IsModified($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True or False
Failure: | Sets @error
@error: | 101 - $hWnd is not a handle

Remarks

The system automatically sets the modification flag to False when the control is created.
If the control's text is changed, either by the user or programmatically, the system sets the flag to True
Call _GUICtrlRichEdit_SetModified to set or clear the flag

Related

_GUICtrlRichEdit_SetModified, _GUICtrlRichEdit_GetText

See Also

Search EM_GETMODIFY in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

Report("Initial state after creation")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_AppendText($hRichEdit, @CR & "A paragraph")
Report("Added some text")
Case 2
_GuiCtrlRichEdit_SetModified($hRichEdit, False)
Report("After clearing the modification flag")
Case 3
GUICtrlSetData($lblMsg, "Type some text. Then click on Next")
ControlFocus($hRichEdit, "", "")
Case 4
Report("After typing")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "State is " & _GUICtrlRichEdit_IsModified($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_IsTextSelected

Function Reference

_GUICtrlRichEdit_IsTextSelected

Is text selected?

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_IsTextSelected($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True or False
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_GetSel, _GUICtrlRichEdit_SetSel, _GUICtrlRichEdit_Deselect

See Also

Search EM_EXGETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_Paste

Function Reference

_GUICtrlRichEdit_Paste

Paste RTF or RTF with Objects from clipboard

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Paste($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

Pastes with objects if available, else without

Related

_GUICtrlRichEdit_CanPaste, _GUICtrlRichEdit_PasteSpecial, _GUICtrlRichEdit_Cut, _GUICtrlRichEdit_Copy

See Also

Search WM_PASTE in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_PasteSpecial

Function Reference

_GUICtrlRichEdit_PasteSpecial

Paste RTF or RTF and Objects from clipboard

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_PasteSpecial($hWnd, $fAndObjects = True)

Parameters

$hWnd | Handle to the control
$fAndObjects | Paste objects as well as RTF - True (default) or False

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fAndObjects is neither True nor False

Remarks

None.

Related

_GUICtrlRichEdit_CanPasteSpecial, _GUICtrlRichEdit_Paste, _GUICtrlRichEdit_Cut, _GUICtrlRichEdit_Copy

See Also

Search WM_PASTESPECIAL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_PauseRedraw

Function Reference

_GUICtrlRichEdit_PauseRedraw

Pauses redrawing of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_PauseRedraw($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_ResumeRedraw

See Also

Search WM_SETREDRAW in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GUICtrlRichEdit_PauseRedraw($hRichEdit)
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 5, 2)
Report("1.Redraw is paused")
Case 2
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_2")
Report("2.Text is inserted at active point of selection")
Case 3
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, 20)
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_3")
Report("3.Text is inserted at insertion point and Redraw is resume")
_GUICtrlRichEdit_ResumeRedraw($hRichEdit)
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_Redo

Function Reference

_GUICtrlRichEdit_Redo

Redoes last undone action

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Redo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_Undo, _GUICtrlRichEdit_CanRedo, _GUICtrlRichEdit_GetNextRedo, _GUICtrlRichEdit_EmptyUndoBuffer, _GUICtrlRichEdit_SetUndoLimit

See Also

Search EM_REDO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
_SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>_SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_ReplaceText

Function Reference

_GUICtrlRichEdit_ReplaceText

Replaces selected text

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ReplaceText($hWnd, $sText[, $fCanUndo = True])

Parameters

$hWnd | Handle to the control
$sText | Replacement text
$fCanUndo | [optional] Can operation can be undone? True (Default) or False

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 103 - $fCanUndo must be True or False
 | -1 - no text is selected

Remarks

None.

Related

_GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_SetText

See Also

Search EM_REPLACESEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 5)
Case 2
_GuiCtrlRichEdit_ReplaceText($hRichEdit, "1st")
GUICtrlSetData($lblMsg, "Text has been replaced")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 3)
_GuiCtrlRichEdit_ReplaceText($hRichEdit, "")
GUICtrlSetData($lblMsg, "1st has been deleted")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_ResumeRedraw

Function Reference

_GUICtrlRichEdit_ResumeRedraw

Resumes redrawing of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ResumeRedraw($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_PauseRedraw

See Also

Search WM_SETREDRAW in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GUICtrlRichEdit_PauseRedraw($hRichEdit)
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 5, 2)
Report("1.Redraw is paused")
Case 2
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_2")
Report("2.Text is inserted at active point of selection")
Case 3
_GuiCtrlRichEdit_GotoCharPos($hRichEdit, 20)
_GUICtrlRichEdit_InsertText($hRichEdit, "INSERTED_3")
Report("3.Text is inserted at insertion point and Redraw is resume")
_GUICtrlRichEdit_ResumeRedraw($hRichEdit)
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_ScrollLineOrPage

Function Reference

_GUICtrlRichEdit_ScrollLineOrPage

Scrolls the text down or up a line or a page

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ScrollLineOrPage($hWnd, $sAction)

Parameters

$hWnd | Handle to the control
$sAction | one of the following: "ld" - line down "lu" - line up "pd" - page down "pu" - page up

Return Value

Success: | the number of lines actually scrolled (positive if down)
Failure: | 0 and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $sAction is not two characters
 | 1022 - first character must be l or p
 | 1023 - second character must be d or u

Remarks

This function is well behaved: it never scrolls such that lines beyond the last one are shown.

Related

_GUICtrlRichEdit_ScrollLines, _GUICtrlRichEdit_ScrollToCaret

See Also

Search EM_SCROLL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

For $i = 1 To 20
_GUICtrlRichEdit_AppendText($hRichEdit, "Line " & $i & @CR)
Next
_GUICtrlRichEdit_AppendText($hRichEdit, "Line 21")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
DoIt("lu", "Scrolled up a line")
Case 2
DoIt("pu", "Scrolled up a page")
Case 3
DoIt("pd", "Scrolled down a page")
Case 4
DoIt("pd", "Tried to scroll down another page")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func DoIt($sAction, $sMsg)
Local $iQlines
$iQlines = _GUICtrlRichEdit_ScrollLineOrPage($hRichEdit, $sAction)
GUICtrlSetData($lblMsg, $sMsg & @CR & @CR & "Actually scrolled " & @CR & $iQlines & " lines")
EndFunc ;==>DoIt


Function _GUICtrlRichEdit_ScrollLines

Function Reference

_GUICtrlRichEdit_ScrollLines

Scrolls the text down or up a number of lines

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ScrollLines($hWnd, $iQlines)

Parameters

$hWnd | Handle to the control
$iQlines | number of lines to scroll

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iQlines is not numeric
 | 700 - attempt to scroll a single-line control

Remarks

To scroll down, set $iQlines to a positive value; to scroll up, a negative value.

_GUICtrlRichEdit_ScrollLines is well behaved: if $iQlines is more than the number of lines below
the current line, it scrolls to show only the last line; if $iQlines is negative and specifies
a line before the first one, it scrolls to show the first line at the top of the control window.

Related

_GUICtrlRichEdit_ScrollLineOrPage, _GUICtrlRichEdit_ScrollToCaret

See Also

Search EM_LINESCROLL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

For $i = 1 To 20
_GuiCtrlRichEdit_AppendText($hRichEdit,"Line " & $i & @CR)
Next
_GuiCtrlRichEdit_AppendText($hRichEdit,"Line 21")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_ScrollLines($hRichEdit, -10.2)
Report("Scrolled up")
Case 2
_GUICtrlRichEdit_ScrollLines($hRichEdit, +100)
Report("Scrolled down so only last line shows")
Case 3
_GUICtrlRichEdit_ScrollLines($hRichEdit, -200)
Report("Scrolled up all the way")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_ScrollToCaret

Function Reference

_GUICtrlRichEdit_ScrollToCaret

Scrolls to show line on which caret (insertion point) is

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_ScrollToCaret($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle

Remarks

None.

Related

_GUICtrlRichEdit_ScrollLineOrPage, _GUICtrlRichEdit_ScrollLines

See Also

Search EM_SCROLLCARET in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

For $i = 1 To 20
_GUICtrlRichEdit_AppendText($hRichEdit, "Line " & $i & @CR)
Next
_GUICtrlRichEdit_AppendText($hRichEdit, "Line 21")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_ScrollLineOrPage($hRichEdit, "pu")
Report("Scrolled up a page")
Case 2
_GuiCtrlRichEdit_ScrollToCaret($hRichEdit)
Report("Scrolled caret into view")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetCharAttributes

Function Reference

_GUICtrlRichEdit_SetCharAttributes

Turns an attribute on or off for selected text or, if none selected, for text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetCharAttributes($hWnd, $sStatesAndEffects [, $fWord = False])

Parameters

$hWnd | Handle to the control
$sStatesAndEffects | a string consisting of three character groups: + (or -) for the state, and a two-letter abbreviation for the attribute first character: + for on, - for off second and third character: any of: bo - bold di - disable - displays characters with a shadow [nd] em - emboss [nd] hi - hide, i.e. don't display im - imprint [nd] it - italcize li - send EN_LINK messages when mouse is over text with this attribute ou - outline [nd] pr - send EN_PROTECT when user attempts to modify re - mark as revised [nd] sh - shadow [nd] sm - small capital letters [nd] st - strike out sb - subscript [nd] sp - superscript [nd] un - underline
$fWord | [optional] True If text is selected, apply the attribute to whole words in the selected text If not: If the insertion point is in a word, or at the end of it, apply the attribute to the word If not, apply the attribute to text inserted at the insertion point False (Default) If text is selected, apply the attribute to the selected text If not, apply the attribute to text inserted at the insertion point

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1021 - length of $sStatesAndAtts is not multiple of 3
 | 1022 - first character of group not + or -. The character is in @extended
 | 1023 - an abbreviation for an attribute is invalid. It is in @extended
 | 103 - $fWord must be True or False

Remarks

Some attributes do not display; they are marked with [nd] above.

Related

_GUICtrlRichEdit_GetCharAttributes

See Also

Search EM_SETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1 ")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
_GuiCtrlRichEdit_SetCharAttributes($hRichEdit, "+un")
Report("1. Two characters underlined")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 1, 5)
_GuiCtrlRichEdit_SetCharAttributes($hRichEdit, "+bo")
Report("2. Some characters bolded")
Case 3
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & _GUICtrlRichEdit_GetCharAttributes($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetCharBkColor

Function Reference

_GUICtrlRichEdit_SetCharBkColor

Sets the background color of selected text or, if none selected, sets the background color of text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetCharBkColor($hWnd [, $iColor])

Parameters

$hWnd | Handle to the control
$iColor | [optional] one of the following: a number - a COLORREF value Default keyword - the system color (default)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $vColor: not 2 semicolons
 | 1022 - $vColor: value not 0 to 100
 | 1023 - $vColor: invalid character

Remarks

None.

Related

_GUICtrlRichEdit_GetCharBkColor

See Also

Search EM_SETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 5)
_GuiCtrlRichEdit_SetCharBkColor($hRichEdit, "304050")
Report("2. Setting is now")
Case 3
_GuiCtrlRichEdit_SetCharBkColor($hRichEdit)
Report("3. Background of a few characters changed")
Case 4
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, -1)
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
Report("4. Saved to File")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iBkColor = _GUICtrlRichEdit_GetCharBkColor($hRichEdit)
Local $sMixed = _Iif(@extended, "+", "~")
Local $aRet = _ColorGetRGB($iBkColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " BkColor=0x" & Hex($iBkColor) & ":" & $sMixed
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetCharColor

Function Reference

_GUICtrlRichEdit_SetCharColor

Sets the color of selected text or, if none selected, sets the background color of text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetCharColor($hWnd [, $iColor])

Parameters

$hWnd | Handle to the control
$iColor | [optional] one of the following: a number - a COLORREF value Default keyword - the system color (default)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1022 - $iColor is invalid

Remarks

None.

Related

_GUICtrlRichEdit_GetCharColor

See Also

Search EM_SETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GuiCtrlRichEdit_SetCharColor($hRichEdit, "304050")
Report("2. Setting is now")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 1, 5)
_GuiCtrlRichEdit_SetCharColor($hRichEdit)
Report("3. Background of a few characters changed")
Case 4
_GuiCtrlRichEdit_SetSel($hRichEdit, 6, -1)
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
Report("4. Saved to File")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iColor = _GUICtrlRichEdit_GetCharColor($hRichEdit)
Local $sMixed = _Iif(@extended, "+", "~")
Local $aRet = _ColorGetRGB($iColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " Color=0x" & Hex($iColor) & ":" & $sMixed
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetBkColor

Function Reference

_GUICtrlRichEdit_SetBkColor

Sets the background color of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetBkColor($hWnd [, $iColor = Default])

Parameters

$hWnd | Handle to the control
$iColor | [optional] one of the following: a number - a COLORREF value Default keyword - the system color (default)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1022 - $iColor is invalid

Remarks

None.

Related

_GUICtrlRichEdit_GetBkColor

See Also

Search EM_SETBKGNDCOLOR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetBkColor($hRichEdit, 0xE8CCCC)
Report("1. Colored background")
Case 2
_GUICtrlRichEdit_SetBkColor($hRichEdit)
Report("2. Back to white")
Case 3
_GUICtrlRichEdit_SetBkColor($hRichEdit, 0xB3B3C7)
Report("3. Colored background again")
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $iBngColor = _GUICtrlRichEdit_GetBkColor($hRichEdit)
Local $aRet = _ColorGetRGB($iBngColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " BngColor=0x" & Hex($iBngColor)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetEventMask

Function Reference

_GUICtrlRichEdit_SetEventMask

Specifies which notification messages are sent to the parent window

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetEventMask($hWnd, $iEventMask)

Parameters

$hWnd Handle to the control
$iEventMask BitOr combination of :
$ENM_CHANGE - Sends $EN_CHANGE notifications (user may have altered text)
$ENM_CORRECTTEXT - Sends $EN_CORRECTTEXT notifications (parent window can cancel correction of text)
$ENM_DRAGDROPDONE - Sends $EN_DRAGDROPDONE notifications (drag and drop operation completed)
$ENM_DROPFILES - Sends $EN_DROPFILES notifications (user is attempting to drop files into the control)
$ENM_KEYEVENTS - Sends $EN_MSGFILTER notifications for keyboard events
$ENM_LINK - Sends $EN_LINK notifications when the mouse pointer is over text having the link character
attribute set and when user clicks the mouse [2.0+]
$ENM_MOUSEEVENTS - Sends $EN_MSGFILTER notifications for mouse events to parent window
$ENM_OBJECTPOSITIONS - Sends $EN_OBJECTPOSITIONS notifications when the control reads in objects
$ENM_PROTECTED - Sends $EN_PROTECTED notifications when the user attempts to change characters having
the protected attribute set
$ENM_REQUESTRESIZE - Sends $EN_REQUESTRESIZE notifications that the control's contents are either smaller or
larger than the control's window size
$ENM_SCROLL - Sends $EN_HSCROLL and $EN_VSCROLL notifications when the user clicks the horizontal/vertical
scroll bar
$ENM_SCROLLEVENTS - Sends EN_MSGFILTER notifications for mouse wheel events
$ENM_SELCHANGE - Sends EN_SELCHANGE notifications when the current selection changes
$ENM_UPDATE - Sends EN_UPDATE notifications when a control is about to redraw itself
or
$ENM_NONE - Disables sending of notification messages to the parent window

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iEventMask is not a number

Remarks

The number in parentheses indicate which versions mask settings apply to.

$ENM_IMECHANGE only applies to Asian-language versions of Windows

$EN_UPDATE notifications are always sent except for when 4.0 is emulating 1.0

Related

_GUICtrlRichEdit_AutoDetectURL

See Also

Search EM_SETEVENTMASK in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


Function _GUICtrlRichEdit_SetFont

Function Reference

_GUICtrlRichEdit_SetFont

Sets the font attributes of selected text or, if none selected, sets those of text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetFont($hWnd [, $iPoints = Default[, $sName = Default[, $iCharset = Default[, $iLcid = Default]]]])

Parameters

$hWnd | Handle to the control
$iPoints | [optional] point size
$sName | [optional] the name of the font face, e.g. "Courier" not "Courier Bold"
$iCharSet | [optional] the character set - one of: $ANSI_CHARSET - 0 $BALTIC_CHARSET - 186 $CHINESEBIG5_CHARSET - 136 $DEFAULT_CHARSET - 1 $EASTEUROPE_CHARSET - 238 $GB2312_CHARSET - 134 $GREEK_CHARSET - 161 $HANGEUL_CHARSET - 129 $MAC_CHARSET - 77 $OEM_CHARSET - 255 $RUSSIAN_CHARSET - 204 $SHIFTJIS_CHARSET - 128 $SYMBOL_CHARSET - 2 $TURKISH_CHARSET - 162 $VIETNAMESE_CHARSET - 163
$iLcid | [optional] see http://www.microsoft.com/globaldev/reference/lcid-all.mspx

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iPoints is not a positive number
 | 103 - $sName is not alphabetic
 | 104 - $iLcid is not a number

Remarks

If a parameter is omitted (or is Default), the value is unchanged

Related

_GUICtrlRichEdit_GetFont, _GUICtrlRichEdit_ChangeFontSize

See Also

Search http://www.hep.wisc.edu/~pinghc/books/apirefeng/l/logfont.html in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial")
Case 2
_GUICtrlRichEdit_SetFont($hRichEdit, 15, "Times Roman")
Report("2. Set Font")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRet = _GUICtrlRichEdit_GetFont($hRichEdit)
$sMsg = $sMsg & @CR & @CR & $aRet[1] & " " & $aRet[0] & " points"
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetLimitOnText

Function Reference

_GUICtrlRichEdit_SetLimitOnText

Change number of characters that can be typed, pasted or streamed in as Rich Text Format

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetLimitOnText($hWnd, $iNewLimit)

Parameters

$hWnd | Handle to the control
$iNewLimit | new limit

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iNewLimit is neither a positive number nor zero

Remarks

This function sets the limit on the number of characters a user can type in or paste into a control.

It also limits the number of characters of RTF text that can be streamed in using
_GUICtrlRichEdit_StreamFromFile and _GUICtrlRichEdit_StreamFromVar.

It does not limit the amount of plain text that can be streamed in.

The initial limit is 32,767 characters.

Related

_GUICtrlRichEdit_StreamToFile, _GUICtrlRichEdit_StreamToVar, _GUICtrlRichEdit_StreamFromFile, _GUICtrlRichEdit_StreamFromVar

See Also

Search EM_EXLIMITTEXT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetLimitOnText($hRichEdit, 0)
GUICtrlSetData($lblMsg, "1. Limit set to 65,536 characters")
Case 2
_GuiCtrlRichEdit_SetLimitOnText($hRichEdit, 100000)
GUICtrlSetData($lblMsg, "2. Limit set to 100,000 characters")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_SetModified

Function Reference

_GUICtrlRichEdit_SetModified

Sets or clears the modification flag

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetModified($hWnd, $fState = True)

Parameters

$hWnd | Handle to the control
$fState | Specifies the new value for the modification flag: True - Indicates that the text has been modified (default) False - Indicates it has not been modified.

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fState must be True or False

Remarks

The system automatically sets the modification flag to False when the control is created.
If the control's text is changed, either by the user or programmatically, the system sets the flag to True
Call _GUICtrlRichEdit_IsModified to retrieve the current state of the flag.

Related

_GUICtrlRichEdit_IsModified

See Also

Search $EM_SETMODIFY in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

Report("Initial state after creation")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_AppendText($hRichEdit, @CR & "A paragraph")
Report("Added some text")
Case 2
_GuiCtrlRichEdit_SetModified($hRichEdit, False)
Report("After clearing the modification flag")
Case 3
GUICtrlSetData($lblMsg, "Type some text. Then click on Next")
ControlFocus($hRichEdit, "", "")
Case 4
Report("After typing")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & "State is " & _GUICtrlRichEdit_IsModified($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetRECT

Function Reference

_GUICtrlRichEdit_SetRECT

Sets or clears the modification flag

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetRECT($hWnd [,$iLeft = Default [, $iTop = Default [, $iRight = Default [, $iBottom = Default [, $bRedraw = True]]]]]])

Parameters

$hWnd | Handle to the control
$iLeft | [optional] Left position in dialog units
$iTop | [optional] Top position in dialog units
$iRight | [optional] Right position in dialog units
$iBottom | [optional] Bottom position in dialog unit
$bRedraw | [optional] True to force redraw

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iLeft is not a positive number
 | 1022 - $iTop is not a positive number
 | 1023 - $iRight is not a positive number
 | 1024 - $iBottom is not a positive number
 | 1025 - $iLeft >= $iRight
 | 1026 - $iTop >= $iBottom

Remarks

The formatting rectangle is the area in which text is drawn, part of which may not be visible.
Parameters default = no change to previous values
If only $hWnd defined, formatting is reset as at creation time.

Related

_GUICtrlRichEdit_GetRECT

See Also

Search EM_SETMODIFY in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Default settings ")
Case 2
_GuiCtrlRichEdit_SetRECT($hRichEdit, 10, 10, 100, 100)
Report("2. Settings ")
Case 3
_GuiCtrlRichEdit_SetRECT($hRichEdit)
Report("3. ReSettings to default")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aRect = _GUICtrlRichEdit_GetRECT($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Left=" & $aRect[0] & " Top=" & $aRect[1] & " Right=" & $aRect[2] & " Bottom=" & $aRect[3]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetTabStops

Function Reference

_GUICtrlRichEdit_SetTabStops

Sets tab stops for the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetTabStops($hWnd, $vTabStops[, $fRedraw = True])

Parameters

$hWnd | handle of control
$VTabStops | tab stop(s) to set in space units: If a string, semicolon-separated tab stop positions If numeric: set a tab stop every space units
$fRedraw | [optional] whether to redraw the control - True (default) or False

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $vTabStops is neither a string nor a number
 | 1022 - $vTabStops is a string but a tab stop in it is not a positive number
 | 1023 - $vTabStops is an empty string
 | 1024 - $vTabStops is a number but it is zero or negative
 | 103 - $fRedraw must be True or False

Remarks

Space units are initially inches.
To enter a tab into a control, press Ctrl_Tab

Related

_GUICtrlRichEdit_SetParaTabStops, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETTABSTOPS in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetTabStops($hRichEdit, 1)
GUICtrlSetData($lblMsg, "1. Set tab stops every inch")
Case 2
_GuiCtrlRichEdit_SetTabStops($hRichEdit, "0.5;1.5")
GUICtrlSetData($lblMsg, "2. Set tab stops at 0.5 and 1.5 inches")

; Stream all text to the Desktop so you can look at settings in Word
_GUICtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_SetZoom

Function Reference

_GUICtrlRichEdit_SetZoom

Sets zoom level of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetZoom($hWnd, $iPercent)

Parameters

$hWnd | Handle to the control
$iPercent | percentage zoom values: 100 and 200 to 6400

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iPercent is not a positive number
 | 1022 - $iPercent neither 100 nor in the range 200 to 6400

Remarks

MSDN claims that EM_SETZOOM works from 1.56% (1/64) to 6400$ (64/1) but testing shows that
it only works reliably for the values shown above

Related

_GUICtrlRichEdit_GetZoom

See Also

Search EM_SETZOOM in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
Case 2
_GUICtrlRichEdit_SetZoom($hRichEdit, 250)
Report("2.Now zoomed to " & _GUICtrlRichEdit_GetZoom($hRichEdit) & "%")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaAlignment

Function Reference

_GUICtrlRichEdit_SetParaAlignment

Sets alignment of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaAlignment($hWnd, $sAlignment)

Parameters

$hWnd | Handle to the control
$sAlignment | values: "l" - align with the left margin. "r" - align with the right margin. "c" - center between margins "j" - justify between margins "f" - justify between margins by only expanding spaces

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - invalid $sAlignment

Remarks

In Richedit 2.0, justify does not display

Related

_GUICtrlRichEdit_GetParaAlignment

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iCp, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "r")
Report("First paragraph")
Case 2
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "c")
Report("Second paragraph")
Case 3
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Third paragraph")
_GUICtrlRichEdit_SetParaAlignment($hRichEdit, "l")
Report("Third paragraph")
Case 4
$iCp = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp, -1)
Report("Alignment of paragraphs in selection")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns "& @CR & _GUICtrlRichEdit_GetParaAlignment($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaAttributes

Function Reference

_GUICtrlRichEdit_SetParaAttributes

Sets attributes of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaAttributes($hWnd, $sStatesAndAtts)

Parameters

$hWnd | Handle to the control
$sStatesAndAtts | a string consisting of groups separated by semicolons (;}. Each group consists of: First character - state: + - turn attribute on - - turn attribute off "fpg" - force this/these paragraphs on to new page(s) (Initially off) "hyp" - automatic hypthenation (Initially on) "kpt" - keep this/these paragraph(s) together on a page (Initially off} "kpn" - keep this/these paragraph(s) and the next together on a page (Initially off) "pwo" - prevent widows and orphans, i.e. avoid a single line of this/these paragraphs on a page (Initially off) "r2l" - display text using right-to-left reading order (Initially off) "row" - paragraph(s) is/are table row(s) (Initially off) "sbs" - display paragraphs side by side (Initially off) "sln" - suppress line numbers in documents or sections with line numbers (Initially off)

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - a state character in $sStatesAndAtts is invalid. It is in @extended
 | 1022 - an attribute abbreviation in $sStatesAndAtts is invalid. It is in @extended
 | 1023 - length of $sStatesAndAtts is invalid

Remarks

Displays results in Word but not in Rich Edit

Related

_GUICtrlRichEdit_GetParaAttributes

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "First paragraph")
Report("First paragraph: default attributes")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaAttributes($hRichEdit, "-hyp")
Report("Second paragraph: hyphenation off")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, -1)
_GUICtrlRichEdit_SetParaAttributes($hRichEdit, "-hyp;+fpg;+kpn")
Report("Attributes of first paragraph in selection")
Case 3
; Stream all text to the Desktop so you can look at attributes in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaAttributes($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaBorder

Function Reference

_GUICtrlRichEdit_SetParaBorder

Sets the border of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaBorder($hWnd [, $sLocation [, $vLineStyle [, $sColor [, $iSpace]]]])

Parameters

$hWnd | Handle to the control
$sLocation | [optional] a string consisting of any logical combination of: l - left border r - right border t - top border b - bottom border i - inside border o - outside border or "" - no border (initial value)
$vLineStyle | [optional] line style - one of: "none" - no line (initial value) .75 - 3/4 point 1.5 - 1 1/2 points 2.25 - 2 1/4 points 3 - 3 points 4.5 - 4 1/2 points 6 - 6 points ".75d" - 1/2 points, double "1.5d" - 1 1/2 points, double "2.25d" - 2 1/4 points, double ".75g" - 3/4 point grey ".75gd" - 3/4 point grey dashed
$sColor | [optional] one of: "aut" - autocolor "blk" - black (initial value) "blu" - blue "cyn" - cyan "grn" - green "mag" - magenta "red" - red "yel" - yellow "whi" - white "dbl" - dark blue "dgn" - dark green "dmg" - dark magenta "drd" - dark red "dyl" - dark yellow "dgy" - dark grey "lgy" - light grey
$iSpace | [optional] space between the border and the text (in space units) ( (initial value): 0)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - value of $sLocation is invalid
 | 103 - value of $ivLineStyle is invalid
 | 104 - value of $sColor is invalid
 | 106 - $iSpace is neither a positive number nor zero
 | 106 - $iWidth is neither a positive number nor zero

Remarks

To set "space units", call _GUICtrlRichEdit_SetSpaceUnit. Initially inches

If text is selected, the defaults are the values of the first paragraph with text selected.
If none is selected, the defaults are the values of the current paragraph.

To remove a border, call with two parameters: ($hWnd, "")

Borders do not show in Rich Edit, but ones created here should show in Word

Related

_GUICtrlRichEdit_GetParaBorder, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $iStep = 0, $btnNext
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "First paragraph")
Report("0. First paragraph: default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "o", 3, "mag", 0.25)
Report("1. Second paragraph: with border (should show in Word)")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, -1)
Report("2. Settings of first paragraph in selection")
Case 3
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "l", 6, "blu")
Report("3. Settings of both paragraphs changed")
Case 4
_GUICtrlRichEdit_SetParaBorder($hRichEdit, Default, ".75gd")
Report("4. Line style changed")
Case 5
; Stream all text to the Desktop so you can look at border settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaBorder($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaIndents

Function Reference

_GUICtrlRichEdit_SetParaIndents

Sets indents of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaIndents($hWnd [, $vLeft = Default [, $iRight = Default [, $iFirstLine = Default]]])

Parameters

$hWnd | Handle to the control
$vLeft | [optional] indentation of left side of the body of the paragraph (in space units) absolute - a number relative to previous - a string - "+" or "-"
$iRight | [optional] indentation of right side of the paragraph (in space units)
$iFirstLine | [optional] indentation of the first line relative to other lines (in space units)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $vLeft is neither a number nor a string consisting of a number
 | 1022 - $vLeft would start body of paragrpah to left of client area
 | 103 - $iRight is not a number
 | 105 - $iFirstLine is not a number
 | 200 - First line would be outdented beyond the client area
 | 700 - Operation failed

Remarks

Postive values of $iLeft, $iRight and $iFirstLine indent towards the center of the paragraph

All three values are initially zero.

To set "space units", call _GUICtrlRichEdit_SetSpaceUnit. Initially inches

If text is selected, the defaults are the values of the first paragraph with text selected.
If none is selected, the defaults are the values of the current paragraph.

Related

_GUICtrlRichEdit_GetParaIndents, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("Para with default indent settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
Report("Added second paragraph")
Case 2
_GUICtrlRichEdit_SetParaIndents($hRichEdit, 0.25, .1)
Report("Changed indent settings of second paragraph")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaIndents($hRichEdit, Default, 0, .2)
Report("Change settings of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at Indents settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaIndents($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaNumbering

Function Reference

_GUICtrlRichEdit_SetParaNumbering

Sets numbering of paragraph(s) in the current selection or, if no selection, of paragraph(s) inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaNumbering($hWnd, $sStyle [, $iTextToNbrSpace = Default [, $fForceRoman=False]])

Parameters

$hWnd | Handle to the control
$sStyle | a string specifying style and starting "number": e.g. "." (bullet), "1)","(b)", "C.", "iv", "V)" This is the "numbering" that will display for the first paragraph. Trailing spaces indicate the minimum spaces between the number and the paragraph unless iTextToNbrSpace is entered Special cases: "=" - This paragraph is an unnumbered paragraph within the preceding list element "" - removed the numbering from the selected paragraph(s)
$iTextToNbrSpace | [optional] space between number/bullet and paragraph (in space units) Default: number of trailing spaces times point size
$fForceRoman | [optional] False - i, v, x ... in $sStyle is letter i, v, x ... {Default)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - $sStyle is invalid
 | 103 - $iTextToNbrSpace is not a postive number
 | 104 - $fForceRoman must be True or False

Remarks

To set "space units", call _GUICtrlRichEdit_SetSpaceUnit. Initially inches

Related

_GUICtrlRichEdit_GetParaNumbering, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 1)
Report("Para with default indent settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, ".")
Report("Added second paragraph")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("Style of first paragraph in the selection")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "v) ", Default, True)
Report("Change settings of both paragraphs")
Case 4
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaNumbering($hRichEdit, "2. ", Default, True)
Report("Changed settings for both paragraphs")
Case 5
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaNumbering($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaShading

Function Reference

_GUICtrlRichEdit_SetParaShading

Sets the shading of paragraph(s) in the current selection or, if no selection, of paragraphs inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaShading($hWnd [, $iWeight = Default [, $sStyle = Default [, $sForeColor = Default [, $sBackColor = Default]]]])

Parameters

$hWnd | Handle to the control
$iWeight | [optional] percent of foreground color, the rest being background color
$sStyle | [optional] shading style - a string containing one of the following: non - none dhz - dark horizontal dvt - dark vertical ddd - dark down diagonal dud - dark up diagonal dgr - dark grid dtr - dark trellis lhz - light horizontal lvt - light vertical ldd - light down diagonal lud - light up diagonal lgr - light grid ltr - light trellis
$sForeColor | [optional] one of the following: "blk" - black (initial value) "blu" - blue "cyn" - cyan "grn" - green "mag" - magenta "red" - red "yel" - yellow "whi" - white "dbl" - dark blue "dgn" - dark green "dmg" - dark magenta "drd" - dark red "dyl" - dark yellow "dgy" - dark grey "lgy" - light grey
$sBackColor | [optional] same values as for $sForeColor

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $iWeight is not a positive number
 | 1022 - value of $iWeight is invalid
 | 103 - value of $sStyle is invalid
 | 104 - value of $sForeColor is invalid
 | 105 - value of $sBackColor is invalid
 | 700 - operation failed

Remarks

If text is selected, the defaults are the values of the first paragraph with text selected.
If none is selected, the defaults are the values of the current paragraph.

Shading does not show in Rich Edit, but shading created here will show in Word

Related

_GUICtrlRichEdit_GetParaShading

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaShading($hRichEdit, 60, "ddd", "blu", "dmg")
Report("1. Shading of second paragraph is ")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Style of first paragraph in the selection is ")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaShading($hRichEdit, Default, "dgr")
Report("3. Change shading of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at settings in Word
_GUICtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaShading($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaSpacing

Function Reference

_GUICtrlRichEdit_SetParaSpacing

Sets paragraph spacing of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaSpacing($hWnd, [$vInter=Default [, $iBefore=Default [, $iAfter=Default]]])

Parameters

$hWnd | Handle to the control
$vInter | [optional] spacing between lines: either: a number - in space units or: " lines" - in lines
$iBefore | [optional] spacing before paragraph(s) (in space units)
$iAfter | [optional] spacing after paragraph(s) (in space units)

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 1021 - $vInter is invalid
 | 1022 - Only 1, 1.5 and 2 line spacing can be set via " lines"
 | 103 - $iBefore is neither a positive number nor zero
 | 104 - $iAfter is neither a positive number nor zero

Remarks

Only settings which are not defaulted are set

To set "space units", call _GUICtrlRichEdit_SetSpaceUnit. Initially inches

Related

_GUICtrlRichEdit_GetParaSpacing, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETPARAFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaSpacing($hRichEdit, "2 lines", .2, .25)
Report("1. Spacing of second paragraph is ")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Settings of first paragraph in the selection are ")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
_GUICtrlRichEdit_SetParaSpacing($hRichEdit, Default, .1)
Report("3. Change spacing of both paragraphs")
Case 4
; Stream all text to the Desktop so you can look at Indents settings in Word
_GUICtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaSpacing($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetParaTabStops

Function Reference

_GUICtrlRichEdit_SetParaTabStops

Sets tab stops of paragraphs having selected text or, if none selected, sets it for text inserted at the insertion point

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetParaTabStops($hWnd, $sTabStops)

Parameters

$hWnd | Handle to the control
$sTabStops | A string consisting of groups separated by ; (semicolon). Format of a group: absolute position of a tab stop (in space units) kind of tab l - left tab c - center tab r - decimal tab b - bar tab kind of dot leader . - dotted leader - - dashed leader _ - underline leader = - double line leader t - thick-line leader a space - no leader

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - absolute position of a tab stop missing or invalid
 | 1022 - kind of tab missing or invalid
 | 1023 - kind of tab leader missing or invalid
 | 1024 - attempt to set too many tab stops
 | @extended contains the tab number (ref 1) in $sTabStops where the error occurred.

Remarks

To reset the tab stops, do _GUICtrlRichEdit_SetParaTabStops($hWnd, "")

To set "space units", call _GUICtrlRichEdit_SetSpaceUnit. Initially inches

To enter a tab into a control, press Ctrl_Tab

Related

_GUICtrlRichEdit_GetParaTabStops, _GUICtrlRichEdit_SetSpaceUnit, _GUICtrlRichEdit_SetTabStops

See Also

Search EM_SETCHARFORMAT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
Report("0. Para with default settings")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaTabStops($hRichEdit, ".3l ;1c ;2.5r.")
Report("1. TabStops of second paragraph")
Case 2
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 2)
Report("2. Tabstops of first paragraph")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 10, 26)
Report("Tabstops of first paragraph in selection")
Case 4
_GUICtrlRichEdit_SetParaTabStops($hRichEdit, "2.3r=")
Report("3. Change tabstops of both paragraphs")
Case 5
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & "Get function returns " & @CR & _GUICtrlRichEdit_GetParaTabStops($hRichEdit)
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetPasswordChar

Function Reference

_GUICtrlRichEdit_SetPasswordChar

Sets the characters to be displayed instead of those typed, or causes typed characters to show

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetPasswordChar($hWnd[, $cDisplayChar = "0"])

Parameters

$hWnd | Handle to the control
$cDisplayChar | [optional] The character to be displayed in place of the characters typed by the user. Special value: "" - characters typed are displayed

Return Value

Succcess: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $cDisplayChar is not a character

Remarks

None.

Related

_GUICtrlRichEdit_GetPasswordChar

See Also

Search EM_SETPASSWORDCHAR in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

Report("Initial state after creation:")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetPasswordChar($hRichEdit, "*")
Report("Changed password character. Type some text")
Case 2
_GUICtrlRichEdit_SetPasswordChar($hRichEdit, "")
Report("Changed it back")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $ch
$ch = _GUICtrlRichEdit_GetPasswordChar($hRichEdit)
If $ch = "" Then
$sMsg &= @CR & "Characters appear as typed"
Else
$sMsg = $sMsg & @CR & "Typed characters appear as " & $ch & "s"
EndIf
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetReadOnly

Function Reference

_GUICtrlRichEdit_SetReadOnly

Sets or removes the read-only state

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetReadOnly($hWnd[, $fState = True])

Parameters

$hWnd | Handle to the control
$fState | [optional] one of the following values: True - Sets control to read-only (default) False - Sets control to read-write

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $fState is neither true nor false
 | 700 - operation failed

Remarks

None.

Related

See Also

Search EM_SETREADONLY in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

For $i = 1 To 5
_GUICtrlRichEdit_AppendText($hRichEdit, "Line " & $i & @CR)
Next
_GUICtrlRichEdit_AppendText($hRichEdit, "Line 6")
Report("Initial state")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetReadOnly($hRichEdit)
Report("Set to read-only")
Case 2
_GuiCtrlRichEdit_SetReadOnly($hRichEdit, False)
Report("Now read-write")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
GUICtrlSetData($lblMsg, $sMsg & @CR & "Try typing some text")
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetScrollPos

Function Reference

_GUICtrlRichEdit_SetScrollPos

Scrolls the display such that ($ix,$iY) is in the upper left corner of the control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetScrollPos($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | x coorindate (in pixels)
$iY | y coorindate (in pixels)

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iX is neither a positive number nor zero
 | 103 - $iY is neither a positive number nor zero

Remarks

Never scrolls the text completely off the view rectangle

Related

_GUICtrlRichEdit_GetScrollPos

See Also

Search EM_SETSCROLLPOS in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
For $i = 2 To 20
_GuiCtrlRichEdit_AppendText($hRichEdit, @CRLF & "Paragraph " & $i)
Next
Report("0. Initially scrolled to show insertion point")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetScrollPos($hRichEdit, 0, 0)
Report("1. Scrolled to top")
Case 2
_GUICtrlRichEdit_SetScrollPos($hRichEdit, 7, 22)
Report("2. Scrolled down a bit, and to the right")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $aPos = _GUICtrlRichEdit_GetScrollPos($hRichEdit)
$sMsg = $sMsg & @CR & "Get function returns " & $aPos[0] & ";" & $aPos[1]
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetSel

Function Reference

_GUICtrlRichEdit_SetSel

Sets the low and high character position of a selection

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetSel($hWnd, $iAnchor, $iActive[, $fHideSel = False])

Parameters

$hWnd | Handle to the control
$iAnchor | the character position of the first character to select Special value: -1 - end of text
$iActive | the character position of the last character to select Special value: -1 - end of text
$fHideSel | [optional] True to hide the selection

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iAnchor is neither a positive number nor zero nor -1
 | 103 - $iActive is neither a positive number nor zero nor -1
 | 104 - $fHideSel must be True or False

Remarks

The first character of the text in a control is at character position 1

$iActive can be less than $iAnchor

Related

_GUICtrlRichEdit_GetSel, _GUICtrlRichEdit_GetSelAA, _GUICtrlRichEdit_Deselect, _GUICtrlRichEdit_IsTextSelected, _GUICtrlRichEdit_GotoCharPos

See Also

Search EM_EXSETSEL in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $iCp1
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_NOHIDESEL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GuiCtrlRichEdit_SetSel($hRichEdit, 0, 3)
Report("1. Initial Character attributes at start of line 1 are")
Case 2
_GuiCtrlRichEdit_AutoDetectURL($hRichEdit, True)
_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "http://www.autoitscript.com")
$iCp1 = _GuiCtrlRichEdit_GetFirstCharPosOnLine($hRichEdit, 2)
_GuiCtrlRichEdit_SetSel($hRichEdit, $iCp1, $iCp1 + 3)
Report("2. Character attributes at start of line 2 are")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
Local $sRet = _GuiCtrlRichEdit_GetCharAttributes($hRichEdit)
$sMsg = $sMsg & @CR & @CR & "Char Attributes=" & $sRet
GUICtrlSetData($lblMsg, $sMsg)
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetSpaceUnit

Function Reference

_GUICtrlRichEdit_SetSpaceUnit

Gets the unit of measure of horizontal and vertical space used in parameters of various _GUICtrlRichEdit functions

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetSpaceUnit($sUnit)

Parameters

$sUnit "in", "cm", "mm", "pt" (points), or "tw" (twips, 1/1440 inches, 1/567 centimeters

Return Value

Success: | True
Failure: | False and sets @error to 1

Remarks

Initially, space is measured in inches

Related

_GUICtrlRichEdit_GetSpaceUnit, _GUICtrlRichEdit_SetParaBorder, _GUICtrlRichEdit_SetParaIndents, _GUICtrlRichEdit_SetParaNumbering, _GUICtrlRichEdit_SetParaSpacing, _GUICtrlRichEdit_SetParaTabStops, _GUICtrlRichEdit_SetTabStops

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $lblMsg, $hRichEdit

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GuiCtrlRichEdit_SetSpaceUnit("cm")
Report("2. Setting is now")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main

Func Report($sMsg)
$sMsg = $sMsg & @CR & @CR & _GUICtrlRichEdit_GetSpaceUnit()
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report


Function _GUICtrlRichEdit_SetText

Function Reference

_GUICtrlRichEdit_SetText

Sets the text of a control

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetText($hWnd, $sText)

Parameters

$hWnd | Handle to the control
$sText | Plain or RTF text to put into the control

Return Value

Succcess: | True
Failure: | False, and sets @error:
@error: | 101 - $hWnd is not a handle

Remarks

Sets all of the text. Text can be plain or RTF text.
Keeps the undo stack.

Related

_GUICtrlRichEdit_GetText, _GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_ReplaceText, _GUICtrlRichEdit_EmptyUndoBuffer

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_SetUndoLimit

Function Reference

_GUICtrlRichEdit_SetUndoLimit

Sets the maximum number of actions that can stored in the undo queue

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetUndoLimit($hWnd, $iLimit)

Parameters

$hWnd | Handle to the control
$iLimit | the maximum number of actions that can be stored in the undo queue

Return Value

Success | True
Failure | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 102 - $iLimit is neither a positive number nor zero

Remarks

To disable the Undo feature, set $iLimit to zero

The initial value of $iLimit is 100.

Related

_GUICtrlRichEdit_Undo, _GUICtrlRichEdit_CanRedo, _GUICtrlRichEdit_CanUndo, _GUICtrlRichEdit_GetNextRedo, _GUICtrlRichEdit_Redo

See Also

Search EM_SETUNDOLIMIT in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_SetUndoLimit($hRichEdit, 200)
GUICtrlSetData($lblMsg, "Increased the number of actions that can stored in the undo queue from 100 to 200")
Case 2
_GUICtrlRichEdit_SetUndoLimit($hRichEdit, 0)
GUICtrlSetData($lblMsg, "Undo is disabled")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_StreamFromFile

Function Reference

_GUICtrlRichEdit_StreamFromFile

Sets text in a control from a file

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_StreamFromFile($hWnd, $sFilespec)

Parameters

$hWnd | Handle to the control
$sFileSpec | file specification

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 1021 - unable to open $sFilespec
 | 1022 - file is empty
 | 700 - attempt to stream in too many characters

Remarks

If text is selected, replaces selection, else replaces all text in the control

Call _GUICtrlRichEdit_SetLimitonText to increase the number of characters the control can contain

Related

_GUICtrlRichEdit_SetLimitOnText, _GUICtrlRichEdit_StreamFromVar, _GUICtrlRichEdit_StreamToFile

See Also

Search EM_STREAMIN in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
_GUICtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetData($lblMsg, "Streamed to gcre.rtf")
Case 2
_GuiCtrlRichEdit_SetText($hRichEdit, "")
_GUICtrlRichEdit_StreamFromFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetData($lblMsg, "Streamed from gcre.rtf")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 6)
_GUICtrlRichEdit_StreamFromFile($hRichEdit, @DesktopDir & "\gcre.rtf")
GUICtrlSetData($lblMsg, "Replaced selection: an intentional mess!")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_StreamFromVar

Function Reference

_GUICtrlRichEdit_StreamFromVar

Sets text in a control from a variable

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_StreamFromVar($hWnd, $sVar)

Parameters

$hWnd | Handle to the control
$sVar | a string

Return Value

Success: | True
Failure: | False and sets @error
@error: | 101 - $hWnd is not a handle
 | 700 - attempt to stream in too many characters

Remarks

If text is selected, replaces selection, else replaces all text in the control

Call _GUICtrlRichEdit_SetLimitonText to increase the number of characters the control can contain

Related

_GUICtrlRichEdit_SetLimitOnText, _GUICtrlRichEdit_StreamFromFile, _GUICtrlRichEdit_StreamToVar, _GUICtrlRichEdit_StreamToFile

See Also

Search EM_STREAMIN in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit, $s
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
$s = _GUICtrlRichEdit_StreamToVar($hRichEdit)
GUICtrlSetData($lblMsg, "Streamed to variable")
Case 2
_GuiCtrlRichEdit_SetText($hRichEdit, "")
_GUICtrlRichEdit_StreamFromVar($hRichEdit, $s)
GUICtrlSetData($lblMsg, "Streamed from variable")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 6)
_GUICtrlRichEdit_StreamFromVar($hRichEdit, $s)
GUICtrlSetData($lblMsg, "Replaced selection: an intentional mess!")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_StreamToFile

Function Reference

_GUICtrlRichEdit_StreamToFile

Writes contens of a control to a file

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_StreamToFile($hWnd, $sFilespec [, $fIncludeCOM=True [, $iOpts=0 [, $iCodePage = 0]]])

Parameters

$hWnd | Handle to the control
$sFileSpec | file specification
$fIncludeCOM | [optional] True (default): If writing to a .rtf file, includes any COM objects (space consuming) If writing to any other file, writes a text represntation of COM objects False: Writes spaces instead of COM objects
$iOpts | [optional] additional options: (default: 0) $SFF_PLAINTRTF - write only rich text keywords common to all languages $SF_UNICODE - write Unicode
$iCodePage | [optional] Generate UTF-8 and text using this code page Default: do not

Return Value

Success: | True
Failure: | False and set @error
@error: | 101 - $hWnd is not a handle
 | 102 - Can't create $sFilespec
 | 1041 - $SFF_PLAINRTF is invalid for a text file
 | 1042 - $opts: invalid option
 | 1043 - $SF_UNICODE is only valid for a text file
 | 700 - internal error

Remarks

If text is selected, writes only the selection, else writes all text in the control

If the extension in $sFileSpec is .rtf, RTF is written, else text

Related

_GUICtrlRichEdit_SetLimitOnText, _GUICtrlRichEdit_StreamFromVar, _GUICtrlRichEdit_StreamToVar, _GUICtrlRichEdit_StreamFromFile

See Also

Search EM_STREAMIN in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $hRichEdit, $iMsg
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState()

_GuiCtrlRichEdit_AppendText($hRichEdit, "Para with default border settings")
MsgBox(4096, "", "The default paragraph border settings are " & _GUICtrlRichEdit_GetParaBorder($hRichEdit))

_GuiCtrlRichEdit_AppendText($hRichEdit, @CR & "Second paragraph")
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "o", 3, "mag", 0.25)
MsgBox(4096, "", "Border settings of second paragraph are " & _GUICtrlRichEdit_GetParaBorder($hRichEdit))

_GuiCtrlRichEdit_SetSel($hRichEdit, 10, -1)
Sleep(1000)
MsgBox(4096, "", "Border settings of first paragraph in the selection are " & _GUICtrlRichEdit_GetParaBorder($hRichEdit))

; Change from outside border to left border
_GUICtrlRichEdit_SetParaBorder($hRichEdit, "l")

; Stream all text to the Desktop so you can look at border settings in Word
_GUICtrlRichEdit_Deselect($hRichEdit)
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")

While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_StreamToVar

Function Reference

_GUICtrlRichEdit_StreamToVar

Writes contents of a control to a variable

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_StreamToVar($hWnd [, $fRtf = True [, $fIncludeCOM=True [, $iOpts=0[, $iCodePage = 0]]]])

Parameters

$hWnd | Handle to the control
$fRtf | [optional] True - write Rich Text Format (RTF) (Default) False - write only text
$fIncludeCOM | [optional] True (default): If writing RTF, include any COM objects (space consuming) If writing only text, write a text represntation of COM objects False: Write spaces instead of COM objects
$iOpts | [optional] additional options: $SFF_PLAINTRTF - write only rich text keywords common to all languages $SF_UNICODE - write Unicode
$iCodePage | [optional] Generate UTF-8 and text using this code page Default: do not

Return Value

Success: | the RTF or text
Failure: | "" and set @error
@error: | 101 - $hWnd is not a handle
 | 1041 - $SFF_PLAINRTF is invalid for a text file
 | 1042 - $opts: invalid option
 | 1043 - $SF_UNICODE is only valid for a text file
 | 700 - internal error

Remarks

If text is selected, writes only the selection, else writes all text in the control

If the extension in $sFileSpec is .rtf, RTF is written, else text

Call _GUICtrlRichEdit_IsModified() to determine whether the text has changed

Related

_GUICtrlRichEdit_SetLimitOnText, _GUICtrlRichEdit_StreamFromVar, _GUICtrlRichEdit_StreamToFile

See Also

Search EM_STREAMIN in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Main()

Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0, $lblMsg, $hRichEdit, $s
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()

_GuiCtrlRichEdit_SetText($hRichEdit, "First paragraph")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
$s = _GUICtrlRichEdit_StreamToVar($hRichEdit)
GUICtrlSetData($lblMsg, "Streamed to variable")
Case 2
_GuiCtrlRichEdit_SetText($hRichEdit, "")
_GUICtrlRichEdit_StreamFromVar($hRichEdit, $s)
GUICtrlSetData($lblMsg, "Streamed from variable")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 2, 6)
_GUICtrlRichEdit_StreamFromVar($hRichEdit, $s)
GUICtrlSetData($lblMsg, "Replaced selection: an intentional mess!")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main


Function _GUICtrlRichEdit_Undo

Function Reference

_GUICtrlRichEdit_Undo

Undoes the last edit control operation in the control's undo queue

#Include <GuiRichEdit.au3>
_GUICtrlRichEdit_Undo($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True - undo operation succeeded
Failure: | False - undo operation failed. May set @error:
 | 101 - $hWnd is not a handle

Remarks

For a single-line edit control, the return value is always True

Related

_GUICtrlRichEdit_CanUndo, _GUICtrlRichEdit_GetNextUndo, _GUICtrlRichEdit_Redo, _GUICtrlRichEdit_GetNextRedo, _GUICtrlRichEdit_EmptyUndoBuffer, _GUICtrlRichEdit_SetUndoLimit

See Also

Search EM_UNDO in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiMenu.au3>

Global $hRichEdit, $mnu, $mnuUndo, $mnuRedo, $mnuCut, $mnuCopy
Global $mnuPaste, $mnuPasteSpl, $mnuPasteSplRTF, $mnuPasteSplwObjs

Main()

Func Main()
Local $hGui
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) &")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
GUISetState(@SW_SHOW)

_GUICtrlRichEdit_AppendText($hRichEdit, ReadBmpToRtf(FindFirstBMP()) & @CR)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$mnu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$mnuUndo = GUICtrlCreateMenuItem("Undo", $mnu)
$mnuRedo = GUICtrlCreateMenuItem("Redo", $mnu)
GUICtrlCreateMenuItem("", $mnu)
$mnuCut = GUICtrlCreateMenuItem("Cut", $mnu)
$mnuCopy = GUICtrlCreateMenuItem("Copy", $mnu)
$mnuPaste = GUICtrlCreateMenuItem("Paste", $mnu)
$mnuPasteSpl = GUICtrlCreateMenu("Paste Special", $mnu)
$mnuPasteSplRTF = GUICtrlCreateMenuItem("RTF only", $mnuPasteSpl)
$mnuPasteSplwObjs = GUICtrlCreateMenuItem("With objects", $mnuPasteSpl)
_GuiCtrlRichEdit_SetEventMask($hRichEdit, $ENM_MOUSEEVENTS)

While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $mnuUndo
_GuiCtrlRichEdit_Undo($hRichEdit)
Case $mnuRedo
_GuiCtrlRichEdit_Redo($hRichEdit)
Case $mnuCut
_GuiCtrlRichEdit_Cut($hRichEdit)
Case $mnuCopy
_GuiCtrlRichEdit_Copy($hRichEdit)
Case $mnuPaste
_GuiCtrlRichEdit_Paste($hRichEdit)
Case $mnuPasteSplRTF
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, False)
Case $mnuPasteSplwObjs
_GuiCtrlRichEdit_PasteSpecial($hRichEdit, True)
EndSwitch
WEnd
EndFunc ;==>Main

Func WM_NOTIFY($hWnd, $iMsg, $iWparam, $iLparam)
#forceref $iMsg, $iWparam
Local $hWndFrom, $iCode, $tNMHDR, $tMsgFilter, $hMenu
$tNMHDR = DllStructCreate($tagNMHDR, $iLparam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hRichEdit
Select
Case $iCode = $EN_MSGFILTER
$tMsgFilter = DllStructCreate($tagEN_MSGFILTER, $iLparam)
If DllStructGetData($tMsgFilter, "msg") = $WM_RBUTTONUP Then
$hMenu = GUICtrlGetHandle($mnu)
SetMenuTexts($hWndFrom, $hMenu)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
EndIf
EndSelect
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func SetMenuTexts($hWnd, $hMenu)
Local $fState
If _GUICtrlRichEdit_CanUndo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo: " & _GUICtrlRichEdit_GetNextUndo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuUndo, "Undo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuUndo, False, False)
EndIf
If _GUICtrlRichEdit_CanRedo($hWnd) Then
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, True, False)
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo: " & _GUICtrlRichEdit_GetNextRedo($hWnd), False)
Else
_GUICtrlMenu_SetItemText($hMenu, $mnuRedo, "Redo", False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuRedo, False, False)
EndIf
$fState = _GuiCtrlRichEdit_IsTextSelected($hWnd)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCut, $fState, False)
_GUICtrlMenu_SetItemEnabled($hMenu, $mnuCopy, $fState, False)

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPaste, _GUICtrlRichEdit_CanPaste($hWnd))

_GUICtrlMenu_SetItemEnabled($hMenu, $mnuPasteSpl, _GUICtrlRichEdit_CanPasteSpecial($hWnd), False)
EndFunc ;==>SetMenuTexts

Func ReadBmpToRtf($sBmpFilspc)
Local $hFile, $sRtf
$hFile = FileOpen($sBmpFilspc, 16)
If FileRead($hFile, 2) <> "0x424D" Then Return SetError(1, 0, "")
FileRead($hFile, 12)
$sRtf = '{\rtf1{\pict\dibitmap ' & Hex(FileRead($hFile)) & '}}'
FileClose($hFile)
Return $sRtf
EndFunc ;==>ReadBmpToRtf

Func FindFirstBMP($sPath = @WindowsDir)
Local $hFind, $sBmpFilspc
$hFind = FileFindFirstFile($sPath & "\*.bmp")
$sBmpFilspc = FileFindNextFile($hFind)
FileClose($hFind)
Return $sPath & "\" & $sBmpFilspc
EndFunc ;==>FindFirstBMP


User Defined Functions

GuiScrollBars user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiScrollBars.au3>.

User Defined Function | Description
_GUIScrollBars_EnableScrollBar | Enable/Disable scrollbar
_GUIScrollBars_GetScrollBarInfoEx | Retrieves information about the specified scroll bar
_GUIScrollBars_GetScrollBarRect | Retrieves coordinates of the scroll bar
_GUIScrollBars_GetScrollBarRGState | Retrieves the state of a scroll bar component
_GUIScrollBars_GetScrollBarXYLineButton | Retrieves the Height or width of the thumb
_GUIScrollBars_GetScrollBarXYThumbBottom | Retrieves the Position of the bottom or right of the thumb
_GUIScrollBars_GetScrollBarXYThumbTop | Retrieves the Position of the top or left of the thumb
_GUIScrollBars_GetScrollInfo | Retrieves the parameters of a scroll bar
_GUIScrollBars_GetScrollInfoEx | Retrieves the parameters of a scroll bar
_GUIScrollBars_GetScrollInfoMax | Retrieves the maximum scrolling position
_GUIScrollBars_GetScrollInfoMin | Retrieves the minimum scrolling position
_GUIScrollBars_GetScrollInfoPage | Retrieves the page size
_GUIScrollBars_GetScrollInfoPos | Retrieves the position of the scroll box
_GUIScrollBars_GetScrollInfoTrackPos | Retrieves the immediate position of a scroll box that the user is dragging
_GUIScrollBars_GetScrollPos | Retrieves the current position of the scroll box (thumb) in the specified scroll bar
_GUIScrollBars_GetScrollRange | Retrieves the current minimum and maximum scroll box (thumb) positions for the specified scroll bar
_GUIScrollBars_Init | Initialize the scrollbars for the window
_GUIScrollBars_ScrollWindow | Scrolls the contents of the specified window's client area
_GUIScrollBars_SetScrollInfo | Sets the parameters of a scroll bar
_GUIScrollBars_SetScrollInfoMax | Sets the maximum scrolling position
_GUIScrollBars_SetScrollInfoMin | Sets the minimum scrolling position
_GUIScrollBars_SetScrollInfoPage | Sets the page size
_GUIScrollBars_SetScrollInfoPos | Sets the position of the scroll box (thumb) in the specified scroll bar
_GUIScrollBars_SetScrollRange | Sets the minimum and maximum scroll box positions for the specified scroll bar
_GUIScrollBars_ShowScrollBar | Shows or hides the specified scroll bar


Function _GUIScrollBars_EnableScrollBar

Function Reference

_GUIScrollBars_EnableScrollBar

Enable/Disable scrollbar

#Include <GuiScrollBars.au3>
_GUIScrollBars_EnableScrollBar($hWnd[, $wSBflags = $SB_BOTH[, $wArrows = $ESB_ENABLE_BOTH]])

Parameters

$hWnd | Handle to the window
$wSBflags | [optional] Specifies the scroll bar type. This parameter can be one of the following values: $SB_BOTH - Enables or disables the arrows on the horizontal and vertical scroll bars associated with the specified window. $SB_CTL - Indicates that the scroll bar is a scroll bar control. The $hWnd must be the handle to the scroll bar control. $SB_HORZ - Enables or disables the arrows on the horizontal scroll bar associated with the specified window. $SB_VERT - Enables or disables the arrows on the vertical scroll bar associated with the specified window.
$wArrows | [optional] Specifies whether the scroll bar arrows are enabled or disabled and indicates which arrows are enabled or disabled. This parameter can be one of the following values $ESB_DISABLE_BOTH - Disables both arrows on a scroll bar. $ESB_DISABLE_DOWN - Disables the down arrow on a vertical scroll bar. $ESB_DISABLE_LEFT - Disables the left arrow on a horizontal scroll bar. $ESB_DISABLE_LTUP - Disables the left arrow on a horizontal scroll bar or the up arrow of a vertical scroll bar. $ESB_DISABLE_RIGHT - Disables the right arrow on a horizontal scroll bar. $ESB_DISABLE_RTDN - Disables the right arrow on a horizontal scroll bar or the down arrow of a vertical scroll bar. $ESB_DISABLE_UP - Disables the up arrow on a vertical scroll bar. $ESB_ENABLE_BOTH - Enables both arrows on a scroll bar.

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_ShowScrollBar

See Also

Search EnableScrollBar in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Disable down arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_DISABLE_DOWN))
Sleep(3000)
MemoWrite("Disable up arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_DISABLE_UP))
Sleep(3000)
MemoWrite("Enable both arrows: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_ENABLE_BOTH))
Sleep(3000)
MemoWrite("Disable left arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_DISABLE_LEFT))
Sleep(3000)
MemoWrite("Disable right arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_DISABLE_RIGHT))
Sleep(3000)
MemoWrite("Enable both arrows: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_ENABLE_BOTH))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE;, $nExititem
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarInfoEx

Function Reference

_GUIScrollBars_GetScrollBarInfoEx

Retrieves information about the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarInfoEx($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Struct of type $tagSCROLLBARINFO
Failure: | set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

$tagSCROLLBARINFO, _GUIScrollBars_GetScrollBarRect, _GUIScrollBars_GetScrollBarRGState, _GUIScrollBars_GetScrollBarXYLineButton, _GUIScrollBars_GetScrollBarXYThumbBottom, _GUIScrollBars_GetScrollBarXYThumbTop

See Also

Search GetScrollBarInfo in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $tSCROLLBARINFO

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hGUI, $OBJID_HSCROLL)
MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Left.........: " & DllStructGetData($tSCROLLBARINFO, "Left"))
MemoWrite("Top..........: " & DllStructGetData($tSCROLLBARINFO, "Top"))
MemoWrite("Right........: " & DllStructGetData($tSCROLLBARINFO, "Right"))
MemoWrite("Bottom.......: " & DllStructGetData($tSCROLLBARINFO, "Bottom"))
MemoWrite("dxyLineButton: " & DllStructGetData($tSCROLLBARINFO, "dxyLineButton"))
MemoWrite("xyThumbTop...: " & DllStructGetData($tSCROLLBARINFO, "xyThumbTop"))
MemoWrite("xyThumbBottom: " & DllStructGetData($tSCROLLBARINFO, "xyThumbBottom"))
For $x = 0 To 5
MemoWrite("rgstate[" & $x & "]...: " & DllStructGetData($tSCROLLBARINFO, "rgstate", $x + 1))
Next

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarRect

Function Reference

_GUIScrollBars_GetScrollBarRect

Retrieves coordinates of the scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarRect($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Array in the following format:
 | [0] - Left
 | [1] - Top
 | [2] - Right
 | [3] - Bottom
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollBarInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $aRect

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$aRect = _GUIScrollBars_GetScrollBarRect($hGUI, $OBJID_HSCROLL)
MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Left.........: " & $aRect[0])
MemoWrite("Top..........: " & $aRect[1])
MemoWrite("Right........: " & $aRect[2])
MemoWrite("Bottom.......: " & $aRect[3])

$aRect = _GUIScrollBars_GetScrollBarRect($hGUI, $OBJID_VSCROLL)
MemoWrite(@CRLF & "--------------------------------------" & @CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("Left.........: " & $aRect[0])
MemoWrite("Top..........: " & $aRect[1])
MemoWrite("Right........: " & $aRect[2])
MemoWrite("Bottom.......: " & $aRect[3])

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarRGState

Function Reference

_GUIScrollBars_GetScrollBarRGState

Retrieves the state of a scroll bar component

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarRGState($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Array in the following format:
 | [0] - The scroll bar itself.
 | [1] - The top or right arrow button.
 | [2] - The page up or page right region.
 | [3] - The scroll box (thumb).
 | [4] - The page down or page left region.
 | [5] - The bottom or left arrow button.
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollBarInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $aRGState

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$aRGState = _GUIScrollBars_GetScrollBarRGState($hGUI, $OBJID_HSCROLL)
MemoWrite("Horizontal (Before)" & @CRLF & "--------------------------------------")
For $x = 0 To 5
MemoWrite("rgstate[" & $x & "]...: " & $aRGState[$x])
Next

MemoWrite(@CRLF & "Disable both arrows: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_DISABLE_BOTH) & @CRLF)

$aRGState = _GUIScrollBars_GetScrollBarRGState($hGUI, $OBJID_HSCROLL)
MemoWrite("Horizontal (After)" & @CRLF & "--------------------------------------")
For $x = 0 To 5
MemoWrite("rgstate[" & $x & "]...: " & $aRGState[$x])
Next

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarXYLineButton

Function Reference

_GUIScrollBars_GetScrollBarXYLineButton

Retrieves the Height or width of the thumb

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarXYLineButton($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Height or width of the thumb
Failure: | -1 and set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollBarInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Height of thumb: " & _GUIScrollBars_GetScrollBarXYLineButton($hGUI, $OBJID_HSCROLL) & @CRLF)

MemoWrite("Vertical" & @CRLF & "--------------------------------------")
MemoWrite("Width of thumb: " & _GUIScrollBars_GetScrollBarXYLineButton($hGUI, $OBJID_VSCROLL))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarXYThumbBottom

Function Reference

_GUIScrollBars_GetScrollBarXYThumbBottom

Retrieves the Position of the bottom or right of the thumb

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarXYThumbBottom($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Position of the bottom or right of the thumb
Failure: | -1, and set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollBarInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Left of thumb: " & _GUIScrollBars_GetScrollBarXYThumbTop($hGUI, $OBJID_HSCROLL))
MemoWrite("Right of thumb: " & _GUIScrollBars_GetScrollBarXYThumbBottom($hGUI, $OBJID_HSCROLL) & @CRLF)

MemoWrite("Vertical" & @CRLF & "--------------------------------------")
MemoWrite("Top of thumb: " & _GUIScrollBars_GetScrollBarXYLineButton($hGUI, $OBJID_VSCROLL))
MemoWrite("Bottom of thumb: " & _GUIScrollBars_GetScrollBarXYThumbBottom($hGUI, $OBJID_VSCROLL))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollBarXYThumbTop

Function Reference

_GUIScrollBars_GetScrollBarXYThumbTop

Retrieves the Position of the top or left of the thumb

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarXYThumbTop($hWnd, $idObject)

Parameters

$hWnd | Handle to the window
$idObject | Specifies the scroll bar object. This parameter can be one of the following values: $OBJID_CLIENT - The $hWnd parameter is a handle to a scroll bar control. $OBJID_HSCROLL - The horizontal scroll bar of the $hWnd window. $OBJID_VSCROLL - The vertical scroll bar of the $hWnd window.

Return Value

Success: | Position of the top or left of the thumb
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollBarInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Left of thumb: " & _GUIScrollBars_GetScrollBarXYThumbTop($hGUI, $OBJID_HSCROLL))
MemoWrite("Right of thumb: " & _GUIScrollBars_GetScrollBarXYThumbBottom($hGUI, $OBJID_HSCROLL) & @CRLF)

MemoWrite("Vertical" & @CRLF & "--------------------------------------")
MemoWrite("Top of thumb: " & _GUIScrollBars_GetScrollBarXYLineButton($hGUI, $OBJID_VSCROLL))
MemoWrite("Bottom of thumb: " & _GUIScrollBars_GetScrollBarXYThumbBottom($hGUI, $OBJID_VSCROLL))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfo

Function Reference

_GUIScrollBars_GetScrollInfo

Retrieves the parameters of a scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfo($hWnd, $fnBar, ByRef $tSCROLLINFO)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.
$tSCROLLINFO | Structure of type $tagSCROLLINFO

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx, $tagSCROLLINFO, _GUIScrollBars_SetScrollInfo

See Also

Search GetScrollInfo in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
DllStructSetData($tSCROLLINFO, "fMask", $_SCROLLBARCONSTANTS_SIF_ALL)
_GUIScrollBars_GetScrollInfo($hGUI, $SB_HORZ, $tSCROLLINFO)
MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & DllStructGetData($tSCROLLINFO, "nPage"))
MemoWrite("nPos.....: " & DllStructGetData($tSCROLLINFO, "nPos"))
MemoWrite("nMin.....: " & DllStructGetData($tSCROLLINFO, "nMin"))
MemoWrite("nMax.....: " & DllStructGetData($tSCROLLINFO, "nMax"))
MemoWrite("nTrackPos: " & DllStructGetData($tSCROLLINFO, "nTrackPos"))

DllStructSetData($tSCROLLINFO, "cbSize", DllStructGetSize($tSCROLLINFO))
DllStructSetData($tSCROLLINFO, "fMask", $_SCROLLBARCONSTANTS_SIF_ALL)
_GUIScrollBars_GetScrollInfo($hGUI, $SB_VERT, $tSCROLLINFO)
$tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hGUI, $SB_VERT)
MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & DllStructGetData($tSCROLLINFO, "nPage"))
MemoWrite("nPos.....: " & DllStructGetData($tSCROLLINFO, "nPos"))
MemoWrite("nMin.....: " & DllStructGetData($tSCROLLINFO, "nMin"))
MemoWrite("nMax.....: " & DllStructGetData($tSCROLLINFO, "nMax"))
MemoWrite("nTrackPos: " & DllStructGetData($tSCROLLINFO, "nTrackPos"))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoEx

Function Reference

_GUIScrollBars_GetScrollInfoEx

Retrieves the parameters of a scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoEx($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | $tagSCROLLINFO structure
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfo, $tagSCROLLINFO, _GUIScrollBars_GetScrollInfoMax, _GUIScrollBars_GetScrollInfoMin, _GUIScrollBars_GetScrollInfoPage, _GUIScrollBars_GetScrollInfoPos, _GUIScrollBars_GetScrollInfoTrackPos

See Also

Search GetScrollInfo in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $tSCROLLBARINFO

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$tSCROLLBARINFO = _GUIScrollBars_GetScrollBarInfoEx($hGUI, $OBJID_HSCROLL)
MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("Left.........: " & DllStructGetData($tSCROLLBARINFO, "Left"))
MemoWrite("Top..........: " & DllStructGetData($tSCROLLBARINFO, "Top"))
MemoWrite("Right........: " & DllStructGetData($tSCROLLBARINFO, "Right"))
MemoWrite("Bottom.......: " & DllStructGetData($tSCROLLBARINFO, "Bottom"))
MemoWrite("dxyLineButton: " & DllStructGetData($tSCROLLBARINFO, "dxyLineButton"))
MemoWrite("xyThumbTop...: " & DllStructGetData($tSCROLLBARINFO, "xyThumbTop"))
MemoWrite("xyThumbBottom: " & DllStructGetData($tSCROLLBARINFO, "xyThumbBottom"))
For $x = 0 To 5
MemoWrite("rgstate[" & $x & "]...: " & DllStructGetData($tSCROLLBARINFO, "rgstate", $x + 1))
Next

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoMax

Function Reference

_GUIScrollBars_GetScrollInfoMax

Retrieves the maximum scrolling position

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoMax($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | The maximum scrolling position
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoMin

Function Reference

_GUIScrollBars_GetScrollInfoMin

Retrieves the minimum scrolling position

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoMin($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | The minimum scrolling position
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoPage

Function Reference

_GUIScrollBars_GetScrollInfoPage

Retrieves the page size

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoPage($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | The page size
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoPos

Function Reference

_GUIScrollBars_GetScrollInfoPos

Retrieves the position of the scroll box

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoPos($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | The position of the scroll box
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollInfoTrackPos

Function Reference

_GUIScrollBars_GetScrollInfoTrackPos

Retrieves the immediate position of a scroll box that the user is dragging

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollInfoTrackPos($hWnd, $fnBar)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the parameters for a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the parameters for the window's standard horizontal scroll bar. $SB_VERT - Retrieves the parameters for the window's standard vertical scroll bar.

Return Value

Success: | The immediate position of a scroll box
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfoEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollPos

Function Reference

_GUIScrollBars_GetScrollPos

Retrieves the current position of the scroll box (thumb) in the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollPos($hWnd, $nBar)

Parameters

$hWnd | Handle to the window
$nBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the position of the scroll box in a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the position of the scroll box in a window's standard horizontal scroll bar $SB_VERT - Retrieves the position of the scroll box in a window's standard vertical scroll bar.

Return Value

Success: | Current position of the scroll box
Failure: | -1

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfoPos

See Also

Search GetScrollPos in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_HORZ, 10)
MemoWrite("Scroll Pos Horizontal: " & _GUIScrollBars_GetScrollPos($hGUI, $SB_HORZ))
Sleep(1000)
_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_HORZ, 0)
MemoWrite("Scroll Pos Horizontal: " & _GUIScrollBars_GetScrollPos($hGUI, $SB_HORZ))
Sleep(1000)
_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_VERT, 20)
MemoWrite("Scroll Pos Vertical: " & _GUIScrollBars_GetScrollPos($hGUI, $SB_VERT))
Sleep(1000)
_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_VERT, 0)
MemoWrite("Scroll Pos Vertical: " & _GUIScrollBars_GetScrollPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_GetScrollRange

Function Reference

_GUIScrollBars_GetScrollRange

Retrieves the current minimum and maximum scroll box (thumb) positions for the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollRange($hWnd, $nBar)

Parameters

$hWnd | Handle to the window
$nBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Retrieves the positions of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Retrieves the positions of the window's standard horizontal scroll bar. $SB_VERT - Retrieves the positions of the window's standard vertical scroll bar.

Return Value

Success: | current minimum and maximum scroll box (thumb) positions for the specified scroll bar, in the following format:
 | [0] - minimum position
 | [1] - maximum position
Failure: | -1

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollRange

See Also

Search GetScrollRange in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $RangeMinMax

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_VERT)
MemoWrite("Vertical Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_HORZ)
MemoWrite("Horizontal Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
Sleep(1000)
_GUIScrollBars_SetScrollRange($hGUI, $SB_VERT, 3, 30)
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_VERT)
MemoWrite("New Vertical Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
Sleep(1000)
_GUIScrollBars_SetScrollRange($hGUI, $SB_HORZ, 10, 98)
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_HORZ)
MemoWrite("New Horizontal Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_Init

Function Reference

_GUIScrollBars_Init

Initialize the scrollbars for the window

#Include <GuiScrollBars.au3>
_GUIScrollBars_Init($hWnd[, $iHMax = -1[, $ivMax = -1]])

Parameters

$hWnd | Handle to the window
$iHMax | [optional] Max size of Horizontal scrollbar
$ivMax | [optional] Max size of Vertical scrollbar

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2
Local $listview, $button

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUISetBkColor(0x88AABB)

$nFileMenu = GUICtrlCreateMenu("File")
$nExititem = GUICtrlCreateMenuItem("Exit", $nFileMenu)
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
GUICtrlSetResizing($button, $GUI_DOCKALL)
For $x = 1 To 30
GUICtrlCreateListViewItem("item" & $x & "|col2|col3", $listview)
Next
GUICtrlSetResizing($listview, $GUI_DOCKALL)

$h_cGUI = GUICreate("Child GUI", 200, 200, 10, 200, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI, $GUI_DOCKALL)

GUISwitch($hGUI)

$h_cGUI2 = GUICreate("Child GUI", 200, 200, 215, 10, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI2, $GUI_DOCKALL)

GUISwitch($hGUI)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")

GUISetState()

_GUIScrollBars_Init($hGUI)
_GUIScrollBars_Init($h_cGUI)

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE, $nExititem
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xClientMax = $aSB_WindowInfo[$index][1]
$xChar = $aSB_WindowInfo[$index][2]
$yChar = $aSB_WindowInfo[$index][3]
$ivMax = $aSB_WindowInfo[$index][7]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient

; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

;~ ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode

Case $SB_LINELEFT ; user clicked left arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINERIGHT ; user clicked right arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$yChar = $aSB_WindowInfo[$index][3]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

Switch $nScrollCode
Case $SB_TOP ; user clicked the HOME keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Min)

Case $SB_BOTTOM ; user clicked the END keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Max)

Case $SB_LINEUP ; user clicked the top arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINEDOWN ; user clicked the bottom arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")

If ($Pos <> $yPos) Then
_GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
$yPos = $Pos
EndIf

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_VSCROLL


Function _GUIScrollBars_ScrollWindow

Function Reference

_GUIScrollBars_ScrollWindow

Scrolls the contents of the specified window's client area

#Include <GuiScrollBars.au3>
_GUIScrollBars_ScrollWindow($hWnd, $iXAmount, $iYAmount)

Parameters

$hWnd | Handle to the window
$iXAmount | Specifies the amount, in device units, of horizontal scrolling
$iYAmount | Specifies the amount, in device units, of vertical scrolling

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search ScrollWindow in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2
Local $listview, $button

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUISetBkColor(0x88AABB)

$nFileMenu = GUICtrlCreateMenu("File")
$nExititem = GUICtrlCreateMenuItem("Exit", $nFileMenu)
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
GUICtrlSetResizing($button, $GUI_DOCKALL)
For $x = 1 To 30
GUICtrlCreateListViewItem("item" & $x & "|col2|col3", $listview)
Next
GUICtrlSetResizing($listview, $GUI_DOCKALL)

$h_cGUI = GUICreate("Child GUI", 200, 200, 10, 200, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI, $GUI_DOCKALL)

GUISwitch($hGUI)

$h_cGUI2 = GUICreate("Child GUI", 200, 200, 215, 10, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI2, $GUI_DOCKALL)

GUISwitch($hGUI)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")

GUISetState()

_GUIScrollBars_Init($hGUI)
_GUIScrollBars_Init($h_cGUI)

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE, $nExititem
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xClientMax = $aSB_WindowInfo[$index][1]
$xChar = $aSB_WindowInfo[$index][2]
$yChar = $aSB_WindowInfo[$index][3]
$ivMax = $aSB_WindowInfo[$index][7]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient

; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

;~ ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode

Case $SB_LINELEFT ; user clicked left arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINERIGHT ; user clicked right arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$yChar = $aSB_WindowInfo[$index][3]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

Switch $nScrollCode
Case $SB_TOP ; user clicked the HOME keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Min)

Case $SB_BOTTOM ; user clicked the END keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Max)

Case $SB_LINEUP ; user clicked the top arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINEDOWN ; user clicked the bottom arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")

If ($Pos <> $yPos) Then
_GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
$yPos = $Pos
EndIf

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_VSCROLL


Function _GUIScrollBars_SetScrollInfo

Function Reference

_GUIScrollBars_SetScrollInfo

Sets the parameters of a scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollInfo($hWnd, $fnBar, $tSCROLLINFO[, $fRedraw = True])

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the parameters of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the parameters of the window's standard horizontal scroll bar. $SB_VERT - Sets the parameters of the window's standard vertical scroll bar.
$tSCROLLINFO | Structure of type $tagSCROLLINFO
$fRedraw | [optional] Specifies whether the scroll bar is redrawn to reflect the changes to the scroll bar

Return Value

Success: | Current position of the scroll box
Failure: | -1

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_GetScrollInfo, _GUIScrollBars_SetScrollInfoMax, _GUIScrollBars_SetScrollInfoMin, _GUIScrollBars_SetScrollInfoPage, _GUIScrollBars_SetScrollInfoPos

See Also

Search SetScrollInfo in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $nFileMenu, $nExititem, $GUIMsg, $hGUI, $h_cGUI, $h_cGUI2
Local $listview, $button

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUISetBkColor(0x88AABB)

$nFileMenu = GUICtrlCreateMenu("File")
$nExititem = GUICtrlCreateMenuItem("Exit", $nFileMenu)
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
GUICtrlSetResizing($button, $GUI_DOCKALL)
For $x = 1 To 30
GUICtrlCreateListViewItem("item" & $x & "|col2|col3", $listview)
Next
GUICtrlSetResizing($listview, $GUI_DOCKALL)

$h_cGUI = GUICreate("Child GUI", 200, 200, 10, 200, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI, $GUI_DOCKALL)

GUISwitch($hGUI)

$h_cGUI2 = GUICreate("Child GUI", 200, 200, 215, 10, $WS_CHILD, $WS_EX_CLIENTEDGE, $hGUI)
GUICtrlCreateButton("a button", 10, 10, 90, 20)
GUISetBkColor(0X006400)
GUISetState()
GUICtrlSetResizing($h_cGUI2, $GUI_DOCKALL)

GUISwitch($hGUI)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")
GUIRegisterMsg($WM_HSCROLL, "WM_HSCROLL")

GUISetState()

_GUIScrollBars_Init($hGUI)
_GUIScrollBars_Init($h_cGUI)

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE, $nExititem
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

Func WM_SIZE($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam
Local $index = -1, $yChar, $xChar, $xClientMax, $xClient, $yClient, $ivMax
For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xClientMax = $aSB_WindowInfo[$index][1]
$xChar = $aSB_WindowInfo[$index][2]
$yChar = $aSB_WindowInfo[$index][3]
$ivMax = $aSB_WindowInfo[$index][7]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

Local $tSCROLLINFO = DllStructCreate($tagSCROLLINFO)

; Retrieve the dimensions of the client area.
$xClient = BitAND($lParam, 0x0000FFFF)
$yClient = BitShift($lParam, 16)
$aSB_WindowInfo[$index][4] = $xClient
$aSB_WindowInfo[$index][5] = $yClient

; Set the vertical scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", $ivMax)
DllStructSetData($tSCROLLINFO, "nPage", $yClient / $yChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)

; Set the horizontal scrolling range and page size
DllStructSetData($tSCROLLINFO, "fMask", BitOR($SIF_RANGE, $SIF_PAGE))
DllStructSetData($tSCROLLINFO, "nMin", 0)
DllStructSetData($tSCROLLINFO, "nMax", 2 + $xClientMax / $xChar)
DllStructSetData($tSCROLLINFO, "nPage", $xClient / $xChar)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)

Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

Func WM_HSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)

Local $index = -1, $xChar, $xPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$xChar = $aSB_WindowInfo[$index][2]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

;~ ; Get all the horizontal scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_HORZ)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$xPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $xPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")
#forceref $Min, $Max
Switch $nScrollCode

Case $SB_LINELEFT ; user clicked left arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINERIGHT ; user clicked right arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGELEFT ; user clicked the scroll bar shaft left of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGERIGHT ; user clicked the scroll bar shaft right of the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_HORZ, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")
If ($Pos <> $xPos) Then _GUIScrollBars_ScrollWindow($hWnd, $xChar * ($xPos - $Pos), 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_HSCROLL

Func WM_VSCROLL($hWnd, $Msg, $wParam, $lParam)
#forceref $Msg, $wParam, $lParam
Local $nScrollCode = BitAND($wParam, 0x0000FFFF)
Local $index = -1, $yChar, $yPos
Local $Min, $Max, $Page, $Pos, $TrackPos

For $x = 0 To UBound($aSB_WindowInfo) - 1
If $aSB_WindowInfo[$x][0] = $hWnd Then
$index = $x
$yChar = $aSB_WindowInfo[$index][3]
ExitLoop
EndIf
Next
If $index = -1 Then Return 0

; Get all the vertial scroll bar information
Local $tSCROLLINFO = _GUIScrollBars_GetScrollInfoEx($hWnd, $SB_VERT)
$Min = DllStructGetData($tSCROLLINFO, "nMin")
$Max = DllStructGetData($tSCROLLINFO, "nMax")
$Page = DllStructGetData($tSCROLLINFO, "nPage")
; Save the position for comparison later on
$yPos = DllStructGetData($tSCROLLINFO, "nPos")
$Pos = $yPos
$TrackPos = DllStructGetData($tSCROLLINFO, "nTrackPos")

Switch $nScrollCode
Case $SB_TOP ; user clicked the HOME keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Min)

Case $SB_BOTTOM ; user clicked the END keyboard key
DllStructSetData($tSCROLLINFO, "nPos", $Max)

Case $SB_LINEUP ; user clicked the top arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos - 1)

Case $SB_LINEDOWN ; user clicked the bottom arrow
DllStructSetData($tSCROLLINFO, "nPos", $Pos + 1)

Case $SB_PAGEUP ; user clicked the scroll bar shaft above the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos - $Page)

Case $SB_PAGEDOWN ; user clicked the scroll bar shaft below the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $Pos + $Page)

Case $SB_THUMBTRACK ; user dragged the scroll box
DllStructSetData($tSCROLLINFO, "nPos", $TrackPos)
EndSwitch

;~ // Set the position and then retrieve it. Due to adjustments
;~ // by Windows it may not be the same as the value set.

DllStructSetData($tSCROLLINFO, "fMask", $SIF_POS)
_GUIScrollBars_SetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
_GUIScrollBars_GetScrollInfo($hWnd, $SB_VERT, $tSCROLLINFO)
;// If the position has changed, scroll the window and update it
$Pos = DllStructGetData($tSCROLLINFO, "nPos")

If ($Pos <> $yPos) Then
_GUIScrollBars_ScrollWindow($hWnd, 0, $yChar * ($yPos - $Pos))
$yPos = $Pos
EndIf

Return $GUI_RUNDEFMSG

EndFunc ;==>WM_VSCROLL


Function _GUIScrollBars_SetScrollInfoMax

Function Reference

_GUIScrollBars_SetScrollInfoMax

Sets the maximum scrolling position

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollInfoMax($hWnd, $fnBar, $nMax)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the parameters of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the parameters of the window's standard horizontal scroll bar. $SB_VERT - Sets the parameters of the window's standard vertical scroll bar.
$nMax | Maximum scrolling position

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfo, _GUIScrollBars_SetScrollRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_SetScrollInfoMin($hGUI, $SB_HORZ, 10)
_GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, 80)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_SetScrollInfoMin

Function Reference

_GUIScrollBars_SetScrollInfoMin

Sets the minimum scrolling position

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollInfoMin($hWnd, $fnBar, $nMin)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the parameters of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the parameters of the window's standard horizontal scroll bar. $SB_VERT - Sets the parameters of the window's standard vertical scroll bar.
$nMin | Minimum scrolling position

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfo, _GUIScrollBars_SetScrollRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_SetScrollInfoMin($hGUI, $SB_HORZ, 10)
_GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, 80)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_SetScrollInfoPage

Function Reference

_GUIScrollBars_SetScrollInfoPage

Sets the page size

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollInfoPage($hWnd, $fnBar, $nPage)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the parameters of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the parameters of the window's standard horizontal scroll bar. $SB_VERT - Sets the parameters of the window's standard vertical scroll bar.
$nPage | Page size

Return Value

Success: | Current position of the scroll box
Failure: | Set @error

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfo

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_SetScrollInfoMin($hGUI, $SB_HORZ, 10)
_GUIScrollBars_SetScrollInfoMax($hGUI, $SB_HORZ, 80)
_GUIScrollBars_SetScrollInfoPage($hGUI, $SB_HORZ, 60)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_SetScrollInfoPos

Function Reference

_GUIScrollBars_SetScrollInfoPos

Sets the position of the scroll box (thumb) in the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollInfoPos($hWnd, $fnBar, $nPos)

Parameters

$hWnd | Handle to the window
$fnBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the parameters of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the parameters of the window's standard horizontal scroll bar. $SB_VERT - Sets the parameters of the window's standard vertical scroll bar.
$nPos | Position of the scroll box

Return Value

None.

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfo, _GUIScrollBars_GetScrollPos

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_HORZ, 30)

MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_HORZ))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_HORZ))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_HORZ))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_HORZ))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_HORZ))

Sleep ( 3000 )

MemoWrite(@CRLF & "Vertical" & @CRLF & "--------------------------------------")
MemoWrite("nPage....: " & _GUIScrollBars_GetScrollInfoPage($hGUI, $SB_VERT))
MemoWrite("nPos.....: " & _GUIScrollBars_GetScrollInfoPos($hGUI, $SB_VERT))
MemoWrite("nMin.....: " & _GUIScrollBars_GetScrollInfoMin($hGUI, $SB_VERT))
MemoWrite("nMax.....: " & _GUIScrollBars_GetScrollInfoMax($hGUI, $SB_VERT))
MemoWrite("nTrackPos: " & _GUIScrollBars_GetScrollInfoTrackPos($hGUI, $SB_VERT))

_GUIScrollBars_SetScrollInfoPos($hGUI, $SB_HORZ, 0)

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_SetScrollRange

Function Reference

_GUIScrollBars_SetScrollRange

Sets the minimum and maximum scroll box positions for the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_SetScrollRange($hWnd, $nBar, $nMinPos, $nMaxPos)

Parameters

$hWnd | Handle to the window
$nBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_CTL - Sets the range of a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Sets the range of a window's standard horizontal scroll bar. $SB_VERT - Sets the range of a window's standard vertical scroll bar.
$nMinPos | Specifies the minimum scrolling position
$nMaxPos | Specifies the maximum scrolling position

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_SetScrollInfoMin, _GUIScrollBars_SetScrollInfoMax, _GUIScrollBars_GetScrollRange

See Also

Search SetScrollRange in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo

_Main()

Func _Main()
Local $GUIMsg, $hGUI, $RangeMinMax

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 2, 380, 380, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_VERT)
MemoWrite("Vertical Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_HORZ)
MemoWrite("Horizontal Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
Sleep(1000)
_GUIScrollBars_SetScrollRange($hGUI, $SB_VERT, 3, 30)
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_VERT)
MemoWrite("New Vertical Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])
Sleep(1000)
_GUIScrollBars_SetScrollRange($hGUI, $SB_HORZ, 10, 98)
$RangeMinMax = _GUIScrollBars_GetScrollRange($hGUI, $SB_HORZ)
MemoWrite("New Horizontal Min/Max: " & $RangeMinMax[0] & "/" & $RangeMinMax[1])

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUIScrollBars_ShowScrollBar

Function Reference

_GUIScrollBars_ShowScrollBar

Shows or hides the specified scroll bar

#Include <GuiScrollBars.au3>
_GUIScrollBars_ShowScrollBar($hWnd, $nBar[, $fShow = True])

Parameters

$hWnd | Handle to the window
$nBar | Specifies the type of scroll bar. This parameter can be one of the following values: $SB_BOTH - Shows or hides a window's standard horizontal and vertical scroll bars. $SB_CTL - Shows or hides a scroll bar control. The $hWnd parameter must be the handle to the scroll bar control. $SB_HORZ - Shows or hides a window's standard horizontal scroll bars. $SB_VERT - Shows or hides a window's standard vertical scroll bar.
$fShow | [optional] Specifies whether the scroll bar is shown or hidden

Return Value

Success: | True
Failure: | False

Remarks

Above constants require ScrollBarConstants.au3

Related

_GUIScrollBars_EnableScrollBar

See Also

Search ShowScrollBar in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIScrollBars.au3>
#include <ScrollBarConstants.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $GUIMsg, $hGUI

$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
GUISetBkColor(0x88AABB)

GUISetState()

_GUIScrollBars_Init($hGUI)

_GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ, False)
Sleep(1000)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_HORZ)

Sleep(1000)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT, False)
Sleep(1000)
_GUIScrollBars_ShowScrollBar($hGUI, $SB_VERT)

While 1
$GUIMsg = GUIGetMsg()

Switch $GUIMsg
Case $GUI_EVENT_CLOSE;, $nExititem
ExitLoop
EndSwitch
WEnd

Exit
EndFunc ;==>_Main


User Defined Functions

GuiSlider user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiSlider.au3>.

User Defined Function | Description
_GUICtrlSlider_ClearSel | Clears the current selection range
_GUICtrlSlider_ClearTics | Removes the current tick marks from a slider
_GUICtrlSlider_Create | Create a Slider control
_GUICtrlSlider_Destroy | Delete the control
_GUICtrlSlider_GetBuddy | Retrieves the handle to a slider control buddy window at a given location
_GUICtrlSlider_GetChannelRect | Retrieves the size and position of the bounding rectangle for a sliders's channel
_GUICtrlSlider_GetChannelRectEx | Retrieves the size and position of the bounding rectangle for a sliders's channel
_GUICtrlSlider_GetLineSize | Retrieves the number of logical positions the slider moves
_GUICtrlSlider_GetLogicalTics | Retrieves an array that contains the logical positions of the tick marks for a slider
_GUICtrlSlider_GetNumTics | Retrieves the number of tick marks from a slider
_GUICtrlSlider_GetPageSize | Retrieves the number of logical positions the slider moves
_GUICtrlSlider_GetPos | Retrieves the logical position the slider
_GUICtrlSlider_GetRange | Retrieves the maximum and minimum position for the slider
_GUICtrlSlider_GetRangeMax | Retrieves the maximum position for the slider
_GUICtrlSlider_GetRangeMin | Retrieves the minimum position for the slider
_GUICtrlSlider_GetSel | Retrieves the ending and starting position of the current selection range
_GUICtrlSlider_GetSelEnd | Retrieves the ending position of the current selection range
_GUICtrlSlider_GetSelStart | Retrieves the starting position of the current selection range
_GUICtrlSlider_GetThumbLength | Retrieves the length of the slider
_GUICtrlSlider_GetThumbRect | Retrieves the size and position of the bounding rectangle for the slider
_GUICtrlSlider_GetThumbRectEx | Retrieves the size and position of the bounding rectangle for the slider
_GUICtrlSlider_GetTic | Retrieves the logical position of a tick mark
_GUICtrlSlider_GetTicPos | Retrieves the current physical position of a tick mark
_GUICtrlSlider_GetToolTips | Retrieves the handle to the ToolTip control assigned to the slider, if any.
_GUICtrlSlider_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlSlider_SetBuddy | Assigns a window as the buddy window for a slider control
_GUICtrlSlider_SetLineSize | Sets the number of logical positions the slider moves
_GUICtrlSlider_SetPageSize | Sets the number of logical positions the slider moves
_GUICtrlSlider_SetPos | Sets the current logical position of the slider
_GUICtrlSlider_SetRange | Sets the range of minimum and maximum logical positions for the slider
_GUICtrlSlider_SetRangeMax | Sets the maximum logical position for the slider
_GUICtrlSlider_SetRangeMin | Sets the minimum logical position for the slider
_GUICtrlSlider_SetSel | Sets the starting and ending positions for the available selection range
_GUICtrlSlider_SetSelEnd | Sets the ending logical position of the current selection range
_GUICtrlSlider_SetSelStart | Sets the starting logical position of the current selection range
_GUICtrlSlider_SetThumbLength | Sets the length of the slider
_GUICtrlSlider_SetTic | Sets a tick mark in a slider at the specified logical position
_GUICtrlSlider_SetTicFreq | Sets the interval frequency for tick marks in a slider
_GUICtrlSlider_SetTipSide | Positions a ToolTip control
_GUICtrlSlider_SetToolTips | Assigns a ToolTip control to a slider control
_GUICtrlSlider_SetUnicodeFormat | Sets the Unicode character format flag for the control


Function _GUICtrlSlider_ClearSel

Function Reference

_GUICtrlSlider_ClearSel

Clears the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_ClearSel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

None.

Related

_GUICtrlSlider_SetSel, _GUICtrlSlider_SetSelEnd, _GUICtrlSlider_SetSelStart

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("(Internal) Slider Clear Sel", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel
_GUICtrlSlider_SetSel($hSlider, 10, 50)

MsgBox(4160, "Information", "Clear Sel")
; Clear Sel
_GUICtrlSlider_ClearSel($hSlider)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_ClearTics

Function Reference

_GUICtrlSlider_ClearTics

Removes the current tick marks from a slider

#Include <GuiSlider.au3>
_GUICtrlSlider_ClearTics($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

This does not remove the first and last tick marks, which are created automatically

Related

_GUICtrlSlider_SetTic, _GUICtrlSlider_SetTicFreq

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("(Internal) Slider Clear Tics", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

MsgBox(4160, "Information", "Clear Tics")
; Clear Tics
_GUICtrlSlider_ClearTics($hSlider)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_Create

Function Reference

_GUICtrlSlider_Create

Create a Slider control

#Include <GuiSlider.au3>
_GUICtrlSlider_Create($hWnd, $iX, $iY[, $iWidth = 100[, $iHeight = 20[, $iStyle = 0x0001[, $iExStyle = 0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control style:
$TBS_AUTOTICKS - Adds tick marks when you set the range on the slider by using the TBM_SETRANGE message.
$TBS_BOTH - Places ticks on both sides of the slider.
$TBS_BOTTOM - Places ticks on the bottom of a horizontal slider.
$TBS_DOWNISLEFT - Down equal left and up equal right
$TBS_ENABLESELRANGE - The tick marks at the starting and ending positions of a selection range are displayed as triangles
(instead of vertical dashes), and the selection range is highlighted
$TBS_FIXEDLENGTH - allows the size of the slider to be changed with the $TBM_SETTHUMBLENGTH message
$TBS_HORZ - Specifies a horizontal slider. This is the default.
$TBS_LEFT - Places ticks on the left side of a vertical slider.
$TBS_NOTHUMB - Specifies that the slider has no slider.
$TBS_NOTICKS - Specifies that no ticks are placed on the slider.
$TBS_REVERSED - Smaller number indicates "higher" and a larger number indicates "lower"
$TBS_RIGHT - Places ticks on the right side of a vertical slider.
$TBS_TOP - Places ticks on the top of a horizontal slider.
$TBS_TOOLTIPS - Creates a default ToolTip control that displays the slider's current position
$TBS_VERT - Places ticks on the left side of a vertical slider.
Default: $TBS_AUTOTICKS
Forced : $WS_CHILD, $WS_TABSTOP, $WS_VISIBLE
$iExStyle [optional] Control extended style. These correspond to the standard $WS_EX_ constants.
Default: $WS_EX_STATICEDGE

Return Value

Success: | Handle to the Slider control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlSlider_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hSlider

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(UDF Created) Slider Create", 400, 296)
$hSlider = _GUICtrlSlider_Create($hGUI, 2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndSlider
$hWndSlider = $hSlider
If Not IsHWnd($hSlider) Then $hWndSlider = GUICtrlGetHandle($hSlider)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndSlider
Switch $iCode
Case $NM_RELEASEDCAPTURE ; The control is releasing mouse capture
_DebugPrint("$NM_RELEASEDCAPTURE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlSlider_Destroy

Function Reference

_GUICtrlSlider_Destroy

Delete the control

#Include <GuiSlider.au3>
_GUICtrlSlider_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on slider created with _GUICtrlSlider_Create

Related

_GUICtrlSlider_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hSlider

; Create GUI
$hGUI = GUICreate("(UDF Created) Slider Destroy", 400, 296)
$hSlider = _GUICtrlSlider_Create($hGUI, 2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
GUISetState()

MsgBox(4160, "Information", "Destroy Slider")
_GUICtrlSlider_Destroy($hSlider)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetBuddy

Function Reference

_GUICtrlSlider_GetBuddy

Retrieves the handle to a slider control buddy window at a given location

#Include <GuiSlider.au3>
_GUICtrlSlider_GetBuddy($hWnd, $fLocation)

Parameters

$hWnd | Handle to the control
$fLocation | Which buddy window handle will be retrieved. This value can be one of the following: True - Retrieves the handle to the buddy to the left of the slider. If the slider control uses the $TBS_VERT style, the message will retrieve the buddy above the slider. False - Retrieves the handle to the buddy to the right of the slider. If the slider control uses the $TBS_VERT style, the message will retrieve the buddy below the slider.

Return Value

Success: Returns the handle to the buddy window at the location specified by $fLocation
Failure: 0

Remarks

None.

Related

_GUICtrlSlider_SetBuddy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hInput, $hInput2, $hSlider

; Create GUI
GUICreate("Slider Get Buddy", 400, 296)
$hSlider = GUICtrlCreateSlider(95, 2, 205, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
$hInput = GUICtrlCreateInput("0", 2, 25, 90, 20)
$hInput2 = GUICtrlCreateInput("0", 2, 25, 90, 20)
GUISetState()

; Set buddy to left
_GUICtrlSlider_SetBuddy($hSlider, True, $hInput)
; Set buddy to right
_GUICtrlSlider_SetBuddy($hSlider, False, $hInput2)

; Get Buddy from the left
MsgBox(4160, "Information", "Buddy Handle: " & _GUICtrlSlider_GetBuddy($hSlider, True))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetChannelRect

Function Reference

_GUICtrlSlider_GetChannelRect

Retrieves the size and position of the bounding rectangle for a sliders's channel

#Include <GuiSlider.au3>
_GUICtrlSlider_GetChannelRect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array in the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlSlider_GetChannelRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hSlider

; Create GUI
GUICreate("Slider Get Channel Rect", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Channel Rect
$aRect = _GUICtrlSlider_GetChannelRect($hSlider)

MsgBox(4160, "Information", StringFormat("[%d][%d][%d][%d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetChannelRectEx

Function Reference

_GUICtrlSlider_GetChannelRectEx

Retrieves the size and position of the bounding rectangle for a sliders's channel

#Include <GuiSlider.au3>
_GUICtrlSlider_GetChannelRectEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagRECT structure that receives the channel coordinates

Remarks

None.

Related

_GUICtrlSlider_GetChannelRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $hSlider

; Create GUI
GUICreate("Slider Get Channel RectEx", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Channel Rect
$tRect = _GUICtrlSlider_GetChannelRectEx($hSlider)

MsgBox(4160, "Information", StringFormat("[%d][%d][%d][%d]", _
DllStructGetData($tRect, "Left"), DllStructGetData($tRect, "Top"), _
DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetLineSize

Function Reference

_GUICtrlSlider_GetLineSize

Retrieves the number of logical positions the slider moves

#Include <GuiSlider.au3>
_GUICtrlSlider_GetLineSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Line size for the slider

Remarks

The default setting for the line size is 1

Related

_GUICtrlSlider_SetLineSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Line Size", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Line Size
MsgBox(4160, "Information", "Line Size: " & _GUICtrlSlider_GetLineSize($hSlider))

; Set Line Size
_GUICtrlSlider_SetLineSize($hSlider, 4)

; Get Line Size
MsgBox(4160, "Information", "Line Size: " & _GUICtrlSlider_GetLineSize($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetLogicalTics

Function Reference

_GUICtrlSlider_GetLogicalTics

Retrieves an array that contains the logical positions of the tick marks for a slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetLogicalTics($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns array logical positions
Failure: @error is set

Remarks

The number of elements in the array is two less than the tick count returned by the
_GUICtrlSlider_GetNumTics function. Note that the values in the array may include duplicate
positions and may not be in sequential order. The data in the returned array is valid until
you change the slider's tick marks

The elements of the array specify the logical positions of the sliders's tick marks, not including
the first and last tick marks created by the slider. The logical positions can be any of the integer
values in the sliders's range of minimum to maximum slider positions.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $hSlider, $aTics

; Create GUI
GUICreate("Slider Get Logical Tic Positions", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 300, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

$aTics = _GUICtrlSlider_GetLogicalTics($hSlider)
MemoWrite("Number Tics Excluding 1st and last .....: " & UBound($aTics))
For $x = 0 To UBound($aTics) - 1
MemoWrite(StringFormat("(%02d) Logical Tick Position .............: %d", $x, $aTics[$x]))
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlSlider_GetNumTics

Function Reference

_GUICtrlSlider_GetNumTics

Retrieves the number of tick marks from a slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetNumTics($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: If no tick flag is set, it returns 2 for the beginning and ending ticks.
If $TBS_NOTICKS is set, it returns zero.
Otherwise, it takes the difference between the range minimum and maximum, divides
by the tick frequency, and adds 2.

Remarks

None.

Related

_GUICtrlSlider_SetTicFreq

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Num Tics", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Num Tics
MsgBox(4160, "Information", "Num Tics: " & _GUICtrlSlider_GetNumTics($hSlider))

; Set Tic Freq
_GUICtrlSlider_SetTicFreq($hSlider, 1)

; Get Num Tics
MsgBox(4160, "Information", "Num Tics: " & _GUICtrlSlider_GetNumTics($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetPageSize

Function Reference

_GUICtrlSlider_GetPageSize

Retrieves the number of logical positions the slider moves

#Include <GuiSlider.au3>
_GUICtrlSlider_GetPageSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The page size for the slider

Remarks

None.

Related

_GUICtrlSlider_SetPageSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Page Size", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Page Size
MsgBox(4160, "Information", "Page Size: " & _GUICtrlSlider_GetPageSize($hSlider))

; Set Page Size
_GUICtrlSlider_SetPageSize($hSlider, 4)

; Get Page Size
MsgBox(4160, "Information", "Page Size: " & _GUICtrlSlider_GetPageSize($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetPos

Function Reference

_GUICtrlSlider_GetPos

Retrieves the logical position the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetPos($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The current logical position of the slider

Remarks

None.

Related

_GUICtrlSlider_SetPos

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Pos", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Pos
_GUICtrlSlider_SetPos($hSlider, Random(0, 100, 1))

; Get Pos
MsgBox(4160, "Information", "Pos: " & _GUICtrlSlider_GetPos($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetRange

Function Reference

_GUICtrlSlider_GetRange

Retrieves the maximum and minimum position for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetRange($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The array in the following format:
[0] - Minimum position in the slider's range of minimum to maximum slider positions
[1] - Maximum position in the slider's range of minimum to maximum slider positions

Remarks

None.

Related

_GUICtrlSlider_SetRange, _GUICtrlSlider_GetRangeMax, _GUICtrlSlider_GetRangeMin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRange, $hSlider

; Create GUI
GUICreate("Slider Get Range", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range
$aRange = _GUICtrlSlider_GetRange($hSlider)
MsgBox(4160, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

; Set Range
_GUICtrlSlider_SetRange($hSlider, 20, 50)

; Get Range
$aRange = _GUICtrlSlider_GetRange($hSlider)
MsgBox(4160, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetRangeMax

Function Reference

_GUICtrlSlider_GetRangeMax

Retrieves the maximum position for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetRangeMax($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The maximum position in the slider's range of minimum to maximum slider positions

Remarks

None.

Related

_GUICtrlSlider_SetRangeMax, _GUICtrlSlider_GetRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Range Max", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range Max
MsgBox(4160, "Information", "Range Max: " & _GUICtrlSlider_GetRangeMax($hSlider))

; Set Range Max
_GUICtrlSlider_SetRangeMax($hSlider, 50)

; Get Range Max
MsgBox(4160, "Information", "Range Max: " & _GUICtrlSlider_GetRangeMax($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetRangeMin

Function Reference

_GUICtrlSlider_GetRangeMin

Retrieves the minimum position for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetRangeMin($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The minimum position in the slider's range of minimum to maximum slider positions

Remarks

None.

Related

_GUICtrlSlider_SetRangeMin, _GUICtrlSlider_GetRange

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Range Min", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range Min
MsgBox(4160, "Information", "Range Min: " & _GUICtrlSlider_GetRangeMin($hSlider))

; Set Range Min
_GUICtrlSlider_SetRangeMin($hSlider, 20)

; Get Range Min
MsgBox(4160, "Information", "Range Min: " & _GUICtrlSlider_GetRangeMin($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetSel

Function Reference

_GUICtrlSlider_GetSel

Retrieves the ending and starting position of the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_GetSel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array in the following format:
[0] - The starting position of the current selection range
[1] - The ending position of the current selection range

Remarks

None.

Related

_GUICtrlSlider_SetSel, _GUICtrlSlider_SetSelEnd, _GUICtrlSlider_SetSelStart

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aSel, $hSlider

; Create GUI
GUICreate("Slider Get Sel", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel
_GUICtrlSlider_SetSel($hSlider, 10, 50)

; Get Sel
$aSel = _GUICtrlSlider_GetSel($hSlider)
MsgBox(4160, "Information", StringFormat("Sel: %d - %d", $aSel[0], $aSel[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetSelEnd

Function Reference

_GUICtrlSlider_GetSelEnd

Retrieves the ending position of the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_GetSelEnd($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The ending position of the current selection range

Remarks

None.

Related

_GUICtrlSlider_SetSelEnd

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Sel End", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel End
_GUICtrlSlider_SetSelEnd($hSlider, 50)

; Get Sel End
MsgBox(4160, "Information", "Sel End: " & _GUICtrlSlider_GetSelEnd($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetSelStart

Function Reference

_GUICtrlSlider_GetSelStart

Retrieves the starting position of the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_GetSelStart($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The starting position of the current selection range

Remarks

None.

Related

_GUICtrlSlider_SetSelStart

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Sel Start", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel Start
_GUICtrlSlider_SetSelStart($hSlider, 10)

; Get Sel Start
MsgBox(4160, "Information", "Sel Start: " & _GUICtrlSlider_GetSelStart($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetThumbLength

Function Reference

_GUICtrlSlider_GetThumbLength

Retrieves the length of the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetThumbLength($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The length, in pixels, of the slider

Remarks

None.

Related

_GUICtrlSlider_SetThumbLength

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Thumb Length", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 25, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_FIXEDLENGTH))
GUISetState()

; Get Thumb Length
MsgBox(4160, "Information", "Thumb Length: " & _GUICtrlSlider_GetThumbLength($hSlider))

; Set Thumb Length
_GUICtrlSlider_SetThumbLength($hSlider, 10)

; Get Thumb Length
MsgBox(4160, "Information", "Thumb Length: " & _GUICtrlSlider_GetThumbLength($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetThumbRect

Function Reference

_GUICtrlSlider_GetThumbRect

Retrieves the size and position of the bounding rectangle for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetThumbRect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array in the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlSlider_GetThumbRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $hSlider

; Create GUI
GUICreate("Slider Get Thumb Rect", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Thumb Rect
$aRect = _GUICtrlSlider_GetThumbRect($hSlider)

MsgBox(4160, "Information", StringFormat("[%d][%d][%d][%d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetThumbRectEx

Function Reference

_GUICtrlSlider_GetThumbRectEx

Retrieves the size and position of the bounding rectangle for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_GetThumbRectEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagRECT structure that receives the bounding rectangle of the slider in client coordinates

Remarks

None.

Related

_GUICtrlSlider_GetThumbRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $hSlider

; Create GUI
GUICreate("Slider Get Thumb RectEx", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Thumb Rect
$tRect = _GUICtrlSlider_GetThumbRectEx($hSlider)

MsgBox(4160, "Information", StringFormat("[%d][%d][%d][%d]", _
DllStructGetData($tRect, "Left"), DllStructGetData($tRect, "Top"), _
DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetTic

Function Reference

_GUICtrlSlider_GetTic

Retrieves the logical position of a tick mark

#Include <GuiSlider.au3>
_GUICtrlSlider_GetTic($hWnd, $iTic)

Parameters

$hWnd | Handle to the control
$iTic | Zero-based index identifying a tick mark Valid indexes are in the range from zero to two less than the tick count returned by the _GUICtrlSlider_GetNumTics function.

Return Value

Success: The logical position of the specified tick mark
Failure: -1

Remarks

None.

Related

_GUICtrlSlider_SetTic

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iTic = Random(0, 100, 1), $hSlider

; Create GUI
GUICreate("Slider Get Tic", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Tic
_GUICtrlSlider_SetTic($hSlider, $iTic)

; Get Tic
MsgBox(4160, "Information", "Tic: " & _GUICtrlSlider_GetTic($hSlider, $iTic))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetTicPos

Function Reference

_GUICtrlSlider_GetTicPos

Retrieves the current physical position of a tick mark

#Include <GuiSlider.au3>
_GUICtrlSlider_GetTicPos($hWnd, $iTic)

Parameters

$hWnd | Handle to the control
$iTic | Zero-based index identifying a tick mark. The positions of the first and last tick marks are not directly available via this message.

Return Value

Success: The following values for type of slider:
horizontal - The x-coordinate of the tick mark
vertical - The y-coordinate of the tick mark
Failure: -1

Remarks

Because the first and last tick marks are not available through this function, valid indexes are offset
from their tick position on the slider. If the difference between _GUICtrlSlider_GetRangeMin and
_GUICtrlSlider_GetRangeMax is less than two, then there is no valid index and this message will fail.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iTic = Random(1, 99, 1), $hSlider

; Create GUI
GUICreate("Slider Get Tic Pos", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Tic Pos
MsgBox(4160, "Information", StringFormat("Tic %d: X Pos: %d", $iTic, _GUICtrlSlider_GetTicPos($hSlider, $iTic)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetToolTips

Function Reference

_GUICtrlSlider_GetToolTips

Retrieves the handle to the ToolTip control assigned to the slider, if any.

#Include <GuiSlider.au3>
_GUICtrlSlider_GetToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: the handle to the ToolTip control assigned to the slider
Failure: 0

Remarks

If the slider control does not use the $TBS_TOOLTIPS style, the return value is 0.

Related

_GUICtrlSlider_SetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hWndTT, $hSlider

; Create GUI
GUICreate("Slider Get Tool Tips", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Tool Tips
$hWndTT = _GUICtrlSlider_GetToolTips($hSlider)
MsgBox(4160, "Information", "Tool Tip Handle: " & $hWndTT)

; Set Tool Tips
_GUICtrlSlider_SetToolTips($hSlider, $hWndTT)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_GetUnicodeFormat

Function Reference

_GUICtrlSlider_GetUnicodeFormat

Retrieves the Unicode character format flag for the control

#Include <GuiSlider.au3>
_GUICtrlSlider_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: The control is using Unicode characters
False: The control is using ANSI characters

Remarks

None.

Related

_GUICtrlSlider_SetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Get Unicode Format", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Unicode Format
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlSlider_GetUnicodeFormat($hSlider))

; Set Unicode Format
MsgBox(4160, "Information", "Previous Unicode Format: " & _GUICtrlSlider_SetUnicodeFormat($hSlider, False))

; Get Unicode Format
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlSlider_GetUnicodeFormat($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetBuddy

Function Reference

_GUICtrlSlider_SetBuddy

Assigns a window as the buddy window for a slider control

#Include <GuiSlider.au3>
_GUICtrlSlider_SetBuddy($hWnd, $fLocation, $hBuddy)

Parameters

$hWnd | Handle to the control
$fLocation | Following values: True - The buddy will appear to the left of the slider if the control uses the $TBS_HORZ style The buddy will appear above the slider if the control uses the $TBS_VERT style False - The buddy will appear to the right of the slider if the control uses the $TBS_HORZ style The buddy will appear below the slider if the control uses the $TBS_VERT style
$hBuddy | Handle to buddy control

Return Value

Success: The handle to the window that was previously assigned to the control at that location

Remarks

None.

Related

_GUICtrlSlider_GetBuddy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hInput, $hInput2, $hSlider

; Create GUI
GUICreate("Slider Set Buddy", 400, 296)
$hSlider = GUICtrlCreateSlider(95, 2, 205, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
$hInput = GUICtrlCreateInput("0", 2, 25, 90, 20)
$hInput2 = GUICtrlCreateInput("0", 2, 25, 90, 20)
GUISetState()

; Set buddy to left
_GUICtrlSlider_SetBuddy($hSlider, True, $hInput)
; Set buddy to right
_GUICtrlSlider_SetBuddy($hSlider, False, $hInput2)

; Get Buddy from the left
MsgBox(4160, "Information", "Buddy Handle: " & _GUICtrlSlider_GetBuddy($hSlider, True))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetLineSize

Function Reference

_GUICtrlSlider_SetLineSize

Sets the number of logical positions the slider moves

#Include <GuiSlider.au3>
_GUICtrlSlider_SetLineSize($hWnd, $iLineSize)

Parameters

$hWnd | Handle to the control
$iLineSize | New line size

Return Value

Success: The previous line size

Remarks

The default setting for the line size is 1

Related

_GUICtrlSlider_GetLineSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Line Size", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Line Size
MsgBox(4160, "Information", "Line Size: " & _GUICtrlSlider_GetLineSize($hSlider))

; Set Line Size
_GUICtrlSlider_SetLineSize($hSlider, 4)

; Get Line Size
MsgBox(4160, "Information", "Line Size: " & _GUICtrlSlider_GetLineSize($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetPageSize

Function Reference

_GUICtrlSlider_SetPageSize

Sets the number of logical positions the slider moves

#Include <GuiSlider.au3>
_GUICtrlSlider_SetPageSize($hWnd, $iPageSize)

Parameters

$hWnd | Handle to the control
$iPageSize | New page size

Return Value

Success: The previous page size

Remarks

None.

Related

_GUICtrlSlider_GetPageSize

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Page Size", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Page Size
MsgBox(4160, "Information", "Page Size: " & _GUICtrlSlider_GetPageSize($hSlider))

; Set Page Size
_GUICtrlSlider_SetPageSize($hSlider, 4)

; Get Page Size
MsgBox(4160, "Information", "Page Size: " & _GUICtrlSlider_GetPageSize($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetPos

Function Reference

_GUICtrlSlider_SetPos

Sets the current logical position of the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetPos($hWnd, $iPosition)

Parameters

$hWnd | Handle to the control
$iPosition | New logical position of the slider

Return Value

None.

Remarks

None.

Related

_GUICtrlSlider_GetPos

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Pos", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Pos
_GUICtrlSlider_SetPos($hSlider, Random(0, 100, 1))

; Get Pos
MsgBox(4160, "Information", "Pos: " & _GUICtrlSlider_GetPos($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetRange

Function Reference

_GUICtrlSlider_SetRange

Sets the range of minimum and maximum logical positions for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetRange($hWnd, $iMinimum, $iMaximum)

Parameters

$hWnd | Handle to the control
$iMinimum | Minimum position for the slider
$iMaximum | Maximum position for the slider

Return Value

None.

Remarks

If the current slider position is outside the new range, the _GUICtrlSlider_SetRange function
sets the slider position to the new maximum or minimum value.

Related

_GUICtrlSlider_GetRange, _GUICtrlSlider_SetRangeMax, _GUICtrlSlider_SetRangeMin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRange, $hSlider

; Create GUI
GUICreate("Slider Set Range", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range
$aRange = _GUICtrlSlider_GetRange($hSlider)
MsgBox(4160, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

; Set Range
_GUICtrlSlider_SetRange($hSlider, 20, 50)

; Get Range
$aRange = _GUICtrlSlider_GetRange($hSlider)
MsgBox(4160, "Information", StringFormat("Range: %d - %d", $aRange[0], $aRange[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetRangeMax

Function Reference

_GUICtrlSlider_SetRangeMax

Sets the maximum logical position for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetRangeMax($hWnd, $iMaximum)

Parameters

$hWnd | Handle to the control
$iMaximum | Maximum position for the slider

Return Value

None.

Remarks

If the current slider position is greater than the new maximum, the _GUICtrlSlider_SetRangeMax function
sets the slider position to the new maximum value.

Related

_GUICtrlSlider_GetRangeMax, _GUICtrlSlider_SetRange, _GUICtrlSlider_SetRangeMin

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Range Max", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range Max
MsgBox(4160, "Information", "Range Max: " & _GUICtrlSlider_GetRangeMax($hSlider))

; Set Range Max
_GUICtrlSlider_SetRangeMax($hSlider, 50)

; Get Range Max
MsgBox(4160, "Information", "Range Max: " & _GUICtrlSlider_GetRangeMax($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetRangeMin

Function Reference

_GUICtrlSlider_SetRangeMin

Sets the minimum logical position for the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetRangeMin($hWnd, $iMinimum)

Parameters

$hWnd | Handle to the control
$iMinimum | Minimum position for the slider

Return Value

None.

Remarks

If the current slider position is less than the new minimum, the _GUICtrlSlider_SetRangeMin function
sets the slider position to the new minimum value.

Related

_GUICtrlSlider_GetRangeMin, _GUICtrlSlider_SetRange, _GUICtrlSlider_SetRangeMax

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Range Min", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Range Min
MsgBox(4160, "Information", "Range Min: " & _GUICtrlSlider_GetRangeMin($hSlider))

; Set Range Min
_GUICtrlSlider_SetRangeMin($hSlider, 20)

; Get Range Min
MsgBox(4160, "Information", "Range Min: " & _GUICtrlSlider_GetRangeMin($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetSel

Function Reference

_GUICtrlSlider_SetSel

Sets the starting and ending positions for the available selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_SetSel($hWnd, $iMinimum, $iMaximum)

Parameters

$hWnd | Handle to the control
$iMinimum | Starting logical position for the selection range
$iMaximum | Ending logical position for the selection range

Return Value

None.

Remarks

This function is ignored if the slider does not have the $TBS_ENABLESELRANGE style.
_GUICtrlSlider_SetSel allows you to restrict the pointer to only a portion of the range
available to the slider.

Related

_GUICtrlSlider_GetSel, _GUICtrlSlider_SetSelEnd, _GUICtrlSlider_SetSelStart, _GUICtrlSlider_ClearSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aSel, $hSlider

; Create GUI
GUICreate("Slider Set Sel", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel
_GUICtrlSlider_SetSel($hSlider, 10, 50)

; Get Sel
$aSel = _GUICtrlSlider_GetSel($hSlider)
MsgBox(4160, "Information", StringFormat("Sel: %d - %d", $aSel[0], $aSel[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetSelEnd

Function Reference

_GUICtrlSlider_SetSelEnd

Sets the ending logical position of the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_SetSelEnd($hWnd, $iMaximum)

Parameters

$hWnd | Handle to the control
$iMaximum | Ending logical position for the selection range

Return Value

None.

Remarks

None.

Related

_GUICtrlSlider_GetSelEnd, _GUICtrlSlider_SetSel, _GUICtrlSlider_SetSelStart, _GUICtrlSlider_ClearSel, _GUICtrlSlider_GetSel

Example

#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Sel End", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel End
_GUICtrlSlider_SetSelEnd($hSlider, 50)

; Get Sel End
MsgBox(4160, "Information", "Sel End: " & _GUICtrlSlider_GetSelEnd($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetSelStart

Function Reference

_GUICtrlSlider_SetSelStart

Sets the starting logical position of the current selection range

#Include <GuiSlider.au3>
_GUICtrlSlider_SetSelStart($hWnd, $iMinimum)

Parameters

$hWnd | Handle to the control
$iMinimum | Starting logical position for the selection range

Return Value

None.

Remarks

None.

Related

_GUICtrlSlider_GetSelStart, _GUICtrlSlider_SetSel, _GUICtrlSlider_SetSelEnd, _GUICtrlSlider_ClearSel, _GUICtrlSlider_GetSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Sel Start", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Sel Start
_GUICtrlSlider_SetSelStart($hSlider, 10)

; Get Sel Start
MsgBox(4160, "Information", "Sel Start: " & _GUICtrlSlider_GetSelStart($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetThumbLength

Function Reference

_GUICtrlSlider_SetThumbLength

Sets the length of the slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetThumbLength($hWnd, $iLength)

Parameters

$hWnd | Handle to the control
$iLength | Length, in pixels, of the slider

Return Value

None.

Remarks

This function is ignored if the trackbar does not have the $TBS_FIXEDLENGTH style

Related

_GUICtrlSlider_GetThumbLength

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Thumb Length", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 25, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_FIXEDLENGTH))
GUISetState()

; Get Thumb Length
MsgBox(4160, "Information", "Thumb Length: " & _GUICtrlSlider_GetThumbLength($hSlider))

; Set Thumb Length
_GUICtrlSlider_SetThumbLength($hSlider, 10)

; Get Thumb Length
MsgBox(4160, "Information", "Thumb Length: " & _GUICtrlSlider_GetThumbLength($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetTic

Function Reference

_GUICtrlSlider_SetTic

Sets a tick mark in a slider at the specified logical position

#Include <GuiSlider.au3>
_GUICtrlSlider_SetTic($hWnd, $iPosition)

Parameters

$hWnd | Handle to the control
$iPosition | Position of the tick mark This parameter can be any of the integer values in the slider's range of minimum to maximum positions

Return Value

Success: True
Failure: False

Remarks

A slider creates its own first and last tick marks.
Do not use this message to set the first and last tick marks.

Related

_GUICtrlSlider_GetTic, _GUICtrlSlider_ClearTics

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $iTic = Random(0, 100, 1), $hSlider

; Create GUI
GUICreate("Slider Set Tic", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Set Tic
_GUICtrlSlider_SetTic($hSlider, $iTic)

; Get Tic
MsgBox(4160, "Information", "Tic: " & _GUICtrlSlider_GetTic($hSlider, $iTic))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetTicFreq

Function Reference

_GUICtrlSlider_SetTicFreq

Sets the interval frequency for tick marks in a slider

#Include <GuiSlider.au3>
_GUICtrlSlider_SetTicFreq($hWnd, $iFreg)

Parameters

$hWnd | Handle to the control
$iFreg | Frequency of the tick marks.

Return Value

None.

Remarks

The slider must have the $TBS_AUTOTICKS style to use this function

Related

_GUICtrlSlider_GetNumTics, _GUICtrlSlider_ClearTics

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Tic Freq", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Num Tics
MsgBox(4160, "Information", "Num Tics: " & _GUICtrlSlider_GetNumTics($hSlider))

; Set Tic Freq
_GUICtrlSlider_SetTicFreq($hSlider, 1)

; Get Num Tics
MsgBox(4160, "Information", "Num Tics: " & _GUICtrlSlider_GetNumTics($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetTipSide

Function Reference

_GUICtrlSlider_SetTipSide

Positions a ToolTip control

#Include <GuiSlider.au3>
_GUICtrlSlider_SetTipSide($hWnd, $fLocation)

Parameters

$hWnd | Handle to the control
$fLocation | The location at which to display the ToolTip control. This value can be one of the following: $TBTS_TOP - Will be positioned above the slider. This flag is for use with horizontal sliders. $TBTS_LEFT - Will be positioned to the left of the slider. This flag is for use with vertical sliders. $TBTS_BOTTOM - Will be positioned below the slider This flag is for use with horizontal sliders. $TBTS_RIGHT - Will be positioned to the right of the slider. This flag is for use with vertical sliders.

Return Value

Success: The ToolTip control's previous location
The return value equals one of the possible values for $fLocation

Remarks

Use the $TBS_TOOLTIPS style display ToolTips

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $rdoBottom, $rdoLeft, $rdoRight, $rdoTop, $hSlider, $hSlider2

; Create GUI
GUICreate("Slider Set Tip Side", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 375, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS))
$hSlider2 = GUICtrlCreateSlider(380, 2, 20, 292, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_VERT))
GUISetState()

GUICtrlCreateGroup("Tip Side Horiz", 2, 25, 120, 120)
$rdoBottom = GUICtrlCreateRadio("Bottom", 5, 40, 108, 20)
$rdoTop = GUICtrlCreateRadio("Top", 5, 115, 108, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState($rdoTop, $GUI_CHECKED)

GUICtrlCreateGroup("Tip Side Vert", 130, 25, 120, 120)
$rdoLeft = GUICtrlCreateRadio("Left", 132, 65, 108, 20)
$rdoRight = GUICtrlCreateRadio("Right", 132, 90, 108, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState($rdoLeft, $GUI_CHECKED)

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $rdoBottom
_GUICtrlSlider_SetTipSide($hSlider, $TBTS_BOTTOM)
Case $rdoLeft
_GUICtrlSlider_SetTipSide($hSlider2, $TBTS_LEFT)
Case $rdoRight
_GUICtrlSlider_SetTipSide($hSlider2, $TBTS_RIGHT)
Case $rdoTop
_GUICtrlSlider_SetTipSide($hSlider, $TBTS_TOP)
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetToolTips

Function Reference

_GUICtrlSlider_SetToolTips

Assigns a ToolTip control to a slider control

#Include <GuiSlider.au3>
_GUICtrlSlider_SetToolTips($hWnd, $hWndTT)

Parameters

$hWnd | Handle to the control
$hWndTT | Handle to an existing ToolTip control

Return Value

None.

Remarks

When a slidert control is created with the $TBS_TOOLTIPS style, it creates a default ToolTip control
that appears next to the slider, displaying the slider's current position.

Related

_GUICtrlSlider_GetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hWndTT, $hSlider

; Create GUI
GUICreate("Slider Set Tool Tips", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Tool Tips
$hWndTT = _GUICtrlSlider_GetToolTips($hSlider)
MsgBox(4160, "Information", "Tool Tip Handle: " & $hWndTT)

; Set Tool Tips
_GUICtrlSlider_SetToolTips($hSlider, $hWndTT)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlSlider_SetUnicodeFormat

Function Reference

_GUICtrlSlider_SetUnicodeFormat

Sets the Unicode character format flag for the control

#Include <GuiSlider.au3>
_GUICtrlSlider_SetUnicodeFormat($hWnd, $fUnicode)

Parameters

$hWnd | Handle to the control
$fUnicode | Determines the character set that is used by the control: True - The control will use Unicode characters False - The control will use ANSI characters

Return Value

Success: The previous Unicode format flag for the control

Remarks

None.

Related

_GUICtrlSlider_GetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Opt('MustDeclareVars', 1)

$Debug_S = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hSlider

; Create GUI
GUICreate("Slider Set Unicode Format", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS, $TBS_ENABLESELRANGE))
GUISetState()

; Get Unicode Format
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlSlider_GetUnicodeFormat($hSlider))

; Set Unicode Format
MsgBox(4160, "Information", "Previous Unicode Format: " & _GUICtrlSlider_SetUnicodeFormat($hSlider, False))

; Get Unicode Format
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlSlider_GetUnicodeFormat($hSlider))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiStatusBar user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiStatusBar.au3>.

User Defined Function | Description
_GUICtrlStatusBar_Create | Create a statusbar
_GUICtrlStatusBar_Destroy | Delete the control
_GUICtrlStatusBar_EmbedControl | Embeds a child control in the control
_GUICtrlStatusBar_GetBorders | Retrieves the current widths of the horizontal and vertical borders
_GUICtrlStatusBar_GetBordersHorz | Retrieves the current width of the horizontal border
_GUICtrlStatusBar_GetBordersRect | Retrieves the current width of the rectangle border
_GUICtrlStatusBar_GetBordersVert | Retrieves the current width of the vertical border
_GUICtrlStatusBar_GetCount | Retrieves the number of parts
_GUICtrlStatusBar_GetHeight | Retrieves the height of a part
_GUICtrlStatusBar_GetIcon | Retrieves the icon for a part
_GUICtrlStatusBar_GetParts | Retrieves the number of parts and the part edges
_GUICtrlStatusBar_GetRect | Retrieves the bounding rectangle of a part
_GUICtrlStatusBar_GetRectEx | Retrieves the bounding rectangle of a part
_GUICtrlStatusBar_GetText | Retrieves the text from the specified part
_GUICtrlStatusBar_GetTextFlags | Retrieves the text length flags for a part
_GUICtrlStatusBar_GetTextLength | Retrieves the length of a part text
_GUICtrlStatusBar_GetTextLengthEx | Retrieves the uFlag of a part
_GUICtrlStatusBar_GetTipText | Retrieves the ToolTip text for a part
_GUICtrlStatusBar_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlStatusBar_GetWidth | Retrieves the width of a part
_GUICtrlStatusBar_IsSimple | Checks a status bar control to determine if it is in simple mode
_GUICtrlStatusBar_Resize | Causes the status bar to resize itself
_GUICtrlStatusBar_SetBkColor | Sets the background color
_GUICtrlStatusBar_SetIcon | Sets the icon for a part
_GUICtrlStatusBar_SetMinHeight | Sets the minimum height of a status window's drawing area
_GUICtrlStatusBar_SetParts | Sets the number of parts and the part edges
_GUICtrlStatusBar_SetSimple | Specifies whether a status window displays simple text or displays all window parts
_GUICtrlStatusBar_SetText | Sets the text in the specified part of a status window
_GUICtrlStatusBar_SetTipText | Sets the ToolTip text for a part
_GUICtrlStatusBar_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlStatusBar_ShowHide | Show/Hide the StatusBar control


Function _GUICtrlStatusBar_Create

Function Reference

_GUICtrlStatusBar_Create

Create a statusbar

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_Create($hWnd[, $vPartEdge = -1[, $vPartText = ""[, $iStyles = -1[, $iExStyles = 0x00000000]]]])

Parameters

$hWnd | Handle to parent window
$vPartEdge | [optional] Width of part or parts, for more than 1 part pass in zero based array in the following format: $vPartEdge[0] - Right edge of part #1 $vPartEdge[1] - Right edge of part #2 $vPartEdge[n] - Right edeg of part n
$vPartText | [optional] Text of part or parts, for more than 1 part pass in zero based array in the following format: $vPartText[0] - First part $vPartText[1] - Second part $vPartText[n] - Last part
$iStyles | [optional] Control styles: $SBARS_SIZEGRIP - The status bar control will include a sizing grip at the right end of the status bar $SBARS_TOOLTIPS - The status bar will have tooltips
 | Forced: $WS_CHILD, $WS_VISIBLE
$iExStyles | [optional] Control extended style

Return Value

Success: | Handle to the control
Failure: | 0

Remarks

If using GUICtrlCreateMenu then use _GUICtrlStatusBar_Create after GUICtrlCreateMenu

Related

_GUICtrlStatusBar_Destroy

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo, $MainGUI, $hStatus

Example1()
Example2()
Example3()
Example4()
Example5()
Example6()

Func Example1()

Local $hGUI
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Create", 400, 300)

;===============================================================================
; defaults to 1 part, no text
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
;===============================================================================
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "Handle to GUI window" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example1

Func Example2()

Local $hGUI
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Create", 400, 300)

;===============================================================================
; sets parts with no text
$hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts)
;===============================================================================

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "Handle to GUI window" & @CRLF & _
@TAB & "part width array of 3 elements" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example2

Func Example3()

Local $hGUI
Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]
Local $aParts[3] = [100, 175, -1]

; Create GUI
$hGUI = GUICreate("(Example 3) StatusBar Create", 400, 300)

;===============================================================================
;sets parts and text
$hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
;===============================================================================

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "only Handle," & @CRLF & _
@TAB & "part width array of 3 elements" & @CRLF & _
@TAB & "part text array of 3 elements" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example3

Func Example4()

Local $hGUI
Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]

; Create GUI
$hGUI = GUICreate("(Example 4) StatusBar Create", 400, 300)

;===============================================================================
; will create part widths based on part size passed in
$hStatus = _GUICtrlStatusBar_Create ($hGUI, 100, $aText)
;===============================================================================

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "only Handle," & @CRLF & _
@TAB & "part width number" & @CRLF & _
@TAB & "part text array of 3 elements" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example4

Func Example5()

Local $hGUI
Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]
Local $aParts[2] = [100, 175]

; Create GUI
$hGUI = GUICreate("(Example 5) StatusBar Create", 400, 300)

;===============================================================================
; adjusts array to largest array passed in (this time the text array is the largest)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
;===============================================================================

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "only Handle," & @CRLF & _
@TAB & "part width array of 2 elements" & @CRLF & _
@TAB & "part text array of 3 elements" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example5

Func Example6()

Local $hGUI
Local $aText[2] = ["Left Justified", @TAB & "Centered"]
Local $aParts[3] = [100, 175, -1]

; Create GUI
$hGUI = GUICreate("(Example 6) StatusBar Create", 400, 300)

;===============================================================================
; adjusts array to largest array passed in (this time the part width array)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
;===============================================================================

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
GUICtrlSetBkColor($iMemo, 0xFFFFFF)
MemoWrite("StatusBar Created with:" & @CRLF & _
@TAB & "only Handle," & @CRLF & _
@TAB & "part width array of 3 elements" & @CRLF & _
@TAB & "part text array of 2 elements" & @CRLF)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE, $MainGUI)
GUIDelete($hGUI)
EndFunc ;==>Example6

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hStatus
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return TRUE ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return TRUE ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return TRUE ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
$iIDFrom = DllStructGetData($tinfo, "IDFrom")
$iCode = DllStructGetData($tinfo, "Code")
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode & @LF & _
"-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
"-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
"-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
"-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
"-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
Return TRUE ; indicate that the mouse click was handled and suppress default processing by the system
;~ Return FALSE ;to allow default processing of the click.
Case $SBN_SIMPLEMODECHANGE ; Simple mode changes
_DebugPrint("$SBN_SIMPLEMODECHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlStatusBar_Destroy

Function Reference

_GUICtrlStatusBar_Destroy

Delete the control

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True, Handle is set to 0
Failure: | False

Remarks

Restricted to only be used on StatusBar created with _GUICtrlStatusBar_Create

Related

_GUICtrlStatusBar_Create

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $HandleBefore, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Destroy", 400, 300)

;===============================================================================
; defaults to 1 part, no text
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
;===============================================================================
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

GUISetState()

$HandleBefore = $hStatus
MsgBox (4160, "Information", "Destroying the Control for Handle: " & $hStatus)
MsgBox (4160, "Information", "Control Destroyed: " & _GUICtrlStatusBar_Destroy ($hStatus) & @LF & _
"Handel Before Destroy: " & $HandleBefore & @LF & _
"Handle After Destroy: " & $hStatus)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlStatusBar_EmbedControl

Function Reference

_GUICtrlStatusBar_EmbedControl

Embeds a child control in the control

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_EmbedControl($hWnd, $iPart, $hControl[, $iFit = 4])

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index
$hControl | Handle of control to embed in panel
$iFit | [optional] Determines how to fit the control. Can be a combination of: 1 - Center the control horizontally 2 - Center the control vertically 4 - Fit the control to the status bar part

Return Value

None.

Remarks

You can embed ANY control in the status bar, not just the usual Progress Bar

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus
Local $aParts[4] = [80, 160, 300, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 400, 300)

;===============================================================================
; defaults to 1 part, no text
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

;===============================================================================
GUISetState()

; Initialize parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Embed a progress bar
If @OSTYPE = "WIN32_WINDOWS" Then
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
Else
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
_SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
EndIf

$input = GUICtrlCreateInput("This is Embeded", 0, 0)
$hInput = GUICtrlGetHandle($input)
_GUICtrlStatusBar_EmbedControl ($hStatus, 3, $hInput, 3)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlStatusBar_GetBorders

Function Reference

_GUICtrlStatusBar_GetBorders

Retrieves the current widths of the horizontal and vertical borders

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetBorders($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Array with the following format:
 | $aBorders[0] - Width of the horizontal border
 | $aBorders[1] - Width of the vertical border
 | $aBorders[2] - Width of the border between rectangles
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetBordersHorz, _GUICtrlStatusBar_GetBordersRect, _GUICtrlStatusBar_GetBordersVert

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $aInfo, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Borders", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get border sizes
$aInfo = _GUICtrlStatusBar_GetBorders ($hStatus)
MemoWrite("Horizontal border width .: " & $aInfo[0])
MemoWrite("Vertical border width ...: " & $aInfo[1])
MemoWrite("Width between rectangles : " & $aInfo[2])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetBordersHorz

Function Reference

_GUICtrlStatusBar_GetBordersHorz

Retrieves the current width of the horizontal border

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetBordersHorz($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Width of the horizontal border
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetBorders, _GUICtrlStatusBar_GetBordersRect, _GUICtrlStatusBar_GetBordersVert

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Borders Horizontal", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetBordersRect

Function Reference

_GUICtrlStatusBar_GetBordersRect

Retrieves the current width of the rectangle border

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetBordersRect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Width of the rectangle border
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetBorders, _GUICtrlStatusBar_GetBordersHorz, _GUICtrlStatusBar_GetBordersVert

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Borders Rect", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetBordersVert

Function Reference

_GUICtrlStatusBar_GetBordersVert

Retrieves the current width of the vertical border

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetBordersVert($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Width of the vertical border
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetBorders, _GUICtrlStatusBar_GetBordersHorz, _GUICtrlStatusBar_GetBordersRect

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Borders Vertical", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get border sizes
MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetCount

Function Reference

_GUICtrlStatusBar_GetCount

Retrieves the number of parts

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Number of status bar parts

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Count", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get number of parts
MemoWrite("Number of parts .: " & _GUICtrlStatusBar_GetCount ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetHeight

Function Reference

_GUICtrlStatusBar_GetHeight

Retrieves the height of a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetHeight($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Height of the parts

Remarks

None.

Related

_GUICtrlStatusBar_GetWidth, _GUICtrlStatusBar_SetMinHeight

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Height", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get parts height/width
MemoWrite("Height of parts .: " & _GUICtrlStatusBar_GetHeight ($hStatus))
MemoWrite("Width of part 1 .: " & _GUICtrlStatusBar_GetWidth ($hStatus, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetIcon

Function Reference

_GUICtrlStatusBar_GetIcon

Retrieves the icon for a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetIcon($hWnd[, $iIndex = 0])

Parameters

$hWnd | Handle to the control
$iIndex | [optional] Zero based index of the part that contains the icon to be retrieved. If this parameter is -1, the status bar is assumed to be a Simple Mode status bar.

Return Value

Success: | The handle to the icon
Failure: | 0

Remarks

None.

Related

_GUICtrlStatusBar_SetIcon

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcons[2], $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Get Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
$hIcons[0] = _WinAPI_LoadShell32Icon (23)
$hIcons[1] = _WinAPI_LoadShell32Icon (40)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon ($hStatus, 1, $hIcons[1])

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcons[0])
_WinAPI_DestroyIcon ($hIcons[1])
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Get Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")
_GUICtrlStatusBar_SetIcon ($hStatus, 1, 40, "shell32.dll")

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetParts

Function Reference

_GUICtrlStatusBar_GetParts

Retrieves the number of parts and the part edges

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetParts($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
$aParts[0] - Number of parts
$aParts[1] - Right edge of part #1
$aParts[2] - Right edge of part #2
$aParts[n] - Right edge of part n

Remarks

None.

Related

_GUICtrlStatusBar_SetParts

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Parts", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set/Get parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
$aParts = _GUICtrlStatusBar_GetParts ($hStatus)
For $iI = 1 To $aParts[0]
MemoWrite("Part " & $iI & " width .: " & $aParts[$iI])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetRect

Function Reference

_GUICtrlStatusBar_GetRect

Retrieves the bounding rectangle of a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetRect($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Success: | Array with the following format:
 | $aRect[0] = X coordinate of the upper left corner of the rectangle
 | $aRect[1] = Y coordinate of the upper left corner of the rectangle
 | $aRect[2] = X coordinate of the lower right corner of the rectangle
 | $aRect[3] = Y coordinate of the lower right corner of the rectangle
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetRectEx

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $aRect, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Rect", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set/Get parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Get part 1 rectangles
$aRect = _GUICtrlStatusBar_GetRect ($hStatus, 0)
MemoWrite("Part 1 left ...: " & $aRect[0])
MemoWrite("Part 1 top ....: " & $aRect[1])
MemoWrite("Part 1 right ..: " & $aRect[2])
MemoWrite("Part 1 bottom .: " & $aRect[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetRectEx

Function Reference

_GUICtrlStatusBar_GetRectEx

Retrieves the bounding rectangle of a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetRectEx($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index. If the control is in simple mode this field is ignored and the rectangle of the status bar is returned.

Return Value

Success: | $tagRECT structure that receives the bounding rectangle
Failure: | Set @error

Remarks

None.

Related

_GUICtrlStatusBar_GetRect, $tagRECT

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $tRect, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get RectEx", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set/Get parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Get part 1 rectangles
$tRect = _GUICtrlStatusBar_GetRectEx ($hStatus, 0)
MemoWrite("Part 1 left ...: " & DllStructGetData($tRect, "Left"))
MemoWrite("Part 1 top ....: " & DllStructGetData($tRect, "Top"))
MemoWrite("Part 1 right ..: " & DllStructGetData($tRect, "Right"))
MemoWrite("Part 1 bottom .: " & DllStructGetData($tRect, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetText

Function Reference

_GUICtrlStatusBar_GetText

Retrieves the text from the specified part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetText($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Success: | Part text
Failure: | set @error

Remarks

None.

Related

_GUICtrlStatusBar_SetText

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcons[2], $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Get Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
$hIcons[0] = _WinAPI_LoadShell32Icon (23)
$hIcons[1] = _WinAPI_LoadShell32Icon (40)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon ($hStatus, 1, $hIcons[1])

; Show part text
MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 0))
MemoWrite("Part 2 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 1))

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcons[0])
_WinAPI_DestroyIcon ($hIcons[1])
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Get Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")
_GUICtrlStatusBar_SetIcon ($hStatus, 1, 40, "shell32.dll")

; Show part text
MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 0))
MemoWrite("Part 2 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 1))

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetTextFlags

Function Reference

_GUICtrlStatusBar_GetTextFlags

Retrieves the text length flags for a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetTextFlags($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Returns the low word specifies the length, in characters, of the text. The high word specifies the type
of operation used to draw the text. The type can be one of the following values: 0 - The text is drawn with a border to appear lower than the plane of the window
$SBT_NOBORDERS - The text is drawn without borders
$SBT_OWNERDRAW - The text is drawn by the parent window
$SBT_POPOUT - The text is drawn with a border to appear higher than the plane of the window
$SBT_RTLREADING - The text will be displayed in the opposite direction to the text in the parent window

Remarks

None.

Related

_GUICtrlStatusBar_GetTextLength, _GUICtrlStatusBar_GetTextLengthEx

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Get Text Flags", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1", 0, $SBT_POPOUT)
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1, $SBT_NOBORDERS)
_GUICtrlStatusBar_SetText ($hStatus, "Part 3", 2, $SBT_NOTABPARSING)

; Get text information
For $iI = 0 To _GUICtrlStatusBar_GetCount ($hStatus) - 1
MemoWrite("Part " & $iI & " text flags .: " & _GUICtrlStatusBar_GetTextFlags ($hStatus, $iI))
MemoWrite("Part " & $iI & " text length : " & _GUICtrlStatusBar_GetTextLength ($hStatus, $iI))
MemoWrite("Part " & $iI & " text length : 0x" & Hex(_GUICtrlStatusBar_GetTextLengthEx ($hStatus, $iI)))
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetTextLength

Function Reference

_GUICtrlStatusBar_GetTextLength

Retrieves the length of a part text

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetTextLength($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Returns the Length of part text

Remarks

None.

Related

_GUICtrlStatusBar_GetTextLengthEx, _GUICtrlStatusBar_GetTextFlags

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Text Length", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Get text information
For $iI = 0 To _GUICtrlStatusBar_GetCount ($hStatus) - 1
MemoWrite("Part " & $iI & " text flags .: 0x" & Hex(_GUICtrlStatusBar_GetTextFlags ($hStatus, $iI)))
MemoWrite("Part " & $iI & " text length : " & _GUICtrlStatusBar_GetTextLength ($hStatus, $iI))
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetTextLengthEx

Function Reference

_GUICtrlStatusBar_GetTextLengthEx

Retrieves the uFlag of a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetTextLengthEx($hwnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Returns the Type of drawing operation. The type can be one of the following values:
0 - The text is drawn with a border to appear lower than the plane of the window
$SBT_NOBORDERS - The text is drawn without borders
$SBT_OWNERDRAW - The text is drawn by the parent window
$SBT_POPOUT - The text is drawn with a border to appear higher than the plane of the window
$SBT_RTLREADING - The text will be displayed in the opposite direction to the text in the parent window

Remarks

None.

Related

_GUICtrlStatusBar_GetTextFlags, _GUICtrlStatusBar_GetTextLength

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Global $hGUI, $iMemo, $iI, $hStatus
Global $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Text LengthEx", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, $SBT_NOBORDERS)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1", 0, $SBT_POPOUT)
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1, $SBT_NOBORDERS)
_GUICtrlStatusBar_SetText ($hStatus, "Part 3", 2, $SBT_NOTABPARSING)

; Get text information
For $iI = 0 To _GUICtrlStatusBar_GetCount ($hStatus) - 1
MemoWrite("Part " & $iI & " text flags .: " & _GUICtrlStatusBar_GetTextFlags ($hStatus, $iI))
MemoWrite("Part " & $iI & " text length : " & _GUICtrlStatusBar_GetTextLength ($hStatus, $iI))
MemoWrite("Part " & $iI & " text length : 0x" & Hex(_GUICtrlStatusBar_GetTextLengthEx ($hStatus, $iI)))
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetTipText

Function Reference

_GUICtrlStatusBar_GetTipText

Retrieves the ToolTip text for a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetTipText($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Returns the Part text

Remarks

The status bar must be created with the $SBARS_TOOLTIPS style to enable ToolTips

Related

_GUICtrlStatusBar_SetTipText

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcon, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Get Tip Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, -1, "", $SBARS_TOOLTIPS)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

; Set icon
$hIcon = _WinAPI_LoadShell32Icon (23)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcon)

; Set text tips
_GUICtrlStatusBar_SetTipText ($hStatus, 0, "Tip works when only icon in part or text exceeds part")
_GUICtrlStatusBar_SetTipText ($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

; Show text tips
MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 0) & @CRLF)
MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcon)
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Get Tip Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, -1, "", $SBARS_TOOLTIPS)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

; Set icon
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")

; Set text tips
_GUICtrlStatusBar_SetTipText ($hStatus, 0, "Tip works when only icon in part or text exceeds part")
_GUICtrlStatusBar_SetTipText ($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

; Show text tips
MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 0) & @CRLF)
MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetUnicodeFormat

Function Reference

_GUICtrlStatusBar_GetUnicodeFormat

Retrieves the Unicode character format flag

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | Control is using Unicode characters
False: | Control is using ANSI characters

Remarks

None.

Related

_GUICtrlStatusBar_SetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Get Unicode Format", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Unicode format
MemoWrite("Unicode format .: " & _GUICtrlStatusBar_GetUnicodeFormat ($hStatus))
_GUICtrlStatusBar_SetUnicodeFormat ($hStatus)
MemoWrite("Unicode format .: " & _GUICtrlStatusBar_GetUnicodeFormat ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_GetWidth

Function Reference

_GUICtrlStatusBar_GetWidth

Retrieves the width of a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_GetWidth($hWnd, $iPart)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index

Return Value

Returns the Width of the parts

Remarks

None.

Related

_GUICtrlStatusBar_GetHeight

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Get Width", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get parts height/width
MemoWrite("Height of parts .: " & _GUICtrlStatusBar_GetHeight ($hStatus))
MemoWrite("Width of part 1 .: " & _GUICtrlStatusBar_GetWidth ($hStatus, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_IsSimple

Function Reference

_GUICtrlStatusBar_IsSimple

Checks a status bar control to determine if it is in simple mode

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_IsSimple($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | Status bar is in simple mode
False: | Status bar is not in simple mode

Remarks

None.

Related

_GUICtrlStatusBar_SetSimple

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar IsSimple", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set simple format
MemoWrite("Simple mode on .: " & _GUICtrlStatusBar_IsSimple ($hStatus))
_GUICtrlStatusBar_SetSimple ($hStatus, True)
MemoWrite("Simple mode on .: " & _GUICtrlStatusBar_IsSimple ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_Resize

Function Reference

_GUICtrlStatusBar_Resize

Causes the status bar to resize itself

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_Resize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hStatus

_Main()

Func _Main()

Local $hGUI
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Resize", 400, 300, -1, -1, $WS_SIZEBOX)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
GUISetState()

GUIRegisterMsg($WM_SIZE, "WM_SIZE")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Resize the status bar when GUI size changes
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
_GUICtrlStatusBar_Resize ($hStatus)
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE


Function _GUICtrlStatusBar_SetBkColor

Function Reference

_GUICtrlStatusBar_SetBkColor

Sets the background color

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetBkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | New background color. Specify the CLR_DEFAULT value to cause the status bar to use its default background color.

Return Value

Returns the previous background color, or CLR_DEFAULT if the background color is the default color

Remarks

Returns RGB COLORREF color, color passed in must be BGR Hex color or RGB COLORREF

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set BkColor", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set background color
_GUICtrlStatusBar_SetBkColor ($hStatus, $CLR_MONEYGREEN)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlStatusBar_SetIcon

Function Reference

_GUICtrlStatusBar_SetIcon

Sets the icon for a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetIcon($hWnd, $iPart[, $hIcon = -1[, $sIconFile = ""]])

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index. If the control is in simple mode, this field is ignored.
$hIcon | [optional] Handle to the icon. If this value is -1, the icon is removed.
$sIconFile | [optional] Icon filename to be used.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlStatusBar_GetIcon

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcons[2], $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
$hIcons[0] = _WinAPI_LoadShell32Icon (23)
$hIcons[1] = _WinAPI_LoadShell32Icon (40)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon ($hStatus, 1, $hIcons[1])

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcons[0])
_WinAPI_DestroyIcon ($hIcons[1])
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Set Icon", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")
_GUICtrlStatusBar_SetIcon ($hStatus, 1, 40, "shell32.dll")

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_SetMinHeight

Function Reference

_GUICtrlStatusBar_SetMinHeight

Sets the minimum height of a status window's drawing area

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetMinHeight($hWnd, $iMinHeight)

Parameters

$hWnd | Handle to the control
$iMinHeight | Minimum height, in pixels, of the window

Return Value

None.

Remarks

None.

Related

_GUICtrlStatusBar_GetHeight

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set Min Height", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set minimum height
_GUICtrlStatusBar_SetMinHeight ($hStatus, 30)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlStatusBar_SetParts

Function Reference

_GUICtrlStatusBar_SetParts

Sets the number of parts and the part edges

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetParts($hWnd[, $iaParts = -1[, $iaPartWidth = 25]])

Parameters

$hWnd | Handle to the control
$iaParts | [optional] Number of parts, can be an zero based array of ints in the following format: $iaParts[0] - Right edge of part #1 $iaParts[1] - Right edge of part #2 $iaParts[n] - Right edge of part n
$iaPartWidth | [optional] Size of parts, can be an zero based array of ints in the following format: $iaPartWidth[0] - width part #1 $iaPartWidth[1] - width of part #2 $iaPartWidth[n] - width of part n

Return Value

Success: | True
Failure: | False

Remarks

If an element is -1, the right edge of the corresponding part extends to the border of the window.

Related

_GUICtrlStatusBar_GetParts

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Set Parts", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set/Get parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
$aParts = _GUICtrlStatusBar_GetParts ($hStatus)
For $iI = 1 To $aParts[0]
MemoWrite("Part " & $iI & " width .: " & $aParts[$iI])
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_SetSimple

Function Reference

_GUICtrlStatusBar_SetSimple

Specifies whether a status window displays simple text or displays all window parts

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetSimple($hWnd, $fSimple = True)

Parameters

$hWnd | Handle to the control
$fSimple | Sets the display of the windows True - The window displays simple text False - The window displays multiple parts

Return Value

None.

Remarks

None.

Related

_GUICtrlStatusBar_IsSimple

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Set Simple", 400, 300)

$hStatus = _GUICtrlStatusBar_Create ($hGUI)
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set simple format
MemoWrite("Simple mode on .: " & _GUICtrlStatusBar_IsSimple ($hStatus))
_GUICtrlStatusBar_SetSimple ($hStatus, True)
MemoWrite("Simple mode on .: " & _GUICtrlStatusBar_IsSimple ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_SetText

Function Reference

_GUICtrlStatusBar_SetText

Sets the text in the specified part of a status window

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetText($hWnd, $sText = "", $iPart = 0, $iUFlag = 0)

Parameters

$hWnd | Handle to the control
$sText | The text to display in the part
$iPart | The part to hold the text
$iUFlag | Type of drawing operation. The type can be one of the following values: 0 - The text is drawn with a border to appear lower than the plane of the window $SBT_NOBORDERS - The text is drawn without borders $SBT_OWNERDRAW - The text is drawn by the parent window $SBT_POPOUT - The text is drawn with a border to appear higher than the plane of the window $SBT_RTLREADING - The text will be displayed in the opposite direction to the text in the parent window

Return Value

Success: | True
Failure: | False

Remarks

Set $iPart to $SB_SIMPLEID for simple statusbar

Related

_GUICtrlStatusBar_GetText

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcons[2], $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
$hIcons[0] = _WinAPI_LoadShell32Icon (23)
$hIcons[1] = _WinAPI_LoadShell32Icon (40)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcons[0])
_GUICtrlStatusBar_SetIcon ($hStatus, 1, $hIcons[1])

; Show part text
MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 0))
MemoWrite("Part 2 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 1))

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcons[0])
_WinAPI_DestroyIcon ($hIcons[1])
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Set Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

; Set icons
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")
_GUICtrlStatusBar_SetIcon ($hStatus, 1, 40, "shell32.dll")

; Show part text
MemoWrite("Part 1 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 0))
MemoWrite("Part 2 text ........: " & _GUICtrlStatusBar_GetText ($hStatus, 1))

; Show icon handles
MemoWrite("Part 1 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 0)))
MemoWrite("Part 2 icon handle .: 0x" & Hex(_GUICtrlStatusBar_GetIcon ($hStatus, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_SetTipText

Function Reference

_GUICtrlStatusBar_SetTipText

Sets the ToolTip text for a part

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetTipText($hWnd, $iPart, $sText)

Parameters

$hWnd | Handle to the control
$iPart | Zero based part index
$sText |

Return Value

None.

Remarks

The status bar must have been created with the $SBARS_TOOLTIPS style to enable ToolTips

Related

_GUICtrlStatusBar_GetTipText

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

Example1()
Example2()

Func Example1()

Local $hGUI, $hIcon, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set Tip Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, -1, "", $SBARS_TOOLTIPS)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

; Set icon
$hIcon = _WinAPI_LoadShell32Icon (23)
_GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcon)

; Set text tips
_GUICtrlStatusBar_SetTipText ($hStatus, 0, "Tip works when only icon in part or text exceeds part")
_GUICtrlStatusBar_SetTipText ($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

; Show text tips
MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 0) & @CRLF)
MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Free icons
_WinAPI_DestroyIcon ($hIcon)
GUIDelete()
EndFunc ;==>Example1

Func Example2()

Local $hGUI, $hStatus
Local $aParts[4] = [75, 150, 300, 400]

; Create GUI
$hGUI = GUICreate("(Example 2) StatusBar Set Tip Text", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI, -1, "", $SBARS_TOOLTIPS)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Set parts
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
_GUICtrlStatusBar_SetText ($hStatus, "Force tip to be shown when text is more than fits in the box", 1)

; Set icon
_GUICtrlStatusBar_SetIcon ($hStatus, 0, 23, "shell32.dll")

; Set text tips
_GUICtrlStatusBar_SetTipText ($hStatus, 0, "Tip works when only icon in part or text exceeds part")
_GUICtrlStatusBar_SetTipText ($hStatus, 1, "Force tip to be shown when text is more than fits in the box")

MemoWrite("Hold Mouse Cursor over part to see tip." & @CRLF)

; Show text tips
MemoWrite("Text tip 1 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 0) & @CRLF)
MemoWrite("Text tip 2 .: " & _GUICtrlStatusBar_GetTipText ($hStatus, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example2

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_SetUnicodeFormat

Function Reference

_GUICtrlStatusBar_SetUnicodeFormat

Sets the Unicode character format flag

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_SetUnicodeFormat($hWnd[, $fUnicode = True])

Parameters

$hWnd | Handle to the control
$fUnicode | [optional] Unicode character format flag: True - Control uses Unicode characters False - Control uses ANSI characters

Return Value

Returns the Previous character format flag setting

Remarks

None.

Related

_GUICtrlStatusBar_GetUnicodeFormat

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("(Example 1) StatusBar Set Unicode Format", 400, 300)
$hStatus = _GUICtrlStatusBar_Create ($hGUI)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get/Set Unicode format
MemoWrite("Unicode format .: " & _GUICtrlStatusBar_GetUnicodeFormat ($hStatus))
_GUICtrlStatusBar_SetUnicodeFormat ($hStatus, False)
MemoWrite("Unicode format .: " & _GUICtrlStatusBar_GetUnicodeFormat ($hStatus))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlStatusBar_ShowHide

Function Reference

_GUICtrlStatusBar_ShowHide

Show/Hide the StatusBar control

#Include <GuiStatusBar.au3>
_GUICtrlStatusBar_ShowHide($hWnd, $iState)

Parameters

$hWnd | Handle to the control
$iState | State of the StatusBar, can be the following values: @SW_SHOW @SW_HIDE

Return Value

True: | The control was previously visible
False: | The control was previously hidden

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hGUI, $hStatus
Local $aParts[3] = [75, 150, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Show/Hide", 400, 300)

;===============================================================================
; defaults to 1 part, no text
$hStatus = _GUICtrlStatusBar_Create ($hGUI)
;===============================================================================
_GUICtrlStatusBar_SetParts ($hStatus, $aParts)

GUISetState()

MsgBox (4160, "Information", "Hide StatusBar")
_GUICtrlStatusBar_ShowHide ($hStatus, @SW_HIDE)
MsgBox (4160, "Information", "Show StatusBar")
_GUICtrlStatusBar_ShowHide ($hStatus, @SW_SHOW)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiTab user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiTab.au3>.

User Defined Function | Description
_GUICtrlTab_ClickTab | Clicks a tab
_GUICtrlTab_Create | Create a TabControl control
_GUICtrlTab_DeleteAllItems | Deletes all tabs
_GUICtrlTab_DeleteItem | Deletes a tab
_GUICtrlTab_DeselectAll | Resets tabs, clearing any that were set to the pressed state
_GUICtrlTab_Destroy | Delete the control
_GUICtrlTab_FindTab | Searches for a tab with the specific text
_GUICtrlTab_GetCurFocus | Returns the index of the item that has the focus in a tab control
_GUICtrlTab_GetCurSel | Determines the currently selected tab
_GUICtrlTab_GetDisplayRect | Retrieves the display rectangle of the client area
_GUICtrlTab_GetDisplayRectEx | Retrieves the display rectangle of the client area
_GUICtrlTab_GetExtendedStyle | Retrieves the extended styles that are currently in use
_GUICtrlTab_GetImageList | Retrieves the tab control image list
_GUICtrlTab_GetItem | Retrieves information about a tab
_GUICtrlTab_GetItemCount | Retrieves the number of tabs
_GUICtrlTab_GetItemImage | Retrieves the image index for a tab
_GUICtrlTab_GetItemParam | Retrieves the param data for a tab
_GUICtrlTab_GetItemRect | Retrieves the bounding rectangle for a tab
_GUICtrlTab_GetItemRectEx | Retrieves the bounding rectangle for a tab
_GUICtrlTab_GetItemState | Retrieves the state of a tab
_GUICtrlTab_GetItemText | Retrieves the text of a tab
_GUICtrlTab_GetRowCount | Retrieves the current number of rows of tabs
_GUICtrlTab_GetToolTips | Retrieves the handle to the ToolTip control associated with the control
_GUICtrlTab_GetUnicodeFormat | Retrieves the Unicode character format flag for the control
_GUICtrlTab_HighlightItem | Sets the highlight state of a tab item
_GUICtrlTab_HitTest | Determines where a point lies control
_GUICtrlTab_InsertItem | Inserts a new tab
_GUICtrlTab_RemoveImage | Removes an image from the control's image list
_GUICtrlTab_SetCurFocus | Sets the focus to a specified tab
_GUICtrlTab_SetCurSel | Selects a tab
_GUICtrlTab_SetExtendedStyle | Sets the extended styles that are currently in use
_GUICtrlTab_SetImageList | Sets the image list associated with a tab control
_GUICtrlTab_SetItem | Sets information about a tab
_GUICtrlTab_SetItemImage | Sets the image of a tab
_GUICtrlTab_SetItemParam | Sets the param data of a tab
_GUICtrlTab_SetItemSize | Sets the width and height of tabs in a fixed width or owner drawn control
_GUICtrlTab_SetItemState | Sets the state of a tab
_GUICtrlTab_SetItemText | Sets the text of a tab
_GUICtrlTab_SetMinTabWidth | Sets the minimum width of items in a tab control
_GUICtrlTab_SetPadding | Sets the amount of space around each tab's icon and label
_GUICtrlTab_SetToolTips | Sets the handle to the ToolTip control associated with the control
_GUICtrlTab_SetUnicodeFormat | Sets the Unicode character format flag for the control


Function _GUICtrlTab_ClickTab

Function Reference

_GUICtrlTab_ClickTab

Clicks a tab

#Include <GuiTab.au3>
_GUICtrlTab_ClickTab($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])

Parameters

$hWnd | Handle to control
$iIndex | Specifies the zero based index of the item
$sButton | [optional] Button to click with
$fMove | [optional] If True, the mouse will be moved. If False, the mouse does not move.
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Click Tab", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Click Tab
_GUICtrlTab_ClickTab($hTab, 1, "left", True, 100)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_Create

Function Reference

_GUICtrlTab_Create

Create a TabControl control

#Include <GuiTab.au3>
_GUICtrlTab_Create($hWnd, $iX, $iY[, $iWidth=150[, $iHeight=150[, $iStyle=0x00000040[, $iExStyle=0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control styles:
$TCS_BOTTOM - Tabs appear at the bottom of the control
$TCS_BUTTONS - Tabs appear as buttons, and no border is drawn around the display area
$TCS_FIXEDWIDTH - All tabs are the same width
$TCS_FLATBUTTONS - Selected tabs appear as being indented into the background while other tabs appear
as being on the same plane as the background. This only affects tab controls with the $TCS_BUTTONS style.
$TCS_FOCUSNEVER - The control does not receive the input focus when clicked
$TCS_FOCUSONBUTTONDOWN - The control receives the input focus when clicked
$TCS_FORCEICONLEFT - Icons are aligned with the left edge of each fixed width tab. This style can only be
used with the $TCS_FIXEDWIDTH style.
$TCS_FORCELABELLEFT - Labels are aligned on the left edge of each fixed width tab. The label is displayed
immediately to the right of the icon instead of being centered. This style can only be used with the
$TCS_FIXEDWIDTH style and it implies the $TCS_FORCEICONLEFT style.
$TCS_HOTTRACK - Items under the pointer are automatically highlighted. You can check whether or not
hot tracking is enabled by calling SystemParametersInfo.
$TCS_MULTILINE - Multiple rows of tabs are displayed, if necessary, so all tabs are visible at once
$TCS_MULTISELECT - Multiple tabs can be selected by holding down the CTRL key when clicking. This style
must be used with the $TCS_BUTTONS style.
$TCS_OWNERDRAWFIXED - The parent window is responsible for drawing tabs
$TCS_RAGGEDRIGHT - Rows of tabs will not be stretched to fill the entire width of the control. This
style is the default.
$TCS_RIGHT - Tabs appear vertically on the right side of controls that use the $TCS_VERTICAL
style. This value equals $TCS_BOTTOM. This style is not supported if you use visual styles.
$TCS_RIGHTJUSTIFY - The width of each tab is increased, if necessary, so that each row of tabs fills the
entire width of the tab control. This style is ignored unless the $TCS_MULTILINE style is also specified.
$TCS_SCROLLOPPOSITE - Unneeded tabs scroll to the opposite side of the control when a tab is selected
$TCS_SINGLELINE - Only one row of tabs is displayed. The user can scroll to see more tabs, if
necessary. This style is the default.
$TCS_TABS - Tabs appear as tabs, and a border is drawn around the display area. This style is
the default.
$TCS_TOOLTIPS - The tab control has a ToolTip control associated with it
$TCS_VERTICAL - Tabs appear at the left side of the control with tab text displayed vertically. This
style is valid only when used with the $TCS_MULTILINE style. To make tabs appear on the right side of the
control, also use the $TCS_RIGHT style.
Default: $TCS_HOTTRACK
Forced: $WS_CHILD, $WS_CLIPSIBLINGS, $WS_VISIBLE
$iExStyle [optional] Control extended styles:
$TCS_EX_FLATSEPARATORS - The control will draw separators between the tab items
$TCS_EX_REGISTERDROP - The control generates $TCN_GETOBJECT notification messages to request a drop target
object when an object is dragged over the tab items.

Return Value

Success: | Handle to the control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlTab_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTab

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("(UDF Created) Tab Control Create", 400, 300)
$hTab = _GUICtrlTab_Create($hGUI, 2, 2, 396, 296)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab
$hWndTab = $hTab
If Not IsHWnd($hTab) Then $hWndTab = GUICtrlGetHandle($hTab)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTab
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; The return value is ignored by the tab control
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RELEASEDCAPTURE ; control is releasing mouse capture
_DebugPrint("$NM_RELEASEDCAPTURE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlTab_DeleteAllItems

Function Reference

_GUICtrlTab_DeleteAllItems

Deletes all tabs

#Include <GuiTab.au3>
_GUICtrlTab_DeleteAllItems($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True
Failure: False

Remarks

This does not delete the controls on the tabitems

Related

_GUICtrlTab_DeleteItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Delete All Items", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Delete all tabs
MsgBox(4160, "Information", "Deleting all tabs")
_GUICtrlTab_DeleteAllItems($hTab)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_DeleteItem

Function Reference

_GUICtrlTab_DeleteItem

Deletes a tab

#Include <GuiTab.au3>
_GUICtrlTab_DeleteItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the item

Return Value

Success: True
Failure: False

Remarks

This does not delete the controls on the tabitems

Related

_GUICtrlTab_DeleteAllItems

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Delete Item", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Delete last tabs
MsgBox(4160, "Information", "Deleting last tab")
_GUICtrlTab_DeleteItem($hTab, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_DeselectAll

Function Reference

_GUICtrlTab_DeselectAll

Resets tabs, clearing any that were set to the pressed state

#Include <GuiTab.au3>
_GUICtrlTab_DeselectAll($hWnd[, $fExclude = True])

Parameters

$hWnd | Handle to the control
$fExclude | [optional] Exclusion flag: True - All tabs except for the one currently selected will be reset False - All tab items will be reset

Return Value

None.

Remarks

This only works if $TCS_BUTTONS style flag has been set

Related

_GUICtrlTab_SetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Deselect All", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, $TCS_BUTTONS)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Select 2nd Tab Item
_GUICtrlTab_SetCurSel($hTab, 1)

; Reset tab selection
MsgBox(4160, "Information", "Resetting tab selection")
_GUICtrlTab_DeselectAll($hTab, False)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_Destroy

Function Reference

_GUICtrlTab_Destroy

Delete the control

#Include <GuiTab.au3>
_GUICtrlTab_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Tab created with _GUICtrlTab_Create

Related

_GUICtrlTab_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hTab

; Create GUI
$hGUI = GUICreate("(UDF Created) Tab Control Destroy", 400, 300)
$hTab = _GUICtrlTab_Create($hGUI, 2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

MsgBox(4160, "Information", "Destroy Tab Control")
_GUICtrlTab_Destroy($hTab)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_FindTab

Function Reference

_GUICtrlTab_FindTab

Searches for a tab with the specific text

#Include <GuiTab.au3>
_GUICtrlTab_FindTab($hWnd, $sText[, $fInStr = False[, $iStart = 0]])

Parameters

$hWnd | Handle to the control
$sText | Text to search for
$fInStr | [optional] If True, the text can be anywhere in the tab's text.
$iStart | [optional] Zero based index of the tab to start searching from

Return Value

Success: | The zero based tab index that matches the search
Failure: | -1

Remarks

The search is case insensitive

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Find Tab", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Search for "Tab 2"
MsgBox(4160, "Information", '"Tab 2" at index ' & _GUICtrlTab_FindTab($hTab, "Tab 2"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetCurFocus

Function Reference

_GUICtrlTab_GetCurFocus

Returns the index of the item that has the focus in a tab control

#Include <GuiTab.au3>
_GUICtrlTab_GetCurFocus($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The zero based index of the tab item that has the focus
Failure: -1

Remarks

The item that has the focus may be different than the selected item

Related

_GUICtrlTab_SetCurFocus

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Current Focus", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set current focus
_GUICtrlTab_SetCurFocus($hTab, 1)
MsgBox(4160, "Information", "Current Focus: " & _GUICtrlTab_GetCurFocus($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetCurSel

Function Reference

_GUICtrlTab_GetCurSel

Determines the currently selected tab

#Include <GuiTab.au3>
_GUICtrlTab_GetCurSel($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The zero based index of the selected tab
Failure: -1

Remarks

None.

Related

_GUICtrlTab_SetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Current Selected", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set current selection
_GUICtrlTab_SetCurSel($hTab, 1)
MsgBox(4160, "Information", "Current Selection: " & _GUICtrlTab_GetCurSel($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetDisplayRect

Function Reference

_GUICtrlTab_GetDisplayRect

Retrieves the display rectangle of the client area

#Include <GuiTab.au3>
_GUICtrlTab_GetDisplayRect($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] = X coordinate of the upper left corner of the rectangle
[1] = Y coordinate of the upper left corner of the rectangle
[2] = X coordinate of the lower right corner of the rectangle
[3] = Y coordinate of the lower right corner of the rectangle

Remarks

Use this function to obtain the coordinates, in pixels, of the portion of the tab control that represents the
contents of the tab pages. The appearance of this portion of the tab control does not change when different
tabs are selected.

Related

_GUICtrlTab_GetDisplayRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $sRect, $hTab

; Create GUI
GUICreate("Tab Control Get Display Rect", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get display rectangle
$aRect = _GUICtrlTab_GetDisplayRect(GUICtrlGetHandle($hTab))
$sRect = StringFormat("[%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3])
MsgBox(4160, "Information", "Display rectangle: " & $sRect)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetDisplayRectEx

Function Reference

_GUICtrlTab_GetDisplayRectEx

Retrieves the display rectangle of the client area

#Include <GuiTab.au3>
_GUICtrlTab_GetDisplayRectEx($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: $tagRECT structure that receives the rectangle of the tab, in viewport coordinates

Remarks

Use this function to obtain the coordinates, in pixels, of the portion of the tab control that represents the
contents of the tab pages. The appearance of this portion of the tab control does not change when different
tabs are selected.

Related

_GUICtrlTab_GetDisplayRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $sRect, $hTab

; Create GUI
GUICreate("Tab Control Get Display RectEx", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get display rectangle
$tRect = _GUICtrlTab_GetDisplayRectEx(GUICtrlGetHandle($hTab))
$sRect = StringFormat("[%d, %d, %d, %d]", DllStructGetData($tRect, "Left"), _
DllStructGetData($tRect, "Top"), _
DllStructGetData($tRect, "Right"), _
DllStructGetData($tRect, "Bottom"))
MsgBox(4160, "Information", "Display rectangle: " & $sRect)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetExtendedStyle

Function Reference

_GUICtrlTab_GetExtendedStyle

Retrieves the extended styles that are currently in use

#Include <GuiTab.au3>
_GUICtrlTab_GetExtendedStyle($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Extended styles currently in use:
$TCS_EX_FLATSEPARATORS - The control will draw separators between the tab items
$TCS_EX_REGISTERDROP - The control generates $TCN_GETOBJECT notification messages to request a drop target
object when an object is dragged over the tab items.

Remarks

None.

Related

_GUICtrlTab_SetExtendedStyle

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Extended Style", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, BitOR($TCS_BUTTONS, $TCS_FLATBUTTONS))
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set extended styles
_GUICtrlTab_SetExtendedStyle($hTab, $TCS_EX_FLATSEPARATORS)
MsgBox(4160, "Information", "Extended styles: 0x" & Hex(_GUICtrlTab_GetExtendedStyle($hTab)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetImageList

Function Reference

_GUICtrlTab_GetImageList

Retrieves the tab control image list

#Include <GuiTab.au3>
_GUICtrlTab_GetImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the image list
Failure: 0

Remarks

None.

Related

_GUICtrlTab_SetImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Get Image List", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1", 0)
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2", 1)
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3", 2)

; Show image list handle
MsgBox(4160, "Information", "Image list handle: 0x" & Hex(_GUICtrlTab_GetImageList($hTab)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItem

Function Reference

_GUICtrlTab_GetItem

Retrieves information about a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Array with the following format:
[0] - Item state flags:
$TCIS_BUTTONPRESSED - The tab control item is selected
$TCIS_HIGHLIGHTED - The tab control item is highlighted
[1] - Item text
[2] - Zero based item image index or -1 if item has no image
[3] - Application-defined data

Remarks

None.

Related

_GUICtrlTab_SetItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
Local $aItem, $hTab, $hImage, $tab0

; Create GUI
GUICreate("Tab Control Get Item", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
$tab0 = GUICtrlCreateTabItem("Tab 0")
$iMemo = GUICtrlCreateEdit("", 4, 28, 390, 265)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUICtrlCreateTabItem("")
GUICtrlCreateTabItem("Tab 1")
GUICtrlCreateTabItem("")
GUICtrlCreateTabItem("Tab 2")
GUICtrlCreateTabItem("")
GUICtrlSetState($tab0, $GUI_SHOW)

; Get/Set tab 0
_GUICtrlTab_SetItem($hTab, 0, "New Text", BitOR($TCIS_BUTTONPRESSED, $TCIS_BUTTONPRESSED), 2)
_GUICtrlTab_SetItem($hTab, 1, -1, -1, 4)
_GUICtrlTab_SetItem($hTab, 2, -1, -1, 5)
GUISetState(@SW_LOCK)
For $x = 0 To 2
$aItem = _GUICtrlTab_GetItem($hTab, $x)
MemoWrite("Tab Item " & $x & @CRLF & "---------------------")
For $y = 0 To 3
MemoWrite("$aItem[" & $y & "]: " & $aItem[$y])
Next
MemoWrite(@CRLF & "---------------------")
Next
GUISetState(@SW_UNLOCK)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlTab_GetItemCount

Function Reference

_GUICtrlTab_GetItemCount

Retrieves the number of tabs

#Include <GuiTab.au3>
_GUICtrlTab_GetItemCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Returns the number of tabs

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Item Count", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Show number of tabs
MsgBox(4160, "Information", "Number of tabs: " & _GUICtrlTab_GetItemCount($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItemImage

Function Reference

_GUICtrlTab_GetItemImage

Retrieves the image index for a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Zero based image index of the tab

Remarks

None.

Related

_GUICtrlTab_SetItemImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Get Item Image", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 2 image
_GUICtrlTab_SetItemImage($hTab, 1, 1)
MsgBox(4160, "Information", "Tab 2 image index: " & _GUICtrlTab_GetItemImage($hTab, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItemParam

Function Reference

_GUICtrlTab_GetItemParam

Retrieves the param data for a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemParam($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Tab param data

Remarks

None.

Related

_GUICtrlTab_SetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

; Warning do not use SetItemParam on items created with GUICtrlCreateTabItem
; Param is the controlId for items created with built-in functions

_Main()

Func _Main()
Local $hGUI, $hTab

; Create GUI
$hGUI = GUICreate("(UDF Created) Tab Control Get Item Param", 400, 300)
$hTab = _GUICtrlTab_Create($hGUI, 2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 1 parameter
_GUICtrlTab_SetItemParam($hTab, 0, 1234)
MsgBox(4160, "Information", "Tab 1 parameter: " & _GUICtrlTab_GetItemParam($hTab, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItemRect

Function Reference

_GUICtrlTab_GetItemRect

Retrieves the bounding rectangle for a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemRect($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item item

Return Value

Success: Array with the following format:
[0] = X coordinate of the upper left corner of the rectangle
[1] = Y coordinate of the upper left corner of the rectangle
[2] = X coordinate of the lower right corner of the rectangle
[3] = Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlTab_GetItemRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aRect, $sRect, $hTab

; Create GUI
GUICreate("Tab Control Get Item Rect", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get tab 0 rectangle
$aRect = _GUICtrlTab_GetItemRect($hTab, 0)
$sRect = StringFormat("[%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3])
MsgBox(4160, "Information", "Tab 0 rectangle: " & $sRect)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItemRectEx

Function Reference

_GUICtrlTab_GetItemRectEx

Retrieves the bounding rectangle for a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemRectEx($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item item

Return Value

Success: $tagRECT structure that receives the rectangle of the tab, in viewport coordinates

Remarks

None.

Related

_GUICtrlTab_GetItemRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $tRect, $sRect, $hTab

; Create GUI
GUICreate("Tab Control Get Item RectEx", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get item 0 rectangle
$tRect = _GUICtrlTab_GetItemRectEx($hTab, 0)
$sRect = StringFormat("[%d, %d, %d, %d]", DllStructGetData($tRect, "Left"), _
DllStructGetData($tRect, "Top"), _
DllStructGetData($tRect, "Right"), _
DllStructGetData($tRect, "Bottom"))
MsgBox(4160, "Information", "Display rectangle: " & $sRect)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetItemState

Function Reference

_GUICtrlTab_GetItemState

Retrieves the state of a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemState($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Integer with the following tab states:
$TCIS_BUTTONPRESSED - The tab control item is selected
$TCIS_HIGHLIGHTED - The tab control item is highlighted

Remarks

None.

Related

_GUICtrlTab_SetItemState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Item State", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, $TCS_BUTTONS)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 2 state
_GUICtrlTab_SetItemState($hTab, 1, $TCIS_BUTTONPRESSED)
MsgBox(4160, "Information", "Tab 2 state: " & _ExplainItemState(_GUICtrlTab_GetItemState($hTab, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _ExplainItemState($iState)
Local $sText = ""
If $iState = 0 Then $sText &= "No state set on this item" & @LF
If BitAND($iState, $TCIS_BUTTONPRESSED) Then $sText &= "Button Pressed" & @LF
If BitAND($iState, $TCIS_HIGHLIGHTED) Then $sText &= "Button Highlighted"
Return $sText
EndFunc ;==>_ExplainItemState


Function _GUICtrlTab_GetItemText

Function Reference

_GUICtrlTab_GetItemText

Retrieves the text of a tab

#Include <GuiTab.au3>
_GUICtrlTab_GetItemText($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: Tab text

Remarks

None.

Related

_GUICtrlTab_SetItemText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Item Text", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 1 text
_GUICtrlTab_SetItemText($hTab, 0, "New Text")
MsgBox(4160, "Information", "Tab 1 text: " & _GUICtrlTab_GetItemText($hTab, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetRowCount

Function Reference

_GUICtrlTab_GetRowCount

Retrieves the current number of rows of tabs

#Include <GuiTab.au3>
_GUICtrlTab_GetRowCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Number of rows of tabs

Remarks

Only tab controls that have the $TCS_MULTILINE style can have multiple rows of tabs

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Row Count", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, $TCS_MULTILINE)
GUISetState()

; Add tabs
For $x = 0 To 10
_GUICtrlTab_InsertItem($hTab, $x, "Tab " & $x + 1)
Next

; Get row count
MsgBox(4160, "Information", "Row count: " & _GUICtrlTab_GetRowCount($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetToolTips

Function Reference

_GUICtrlTab_GetToolTips

Retrieves the handle to the ToolTip control associated with the control

#Include <GuiTab.au3>
_GUICtrlTab_GetToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the ToolTip control
Failure: 0

Remarks

None.

Related

_GUICtrlTab_SetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <GuiToolTip.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTool, $hTab

; Create GUI
GUICreate("Tab Control Get Tool Tips", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tooltip
$hTool = _GUIToolTip_Create(GUICtrlGetHandle($hTab))
_GUICtrlTab_SetToolTips($hTab, $hTool)
MsgBox(4160, "Information", "ToolTip handle: 0x" & _GUICtrlTab_GetToolTips($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_GetUnicodeFormat

Function Reference

_GUICtrlTab_GetUnicodeFormat

Retrieves the Unicode character format flag for the control

#Include <GuiTab.au3>
_GUICtrlTab_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Control is using Unicode characters
False: Control is using ANSI characters

Remarks

None.

Related

_GUICtrlTab_SetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $bFormat, $hTab

; Create GUI
GUICreate("Tab Control Get Unicode Format", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set Unicode format
$bFormat = _GUICtrlTab_GetUnicodeFormat($hTab)
MsgBox(4160, "Information", "Unicode format: " & $bFormat)
_GUICtrlTab_SetUnicodeFormat($hTab, Not $bFormat)
MsgBox(4160, "Information", "Unicode format: " & _GUICtrlTab_GetUnicodeFormat($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_HighlightItem

Function Reference

_GUICtrlTab_HighlightItem

Sets the highlight state of a tab item

#Include <GuiTab.au3>
_GUICtrlTab_HighlightItem($hWnd, $iIndex[, $fHighlight = True])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$fHighlight | [optional] If True, the tab is highlighted, otherwise the tab is reset

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTab_SetCurSel

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Get Highlight Item", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, $TCS_BUTTONS)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Highlight tab 2
_GUICtrlTab_HighlightItem($hTab, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_HitTest

Function Reference

_GUICtrlTab_HitTest

Determines where a point lies control

#Include <GuiTab.au3>
_GUICtrlTab_HitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position to test
$iY | Y position to test

Return Value

Success: Array with the following format:
[0] - Zero based index of the tab, or -1 if no tab is at the position
[1] - Results of the hit test:
1 - The position is not over a tab
2 - The position is over a tab's icon
4 - The position is over a tab's text

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aHit, $hTab

; Create GUI
GUICreate("Tab Control HitTest", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Do a hit test
$aHit = _GUICtrlTab_HitTest($hTab, 80, 10)
MsgBox(4160, "Information", "Point [80,10] is over tab " & $aHit[0])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_InsertItem

Function Reference

_GUICtrlTab_InsertItem

Inserts a new tab

#Include <GuiTab.au3>
_GUICtrlTab_InsertItem($hWnd, $iIndex, $sText[, $iImage = -1[, $iParam = 0]])

Parameters

$hWnd | Handle to the control
$iIndex | Index of the new tab
$sText | Tab text
$iImage | [optional] Zero based tab image index
$iParam | [optional] Application defined data

Return Value

Success: | The zero based index of the new tab
Failure: | -1

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Insert Item", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_RemoveImage

Function Reference

_GUICtrlTab_RemoveImage

Removes an image from the control's image list

#Include <GuiTab.au3>
_GUICtrlTab_RemoveImage($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the image to remove

Return Value

None.

Remarks

The tab control updates each tab's image index, so each tab remains associated with the same image as before.
If a tab is using the image being removed, the tab will be set to have no image.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Remove Image", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1", 0)
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2", 1)
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3", 2)

; Remove second image
MsgBox(4160, "Information", "Removing second image in list")
_GUICtrlTab_RemoveImage($hTab, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetCurFocus

Function Reference

_GUICtrlTab_SetCurFocus

Sets the focus to a specified tab

#Include <GuiTab.au3>
_GUICtrlTab_SetCurFocus($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

None.

Remarks

If the tab control has the $TCS_BUTTONS style (button mode), the tab with the focus may be
different from the selected tab. For example, when a tab is selected, the user can press the
arrow keys to set the focus to a different tab without changing the selected tab. In button
mode, $TCM_SETCURFOCUS sets the input focus to the button associated with the specified tab,
but it does not change the selected tab.

If the tab control does not have the $TCS_BUTTONS style, changing the focus also changes the selected tab.

Related

_GUICtrlTab_GetCurFocus

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Current Focus", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set current focus
_GUICtrlTab_SetCurFocus($hTab, 1)
MsgBox(4160, "Information", "Current Focus: " & _GUICtrlTab_GetCurFocus($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetCurSel

Function Reference

_GUICtrlTab_SetCurSel

Selects a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetCurSel($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index

Return Value

Success: The index of the previously selected tab
Failure: -1

Remarks

A tab control does not send a $TCN_SELCHANGING or $TCN_SELCHANGE notification message when
a tab is selected using this function.

Related

_GUICtrlTab_GetCurSel, _GUICtrlTab_DeselectAll, _GUICtrlTab_HighlightItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Current Selected", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set current selection
_GUICtrlTab_SetCurSel($hTab, 1)
MsgBox(4160, "Information", "Current Selection: " & _GUICtrlTab_GetCurSel($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetExtendedStyle

Function Reference

_GUICtrlTab_SetExtendedStyle

Sets the extended styles that are currently in use

#Include <GuiTab.au3>
_GUICtrlTab_SetExtendedStyle($hWnd, $iStyle)

Parameters

$hWnd | Handle to the control
$iStyle | Extended styles currently in use: $TCS_EX_FLATSEPARATORS - The control will draw separators between the tab items $TCS_EX_REGISTERDROP - The control generates TCN_GETOBJECT notification messages to request a drop target object when an object is dragged over the tab items.

Return Value

Success: Previous extended styles

Remarks

None.

Related

_GUICtrlTab_GetExtendedStyle

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Extended Style", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, BitOR($TCS_BUTTONS, $TCS_FLATBUTTONS))
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set extended styles
_GUICtrlTab_SetExtendedStyle($hTab, $TCS_EX_FLATSEPARATORS)
MsgBox(4160, "Information", "Extended styles: 0x" & Hex(_GUICtrlTab_GetExtendedStyle($hTab)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetImageList

Function Reference

_GUICtrlTab_SetImageList

Sets the image list associated with a tab control

#Include <GuiTab.au3>
_GUICtrlTab_SetImageList($hWnd, $hImage)

Parameters

$hWnd | Handle to the control
$hImage | Handle to the image list to assign to the tab control

Return Value

Success: Handle to the previous image list

Remarks

None.

Related

_GUICtrlTab_GetImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Set Image List", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1", 0)
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2", 1)
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3", 2)

; Show image list handle
MsgBox(4160, "Information", "Image list handle: 0x" & Hex(_GUICtrlTab_GetImageList($hTab)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetItem

Function Reference

_GUICtrlTab_SetItem

Sets information about a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetItem($hWnd, $iIndex[, $sText = -1[, $iState = -1[, $iImage = -1[, $iParam = -1]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$sText | [optional] Item text
$iState | [optional] Item state
$iImage | [optional] Zero based item image
$iParam | [optional] Application defined data

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTab_GetItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $aItem, $hTab

; Create GUI
GUICreate("Tab Control Set Item", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 1 parameter
_GUICtrlTab_SetItem($hTab, 0, -1, -1, -1, 1234)
$aItem = _GUICtrlTab_GetItem($hTab, 0)
MsgBox(4160, "Information", "Tab 1 parameter: " & $aItem[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetItemImage

Function Reference

_GUICtrlTab_SetItemImage

Sets the image of a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetItemImage($hWnd, $iIndex, $iImage)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$iImage | Zero based item image

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlTab_GetItemImage

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Set Item Image", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 2 image
_GUICtrlTab_SetItemImage($hTab, 1, 1)
MsgBox(4160, "Information", "Tab 2 image index: " & _GUICtrlTab_GetItemImage($hTab, 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetItemParam

Function Reference

_GUICtrlTab_SetItemParam

Sets the param data of a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetItemParam($hWnd, $iIndex, $iParam)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$iParam | Application defined data

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlTab_GetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

; Warning do not use SetItemParam on items created with GUICtrlCreateTabItem
; Param is the controlId for items created with built-in functions

_Main()

Func _Main()
Local $hGUI, $hTab

; Create GUI
$hGUI = GUICreate("(UDF Created) Tab Control Set Item Param", 400, 300)
$hTab = _GUICtrlTab_Create($hGUI, 2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 1 parameter
_GUICtrlTab_SetItemParam($hTab, 0, 1234)
MsgBox(4160, "Information", "Tab 1 parameter: " & _GUICtrlTab_GetItemParam($hTab, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetItemSize

Function Reference

_GUICtrlTab_SetItemSize

Sets the width and height of tabs in a fixed width or owner drawn control

#Include <GuiTab.au3>
_GUICtrlTab_SetItemSize($hWnd, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the control
$iWidth | New width, in pixels
$iHeight | New height, in pixels

Return Value

Success: Returns the old width and height. The width is in the low order word of the return value, and
the height is in the high-order word.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Item Size", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, BitOR($TCS_BUTTONS, $TCS_FIXEDWIDTH))
_GUICtrlTab_SetItemSize($hTab, 70, 40)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetItemState

Function Reference

_GUICtrlTab_SetItemState

Sets the state of a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetItemState($hWnd, $iIndex, $iState)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$iState | Item state. Can be a combination of: $TCIS_BUTTONPRESSED - The tab control item is selected $TCIS_HIGHLIGHTED - The tab control item is highlighted

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlTab_GetItemState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Item State", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296, $TCS_BUTTONS)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 2 state
_GUICtrlTab_SetItemState($hTab, 1, $TCIS_BUTTONPRESSED)
MsgBox(4160, "Information", "Tab 2 state: " & _ExplainItemState(_GUICtrlTab_GetItemState($hTab, 1)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _ExplainItemState($iState)
Local $sText = ""
If $iState = 0 Then $sText &= "No state set on this item" & @LF
If BitAND($iState, 1) Then $sText &= "Button Pressed" & @LF
If BitAND($iState, 2) Then $sText &= "Button Highlighted"
Return $sText
EndFunc ;==>_ExplainItemState


Function _GUICtrlTab_SetItemText

Function Reference

_GUICtrlTab_SetItemText

Sets the text of a tab

#Include <GuiTab.au3>
_GUICtrlTab_SetItemText($hWnd, $iIndex, $sText)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based item index
$sText | Item text

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlTab_GetItemText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Item Text", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tab 1 text
_GUICtrlTab_SetItemText($hTab, 0, "New Text")
MsgBox(4160, "Information", "Tab 1 text: " & _GUICtrlTab_GetItemText($hTab, 0))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetMinTabWidth

Function Reference

_GUICtrlTab_SetMinTabWidth

Sets the minimum width of items in a tab control

#Include <GuiTab.au3>
_GUICtrlTab_SetMinTabWidth($hWnd, $iMinWidth)

Parameters

$hWnd | Handle to the control
$iMinWidth | Minimum width to be set for a tab control item. If -1, the control will use the default width.

Return Value

Success: The previous minimum tab width

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTab

; Create GUI
GUICreate("Tab Control Set Min Tab Width", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_SetMinTabWidth($hTab, 80)
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetPadding

Function Reference

_GUICtrlTab_SetPadding

Sets the amount of space around each tab's icon and label

#Include <GuiTab.au3>
_GUICtrlTab_SetPadding($hWnd, $iHorz, $iVert)

Parameters

$hWnd | Handle to the control
$iHorz | Amount of horizontal padding, in pixels
$iVert | Amount of vertical padding, in pixels

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hImage, $hTab

; Create GUI
$hGUI = GUICreate("Tab Control Set Padding", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Create images
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
_GUICtrlTab_SetImageList($hTab, $hImage)

; Add tabs
_GUICtrlTab_SetPadding($hTab, 20, 4)
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1", 0)
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2", 1)
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3", 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetToolTips

Function Reference

_GUICtrlTab_SetToolTips

Sets the handle to the ToolTip control associated with the control

#Include <GuiTab.au3>
_GUICtrlTab_SetToolTips($hWnd, $hToolTip)

Parameters

$hWnd | Handle to the control
$hToolTip | Handle to the ToolTip control

Return Value

None.

Remarks

None.

Related

_GUICtrlTab_GetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <GuiToolTip.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hTool, $hTab

; Create GUI
GUICreate("Tab Control Set Tool Tips", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set tooltip
$hTool = _GUIToolTip_Create(GUICtrlGetHandle($hTab))
_GUICtrlTab_SetToolTips($hTab, $hTool)
MsgBox(4160, "Information", "ToolTip handle: 0x" & _GUICtrlTab_GetToolTips($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTab_SetUnicodeFormat

Function Reference

_GUICtrlTab_SetUnicodeFormat

Sets the Unicode character format flag for the control

#Include <GuiTab.au3>
_GUICtrlTab_SetUnicodeFormat($hWnd, $fUnicode)

Parameters

$hWnd | Handle to the control
$fUnicode | Unicode character flag: True - Control uses Unicode characters False - Control uses ANSI characters

Return Value

Success: Previous character format flag setting

Remarks

None.

Related

_GUICtrlTab_GetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $bFormat, $hTab

; Create GUI
GUICreate("Tab Control Set Unicode Format", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState()

; Add tabs
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")

; Get/Set Unicode format
$bFormat = _GUICtrlTab_GetUnicodeFormat($hTab)
MsgBox(4160, "Information", "Unicode format: " & $bFormat)
_GUICtrlTab_SetUnicodeFormat($hTab, Not $bFormat)
MsgBox(4160, "Information", "Unicode format: " & _GUICtrlTab_GetUnicodeFormat($hTab))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

GuiToolbar user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiToolbar.au3>.

User Defined Function | Description
_GUICtrlToolbar_AddBitmap | Adds images to the image list
_GUICtrlToolbar_AddButton | Adds a button
_GUICtrlToolbar_AddButtonSep | Adds a separator
_GUICtrlToolbar_AddString | Adds a new string to the toolbar's string pool
_GUICtrlToolbar_ButtonCount | Retrieves a count of the buttons
_GUICtrlToolbar_CheckButton | Checks or unchecks a given button
_GUICtrlToolbar_ClickAccel | Clicks a specific button using it's accelerator
_GUICtrlToolbar_ClickButton | Clicks a specific button
_GUICtrlToolbar_ClickIndex | Clicks a specific button using it's index
_GUICtrlToolbar_CommandToIndex | Retrieves the index for the button associated with the specified command identifier
_GUICtrlToolbar_Create | Create a Toolbar control
_GUICtrlToolbar_Customize | Displays the Customize Toolbar dialog box
_GUICtrlToolbar_DeleteButton | Deletes a button from the toolbar
_GUICtrlToolbar_Destroy | Delete the control
_GUICtrlToolbar_EnableButton | Enables or disables the specified button
_GUICtrlToolbar_FindToolbar | Finds a specific toolbar
_GUICtrlToolbar_GetAnchorHighlight | Retrieves the anchor highlight setting
_GUICtrlToolbar_GetBitmapFlags | Retrieves the flags that describe the type of bitmap to be used
_GUICtrlToolbar_GetButtonBitmap | Retrieves the index of the bitmap associated with a button
_GUICtrlToolbar_GetButtonInfo | Retrieves information for a button
_GUICtrlToolbar_GetButtonInfoEx | Retrieves information for a button
_GUICtrlToolbar_GetButtonParam | Retrieves the button param value
_GUICtrlToolbar_GetButtonRect | Retrieves the bounding rectangle for a button
_GUICtrlToolbar_GetButtonRectEx | Retrieves the bounding rectangle for a specified toolbar button
_GUICtrlToolbar_GetButtonSize | Retrieves the current button width and height, in pixels
_GUICtrlToolbar_GetButtonState | Retrieves information about the state of the specified button
_GUICtrlToolbar_GetButtonStyle | Retrieves the style flags of a button
_GUICtrlToolbar_GetButtonText | Retrieves the display text of a button
_GUICtrlToolbar_GetColorScheme | Retrieves the color scheme information
_GUICtrlToolbar_GetDisabledImageList | Retrieves the disabled button image list
_GUICtrlToolbar_GetExtendedStyle | Retrieves the extended styles
_GUICtrlToolbar_GetHotImageList | Retrieves the hot button image list
_GUICtrlToolbar_GetHotItem | Retrieves the index of the hot item
_GUICtrlToolbar_GetImageList | Retrieves the default state image list
_GUICtrlToolbar_GetInsertMark | Retrieves the current insertion mark
_GUICtrlToolbar_GetInsertMarkColor | Retrieves the color used to draw the insertion mark
_GUICtrlToolbar_GetMaxSize | Retrieves the total size of all of the visible buttons and separators
_GUICtrlToolbar_GetMetrics | Retrieves the metrics of a toolbar control
_GUICtrlToolbar_GetPadding | Retrieves the horizontal and vertical padding
_GUICtrlToolbar_GetRows | Retrieves the number of rows of buttons
_GUICtrlToolbar_GetString | Retrieves a string from the string pool
_GUICtrlToolbar_GetStyle | Retrieves the styles currently in use for a toolbar control
_GUICtrlToolbar_GetStyleAltDrag | Indicates that the control allows buttons to be dragged
_GUICtrlToolbar_GetStyleCustomErase | Indicates that the control generates NM_CUSTOMDRAW notification messages
_GUICtrlToolbar_GetStyleFlat | Indicates that the control is flat
_GUICtrlToolbar_GetStyleList | Indicates that the control has button text to the right of the bitmap
_GUICtrlToolbar_GetStyleRegisterDrop | Indicates that the control generates TBN_GETOBJECT notification messages
_GUICtrlToolbar_GetStyleToolTips | Indicates that the control has tooltips
_GUICtrlToolbar_GetStyleTransparent | Indicates that the control is transparent
_GUICtrlToolbar_GetStyleWrapable | Indicates that the control is wrapable
_GUICtrlToolbar_GetTextRows | Retrieves the maximum number of text rows that can be displayed on a button
_GUICtrlToolbar_GetToolTips | Retrieves the handle to the ToolTip control
_GUICtrlToolbar_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlToolbar_HideButton | Hides or shows the specified button
_GUICtrlToolbar_HighlightButton | Sets the highlight state of a given button control
_GUICtrlToolbar_HitTest | Determines where a point lies within the control
_GUICtrlToolbar_IndexToCommand | Retrieves the command identifier associated with the button
_GUICtrlToolbar_InsertButton | Inserts a button
_GUICtrlToolbar_InsertMarkHitTest | Retrieves the insertion mark information for a point
_GUICtrlToolbar_IsButtonChecked | Indicates whether the specified button is checked
_GUICtrlToolbar_IsButtonEnabled | Indicates whether the specified button is enabled
_GUICtrlToolbar_IsButtonHidden | Indicates whether the specified button is hidden
_GUICtrlToolbar_IsButtonHighlighted | Indicates whether the specified button is hilighted
_GUICtrlToolbar_IsButtonIndeterminate | Indicates whether the specified button is indeterminate
_GUICtrlToolbar_IsButtonPressed | Indicates that the button is being clicked
_GUICtrlToolbar_LoadBitmap | Adds a bitmap to the image list from a file
_GUICtrlToolbar_LoadImages | Loads system defined button images into a toolbar control's image list
_GUICtrlToolbar_MapAccelerator | Determines the ID of the button that corresponds to the specified accelerator
_GUICtrlToolbar_MoveButton | Moves a button from one index to another
_GUICtrlToolbar_PressButton | Presses or releases the specified button
_GUICtrlToolbar_SetAnchorHighlight | Sets the anchor highlight setting
_GUICtrlToolbar_SetBitmapSize | Sets the size of the bitmapped images to be added to a toolbar
_GUICtrlToolbar_SetButtonBitMap | Sets the index of the bitmap associated with a button
_GUICtrlToolbar_SetButtonInfo | Sets extended information for a button
_GUICtrlToolbar_SetButtonInfoEx | Sets extended information for a button
_GUICtrlToolbar_SetButtonParam | Sets the button param value
_GUICtrlToolbar_SetButtonSize | Sets the size of the buttons to be added to a toolbar
_GUICtrlToolbar_SetButtonState | Sets information about the state of the specified button
_GUICtrlToolbar_SetButtonStyle | Sets the style flags of a button
_GUICtrlToolbar_SetButtonText | Sets the display text of a button
_GUICtrlToolbar_SetButtonWidth | Sets the minimum and maximum button widths in the toolbar control
_GUICtrlToolbar_SetCmdID | Sets the command identifier of a toolbar button
_GUICtrlToolbar_SetColorScheme | Sets the color scheme information
_GUICtrlToolbar_SetDisabledImageList | Sets the disabled image list
_GUICtrlToolbar_SetDrawTextFlags | Sets the text drawing flags for the toolbar
_GUICtrlToolbar_SetExtendedStyle | Sets the extended styles control
_GUICtrlToolbar_SetHotImageList | Sets the hot button image list
_GUICtrlToolbar_SetHotItem | Sets the hot item
_GUICtrlToolbar_SetImageList | Sets the default button image list
_GUICtrlToolbar_SetIndent | Sets the indentation for the first button control
_GUICtrlToolbar_SetIndeterminate | Sets or clears the indeterminate state of the specified button
_GUICtrlToolbar_SetInsertMark | Sets the current insertion mark for the toolbar
_GUICtrlToolbar_SetInsertMarkColor | Sets the color used to draw the insertion mark
_GUICtrlToolbar_SetMaxTextRows | Sets the maximum number of text rows displayed button
_GUICtrlToolbar_SetMetrics | Retrieves the metrics of a toolbar control
_GUICtrlToolbar_SetPadding | Sets the padding control
_GUICtrlToolbar_SetParent | Sets the window to which the control sends notification messages
_GUICtrlToolbar_SetRows | Sets the number of rows of buttons
_GUICtrlToolbar_SetStyle | Sets the style control
_GUICtrlToolbar_SetStyleAltDrag | Sets whether that the control allows buttons to be dragged
_GUICtrlToolbar_SetStyleCustomErase | Sets whether the control generates NM_CUSTOMDRAW notification messages
_GUICtrlToolbar_SetStyleFlat | Sets whether the control is flat
_GUICtrlToolbar_SetStyleList | Sets whether the control has button text to the right of the bitmap
_GUICtrlToolbar_SetStyleRegisterDrop | Sets whether the control generates TBN_GETOBJECT notification messages
_GUICtrlToolbar_SetStyleToolTips | Sets whether the control has tooltips
_GUICtrlToolbar_SetStyleTransparent | Sets whether the control is transparent
_GUICtrlToolbar_SetStyleWrapable | Sets whether the control is wrapable
_GUICtrlToolbar_SetToolTips | Associates a ToolTip control with a toolbar
_GUICtrlToolbar_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlToolbar_SetWindowTheme | Sets the visual style


Function _GUICtrlToolbar_AddBitmap

Function Reference

_GUICtrlToolbar_AddBitmap

Adds images to the image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_AddBitmap($hWnd, $iButtons, $hInst, $iID)

Parameters

$hWnd | Handle to the control
$iButtons | Number of button images in the bitmap
$hInst | Handle to the module instance with the executable file that contains a bitmap resource. To use bitmap handles instead of resource IDs, set this to 0. You can add system defined button bitmaps to the list by specifying -1 as the hInst member and one of the following values as the iID member: $IDB_STD_LARGE_COLOR - Adds large, color standard bitmaps $IDB_STD_SMALL_COLOR - Adds small, color standard bitmaps $IDB_VIEW_LARGE_COLOR - Adds large, color view bitmaps $IDB_VIEW_SMALL_COLOR - Adds small, color view bitmaps
$iID | If hInst is 0, set this member to the bitmap handle of the bitmap with the button images. Otherwise, set it to the resource identifier of the bitmap with the button images. The following are resource IDs to the standard and view bitmaps: $STD_COPY - Copy image $STD_CUT - Cut image $STD_DELETE - Delete image $STD_FILENEW - New file image $STD_FILEOPEN - Open file image $STD_FILESAVE - Save file image $STD_FIND - Find image $STD_HELP - Help image $STD_PASTE - Paste image $STD_PRINT - Print image $STD_PRINTPRE - Print preview image $STD_PROPERTIES - Properties image $STD_REDOW - Redo image $STD_REPLACE - Replace image $STD_UNDO - Undo image $VIEW_DETAILS - View details image $VIEW_LARGEICONS - View large icons image $VIEW_LIST - View list image $VIEW_SMALLICONS - View small icons image. $VIEW_SORTDATE - Sort by date image. $VIEW_SORTNAME - Sort by name image. $VIEW_SORTSIZE - Sort by size image. $VIEW_SORTTYPE - Sort by type image.

Return Value

Success: The zero based index of the first new image
Failure: -1

Remarks

None.

Related

_GUICtrlToolbar_LoadBitmap

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_AddButton

Function Reference

_GUICtrlToolbar_AddButton

Adds a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_AddButton($hWnd, $iID, $iImage[, $iString = 0[, $iStyle = 0[, $iState = 4[, $iParam = 0]]]])

Parameters

$hWnd | Handle to the control
$iID | Command ID
$iImage | Zero based index of the button image. Set this parameter to -1 and the control will send the $TBN_GETDISPINFO notification to retrieve the image index when it is needed. Set this to -2 to indicate that the button does not have an image. The button layout will only include space for the text. If the button is a separator, this is the width of the separator, in pixels.
$iString | [optional] Zero based index of the button string that was set with AddString
$iStyle | [optional] Button style. Can be a combination of the following: $BTNS_AUTOSIZE - The toolbar control should not assign the standard width to the button $BTNS_BUTTON - Standard button $BTNS_CHECK - Toggles between the pressed and nonpressed $BTNS_CHECKGROUP - Button that stays pressed until another button in the group is pressed $BTNS_DROPDOWN - Creates a drop-down style button that can display a list $BTNS_GROUP - Button that stays pressed until another button in the group is pressed $BTNS_NOPREFIX - The button text will not have an accelerator prefix $BTNS_SEP - Creates a separator $BTNS_SHOWTEXT - Specifies that button text should be displayed $BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop-down arrow
$iState | [optional] Button state. Can be a combination of the following: $TBSTATE_CHECKED - The button has the $TBSTYLE_CHECK style and is being clicked $TBSTATE_PRESSED - The button is being clicked $TBSTATE_ENABLED - The button accepts user input $TBSTATE_HIDDEN - The button is not visible and cannot receive user input $TBSTATE_INDETERMINATE - The button is grayed $TBSTATE_WRAP - The button is followed by a line break $TBSTATE_ELLIPSES - The button's text is cut off and an ellipsis is displayed $TBSTATE_MARKED - The button is marked
$iParam | [optional] Application-defined value

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_DeleteButton, _GUICtrlToolbar_InsertButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_AddButtonSep

Function Reference

_GUICtrlToolbar_AddButtonSep

Adds a separator

#Include <GuiToolBar.au3>
_GUICtrlToolbar_AddButtonSep($hWnd[, $iWidth = 6])

Parameters

$hWnd | Handle to toolbar
$iWidth | [optional] Separator width

Return Value

None.

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_AddString

Function Reference

_GUICtrlToolbar_AddString

Adds a new string to the toolbar's string pool

#Include <GuiToolBar.au3>
_GUICtrlToolbar_AddString($hWnd, $sString)

Parameters

$hWnd | Handle to the control
$sString | String to add

Return Value

Success: Zero based index of the new string
Failure: -1

Remarks

None.

Related

_GUICtrlToolbar_GetString

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New")
$aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open")
$aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save")
$aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help")

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_ButtonCount

Function Reference

_GUICtrlToolbar_ButtonCount

Retrieves a count of the buttons

#Include <GuiToolBar.au3>
_GUICtrlToolbar_ButtonCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Number of buttons on toolbar

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show button count
MsgBox(4096, "Information", "There are " & _GUICtrlToolbar_ButtonCount ($hToolbar) & " buttons")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_CheckButton

Function Reference

_GUICtrlToolbar_CheckButton

Checks or unchecks a given button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_CheckButton($hWnd, $iCommandID[, $fCheck = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fCheck | [optional] Check state: True - Button will be checked False - Button will be unchecked

Return Value

Success: | True
Failure: | False

Remarks

When a button is checked, it is displayed in the pressed state

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Check Save button
_GUICtrlToolbar_CheckButton ($hToolbar, $idSave)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_ClickAccel

Function Reference

_GUICtrlToolbar_ClickAccel

Clicks a specific button using it's accelerator

#Include <GuiToolBar.au3>
_GUICtrlToolbar_ClickAccel($hWnd, $cAccel[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])

Parameters

$hWnd | Handle to the control
$cAccel | Button accelerator
$sButton | [optional] Button to click
$fMove | [optional] Mouse movement flag: True - Mouse will be moved False - Mouse will not be moved
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

None.

Remarks

None.

Related

_GUICtrlToolbar_ClickButton, _GUICtrlToolbar_ClickIndex

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize, $aStrings[4]

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 30, 596, 396 - ($aSize[1] + 30), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New")
$aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open")
$aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save")
$aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help")

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Click Save button using accelerator
_GUICtrlToolbar_ClickAccel($hToolbar, "s", "left", True)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_ClickButton

Function Reference

_GUICtrlToolbar_ClickButton

Clicks a specific button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_ClickButton($hWnd, $iCommandID[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$sButton | [optional] Button to click
$fMove | [optional] Mouse movement flag: True - Mouse will be moved False - Mouse will not be moved
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

None.

Remarks

None.

Related

_GUICtrlToolbar_ClickAccel, _GUICtrlToolbar_ClickIndex

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize, $aStrings[4]

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 30, 596, 396 - ($aSize[1] + 30), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New")
$aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open")
$aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save")
$aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help")

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Click Save button using accelerator
_GUICtrlToolbar_ClickButton($hToolbar, $idSave, "left", True)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_ClickIndex

Function Reference

_GUICtrlToolbar_ClickIndex

Clicks a specific button using it's index

#Include <GuiToolBar.au3>
_GUICtrlToolbar_ClickIndex($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Button index
$sButton | [optional] Button to click
$fMove | [optional] Mouse movement flag: True - Mouse will be moved False - Mouse will not be moved
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

None.

Remarks

None.

Related

_GUICtrlToolbar_ClickAccel, _GUICtrlToolbar_ClickButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize, $aStrings[4]

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 30, 596, 396 - ($aSize[1] + 30), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New")
$aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open")
$aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save")
$aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help")

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Click Save button using accelerator
_GUICtrlToolbar_ClickIndex($hToolbar, 2, "left", True)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_CommandToIndex

Function Reference

_GUICtrlToolbar_CommandToIndex

Retrieves the index for the button associated with the specified command identifier

#Include <GuiToolBar.au3>
_GUICtrlToolbar_CommandToIndex($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Zero based button index
Failure: -1

Remarks

None.

Related

_GUICtrlToolbar_IndexToCommand

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $iIndex
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button index
$iIndex = _GUICtrlToolbar_CommandToIndex ($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button index .: " & $iIndex)
MsgBox(4096, "Information", "Save button command .: " & _GUICtrlToolbar_IndexToCommand ($hToolbar, $iIndex))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_Create

Function Reference

_GUICtrlToolbar_Create

Create a Toolbar control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_Create($hWnd[, $iStyle = 0x00000800[, $iExStyle = 0x00000000]])

Parameters

$hWnd Handle to parent or owner window
$iStyle [optional] Control styles:
$BTNS_AUTOSIZE - Specifies that the toolbar control should not assign the standard width to the button.
Instead, the button's width will be calculated based on the width of the text plus the image of the button.
$BTNS_BUTTON - Creates a standard button
$BTNS_CHECK - Creates a dual-state push button that toggles between the pressed and nonpressed
states each time the user clicks it. The button has a different background color when it is in the pressed
state.
$BTNS_CHECKGROUP - Creates a button that stays pressed until another button in the group is pressed,
similar to option buttons. It is equivalent to combining $BTNS_CHECK and $BTNS_GROUP.
$BTNS_DROPDOWN - Creates a drop-down style button that can display a list when the button is clicked.
Instead of the $WM_COMMAND message used for normal buttons, drop-down buttons send a $TBN_DROPDOWN message
An application can then have the notification handler display a list of options. If the toolbar has the
$TBSTYLE_EX_DRAWDDARROWS extended style, drop-down buttons will have a drop down arrow displayed in a
separate section to their right. If the arrow is clicked, a $TBN_DROPDOWN notification will be sent. If the
associated button is clicked, a $WM_COMMAND message will be sent.
$BTNS_GROUP - When combined with $BTNS_CHECK, creates a button that stays pressed until another
button in the group is pressed.
$BTNS_NOPREFIX - Specifies that the button text will not have an accelerator prefix associated with it
$BTNS_SEP - Creates a separator, providing a small gap between button groups. A button that has
this style does not receive user input.
$BTNS_SHOWTEXT - Specifies that button text should be displayed. All buttons can have text, but only
those buttons with the $BTNS_SHOWTEXT button style will display it. This button style must be used with the
$TBSTYLE_LIST style and the $TBSTYLE_EX_MIXEDBUTTONS extended style. If you set text for buttons that do not
have the $BTNS_SHOWTEXT style, the toolbar control will automatically display it as a ToolTip when the cursor
hovers over the button. This feature allows your application to avoid handling the $TBN_GETINFOTIP message
for the toolbar.
$BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop down arrow, but not as a separate section.
Buttons with this style behave the same, regardless of whether the $TBSTYLE_EX_DRAWDDARROWS extended style is
set.
$TBSTYLE_ALTDRAG - Allows users to change a toolbar button's position by dragging it while holding down
the ALT key. If this style is not specified, the user must hold down the SHIFT key while dragging a button.
Note that the $CCS_ADJUSTABLE style must be specified to enable toolbar buttons to be dragged.
$TBSTYLE_CUSTOMERASE - Generates $NM_CUSTOMDRAW messages when the toolbar processes $WM_ERASEBKGND messages
$TBSTYLE_FLAT - Creates a flat toolbar
$TBSTYLE_LIST - Creates a flat toolbar with button text to the right of the bitmap
$TBSTYLE_REGISTERDROP - Generates $TBN_GETOBJECT notification messages to request drop target objects when
the cursor passes over toolbar buttons.
$TBSTYLE_TOOLTIPS - Creates a ToolTip control that an application can use to display descriptive text for
the buttons in the toolbar.
$TBSTYLE_TRANSPARENT - Creates a transparent toolbar. In a transparent toolbar, the toolbar is transparent
but the buttons are not. Button text appears under button bitmaps. To prevent repainting problems, this style
should be set before the toolbar control becomes visible.
$TBSTYLE_WRAPABLE - Creates a toolbar that can have multiple lines of buttons. Toolbar buttons can "wrap"
to the next line when the toolbar becomes too narrow to include all buttons on the same line. When the
toolbar is wrapped, the break will occur on either the rightmost separator or the rightmost button if there
are no separators on the bar. This style must be set to display a vertical toolbar control when the toolbar
is part of a vertical rebar control.
Default: $TBSTYLE_FLAT
Forced: $WS_CHILD, $WS_CLIPSIBLINGS, $WS_VISIBLE
$iExStyle [optional] Control extended styles:
$TBSTYLE_EX_DRAWDDARROWS - Allows buttons to have a separate dropdown arrow. Buttons that have the
$BTNS_DROPDOWN style will be drawn with a drop down arrow in a separate section, to the right of the button.
If the arrow is clicked, only the arrow portion of the button will depress, and the toolbar control will send
a $TBN_DROPDOWN notification to prompt the application to display the dropdown menu. If the main part of the
button is clicked, the toolbar control sends a $WM_COMMAND message with the button's ID.
$TBSTYLE_EX_HIDECLIPPEDBUTTONS - Hides partially clipped buttons
$TBSTYLE_EX_DOUBLEBUFFER - Requires the toolbar to be double buffered
$TBSTYLE_EX_MIXEDBUTTONS - Allows you to set text for all buttons, but only display it for the buttons
with the $BTNS_SHOWTEXT button style. The $TBSTYLE_LIST style must also be set. Normally, when a button does
not display text, you must handle $TBN_GETINFOTIP to display a ToolTip. With the $TBSTYLE_EX_MIXEDBUTTONS
extended style, text that is set but not displayed on a button will automatically be used as the button's
ToolTip text. You only need to handle $TBN_GETINFOTIP if it needs more flexibility in specifying the ToolTip
text.

Return Value

Success: | Handle to the Toolbar control
Failure: | 0

Remarks

None.

Related

_GUICtrlToolbar_Destroy

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_Customize

Function Reference

_GUICtrlToolbar_Customize

Displays the Customize Toolbar dialog box

#Include <GuiToolBar.au3>
_GUICtrlToolbar_Customize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

The toolbar must handle the $TBN_QUERYINSERT and $TBN_QUERYDELETE notifications for the Customize Toolbar
dialog box to appear. If the toolbar does not handle those notifications, $TB_CUSTOMIZE has no effect.

Related


Function _GUICtrlToolbar_DeleteButton

Function Reference

_GUICtrlToolbar_DeleteButton

Deletes a button from the toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_DeleteButton($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_AddButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Delete Help button
MsgBox(4096, "Information", "Deleting Help button")
_GUICtrlToolbar_DeleteButton ($hToolbar, $idHelp)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_Destroy

Function Reference

_GUICtrlToolbar_Destroy

Delete the control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on Listbox created with _GUICtrlToolbar_Create

Related

_GUICtrlToolbar_Create

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Delete ToolBar
MsgBox(4096, "Information", "Destroying ToolBar")
_GUICtrlToolbar_Destroy ($hToolbar)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_EnableButton

Function Reference

_GUICtrlToolbar_EnableButton

Enables or disables the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_EnableButton($hWnd, $iCommandID[, $fEnable = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fEnable | [optional] Enable flag: True - Button will be enabled False - Button will be disabled

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_HideButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Disable Help button
_GUICtrlToolbar_EnableButton ($hToolbar, $idHelp, False)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_FindToolbar

Function Reference

_GUICtrlToolbar_FindToolbar

Finds a specific toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_FindToolbar($hWnd, $sText)

Parameters

$hWnd | Window handle or text of window
$sText | Button text to search for

Return Value

Success: Handle of the toolbar
Failure: 0

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hToolbar

Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
WinWaitActive("[CLASS:CabinetWClass]")
Sleep ( 1000 )
$hToolbar = _GUICtrlToolbar_FindToolbar ("[CLASS:CabinetWClass]", "&File")
MsgBox(4096, "Information", "File Toolbar handle: 0x" & Hex($hToolbar))

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetAnchorHighlight

Function Reference

_GUICtrlToolbar_GetAnchorHighlight

Retrieves the anchor highlight setting

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetAnchorHighlight($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Anchor highlighting is enabled
False: Anchor highlighting is not enabled

Remarks

Anchor highlighting means that the last highlighted item will remain highlighted until another item is
highlighted. This occurs even if the cursor leaves the toolbar control.

Related

_GUICtrlToolbar_SetAnchorHighlight

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hToolbar, $fEnabled

Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
WinWaitActive("My Computer")
Sleep(1000)
$hToolbar = _GUICtrlToolbar_FindToolbar ("[CLASS:CabinetWClass]", "&File")
$fEnabled = _GUICtrlToolbar_GetAnchorHighlight ($hToolbar)
MsgBox(4096, "Information", "Anchor highlight enabled: " & $fEnabled)
_GUICtrlToolbar_SetAnchorHighlight ($hToolbar, Not $fEnabled)
MsgBox(4096, "Information", "Anchor highlight enabled: " & _GUICtrlToolbar_GetAnchorHighlight ($hToolbar))

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetBitmapFlags

Function Reference

_GUICtrlToolbar_GetBitmapFlags

Retrieves the flags that describe the type of bitmap to be used

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetBitmapFlags($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: A value that describes the type of bitmap that should be used:
0 - Use small (16 x 16) bitmaps
1 - Use large (24 x 24) bitmaps

Remarks

The value returned is only advisory. The control recommends large or small bitmaps based upon whether the user
has chosen large or small fonts.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetButtonBitmap

Function Reference

_GUICtrlToolbar_GetButtonBitmap

Retrieves the index of the bitmap associated with a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonBitmap($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Zero based button bitmap index

Remarks

None.

Related

_GUICtrlToolbar_SetButtonBitmap

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button bitmap index
MsgBox(4096, "Information", "Changing Save bitmap to Print bitmap")
_GUICtrlToolbar_SetButtonBitMap ($hToolbar, $idSave, $STD_PRINT)
MsgBox(4096, "Information", "Save button bitmap index: " & _GUICtrlToolbar_GetButtonBitmap ($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetButtonInfo

Function Reference

_GUICtrlToolbar_GetButtonInfo

Retrieves information for a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonInfo($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Array with the following format:
[0] - Zero based button image index
[1] - Button state. Can be a combination of the following:
$TBSTATE_CHECKED - The button has is being clicked
$TBSTATE_PRESSED - The button is being clicked
$TBSTATE_ENABLED - The button accepts user input
$TBSTATE_HIDDEN - The button is not visible
$TBSTATE_INDETERMINATE - The button is grayed
$TBSTATE_WRAP - The button is followed by a line break
$TBSTATE_ELLIPSES - The button's text is cut off
$TBSTATE_MARKED - The button is marked
[2] - Button style. Can be a combination of the following:
$BTNS_AUTOSIZE - The control should not assign the standard width
$BTNS_BUTTON - Standard button
$BTNS_CHECK - Toggles between the pressed and nonpressed
$BTNS_CHECKGROUP - Button that stays pressed until another button is pressed
$BTNS_DROPDOWN - Creates a drop-down style button that can display a list
$BTNS_GROUP - Button that stays pressed until another button is pressed
$BTNS_NOPREFIX - The button text will not have an accelerator prefix
$BTNS_SEP - Creates a separator
$BTNS_SHOWTEXT - Specifies that button text should be displayed
$BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop-down arrow
[3] - Button width
[4] - Button parameter

Remarks

None.

Related

_GUICtrlToolbar_SetButtonInfo

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aButton
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button information
_GUICtrlToolbar_SetButtonInfo ($hToolbar, $idSave, $STD_PRINT, BitOR($TBSTATE_PRESSED, $TBSTATE_ENABLED), -1, 100, 1234)

; Show Save button information
$aButton = _GUICtrlToolbar_GetButtonInfo ($hToolbar, $idSave)
MemoWrite("Image index ....: " & $aButton[0])
MemoWrite("State flags ....: " & $aButton[1])
MemoWrite("Style flags ....: " & $aButton[2])
MemoWrite("Button width ...: " & $aButton[3])
MemoWrite("Param ..........: " & $aButton[4])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonInfoEx

Function Reference

_GUICtrlToolbar_GetButtonInfoEx

Retrieves information for a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonInfoEx($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: $tagTBBUTTONINFO structure

Remarks

None.

Related

_GUICtrlToolbar_SetButtonInfoEx, $tagTBBUTTONINFO

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $tButton
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button information
$tButton = DllStructCreate($tagTBBUTTONINFO)
DllStructSetData($tButton, "Mask", BitOR($TBIF_IMAGE, $TBIF_STATE, $TBIF_SIZE, $TBIF_LPARAM))
DllStructSetData($tButton, "State", BitOR($TBSTATE_PRESSED, $TBSTATE_ENABLED))
DllStructSetData($tButton, "Image", $STD_PRINT)
DllStructSetData($tButton, "CX", 100)
DllStructSetData($tButton, "Param", 1234)
_GUICtrlToolbar_SetButtonInfoEx ($hToolbar, $idSave, $tButton)

; Show Save button information
$tButton = _GUICtrlToolbar_GetButtonInfoEx ($hToolbar, $idSave)
MemoWrite("Image index ....: " & DllStructGetData($tButton, "Image"))
MemoWrite("State flags ....: " & DllStructGetData($tButton, "State"))
MemoWrite("Button width ...: " & DllStructGetData($tButton, "CX"))
MemoWrite("Param ..........: " & DllStructGetData($tButton, "Param"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonParam

Function Reference

_GUICtrlToolbar_GetButtonParam

Retrieves the button param value

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonParam($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Application-defined value

Remarks

None.

Related

_GUICtrlToolbar_SetButtonParam

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button parameter
_GUICtrlToolbar_SetButtonParam ($hToolbar, $idSave, 1234)

; Show Save button parameter
MemoWrite("Save button parameter: " & _GUICtrlToolbar_GetButtonParam ($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonRect

Function Reference

_GUICtrlToolbar_GetButtonRect

Retrieves the bounding rectangle for a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonRect($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related

_GUICtrlToolbar_GetButtonRectEx

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aRect
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button rectangle
$aRect = _GUICtrlToolbar_GetButtonRect ($hToolbar, $idSave)
MemoWrite("Save Button Rect")
MemoWrite("----------------")
MemoWrite("Left ...: " & $aRect[0])
MemoWrite("Top ....: " & $aRect[1])
MemoWrite("Right ..: " & $aRect[2])
MemoWrite("Bottom .: " & $aRect[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonRectEx

Function Reference

_GUICtrlToolbar_GetButtonRectEx

Retrieves the bounding rectangle for a specified toolbar button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonRectEx($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: $tagRECT structure

Remarks

None.

Related

_GUICtrlToolbar_GetButtonRect, $tagRECT

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $tRect
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button rectangle
$tRect = _GUICtrlToolbar_GetButtonRectEx ($hToolbar, $idSave)
MemoWrite("Save Button Rect")
MemoWrite("----------------")
MemoWrite("Left ...: " & DllStructGetData($tRect, "Left"))
MemoWrite("Top ....: " & DllStructGetData($tRect, "Top"))
MemoWrite("Right ..: " & DllStructGetData($tRect, "Right"))
MemoWrite("Bottom .: " & DllStructGetData($tRect, "Bottom"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonSize

Function Reference

_GUICtrlToolbar_GetButtonSize

Retrieves the current button width and height, in pixels

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] - Button height
[1] - Button width

Remarks

None.

Related

_GUICtrlToolbar_SetButtonSize

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aSize
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show button size
$aSize = _GUICtrlToolbar_GetButtonSize($hToolbar)
MemoWrite("Button height : " & $aSize[0])
MemoWrite("Button width .: " & $aSize[1])
_GUICtrlToolbar_SetButtonSize($hToolbar, $aSize[0], $aSize[1] + 10)
$aSize = _GUICtrlToolbar_GetButtonSize($hToolbar)
MemoWrite("New Button Size")
MemoWrite("Button height : " & $aSize[0])
MemoWrite("Button width .: " & $aSize[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonState

Function Reference

_GUICtrlToolbar_GetButtonState

Retrieves information about the state of the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonState($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Button state. Can be one or more of the following
$TBSTATE_CHECKED - The button has the $TBSTYLE_CHECK style and is being clicked
$TBSTATE_PRESSED - The button is being clicked
$TBSTATE_ENABLED - The button accepts user input
$TBSTATE_HIDDEN - The button is not visible and cannot receive user input
$TBSTATE_INDETERMINATE - The button is grayed
$TBSTATE_WRAP - The button is followed by a line break
$TBSTATE_ELLIPSES - The button's text is cut off and an ellipsis is displayed
$TBSTATE_MARKED - The button is marked
Failure: -1

Remarks

None.

Related

_GUICtrlToolbar_SetButtonState

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button state
MemoWrite("Save button state: " & _GUICtrlToolbar_GetButtonState ($hToolbar, $idSave))

Sleep(1000)

; Set Save button state
_GUICtrlToolbar_SetButtonState ($hToolbar, $idSave, BitOR($TBSTATE_ENABLED, $TBSTATE_PRESSED))

; Show Save button state
MemoWrite("Save button state: " & _GUICtrlToolbar_GetButtonState ($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonStyle

Function Reference

_GUICtrlToolbar_GetButtonStyle

Retrieves the style flags of a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonStyle($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Button style. Can be a combination of the following:
$BTNS_AUTOSIZE - The toolbar control should not assign the standard width to the button
$BTNS_CHECK - Toggles between the pressed and nonpressed
$BTNS_CHECKGROUP - Button that stays pressed until another button in the group is pressed
$BTNS_DROPDOWN - Drop-down style button that can display a list
$BTNS_GROUP - Button that stays pressed until another button in the group is pressed
$BTNS_NOPREFIX - The button text will not have an accelerator prefix
$BTNS_SEP - Separator
$BTNS_SHOWTEXT - Button text should be displayed
$BTNS_WHOLEDROPDOWN - The button has a drop-down arrow

Remarks

None.

Related

_GUICtrlToolbar_SetButtonStyle

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set Save button style
_GUICtrlToolbar_SetButtonStyle($hToolbar, $idSave, $BTNS_CHECK)

; Show Save button style
MemoWrite("Save button style: " & _GUICtrlToolbar_GetButtonStyle($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetButtonText

Function Reference

_GUICtrlToolbar_GetButtonText

Retrieves the display text of a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetButtonText($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

Success: Button text

Remarks

None.

Related

_GUICtrlToolbar_SetButtonText, _GUICtrlToolbar_GetString

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change Save button text
_GUICtrlToolbar_SetButtonText($hToolbar, $idSave, "&Close")

; Show Save button text
MemoWrite("Save button text: " & _GUICtrlToolbar_GetButtonText($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetColorScheme

Function Reference

_GUICtrlToolbar_GetColorScheme

Retrieves the color scheme information

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetColorScheme($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] - The highlight color of the buttons
[1] - The shadow color of the buttons

Remarks

The control uses the color scheme information when drawing the 3-D elements in the control

Related

_GUICtrlToolbar_SetColorScheme

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aScheme
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change Color Scheme
_GUICtrlToolbar_SetColorScheme($hToolbar, 0x00ffff, 0x800000)

; Show Color Scheme
$aScheme = _GUICtrlToolbar_GetColorScheme($hToolbar)
MemoWrite("Highlight: " & '0x' & Hex($aScheme[0], 6))
MemoWrite("Shadow: " & '0x' & Hex($aScheme[1], 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetDisabledImageList

Function Reference

_GUICtrlToolbar_GetDisabledImageList

Retrieves the disabled button image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetDisabledImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the disabled image list
Failure: 0

Remarks

None.

Related

_GUICtrlToolbar_SetDisabledImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetExtendedStyle

Function Reference

_GUICtrlToolbar_GetExtendedStyle

Retrieves the extended styles

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetExtendedStyle($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Control extended styles. Can be one or more of the following:
$TBSTYLE_EX_DRAWDDARROWS - Allows buttons to have a separate dropdown arrow
$TBSTYLE_EX_MIXEDBUTTONS - Allows mixing buttons with text and images
$TBSTYLE_EX_HIDECLIPPEDBUTTONS - Hides partially clipped buttons
$TBSTYLE_EX_DOUBLEBUFFER - Requires the toolbar to be double buffered

Remarks

None.

Related

_GUICtrlToolbar_SetExtendedStyle

Example

#include <GuiToolbar.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $hGUI, $iMemo

_Main()

Func _Main()
Local $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
_GUICtrlToolbar_SetExtendedStyle($hToolbar, $TBSTYLE_EX_DRAWDDARROWS)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, 0, $BTNS_DROPDOWN)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show extended styles in use
MemoWrite("Extended sytles: " & _GUICtrlToolbar_GetExtendedStyle($hToolbar))

; Loop until user exits
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Handle TBN_DROPDOWN message
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tNMHDR, $iCode, $hMenu

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$iCode = DllStructGetData($tNMHDR, "Code")

If $iCode = $TBN_DROPDOWN Then
$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_AddMenuItem($hMenu, "Template 1", 2000)
_GUICtrlMenu_AddMenuItem($hMenu, "Template 2", 2001)
_GUICtrlMenu_AddMenuItem($hMenu, "Template 3", 2002)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI)
_GUICtrlMenu_DestroyMenu($hMenu)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlToolbar_GetHotImageList

Function Reference

_GUICtrlToolbar_GetHotImageList

Retrieves the hot button image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetHotImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the hot image list
Failure: 0

Remarks

A button is considered hot when the cursor is over it

Related

_GUICtrlToolbar_SetHotImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetHotItem

Function Reference

_GUICtrlToolbar_GetHotItem

Retrieves the index of the hot item

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetHotItem($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: The zero based index of the hot item
Failure: -1

Remarks

A button is considered hot when the cursor is over it

Related

_GUICtrlToolbar_SetHotItem

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_GetImageList

Function Reference

_GUICtrlToolbar_GetImageList

Retrieves the default state image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Handle to the image list
Failure: 0

Remarks

A toolbar control uses this image list to display buttons when they are not hot or disabled

Related

_GUICtrlToolbar_SetImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetInsertMark

Function Reference

_GUICtrlToolbar_GetInsertMark

Retrieves the current insertion mark

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetInsertMark($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] - Zero based index of the insertion mark or -1 for no insertion mark
[1] - Defines where the insertion mark is in relation to the button:
0 - To the left
1 - To the right
2 - On the background of the toolbar

Remarks

None.

Related

_GUICtrlToolbar_SetInsertMark

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMark
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set insert mark
_GUICtrlToolbar_SetInsertMarkColor($hToolbar, 0xFF0000)
_GUICtrlToolbar_SetInsertMark($hToolbar, 1, 1)

; Show insert mark
$aMark = _GUICtrlToolbar_GetInsertMark($hToolbar)
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])
MemoWrite("Mark color ...: 0x" & Hex(_GUICtrlToolbar_GetInsertMarkColor($hToolbar), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetInsertMarkColor

Function Reference

_GUICtrlToolbar_GetInsertMarkColor

Retrieves the color used to draw the insertion mark

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetInsertMarkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Insertion mark color

Remarks

None.

Related

_GUICtrlToolbar_SetInsertMarkColor

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMark
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set insert mark
_GUICtrlToolbar_SetInsertMarkColor($hToolbar, 0xFF0000)
_GUICtrlToolbar_SetInsertMark($hToolbar, 1, 1)

; Show insert mark
$aMark = _GUICtrlToolbar_GetInsertMark($hToolbar)
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])
MemoWrite("Mark color ...: 0x" & Hex(_GUICtrlToolbar_GetInsertMarkColor($hToolbar), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetMaxSize

Function Reference

_GUICtrlToolbar_GetMaxSize

Retrieves the total size of all of the visible buttons and separators

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetMaxSize($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] - Maximum width
[1] - Maximum height

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aSize
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show maximum size
$aSize = _GUICtrlToolbar_GetMaxSize($hToolbar)
MemoWrite("Max width .: " & $aSize[0])
MemoWrite("Max height : " & $aSize[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetMetrics

Function Reference

_GUICtrlToolbar_GetMetrics

Retrieves the metrics of a toolbar control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetMetrics($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns an Array with the following format:
[0] - Width of the padding inside the toolbar buttons
[1] - Height of the padding inside the toolbar buttons
[2] - Width of the space between toolbar buttons
[3] - Height of the space between toolbar buttons

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlToolbar_SetMetrics

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMetrics
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

GUISetState(@SW_LOCK)
; Set control metrics
_GUICtrlToolbar_SetMetrics($hToolbar, 1, 2, 3, 4)
GUISetState(@SW_UNLOCK)

; Show control metrics
$aMetrics = _GUICtrlToolbar_GetMetrics($hToolbar)
MemoWrite("Button padding width ...: " & $aMetrics[0])
MemoWrite("Button padding height ..: " & $aMetrics[1])
MemoWrite("Button spacing width ...: " & $aMetrics[2])
MemoWrite("Button spacing height ..: " & $aMetrics[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetPadding

Function Reference

_GUICtrlToolbar_GetPadding

Retrieves the horizontal and vertical padding

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetPadding($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Array with the following format:
[0] - Horizontal padding
[1] - Vertical padding

Remarks

None.

Related

_GUICtrlToolbar_SetPadding

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aPad
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set control padding
_GUICtrlToolbar_SetPadding($hToolbar, 2, 3)

; Show control padding
$aPad = _GUICtrlToolbar_GetPadding($hToolbar)
MemoWrite("Horizontal padding : " & $aPad[0])
MemoWrite("Vertical padding ..: " & $aPad[1])
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetRows

Function Reference

_GUICtrlToolbar_GetRows

Retrieves the number of rows of buttons

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetRows($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Number of rows

Remarks

None.

Related

_GUICtrlToolbar_SetRows

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 36, 2, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Create a vertical toolbar
_GUICtrlToolbar_SetStyle($hToolbar, BitOR($CCS_LEFT, $TBSTYLE_FLAT))
_GUICtrlToolbar_SetRows($hToolbar, 4)

; Show number of rows
MemoWrite("Number of rows:" & _GUICtrlToolbar_GetRows($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetString

Function Reference

_GUICtrlToolbar_GetString

Retrieves a string from the string pool

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetString($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Index of the string

Return Value

Success: Specified string

Remarks

This message returns the specified string from the control's string pool. It does not necessarily correspond
to the text string currently being displayed by a button. To retrieve a button's current text string, send use
_GUICtrlToolbar_GetButtonText.

Related

_GUICtrlToolbar_AddString, _GUICtrlToolbar_GetButtonText

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 45, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Get string 2 text
MemoWrite("String 2 text .: " & _GUICtrlToolbar_GetString($hToolbar, 2))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetStyle

Function Reference

_GUICtrlToolbar_GetStyle

Retrieves the styles currently in use for a toolbar control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyle($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Control styles. Can be a combination of the following:
$TBSTYLE_TOOLTIPS - Creates a ToolTip control
$TBSTYLE_WRAPABLE - Creates a toolbar that can have multiple lines of buttons
$TBSTYLE_ALTDRAG - Allows users to change a toolbar button's position by dragging it
$TBSTYLE_FLAT - Creates a flat toolbar
$TBSTYLE_LIST - Creates a flat toolbar with button text to the right of the bitmap
$TBSTYLE_CUSTOMERASE - Sends $NM_CUSTOMDRAW messages when processing $WM_ERASEBKGND messages
$TBSTYLE_REGISTERDROP - Sends $TBN_GETOBJECT messages to request drop target objects
$TBSTYLE_TRANSPARENT - Creates a transparent toolbar

Remarks

None.

Related

_GUICtrlToolbar_SetStyle

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Set control style
_GUICtrlToolbar_SetStyle($hToolbar, BitOR($TBSTYLE_LIST, $CCS_TOP))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show control style
MemoWrite("Toolbar style .: 0x" & Hex(_GUICtrlToolbar_GetStyle($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetStyleAltDrag

Function Reference

_GUICtrlToolbar_GetStyleAltDrag

Indicates that the control allows buttons to be dragged

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleAltDrag($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleAltDrag

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleAltDrag($hToolbar)
MemoWrite("Toolbar has drag style .: " & $fStyle)
_GUICtrlToolbar_SetStyleAltDrag($hToolbar, Not $fStyle)
MemoWrite("Toolbar has drag style .: " & _GUICtrlToolbar_GetStyleAltDrag($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetStyleCustomErase

Function Reference

_GUICtrlToolbar_GetStyleCustomErase

Indicates that the control generates NM_CUSTOMDRAW notification messages

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleCustomErase($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleCustomErase

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleCustomErase($hToolbar)
MemoWrite("Toolbar sends custom erase .: " & $fStyle)
_GUICtrlToolbar_SetStyleCustomErase($hToolbar, Not $fStyle)
MemoWrite("Toolbar sends custom erase .: " & _GUICtrlToolbar_GetStyleCustomErase($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_GetStyleFlat

Function Reference

_GUICtrlToolbar_GetStyleFlat

Indicates that the control is flat

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleFlat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleFlat

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleFlat($hToolbar)
MsgBox(4096, "Information", "Toolbar has flat style .: " & $fStyle)
GUISetState(@SW_LOCK)
_GUICtrlToolbar_SetStyleFlat($hToolbar, Not $fStyle)
GUISetState(@SW_UNLOCK)
MsgBox(4096, "Information", "Toolbar has flat style .: " & _GUICtrlToolbar_GetStyleFlat($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetStyleList

Function Reference

_GUICtrlToolbar_GetStyleList

Indicates that the control has button text to the right of the bitmap

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleList

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleList($hToolbar)
MsgBox(4096, "Information", "Toolbar has list style .: " & $fStyle)
_GUICtrlToolbar_SetStyleList($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has list style .: " & _GUICtrlToolbar_GetStyleList($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetStyleRegisterDrop

Function Reference

_GUICtrlToolbar_GetStyleRegisterDrop

Indicates that the control generates TBN_GETOBJECT notification messages

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleRegisterDrop($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleRegisterDrop

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleRegisterDrop($hToolbar)
MsgBox(4096, "Information", "Toolbar has register drop style .: " & $fStyle)
_GUICtrlToolbar_SetStyleRegisterDrop($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has register drop style .: " & _GUICtrlToolbar_GetStyleRegisterDrop($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetStyleToolTips

Function Reference

_GUICtrlToolbar_GetStyleToolTips

Indicates that the control has tooltips

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleToolTips

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleToolTips($hToolbar)
MsgBox(4096, "Information", "Toolbar has tooltips style .: " & $fStyle)
_GUICtrlToolbar_SetStyleToolTips($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has tooltips style .: " & _GUICtrlToolbar_GetStyleToolTips($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetStyleTransparent

Function Reference

_GUICtrlToolbar_GetStyleTransparent

Indicates that the control is transparent

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleTransparent($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleTransparent

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetBkColor(0xffffff)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleTransparent($hToolbar)
MsgBox(4096, "Information", "Toolbar has transparent style .: " & $fStyle)
GUISetState(@SW_LOCK)
_GUICtrlToolbar_SetStyleTransparent($hToolbar, Not $fStyle)
GUISetState(@SW_UNLOCK)
MsgBox(4096, "Information", "Toolbar has transparent style .: " & _GUICtrlToolbar_GetStyleTransparent($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetStyleWrapable

Function Reference

_GUICtrlToolbar_GetStyleWrapable

Indicates that the control is wrapable

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetStyleWrapable($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Style is present
False: Style is not present

Remarks

None.

Related

_GUICtrlToolbar_SetStyleWrapable

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleWrapable($hToolbar)
MsgBox(4096, "Information", "Toolbar has wrapable style .: " & $fStyle)
_GUICtrlToolbar_SetStyleWrapable($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has wrapable style .: " & _GUICtrlToolbar_GetStyleWrapable($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetTextRows

Function Reference

_GUICtrlToolbar_GetTextRows

Retrieves the maximum number of text rows that can be displayed on a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetTextRows($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: Maximum number of text rows that can be displayed on a button

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Show number of text rows
MsgBox(4096, "Information", "Number of text rows:" & _GUICtrlToolbar_GetTextRows($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_GetToolTips

Function Reference

_GUICtrlToolbar_GetToolTips

Retrieves the handle to the ToolTip control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: ToolTip handle
Failure: 0

Remarks

None.

Related

_GUICtrlToolbar_SetToolTips

Example

#include <GuiToolbar.au3>
#include <GuiToolTip.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hToolTip

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Create ToolTip
$hToolTip = _GUIToolTip_Create($hToolbar)
_GUICtrlToolbar_SetToolTips($hToolbar, $hToolTip)

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show ToolTip handle
MsgBox(4096, "Information", "ToolTip handle .: 0x" & Hex(_GUICtrlToolbar_GetToolTips($hToolbar)))

; Loop until user exits
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Handle WM_NOTIFY messages
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tInfo, $iID, $iCode

$tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam)
$iCode = DllStructGetData($tInfo, "Code")
If $iCode = $TTN_GETDISPINFO Then
$iID = DllStructGetData($tInfo, "IDFrom")
Switch $iID
Case $idNew
DllStructSetData($tInfo, "aText", "New")
Case $idOpen
DllStructSetData($tInfo, "aText", "Open")
Case $idSave
DllStructSetData($tInfo, "aText", "Save")
Case $idHelp
DllStructSetData($tInfo, "aText", "Help")
EndSwitch
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlToolbar_GetUnicodeFormat

Function Reference

_GUICtrlToolbar_GetUnicodeFormat

Retrieves the Unicode character format flag

#Include <GuiToolBar.au3>
_GUICtrlToolbar_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: Control is using Unicode characters
False: Control is using ANSI characters

Remarks

None.

Related

_GUICtrlToolbar_SetUnicodeFormat

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fUnicode
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show Unicode format
$fUnicode = _GUICtrlToolbar_GetUnicodeFormat($hToolbar)
MemoWrite("Unicode format .:" & $fUnicode)

; Change Unicode format
_GUICtrlToolbar_SetUnicodeFormat($hToolbar, Not $fUnicode)
MemoWrite("Unicode format .:" & _GUICtrlToolbar_GetUnicodeFormat($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_HideButton

Function Reference

_GUICtrlToolbar_HideButton

Hides or shows the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_HideButton($hWnd, $iCommandID[, $fHide = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fHide | [optional] State indicator: True - Button will be hidden False - Button will be made visible

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_EnableButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Hide Save button
MsgBox(4096, "Information", "Hiding Save button")
_GUICtrlToolbar_HideButton($hToolbar, $idSave, True)
MsgBox(4096, "Information", "Restoring Save button")
_GUICtrlToolbar_HideButton($hToolbar, $idSave, False)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_HighlightButton

Function Reference

_GUICtrlToolbar_HighlightButton

Sets the highlight state of a given button control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_HighlightButton($hWnd, $iCommandID[, $fHighlight = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fHighlight | [optional] Highlight state: True - Button will be highlighted False - Button will be unhighlighted

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Mark Save button
MemoWrite("Save button Highlight State: " & _GUICtrlToolbar_IsButtonHighlighted($hToolbar, $idSave))
_GUICtrlToolbar_HighlightButton($hToolbar, $idSave)
MemoWrite("Save button Highlight State: " & _GUICtrlToolbar_IsButtonHighlighted($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_HitTest

Function Reference

_GUICtrlToolbar_HitTest

Determines where a point lies within the control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_HitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position to test
$iY | Y position to test

Return Value

Success: If the value is zero or a positive value, it is the zero based index of the nonseparator item
in which the point lies.
Failure: If the value is negative, the point does not lie within a button

Remarks

The absolute value of the return value is the index of a separator item or the nearest nonseparator item.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aRect, $iHit, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Do a hit test on the Save button
$aRect = _GUICtrlToolbar_GetButtonRect($hToolbar, $idSave)
$iHit = _GUICtrlToolbar_HitTest($hToolbar, $aRect[0], $aRect[1])
MemoWrite(StringFormat("Hit test at %d, %d = %d", $aRect[0], $aRect[1], $iHit))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_IndexToCommand

Function Reference

_GUICtrlToolbar_IndexToCommand

Retrieves the command identifier associated with the button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IndexToCommand($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Button index

Return Value

Success: Button command identifier

Remarks

None.

Related

_GUICtrlToolbar_CommandToIndex

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $iIndex
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button index
$iIndex = _GUICtrlToolbar_CommandToIndex ($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button index .: " & $iIndex)
MsgBox(4096, "Information", "Save button command .: " & _GUICtrlToolbar_IndexToCommand ($hToolbar, $iIndex))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_InsertButton

Function Reference

_GUICtrlToolbar_InsertButton

Inserts a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_InsertButton($hWnd, $iIndex, $iID, $iImage[, $sText = ""[, $iStyle = 0[, $iState = 4[, $iParam = 0]]]])

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of a button
$iID | Command ID
$iImage | Zero based image index
$sText | [optional] Button text
$iStyle | [optional] Button style. Can be a combination of the following: $BTNS_AUTOSIZE - The toolbar control should not assign the standard width to the button $BTNS_BUTTON - Standard button $BTNS_CHECK - Toggles between the pressed and nonpressed $BTNS_CHECKGROUP - Button that stays pressed until another button in the group is pressed $BTNS_DROPDOWN - Creates a drop-down style button that can display a list $BTNS_GROUP - Button that stays pressed until another button in the group is pressed $BTNS_NOPREFIX - The button text will not have an accelerator prefix $BTNS_SEP - Creates a separator $BTNS_SHOWTEXT - Specifies that button text should be displayed $BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop-down arrow
$iState | [optional] Button state. Can be a combination of the following: $TBSTATE_CHECKED - The button has the $TBSTYLE_CHECK style and is being clicked $TBSTATE_PRESSED - The button is being clicked $TBSTATE_ENABLED - The button accepts user input $TBSTATE_HIDDEN - The button is not visible and cannot receive user input $TBSTATE_INDETERMINATE - The button is grayed $TBSTATE_WRAP - The button is followed by a line break $TBSTATE_ELLIPSES - The button's text is cut off and an ellipsis is displayed $TBSTATE_MARKED - The button is marked
$iParam | [optional] Application-defined value

Return Value

Success: | True
Failure: | False

Remarks

Inserts the new button to the left of the button at iIndex

Related

_GUICtrlToolbar_AddButton

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_InsertButton($hToolbar, 0, $idNew, $STD_FILENEW)
_GUICtrlToolbar_InsertButton($hToolbar, 1, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_InsertButton($hToolbar, 2, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_InsertButton($hToolbar, 4, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_InsertMarkHitTest

Function Reference

_GUICtrlToolbar_InsertMarkHitTest

Retrieves the insertion mark information for a point

#Include <GuiToolBar.au3>
_GUICtrlToolbar_InsertMarkHitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position relative to the client area
$iY | Y position relative to the client area

Return Value

Success: Array with the following format:
[0] - Zero based index of the insertion mark or -1 for no insertion mark
[1] - Defines the insertion position. This can be one of the following values:
0 - To the left
1 - To the right
2 - On the background of the toolbar

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4], $aRect, $aMark
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Set insert mark
_GUICtrlToolbar_SetInsertMark($hToolbar, 1, 1)

; Do insert mark hit test 1
$aMark = _GUICtrlToolbar_InsertMarkHitTest($hToolbar, 0, 0)
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])

; Do insert mark hit test 2
$aRect = _GUICtrlToolbar_GetButtonRect($hToolbar, $idSave)
$aMark = _GUICtrlToolbar_InsertMarkHitTest($hToolbar, $aRect[0], $aRect[1])
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_IsButtonChecked

Function Reference

_GUICtrlToolbar_IsButtonChecked

Indicates whether the specified button is checked

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonChecked($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is checked
False: Button is not checked

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Check Save button
MsgBox(4096, "Information", "Save button is checked: " & _GUICtrlToolbar_IsButtonChecked($hToolbar, $idSave))
_GUICtrlToolbar_CheckButton($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button is checked: " & _GUICtrlToolbar_IsButtonChecked($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_IsButtonEnabled

Function Reference

_GUICtrlToolbar_IsButtonEnabled

Indicates whether the specified button is enabled

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonEnabled($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is enabled
False: Button is not enabled

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Disable Help button
MsgBox(4096, "Information", "Help button enabled: " & _GUICtrlToolbar_IsButtonEnabled($hToolbar, $idHelp))
_GUICtrlToolbar_EnableButton($hToolbar, $idHelp, False)
MsgBox(4096, "Information", "Help button enabled: " & _GUICtrlToolbar_IsButtonEnabled($hToolbar, $idHelp))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_IsButtonHidden

Function Reference

_GUICtrlToolbar_IsButtonHidden

Indicates whether the specified button is hidden

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonHidden($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is hidden
False: Button is not hidden

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Hide Save button
MsgBox(4096, "Information", "Save button hidden: " & _GUICtrlToolbar_IsButtonHidden($hToolbar, $idSave))
_GUICtrlToolbar_HideButton($hToolbar, $idSave, True)
MsgBox(4096, "Information", "Save button hidden: " & _GUICtrlToolbar_IsButtonHidden($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_IsButtonHighlighted

Function Reference

_GUICtrlToolbar_IsButtonHighlighted

Indicates whether the specified button is hilighted

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonHighlighted($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is hilighted
False: Button is not hilighted

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Mark Save button
MsgBox(4096, "Information", "Save button Marked: " & _GUICtrlToolbar_IsButtonHighlighted($hToolbar, $idSave))
_GUICtrlToolbar_HighlightButton($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button Marked: " & _GUICtrlToolbar_IsButtonHighlighted($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_IsButtonIndeterminate

Function Reference

_GUICtrlToolbar_IsButtonIndeterminate

Indicates whether the specified button is indeterminate

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonIndeterminate($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is indeterminate
False: Button is not indeterminate

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Set Save button state
MsgBox(4096, "Information", "Save button indeterminate: " & _GUICtrlToolbar_IsButtonIndeterminate($hToolbar, $idSave))
_GUICtrlToolbar_SetIndeterminate($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button indeterminate: " & _GUICtrlToolbar_IsButtonIndeterminate($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_IsButtonPressed

Function Reference

_GUICtrlToolbar_IsButtonPressed

Indicates that the button is being clicked

#Include <GuiToolBar.au3>
_GUICtrlToolbar_IsButtonPressed($hWnd, $iCommandID)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID

Return Value

True: Button is pressed
False: Button is not pressed

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Set Save button state
MsgBox(4096, "Information", "Save button pressed: " & _GUICtrlToolbar_IsButtonPressed($hToolbar, $idSave))
_GUICtrlToolbar_PressButton($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button pressed: " & _GUICtrlToolbar_IsButtonPressed($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_LoadBitmap

Function Reference

_GUICtrlToolbar_LoadBitmap

Adds a bitmap to the image list from a file

#Include <GuiToolBar.au3>
_GUICtrlToolbar_LoadBitmap($hWnd, $sFileName)

Parameters

$hWnd | Handle to toolbar
$sFileName | Fully qualified path to bitmap file

Return Value

Success: The zero based index of the new image
Failure: -1

Remarks

None.

Related

_GUICtrlToolbar_AddBitmap

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idRed=1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add bitmaps
_GUICtrlToolbar_LoadBitmap($hToolbar, @ScriptDir & "\images\Red.bmp")
_GUICtrlToolbar_LoadBitmap($hToolbar, @ScriptDir & "\Images\Green.bmp")
_GUICtrlToolbar_LoadBitmap($hToolbar, @ScriptDir & "\Images\Blue.bmp")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_LoadImages

Function Reference

_GUICtrlToolbar_LoadImages

Loads system defined button images into a toolbar control's image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_LoadImages($hWnd, $iBitMapID)

Parameters

$hWnd | Handle to the control
$iBitMapID | Identifier of a system-defined button image list. Can be set to one of the following values: $IDB_HIST_LARGE_COLOR $IDB_HIST_SMALL_COLOR $IDB_STD_LARGE_COLOR $IDB_STD_SMALL_COLOR $IDB_VIEW_LARGE_COLOR $IDB_VIEW_SMALL_COLOR $IDB_HIST_NORMAL $IDB_HIST_HOT $IDB_HIST_DISABLED $IDB_HIST_PRESSED

Return Value

Success: The count of images in the image list, not including the ones just added
Failure: 0

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_SetBitmapSize($hToolbar, 24, 24)
_GUICtrlToolbar_LoadImages($hToolbar, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_MapAccelerator

Function Reference

_GUICtrlToolbar_MapAccelerator

Determines the ID of the button that corresponds to the specified accelerator

#Include <GuiToolBar.au3>
_GUICtrlToolbar_MapAccelerator($hWnd, $cAccel)

Parameters

$hWnd | Handle to the control
$cAccel | Accelerator character

Return Value

Success: Command ID of the button that has cAccel as its accelerator character

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4], $iCmdID
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Press Save button by accelerator
$iCmdID = _GUICtrlToolbar_MapAccelerator($hToolbar, "s")
_GUICtrlToolbar_PressButton($hToolbar, $iCmdID)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_MoveButton

Function Reference

_GUICtrlToolbar_MoveButton

Moves a button from one index to another

#Include <GuiToolBar.au3>
_GUICtrlToolbar_MoveButton($hWnd, $iOldPos, $iNewPos)

Parameters

$hWnd | Handle to the control
$iOldPos | Zero based index of the button to be moved
$iNewPos | Zero based index where the button will be moved

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Move Save button state
MsgBox(4096, "Information", "Moving Save button")
_GUICtrlToolbar_MoveButton($hToolbar, 2, 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_PressButton

Function Reference

_GUICtrlToolbar_PressButton

Presses or releases the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_PressButton($hWnd, $iCommandID[, $fPress = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fPress | [optional] Pressed state: True - Button will be set to a pressed state False - Button will be set to an unpressed state

Return Value

Success: | True
Failure: | False

Remarks

This function does not fire the click event on dropdown style buttons. You should use the _GUICtrlToolbar_ClickButton
function if you want to ensure that the button click event is fired, regardless of the button style.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Set Save button state
MsgBox(4096, "Information", "Save button pressed: " & _GUICtrlToolbar_IsButtonPressed($hToolbar, $idSave))
_GUICtrlToolbar_PressButton($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button pressed: " & _GUICtrlToolbar_IsButtonPressed($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetAnchorHighlight

Function Reference

_GUICtrlToolbar_SetAnchorHighlight

Sets the anchor highlight setting

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetAnchorHighlight($hWnd, $fAnchor)

Parameters

$hWnd | Handle to the control
$fAnchor | Anchor highlighting setting: True - Anchor highlighting will be enabled False - Anchor highlighting will be disabled

Return Value

Success: The previous anchor highlight setting

Remarks

Anchor highlighting means that the last highlighted item will remain highlighted until another item is
highlighted. This occurs even if the cursor leaves the toolbar control.

Related

_GUICtrlToolbar_GetAnchorHighlight

Example

#include <GuiToolbar.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hToolbar, $fEnabled

Run("explorer.exe /root, ,::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
WinWaitActive("My Computer")
$hToolbar = _GUICtrlToolbar_FindToolbar("[CLASS:CabinetWClass]", "&File")
$fEnabled = _GUICtrlToolbar_GetAnchorHighlight($hToolbar)
MsgBox(4096, "Information", "Anchor highlight enabled: " & $fEnabled)
_GUICtrlToolbar_SetAnchorHighlight($hToolbar, Not $fEnabled)
MsgBox(4096, "Information", "Anchor highlight enabled: " & _GUICtrlToolbar_GetAnchorHighlight($hToolbar))

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetBitmapSize

Function Reference

_GUICtrlToolbar_SetBitmapSize

Sets the size of the bitmapped images to be added to a toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetBitmapSize($hWnd, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the control
$iWidth | Width, in pixels, of the bitmapped images
$iHeight | Height, in pixels, of the bitmapped images

Return Value

Success: True
Failure: False

Remarks

The size can be set only before adding any bitmaps to the toolbar. If an application does not explicitly set
the bitmap size, the size defaults to 16 by 15 pixels.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
_GUICtrlToolbar_SetBitmapSize($hToolbar, 24, 24)
_GUICtrlToolbar_LoadImages($hToolbar, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetButtonBitMap

Function Reference

_GUICtrlToolbar_SetButtonBitMap

Sets the index of the bitmap associated with a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonBitMap($hWnd, $iCommandID, $iIndex)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$iIndex | Zero based index of an images image list

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonBitmap

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Show Save button bitmap index
MsgBox(4096, "Information", "Changing Save bitmap to Print bitmap")
_GUICtrlToolbar_SetButtonBitMap($hToolbar, $idSave, $STD_PRINT)
MsgBox(4096, "Information", "Save button bitmap index: " & _GUICtrlToolbar_GetButtonBitmap($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetButtonInfo

Function Reference

_GUICtrlToolbar_SetButtonInfo

Sets extended information for a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonInfo($hWnd, $iCommandID[, $iImage = -3[, $iState = -1[, $iStyle = -1[, $iWidth = -1[, $iParam = -1]]]]])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$iImage | [optional] Zero based index of the button image. Set this parameter to -1 and the control will send the $TBN_GETDISPINFO notification to retrieve the image index when it is needed. Set this to -2 to indicate that the button does not have an image. The button layout will only include space for the text. If the button is a separator, this is the width of the separator, in pixels.
$iState | [optional] Button state. Can be a combination of the following: $TBSTATE_CHECKED - The button being clicked $TBSTATE_PRESSED - The button is being clicked $TBSTATE_ENABLED - The button accepts user input $TBSTATE_HIDDEN - The button is not visible $TBSTATE_INDETERMINATE - The button is grayed $TBSTATE_WRAP - The button is followed by a line break $TBSTATE_ELLIPSES - The button's text is cut off $TBSTATE_MARKED - The button is marked
$iStyle | [optional] Button style. Can be a combination of the following: $BTNS_AUTOSIZE - The control should not assign the standard width $BTNS_BUTTON - Standard button $BTNS_CHECK - Toggles between the pressed and nonpressed $BTNS_CHECKGROUP - Button that stays pressed until another button is pressed $BTNS_DROPDOWN - Creates a drop-down style button that can display a list $BTNS_GROUP - Button that stays pressed until another button is pressed $BTNS_NOPREFIX - The button text will not have an accelerator prefix $BTNS_SEP - Creates a separator $BTNS_SHOWTEXT - Specifies that button text should be displayed $BTNS_WHOLEDROPDOWN - Specifies that the button will have a drop-down arrow
$iWidth | [optional] Button width
$iParam | [optional] Application-defined value

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonInfo, $tagTBBUTTONINFO

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aButton
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button information
_GUICtrlToolbar_SetButtonInfo ($hToolbar, $idSave, $STD_PRINT, BitOR($TBSTATE_PRESSED, $TBSTATE_ENABLED), -1, 100, 1234)

; Show Save button information
$aButton = _GUICtrlToolbar_GetButtonInfo ($hToolbar, $idSave)
MemoWrite("Image index ....: " & $aButton[0])
MemoWrite("State flags ....: " & $aButton[1])
MemoWrite("Style flags ....: " & $aButton[2])
MemoWrite("Button width ...: " & $aButton[3])
MemoWrite("Param ..........: " & $aButton[4])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonInfoEx

Function Reference

_GUICtrlToolbar_SetButtonInfoEx

Sets extended information for a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonInfoEx($hWnd, $iCommandID, $tButton)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$tButton | $tagBUTTONINFO structure

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonInfoEx, $tagTBBUTTONINFO

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $tButton
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button information
$tButton = DllStructCreate($tagTBBUTTONINFO)
DllStructSetData($tButton, "Mask", BitOR($TBIF_IMAGE, $TBIF_STATE, $TBIF_SIZE, $TBIF_LPARAM))
DllStructSetData($tButton, "State", BitOR($TBSTATE_PRESSED, $TBSTATE_ENABLED))
DllStructSetData($tButton, "Image", $STD_PRINT)
DllStructSetData($tButton, "CX", 100)
DllStructSetData($tButton, "Param", 1234)
_GUICtrlToolbar_SetButtonInfoEx ($hToolbar, $idSave, $tButton)

; Show Save button information
$tButton = _GUICtrlToolbar_GetButtonInfoEx ($hToolbar, $idSave)
MemoWrite("Image index ....: " & DllStructGetData($tButton, "Image"))
MemoWrite("State flags ....: " & DllStructGetData($tButton, "State"))
MemoWrite("Button width ...: " & DllStructGetData($tButton, "CX"))
MemoWrite("Param ..........: " & DllStructGetData($tButton, "Param"))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonParam

Function Reference

_GUICtrlToolbar_SetButtonParam

Sets the button param value

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonParam($hWnd, $iCommandID, $iParam)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$iParam | Application-defined value

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonParam

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Set Save button parameter
_GUICtrlToolbar_SetButtonParam ($hToolbar, $idSave, 1234)

; Show Save button parameter
MemoWrite("Save button parameter: " & _GUICtrlToolbar_GetButtonParam ($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonSize

Function Reference

_GUICtrlToolbar_SetButtonSize

Sets the size of the buttons to be added to a toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonSize($hWnd, $iHeight, $iWidth)

Parameters

$hWnd | Handle to the control
$iHeight | Height, in pixels, of the buttons
$iWidth | Width, in pixels, of the buttons

Return Value

Success: True
Failure: False

Remarks

The size can be set only before adding any buttons to the toolbar. If an application does not explicitly set
the button size, the size defaults to 24 by 22 pixels.

Related

_GUICtrlToolbar_GetButtonSize

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aSize
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show button size
$aSize = _GUICtrlToolbar_GetButtonSize($hToolbar)
MemoWrite("Button height : " & $aSize[0])
MemoWrite("Button width .: " & $aSize[1])
_GUICtrlToolbar_SetButtonSize($hToolbar, $aSize[0], $aSize[1] + 10)
$aSize = _GUICtrlToolbar_GetButtonSize($hToolbar)
MemoWrite("New Button Size")
MemoWrite("Button height : " & $aSize[0])
MemoWrite("Button width .: " & $aSize[1])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonState

Function Reference

_GUICtrlToolbar_SetButtonState

Sets information about the state of the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonState($hWnd, $iCommandID, $iState)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$iState | Button state. Can be one or more of the following: $TBSTATE_CHECKED - The button has the $TBSTYLE_CHECK style and is being clicked $TBSTATE_PRESSED - The button is being clicked $TBSTATE_ENABLED - The button accepts user input $TBSTATE_HIDDEN - The button is not visible and cannot receive user input $TBSTATE_INDETERMINATE - The button is grayed $TBSTATE_WRAP - The button is followed by a line break $TBSTATE_ELLIPSES - The button's text is cut off and an ellipsis is displayed $TBSTATE_MARKED - The button is marked

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonState

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags ($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Show Save button state
MemoWrite("Save button state: " & _GUICtrlToolbar_GetButtonState ($hToolbar, $idSave))

Sleep(1000)

; Set Save button state
_GUICtrlToolbar_SetButtonState ($hToolbar, $idSave, BitOR($TBSTATE_ENABLED, $TBSTATE_PRESSED))

; Show Save button state
MemoWrite("Save button state: " & _GUICtrlToolbar_GetButtonState ($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonStyle

Function Reference

_GUICtrlToolbar_SetButtonStyle

Sets the style flags of a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonStyle($hWnd, $iCommandID, $iStyle)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$iStyle | Button style. Can be one or more of the following: $BTNS_AUTOSIZE - The toolbar control should not assign the standard width to the button $BTNS_CHECK - Toggles between the pressed and nonpressed $BTNS_CHECKGROUP - Button that stays pressed until another button in the group is pressed $BTNS_DROPDOWN - Drop-down style button that can display a list $BTNS_GROUP - Button that stays pressed until another button in the group is pressed $BTNS_NOPREFIX - The button text will not have an accelerator prefix $BTNS_SEP - Separator $BTNS_SHOWTEXT - Button text should be displayed $BTNS_WHOLEDROPDOWN - The button has a drop-down arrow

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonStyle

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set Save button style
_GUICtrlToolbar_SetButtonStyle($hToolbar, $idSave, $BTNS_CHECK)

; Show Save button style
MemoWrite("Save button style: " & _GUICtrlToolbar_GetButtonStyle($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonText

Function Reference

_GUICtrlToolbar_SetButtonText

Sets the display text of a button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonText($hWnd, $iCommandID, $sText)

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$sText | Button text

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetButtonText

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change Save button text
_GUICtrlToolbar_SetButtonText($hToolbar, $idSave, "&Close")

; Show Save button text
MemoWrite("Save button text: " & _GUICtrlToolbar_GetButtonText($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetButtonWidth

Function Reference

_GUICtrlToolbar_SetButtonWidth

Sets the minimum and maximum button widths in the toolbar control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetButtonWidth($hWnd, $iMin, $iMax)

Parameters

$hWnd | Handle to the control
$iMin | Minimum button width, in pixels
$iMax | Maximum button width, in pixels

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Enable multi line button labels
_GUICtrlToolbar_SetButtonWidth($hToolbar, 32, 40)
_GUICtrlToolbar_SetMaxTextRows($hToolbar, 2)

_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Show number of text rows
MsgBox(4096, "Information", "Number of text rows:" & _GUICtrlToolbar_GetTextRows($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetCmdID

Function Reference

_GUICtrlToolbar_SetCmdID

Sets the command identifier of a toolbar button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetCmdID($hWnd, $iIndex, $iCommandID)

Parameters

$hWnd | Handle to the control
$iIndex | Zero based index of the button whose command identifier is to be set
$iCommandID | Command identifier

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp, $idPrint

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Change Save button to Print button
MsgBox(4096, "Information", "Changing Save button to Print button")
_GUICtrlToolbar_SetCmdID($hToolbar, 2, $idPrint)
_GUICtrlToolbar_SetButtonBitMap($hToolbar, $idPrint, $STD_PRINT)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetColorScheme

Function Reference

_GUICtrlToolbar_SetColorScheme

Sets the color scheme information

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetColorScheme($hWnd, $iHighlight, $iShadow)

Parameters

$hWnd | Handle to the control
$iHighlight | Highlight color
$iShadow | Shadow color

Return Value

None.

Remarks

The control uses the color scheme information when drawing the 3-D elements in the control

Related

_GUICtrlToolbar_GetColorScheme

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aScheme
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change Color Scheme
_GUICtrlToolbar_SetColorScheme($hToolbar, 0x00ffff, 0x800000)

; Show Color Scheme
$aScheme = _GUICtrlToolbar_GetColorScheme($hToolbar)
MemoWrite("Highlight: " & '0x' & Hex($aScheme[0], 6))
MemoWrite("Shadow: " & '0x' & Hex($aScheme[1], 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetDisabledImageList

Function Reference

_GUICtrlToolbar_SetDisabledImageList

Sets the disabled image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetDisabledImageList($hWnd, $hImageList)

Parameters

$hWnd | Handle to the control
$hImageList | Handle to the image list that will be set

Return Value

Success: The handle to the image list previously used to display disabled buttons
Failure: 0

Remarks

None.

Related

_GUICtrlToolbar_GetDisabledImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetDrawTextFlags

Function Reference

_GUICtrlToolbar_SetDrawTextFlags

Sets the text drawing flags for the toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetDrawTextFlags($hWnd, $iMask, $iDTFlags)

Parameters

$hWnd | Handle to the control
$iMask | One or more of the DT_ flags, specified in DrawText, that indicate which bits in iDTFlags will be used when drawing the text.
$iDTFlags | One or more of the DT_ flags, specified in DrawText, that indicate how the button text will be drawn. This value will be passed to the DrawText API when the button text is drawn.

Return Value

Success: Returns the previous text drawing flags

Remarks

The iMask parameter allows you to specify which flags will be used when drawing the text, even if these flags
are turned off. For example, if you don't want the $DT_CENTER flag used when drawing text you would add the
$DT_CENTER flag to iMask and not specify the $DT_CENTER flag in iDTFlags. This prevents the control from
passing the $DT_CENTER flag to the DrawText API.

Related


Function _GUICtrlToolbar_SetExtendedStyle

Function Reference

_GUICtrlToolbar_SetExtendedStyle

Sets the extended styles control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetExtendedStyle($hWnd, $iStyle)

Parameters

$hWnd | Handle to the control
$iStyle | Control extended styles. Can be one or more of the following: $TBSTYLE_EX_DRAWDDARROWS - Allows buttons to have a separate dropdown arrow $TBSTYLE_EX_MIXEDBUTTONS - Allows mixing buttons with text and images $TBSTYLE_EX_HIDECLIPPEDBUTTONS - Hides partially clipped buttons $TBSTYLE_EX_DOUBLEBUFFER - Requires the toolbar to be double buffered

Return Value

Success: The previous extended styles

Remarks

None.

Related

_GUICtrlToolbar_GetExtendedStyle

Example

#include <GuiToolbar.au3>
#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $hGUI, $iMemo

_Main()

Func _Main()
Local $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
_GUICtrlToolbar_SetExtendedStyle($hToolbar, $TBSTYLE_EX_DRAWDDARROWS)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, 0, $BTNS_DROPDOWN)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show extended styles in use
MemoWrite("Extended sytles: " & _GUICtrlToolbar_GetExtendedStyle($hToolbar))

; Loop until user exits
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; Handle TBN_DROPDOWN message
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tNMHDR, $iCode, $hMenu

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$iCode = DllStructGetData($tNMHDR, "Code")

If $iCode = $TBN_DROPDOWN Then
$hMenu = _GUICtrlMenu_CreatePopup()
_GUICtrlMenu_AddMenuItem($hMenu, "Template 1", 2000)
_GUICtrlMenu_AddMenuItem($hMenu, "Template 2", 2001)
_GUICtrlMenu_AddMenuItem($hMenu, "Template 3", 2002)
_GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI)
_GUICtrlMenu_DestroyMenu($hMenu)
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlToolbar_SetHotImageList

Function Reference

_GUICtrlToolbar_SetHotImageList

Sets the hot button image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetHotImageList($hWnd, $hImageList)

Parameters

$hWnd | Handle to the control
$hImageList | Handle to the image list that will be set

Return Value

Success: The handle to the image list previously used to display hot buttons
Failure: 0

Remarks

None.

Related

_GUICtrlToolbar_GetHotImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetHotItem

Function Reference

_GUICtrlToolbar_SetHotItem

Sets the hot item

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetHotItem($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | Index of the item that will be made hot. If this value is -1, none of the items will be hot.

Return Value

Success: The index of the previous hot item, or -1 if there was no hot item

Remarks

A button is considered hot when the cursor is over it

Related

_GUICtrlToolbar_GetHotItem

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $aSize

; Create GUI
$hGUI = GUICreate("Toolbar", 600, 400)
$hToolbar = _GUICtrlToolbar_Create ($hGUI)
$aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar)

$iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

; Add standard system bitmaps
_GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add buttons
_GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep ($hToolbar)
_GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
#forceref $hWndGUI, $MsgID, $wParam
Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
Local $tNMTOOLBAR, $tNMTBHOTITEM
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$idFrom = DllStructGetData($tNMHDR, "IDFrom")
$code = DllStructGetData($tNMHDR, "Code")
Switch $hwndFrom
Case $hToolbar
Switch $code
Case $NM_LDOWN
;----------------------------------------------------------------------------------------------
MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem))
;----------------------------------------------------------------------------------------------
Case $TBN_HOTITEMCHANGE
$tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
$i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
$i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
$iItem = $i_idNew
$dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
MemoWrite("$HICF_LEAVING: " & $i_idOld)
Else
Switch $i_idNew
Case $idNew
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idNew")
;----------------------------------------------------------------------------------------------
Case $idOpen
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idOpen")
;----------------------------------------------------------------------------------------------
Case $idSave
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idSave")
;----------------------------------------------------------------------------------------------
Case $idHelp
;----------------------------------------------------------------------------------------------
MemoWrite("$TBN_HOTITEMCHANGE: $idHelp")
;----------------------------------------------------------------------------------------------
EndSwitch
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_NOTIFY


Function _GUICtrlToolbar_SetImageList

Function Reference

_GUICtrlToolbar_SetImageList

Sets the default button image list

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetImageList($hWnd, $hImageList)

Parameters

$hWnd | Handle to the control
$hImageList | Handle to the image list to set. If this parameter is 0, no images are displayed in the buttons.

Return Value

Success: The handle to the image list previously used to display buttons in their default state
Failure: 0

Remarks

None.

Related

_GUICtrlToolbar_GetImageList

Example

#include <GuiToolbar.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hNormal, $hDisabled, $hHot
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp
Local Enum $idRed = 1000, $idGreen, $idBlue

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
GUISetBkColor(0xffff00)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Create normal image list
$hNormal = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hNormal, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
_GUICtrlToolbar_SetImageList($hToolbar, $hNormal)

; Create disabled image list
$hDisabled = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUIImageList_Add($hDisabled, _WinAPI_CreateSolidBitmap($hGUI, 0xCCCCCC, 32, 24))
_GUICtrlToolbar_SetDisabledImageList($hToolbar, $hDisabled)

; Create hot image list
$hHot = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x111111, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0x888888, 32, 24))
_GUIImageList_Add($hHot, _WinAPI_CreateSolidBitmap($hGUI, 0xAAAAAA, 32, 24))
_GUICtrlToolbar_SetHotImageList($hToolbar, $hHot)

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idRed, 0)
_GUICtrlToolbar_AddButton($hToolbar, $idGreen, 1)
_GUICtrlToolbar_AddButton($hToolbar, $idBlue, 2)

; Disable Blue button
_GUICtrlToolbar_EnableButton($hToolbar, $idBlue, False)

; Show image list handles
MemoWrite("Disabled list handle .: 0x" & Hex(_GUICtrlToolbar_GetDisabledImageList($hToolbar)))
MemoWrite("Hot list handle ......: 0x" & Hex(_GUICtrlToolbar_GetHotImageList($hToolbar)))
MemoWrite("Normal list handle ...: 0x" & Hex(_GUICtrlToolbar_GetImageList($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetIndent

Function Reference

_GUICtrlToolbar_SetIndent

Sets the indentation for the first button control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetIndent($hWnd, $iIndent)

Parameters

$hWnd | Handle to the control
$iIndent | Indentation in pixels

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp, $idPrint

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Set the first button indent
_GUICtrlToolbar_SetIndent($hToolbar, 24)

_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetIndeterminate

Function Reference

_GUICtrlToolbar_SetIndeterminate

Sets or clears the indeterminate state of the specified button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetIndeterminate($hWnd, $iCommandID[, $fState = True])

Parameters

$hWnd | Handle to the control
$iCommandID | Button command ID
$fState | [optional] True if indeterminate, otherwise False

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp, $idPrint

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Set Save button state
MsgBox(4096, "Information", "Save button indeterminate: " & _GUICtrlToolbar_IsButtonIndeterminate($hToolbar, $idSave))
_GUICtrlToolbar_SetIndeterminate($hToolbar, $idSave)
MsgBox(4096, "Information", "Save button indeterminate: " & _GUICtrlToolbar_IsButtonIndeterminate($hToolbar, $idSave))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetInsertMark

Function Reference

_GUICtrlToolbar_SetInsertMark

Sets the current insertion mark for the toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetInsertMark($hWnd, $iButton[, $iFlags = 0])

Parameters

$hWnd | Handle to the control
$iButton | Zero based index of the insertion mark. If -1, there is no mark.
$iFlags | [optional] Defines where the insertion mark is in relation to iButton: 0 - Left of the specified button 1 - Right of the specified button 2 - Background of the toolbar

Return Value

None.

Remarks

None.

Related

_GUICtrlToolbar_GetInsertMark

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMark
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set insert mark
_GUICtrlToolbar_SetInsertMarkColor($hToolbar, 0xFF0000)
_GUICtrlToolbar_SetInsertMark($hToolbar, 1, 1)

; Show insert mark
$aMark = _GUICtrlToolbar_GetInsertMark($hToolbar)
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])
MemoWrite("Mark color ...: 0x" & Hex(_GUICtrlToolbar_GetInsertMarkColor($hToolbar), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetInsertMarkColor

Function Reference

_GUICtrlToolbar_SetInsertMarkColor

Sets the color used to draw the insertion mark

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetInsertMarkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Insertion mark color

Return Value

Success: Previous insertion mark color

Remarks

None.

Related

_GUICtrlToolbar_GetInsertMarkColor

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMark
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set insert mark
_GUICtrlToolbar_SetInsertMarkColor($hToolbar, 0xFF0000)
_GUICtrlToolbar_SetInsertMark($hToolbar, 1, 1)

; Show insert mark
$aMark = _GUICtrlToolbar_GetInsertMark($hToolbar)
MemoWrite("Index ........: " & $aMark[0])
MemoWrite("Relationship .: " & $aMark[1])
MemoWrite("Mark color ...: 0x" & Hex(_GUICtrlToolbar_GetInsertMarkColor($hToolbar), 6))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetMaxTextRows

Function Reference

_GUICtrlToolbar_SetMaxTextRows

Sets the maximum number of text rows displayed button

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetMaxTextRows($hWnd, $iMaxRows)

Parameters

$hWnd | Handle to the control
$iMaxRows | Maximum number of rows of text that can be displayed

Return Value

Success: True
Failure: False

Remarks

None.

Related

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aStrings[4]
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Enable multi line button labels
_GUICtrlToolbar_SetButtonWidth($hToolbar, 32, 40)
_GUICtrlToolbar_SetMaxTextRows($hToolbar, 2)

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add strings
$aStrings[0] = _GUICtrlToolbar_AddString($hToolbar, "&New Button")
$aStrings[1] = _GUICtrlToolbar_AddString($hToolbar, "&Open Button")
$aStrings[2] = _GUICtrlToolbar_AddString($hToolbar, "&Save Button")
$aStrings[3] = _GUICtrlToolbar_AddString($hToolbar, "&Help Button")

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW, $aStrings[0])
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1])
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2])
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, $aStrings[3])

; Show number of text rows
MsgBox(4096, "Information", "Number of text rows:" & _GUICtrlToolbar_GetTextRows($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetMetrics

Function Reference

_GUICtrlToolbar_SetMetrics

Retrieves the metrics of a toolbar control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetMetrics($hWnd, $iXPad, $iYPad, $iXSpacing, $iYSpacing)

Parameters

$hWnd | Handle to the control
$iXPad | Width of the padding inside the toolbar buttons
$iYPad | Height of the padding inside the toolbar buttons
$iXSpacing | Width of the space between toolbar buttons
$iYSpacing | Height of the space between toolbar buttons

Return Value

Success: | True
Failure: | False

Remarks

Minimum OS - Windows XP.

Related

_GUICtrlToolbar_GetMetrics

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aMetrics
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

GUISetState(@SW_LOCK)
; Set control metrics
_GUICtrlToolbar_SetMetrics($hToolbar, 1, 2, 3, 4)
GUISetState(@SW_UNLOCK)

; Show control metrics
$aMetrics = _GUICtrlToolbar_GetMetrics($hToolbar)
MemoWrite("Button padding width ...: " & $aMetrics[0])
MemoWrite("Button padding height ..: " & $aMetrics[1])
MemoWrite("Button spacing width ...: " & $aMetrics[2])
MemoWrite("Button spacing height ..: " & $aMetrics[3])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetPadding

Function Reference

_GUICtrlToolbar_SetPadding

Sets the padding control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetPadding($hWnd, $iCX, $iCY)

Parameters

$hWnd | Handle to the control
$iCX | The horizontal padding, in pixels
$iCY | The vertical padding, in pixels

Return Value

Success: Previous horizontal padding in the low word and the previous vertical padding in the high word

Remarks

The padding values are used to create a blank area between the edge of the button and the button's image
and/or text. The horizontal padding value is applied to both the right and left of the button and the vertical
padding value is applied to both the top and bottom of the button. Padding is only applied to buttons that
have the $TBSTYLE_AUTOSIZE style.

Related

_GUICtrlToolbar_GetPadding

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $aPad
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Set control padding
_GUICtrlToolbar_SetPadding($hToolbar, 2, 3)

; Show control padding
$aPad = _GUICtrlToolbar_GetPadding($hToolbar)
MemoWrite("Horizontal padding : " & $aPad[0])
MemoWrite("Vertical padding ..: " & $aPad[1])
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetParent

Function Reference

_GUICtrlToolbar_SetParent

Sets the window to which the control sends notification messages

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetParent($hWnd, $hParent)

Parameters

$hWnd | Handle to the control
$hParent | Handle to the window to receive notification messages

Return Value

Success: Handle to the previous notification window
Failure: 0

Remarks

The $TB_SETPARENT message does not change the parent window that was specified when the control was created.
Calling the _WinAPI_GetParent function control will return the actual parent window, not the window specified in
$TB_SETPARENT. To change the control's parent window, call the _WinAPI_SetParent function.

Related


Function _GUICtrlToolbar_SetRows

Function Reference

_GUICtrlToolbar_SetRows

Sets the number of rows of buttons

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetRows($hWnd, $iRows[, $fLarger = True])

Parameters

$hWnd | Handle to the control
$iRows | Number of rows requested. The minimum number of rows is one, and the maximum number of rows is equal to the total number of buttons.
$fLarger | [optional] Flag that indicates whether to create more rows than requested when the system can not create the number of rows specified by $iRows. If this parameter is True, the system creates more rows. If it is False, the system creates fewer rows.

Return Value

Success: Array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

Remarks

Because the system does not break up button groups when setting the number of rows, the resulting number of
rows might differ from the number requested.

Related

_GUICtrlToolbar_GetRows

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 36, 2, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Create a vertical toolbar
_GUICtrlToolbar_SetStyle($hToolbar, BitOR($CCS_LEFT, $TBSTYLE_FLAT))
_GUICtrlToolbar_SetRows($hToolbar, 4)

; Show number of rows
MemoWrite("Number of rows:" & _GUICtrlToolbar_GetRows($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetStyle

Function Reference

_GUICtrlToolbar_SetStyle

Sets the style control

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyle($hWnd, $iStyle)

Parameters

$hWnd | Handle to the control
$iStyle | Control styles. Can be a combination of the following: $TBSTYLE_TOOLTIPS - Creates a ToolTip control $TBSTYLE_WRAPABLE - Creates a toolbar that can have multiple lines of buttons $TBSTYLE_ALTDRAG - Allows users to change a toolbar button's position by dragging it $TBSTYLE_FLAT - Creates a flat toolbar $TBSTYLE_LIST - Creates a flat toolbar with button text to the right of the bitmap $TBSTYLE_CUSTOMERASE - Sends $NM_CUSTOMDRAW messages when processing $WM_ERASEBKGND messages $TBSTYLE_REGISTERDROP - Sends $TBN_GETOBJECT messages to request drop target objects $TBSTYLE_TRANSPARENT - Creates a transparent toolbar

Return Value

None.

Remarks

None.

Related

_GUICtrlToolbar_GetStyle

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Set control style
_GUICtrlToolbar_SetStyle($hToolbar, BitOR($TBSTYLE_LIST, $CCS_TOP))

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show control style
MemoWrite("Toolbar style .: 0x" & Hex(_GUICtrlToolbar_GetStyle($hToolbar)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetStyleAltDrag

Function Reference

_GUICtrlToolbar_SetStyleAltDrag

Sets whether that the control allows buttons to be dragged

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleAltDrag($hWnd[, $fState = True])

Parameters

$hWnd | Handle to the control
$fState | [optional] True to set, False to unset

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleAltDrag

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleAltDrag($hToolbar)
MemoWrite("Toolbar has drag style .: " & $fStyle)
_GUICtrlToolbar_SetStyleAltDrag($hToolbar, Not $fStyle)
MemoWrite("Toolbar has drag style .: " & _GUICtrlToolbar_GetStyleAltDrag($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetStyleCustomErase

Function Reference

_GUICtrlToolbar_SetStyleCustomErase

Sets whether the control generates NM_CUSTOMDRAW notification messages

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleCustomErase($hWnd[, $fState = True])

Parameters

$hWnd | Handle to the control
$fState | [optional] True to set, False to unset

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleCustomErase

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleCustomErase($hToolbar)
MemoWrite("Toolbar sends custom erase .: " & $fStyle)
_GUICtrlToolbar_SetStyleCustomErase($hToolbar, Not $fStyle)
MemoWrite("Toolbar sends custom erase .: " & _GUICtrlToolbar_GetStyleCustomErase($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetStyleFlat

Function Reference

_GUICtrlToolbar_SetStyleFlat

Sets whether the control is flat

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleFlat($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleFlat

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleFlat($hToolbar)
MsgBox(4096, "Information", "Toolbar has flat style .: " & $fStyle)
GUISetState(@SW_LOCK)
_GUICtrlToolbar_SetStyleFlat($hToolbar, Not $fStyle)
GUISetState(@SW_UNLOCK)
MsgBox(4096, "Information", "Toolbar has flat style .: " & _GUICtrlToolbar_GetStyleFlat($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetStyleList

Function Reference

_GUICtrlToolbar_SetStyleList

Sets whether the control has button text to the right of the bitmap

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleList($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleList

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleList($hToolbar)
MsgBox(4096, "Information", "Toolbar has list style .: " & $fStyle)
_GUICtrlToolbar_SetStyleList($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has list style .: " & _GUICtrlToolbar_GetStyleList($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetStyleRegisterDrop

Function Reference

_GUICtrlToolbar_SetStyleRegisterDrop

Sets whether the control generates TBN_GETOBJECT notification messages

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleRegisterDrop($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleRegisterDrop

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleRegisterDrop($hToolbar)
MsgBox(4096, "Information", "Toolbar has register drop style .: " & $fStyle)
_GUICtrlToolbar_SetStyleRegisterDrop($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has register drop style .: " & _GUICtrlToolbar_GetStyleRegisterDrop($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetStyleToolTips

Function Reference

_GUICtrlToolbar_SetStyleToolTips

Sets whether the control has tooltips

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleToolTips($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleToolTips

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleToolTips($hToolbar)
MsgBox(4096, "Information", "Toolbar has tooltips style .: " & $fStyle)
_GUICtrlToolbar_SetStyleToolTips($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has tooltips style .: " & _GUICtrlToolbar_GetStyleToolTips($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetStyleTransparent

Function Reference

_GUICtrlToolbar_SetStyleTransparent

Sets whether the control is transparent

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleTransparent($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleTransparent

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetBkColor(0xffffff)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleTransparent($hToolbar)
MsgBox(4096, "Information", "Toolbar has transparent style .: " & $fStyle)
GUISetState(@SW_LOCK)
_GUICtrlToolbar_SetStyleTransparent($hToolbar, Not $fStyle)
GUISetState(@SW_UNLOCK)
MsgBox(4096, "Information", "Toolbar has transparent style .: " & _GUICtrlToolbar_GetStyleTransparent($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetStyleWrapable

Function Reference

_GUICtrlToolbar_SetStyleWrapable

Sets whether the control is wrapable

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetStyleWrapable($hWnd, $fState)

Parameters

$hWnd | Handle to the control
$fState | True to set, false to unset

Return Value

Success: True
Failure: False

Remarks

None.

Related

_GUICtrlToolbar_GetStyleWrapable

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fStyle
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Change control style
$fStyle = _GUICtrlToolbar_GetStyleWrapable($hToolbar)
MsgBox(4096, "Information", "Toolbar has wrapable style .: " & $fStyle)
_GUICtrlToolbar_SetStyleWrapable($hToolbar, Not $fStyle)
MsgBox(4096, "Information", "Toolbar has wrapable style .: " & _GUICtrlToolbar_GetStyleWrapable($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main


Function _GUICtrlToolbar_SetToolTips

Function Reference

_GUICtrlToolbar_SetToolTips

Associates a ToolTip control with a toolbar

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetToolTips($hWnd, $hToolTip)

Parameters

$hWnd | Handle to the control
$hToolTip | Handle to the ToolTip control

Return Value

None.

Remarks

Any buttons that are added to the control before sending the calling this function will not be registered with
the ToolTip control.

Related

_GUICtrlToolbar_GetToolTips

Example

#include <GuiToolbar.au3>
#include <GuiToolTip.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp

_Main()

Func _Main()
Local $hGUI, $hToolbar, $hToolTip

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
GUISetState()

; Create ToolTip
$hToolTip = _GUIToolTip_Create($hToolbar)
_GUICtrlToolbar_SetToolTips($hToolbar, $hToolTip)

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show ToolTip handle
MsgBox(4096, "Information", "ToolTip handle .: 0x" & Hex(_GUICtrlToolbar_GetToolTips($hToolbar)))

; Loop until user exits
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Handle WM_NOTIFY messages
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tInfo, $iID, $iCode

$tInfo = DllStructCreate($tagNMTTDISPINFO, $ilParam)
$iCode = DllStructGetData($tInfo, "Code")
If $iCode = $TTN_GETDISPINFO Then
$iID = DllStructGetData($tInfo, "IDFrom")
Switch $iID
Case $idNew
DllStructSetData($tInfo, "aText", "New")
Case $idOpen
DllStructSetData($tInfo, "aText", "Open")
Case $idSave
DllStructSetData($tInfo, "aText", "Save")
Case $idHelp
DllStructSetData($tInfo, "aText", "Help")
EndSwitch
EndIf
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY


Function _GUICtrlToolbar_SetUnicodeFormat

Function Reference

_GUICtrlToolbar_SetUnicodeFormat

Sets the Unicode character format flag

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetUnicodeFormat($hWnd, $fUnicode = False)

Parameters

$hWnd | Handle to the control
$fUnicode | Unicode character setting: True - Control uses Unicode characters False - Control uses ANSI characters

Return Value

Success: Previous character format flag setting

Remarks

None.

Related

_GUICtrlToolbar_GetUnicodeFormat

Example

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hToolbar, $fUnicode
Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp

; Create GUI
$hGUI = GUICreate("Toolbar", 400, 300)
$hToolbar = _GUICtrlToolbar_Create($hGUI)
$iMemo = GUICtrlCreateEdit("", 2, 36, 396, 262, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
GUISetState()

; Add standard system bitmaps
Switch _GUICtrlToolbar_GetBitmapFlags($hToolbar)
Case 0
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_SMALL_COLOR)
Case 2
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
EndSwitch

; Add buttons
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)

; Show Unicode format
$fUnicode = _GUICtrlToolbar_GetUnicodeFormat($hToolbar)
MemoWrite("Unicode format .:" & $fUnicode)

; Change Unicode format
_GUICtrlToolbar_SetUnicodeFormat($hToolbar, Not $fUnicode)
MemoWrite("Unicode format .:" & _GUICtrlToolbar_GetUnicodeFormat($hToolbar))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _GUICtrlToolbar_SetWindowTheme

Function Reference

_GUICtrlToolbar_SetWindowTheme

Sets the visual style

#Include <GuiToolBar.au3>
_GUICtrlToolbar_SetWindowTheme($hWnd, $sTheme)

Parameters

$hWnd | Handle to the control
$sTheme | String that contains the toolbar visual style

Return Value

None.

Remarks

Minimum OS - Windows XP.

Related


User Defined Functions

GuiToolTip user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiToolTip.au3>.

User Defined Function | Description
_GUIToolTip_Activate | Activates or deactivates the control
_GUIToolTip_AddTool | Registers a tool with the control
_GUIToolTip_AdjustRect | Calculates the text display rectangle from the window rectangle
_GUIToolTip_BitsToTTF | Encode user bit flags to $TTF_ flags
_GUIToolTip_Create | Creates a ToolTip control
_GUIToolTip_DelTool | Removes a tool
_GUIToolTip_Destroy | Delete the ToolTip control
_GUIToolTip_EnumTools | Retrieves information about the current tool
_GUIToolTip_GetBubbleHeight | Returns the height of the control
_GUIToolTip_GetBubbleSize | Returns the width and height of the control
_GUIToolTip_GetBubbleWidth | Returns the width of a ToolTip control
_GUIToolTip_GetCurrentTool | Retrieves information for the current tool
_GUIToolTip_GetDelayTime | Retrieves the initial, pop-up or reshow durations
_GUIToolTip_GetMargin | Retrieves the top, left, bottom, and right margins
_GUIToolTip_GetMarginEx | Retrieves the top, left, bottom, and right margins
_GUIToolTip_GetMaxTipWidth | Retrieves the maximum width for a ToolTip window
_GUIToolTip_GetText | Retrieves the text
_GUIToolTip_GetTipBkColor | Retrieves the background color
_GUIToolTip_GetTipTextColor | Retrieves the text color
_GUIToolTip_GetTitleBitMap | Retrieves the title bitmap icon
_GUIToolTip_GetTitleText | Retrieve the title
_GUIToolTip_GetToolCount | Retrieves the tool count
_GUIToolTip_GetToolInfo | Retrieves the information about a specific tool
_GUIToolTip_HitTest | Retrieves the information that a ToolTip control maintains about a tool
_GUIToolTip_NewToolRect | Sets a new bounding rectangle for a tool
_GUIToolTip_Pop | Removes a displayed ToolTip from view
_GUIToolTip_PopUp | Causes the ToolTip to display at the coordinates of the last mouse message
_GUIToolTip_SetDelayTime | Sets the initial, pop-up, and reshow durations
_GUIToolTip_SetMargin | Sets the top, left, bottom, and right margins
_GUIToolTip_SetMaxTipWidth | Sets the maximum width for a ToolTip window
_GUIToolTip_SetTipBkColor | Sets the background color
_GUIToolTip_SetTipTextColor | Sets the text color
_GUIToolTip_SetTitle | Adds a standard icon and title string
_GUIToolTip_SetToolInfo | Sets the information for a tool
_GUIToolTip_SetWindowTheme | Sets the visual style
_GUIToolTip_ToolExists | Determines whether a current tool exists
_GUIToolTip_ToolToArray | Transfers a ToolInfo structure to an array
_GUIToolTip_TrackActivate | Activates or deactivates a tracking ToolTip
_GUIToolTip_TrackPosition | Sets the position of a tracking ToolTip
_GUIToolTip_TTFToBits | Decode $TTF_flags to user bit flags
_GUIToolTip_Update | Forces the current tool to be redrawn
_GUIToolTip_UpdateTipText | Sets the ToolTip text for a tool


Function _GUIToolTip_Activate

Function Reference

_GUIToolTip_Activate

Activates or deactivates the control

#Include <GuiToolTip.au3>
_GUIToolTip_Activate($hWnd[, $fActivate = True])

Parameters

$hWnd | Handle to control
$fActivate | [optional] Activation flag: True - Activate ToolTip False - Deactivate ToolTip

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_AddTool

Function Reference

_GUIToolTip_AddTool

Registers a tool with the control

#Include <GuiToolTip.au3>
_GUIToolTip_AddTool($hTool, $hWnd, $sText[, $iID = 0[, $iLeft = 0[, $iTop = 0[, $iRight = 0[, $iBottom = 0[, $iFlags = 8[, $iParam = 0]]]]]]])

Parameters

$hTool | ToolTip handle
$hWnd | Handle to the window that contains the tool
$sText | Text for the ToolTip control
$iID | [optional] Identifier or window handle of the tool
$iLeft | [optional] X coordinate of the upper left corner of the rectangle
$iTop | [optional] Y coordinate of the upper left corner of the rectangle
$iRight | [optional] X coordinate of the lower right corner of the rectangle
$iBottom | [optional] Y coordinate of the lower right corner of the rectangle
$iFlags | [optional] Flags that control the ToolTip display: 1 - Indicates that $iID is the window handle to the tool instead of the ID 2 - Centers the window below the tool specified by $iID 4 - Indicates that text will be displayed in the opposite direction 8 - Indicates that the control should subclass the tool's window 16 - Positions the control next to the tool to which it corresponds 32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION 64 - Causes the control to forward mouse messages to the parent window 128 - Indicates that links in the control text should be parsed
$iParam | [optional] Application-defined value that is associated with the tool

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUIToolTip_DelTool


Function _GUIToolTip_AdjustRect

Function Reference

_GUIToolTip_AdjustRect

Calculates the text display rectangle from the window rectangle

#Include <GuiToolTip.au3>
_GUIToolTip_AdjustRect($hWnd, ByRef $tRect[, $fLarger = True])

Parameters

$hWnd | Handle to control
$tRect | $tagRECT structure that holds a window or text display rectangle
$fLarger | [optional] Value that specifies which operation to perform. If True, $tRect is used to specify a text display rectangle and it receives the corresponding window rectangle. If False, $tRect is used to specify a window rectangle and it receives the corresponding text display rectangle.

Return Value

Success: $tagRECT structure

Remarks

The ToolTip's window rectangle is somewhat larger than the text display rectangle that bounds the ToolTip
string. The window origin is also offset up and to the left from the origin of the text display rectangle.
To position the text display rectangle, you must calculate the corresponding window rectangle and use that
rectangle to position the ToolTip. $TTM_ADJUSTRECT handles this calculation for you. If you set $fLarger to
True, $TTM_ADJUSTRECT takes the size and position of the desired ToolTip text display rectangle, and passes
back the size and position of the ToolTip window needed to display the text in the specified position. If you
set $fLarger to False you can specify a ToolTip window rectangle and $TTM_ADJUSTRECT will return the size and
position of its text rectangle.

Related


Function _GUIToolTip_BitsToTTF

Function Reference

_GUIToolTip_BitsToTTF

Encode user bit flags to $TTF_ flags

#Include <GuiToolTip.au3>
_GUIToolTip_BitsToTTF($iFlags)

Parameters

$iFlags User bit flags

Return Value

Success: $TTF_ flags

Remarks

None.

Related

_GUIToolTip_TTFToBits


Function _GUIToolTip_Create

Function Reference

_GUIToolTip_Create

Creates a ToolTip control

#Include <GuiToolTip.au3>
_GUIToolTip_Create($hWnd[, $iStyle = 0x00000003])

Parameters

$hWnd Handle to control that will own the tool tip window
$iStyle [optional] ToolTip style:
$TTS_ALWAYSTIP - Indicates that the ToolTip control appears when the cursor is on a tool even if the ToolTip
control's owner window is inactive. Without this style, the ToolTip appears only when the tool's owner window
is active.
$TTS_BALLOON - Indicates that the ToolTip control has the appearance of a cartoon "balloon," with rounded
corners and a stem pointing to the item.
$TTS_NOANIMATE - Disables sliding ToolTip animation on Windows 98 and Windows 2000 systems. This style is
ignored on earlier systems.
$TTS_NOFADE - Disables fading ToolTip animation on Windows 2000 systems. This style is ignored on earlier
Windows NT systems, Windows 95 and Windows 98.
$TTS_NOPREFIX - Prevents the system from stripping the ampersand character from a string. Without this style
the system automatically strips ampersand characters. This allows an application to use the same string as
both a menu item and as text in a ToolTip control.
$TTS_CLOSE - Displays a close icon so that the tooltip can be canceled
Default: $TTS_ALWAYSTIP, $TTS_NOPREFIX

Return Value

Success: | The handle to the Tooltip window
Failure: | 0

Remarks

None.

Related

_GUIToolTip_Destroy


Function _GUIToolTip_DelTool

Function Reference

_GUIToolTip_DelTool

Removes a tool

#Include <GuiToolTip.au3>
_GUIToolTip_DelTool($hWnd, $hTool[, $iID = 0])

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | [optional] Identifier of the tool

Return Value

None.

Remarks

None.

Related

_GUIToolTip_AddTool


Function _GUIToolTip_Destroy

Function Reference

_GUIToolTip_Destroy

Delete the ToolTip control

#Include <GuiToolTip.au3>
_GUIToolTip_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: True, Handle is set to 0
Failure: False

Remarks

Restricted to only be used on ToolTip created with _GUIToolTip_Create

Related

_GUIToolTip_Create


Function _GUIToolTip_EnumTools

Function Reference

_GUIToolTip_EnumTools

Retrieves information about the current tool

#Include <GuiToolTip.au3>
_GUIToolTip_EnumTools($hWnd, $iIndex)

Parameters

$hWnd | Handle to control
$iIndex | Zero based index of the tool for which to retrieve information

Return Value

Success: Array with the following format:
[0] - Flags that control the ToolTip display:
1 - Indicates that $iID is the window handle to the tool instead of the ID
2 - Centers the window below the tool specified by $iID
4 - Indicates that text will be displayed in the opposite direction
8 - Indicates that the control should subclass the tool's window to intercept messages
16 - Positions the control next to the tool to which it corresponds
32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION
64 - Causes the control to forward mouse messages to the parent window
128 - Indicates that links in the control text should be parsed
[1] - Handle to the window that contains the tool
[2] - Identifier of the tool
[3] - X coordinate of the upper left corner of the rectangle
[4] - Y coordinate of the upper left corner of the rectangle
[5] - X coordinate of the lower right corner of the rectangle
[6] - Y coordinate of the lower right corner of the rectangle
[7] - Handle to the instance that contains the string resource for the tool
[8] - Text for the tool
[9] - Application-defined value associated with the tool

Remarks

None.

Related


Function _GUIToolTip_GetBubbleHeight

Function Reference

_GUIToolTip_GetBubbleHeight

Returns the height of the control

#Include <GuiToolTip.au3>
_GUIToolTip_GetBubbleHeight($hWnd, $hTool, $iID[, $iFlags = 48])

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Identifier of the tool
$iFlags | [optional] Flags that control the ToolTip display: 1 - Indicates that $iID is the window handle to the tool instead of the ID 2 - Centers the window below the tool specified by $iID 4 - Indicates that text will be displayed in the opposite direction 8 - Indicates that the control should subclass the tool's window to intercept messages 16 - Positions the control next to the tool to which it corresponds 32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION 64 - Causes the control to forward mouse messages to the parent window 128 - Indicates that links in the control text should be parsed

Return Value

Success: The height the ToolTip

Remarks

None.

Related

_GUIToolTip_GetBubbleSize, _GUIToolTip_GetBubbleWidth


Function _GUIToolTip_GetBubbleSize

Function Reference

_GUIToolTip_GetBubbleSize

Returns the width and height of the control

#Include <GuiToolTip.au3>
_GUIToolTip_GetBubbleSize($hWnd, $hTool, $iID[, $iFlags = 0x000000A0])

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Identifier of the tool
$iFlags | [optional] Flags that control the ToolTip display

Return Value

Success: Returns the width of the ToolTip in the low word and the height in the high word

Remarks

None.

Related

_GUIToolTip_GetBubbleHeight, _GUIToolTip_GetBubbleWidth


Function _GUIToolTip_GetBubbleWidth

Function Reference

_GUIToolTip_GetBubbleWidth

Returns the width of a ToolTip control

#Include <GuiToolTip.au3>
_GUIToolTip_GetBubbleWidth($hWnd, $hTool, $iID[, $iFlags = 48])

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Application-defined identifier of the tool
$iFlags | [optional] Flags that control the ToolTip display: 1 - Indicates that $iID is the window handle to the tool instead of the ID 2 - Centers the window below the tool specified by $iID 4 - Indicates that text will be displayed in the opposite direction 8 - Indicates that the control should subclass the tool's window to intercept messages 16 - Positions the control next to the tool to which it corresponds 32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION 64 - Causes the control to forward mouse messages to the parent window 128 - Indicates that links in the control text should be parsed

Return Value

Success: The width the ToolTip

Remarks

None.

Related

_GUIToolTip_GetBubbleHeight, _GUIToolTip_GetBubbleSize


Function _GUIToolTip_GetCurrentTool

Function Reference

_GUIToolTip_GetCurrentTool

Retrieves information for the current tool

#Include <GuiToolTip.au3>
_GUIToolTip_GetCurrentTool($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - Flags that control the ToolTip display:
1 - Indicates that $iID is the window handle to the tool instead of the ID
2 - Centers the window below the tool specified by $iID
4 - Indicates that text will be displayed in the opposite direction
8 - Indicates that the control should subclass the tool's window to intercept messages
16 - Positions the control next to the tool to which it corresponds
32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION
64 - Causes the control to forward mouse messages to the parent window
128 - Indicates that links in the control text should be parsed
[1] - Handle to the window that contains the tool
[2] - Identifier of the tool
[3] - X coordinate of the upper left corner of the rectangle
[4] - Y coordinate of the upper left corner of the rectangle
[5] - X coordinate of the lower right corner of the rectangle
[6] - Y coordinate of the lower right corner of the rectangle
[7] - Handle to the instance that contains the string resource for the tool
[8] - Text for the tool
[9] - Application-defined value associated with the tool

Remarks

None.

Related


Function _GUIToolTip_GetDelayTime

Function Reference

_GUIToolTip_GetDelayTime

Retrieves the initial, pop-up or reshow durations

#Include <GuiToolTip.au3>
_GUIToolTip_GetDelayTime($hWnd, $iDuration)

Parameters

$hWnd | Handle to control
$iDuration | Flag that specifies which duration value will be retrieved: 0 - Time it takes for subsequent ToolTip windows to appear as the pointer moves from one tool to another 1 - Time the ToolTip window remains visible if the pointer is stationary within a tool's bounding rectangle 2 - Time the pointer must remain stationary within a tool's bounding rectangle before the window appears

Return Value

Success: The specified duration, in milliseconds

Remarks

None.

Related

_GUIToolTip_SetDelayTime


Function _GUIToolTip_GetMargin

Function Reference

_GUIToolTip_GetMargin

Retrieves the top, left, bottom, and right margins

#Include <GuiToolTip.au3>
_GUIToolTip_GetMargin($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Array with the following format:
[0] - Distance between top border and top of text, in pixels
[1] - Distance between left border and left end of text, in pixels
[2] - Distance between bottom border and bottom of text, in pixels
[3] - Distance between right border and right end of text, in pixels

Remarks

None.

Related

_GUIToolTip_GetMarginEx, _GUIToolTip_SetMargin


Function _GUIToolTip_GetMarginEx

Function Reference

_GUIToolTip_GetMarginEx

Retrieves the top, left, bottom, and right margins

#Include <GuiToolTip.au3>
_GUIToolTip_GetMarginEx($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: $tagRECT structure that will receive the margin information:
Top - Distance between top border and top of ToolTip text, in pixels
Left - Distance between left border and left end of ToolTip text, in pixels
Bottom - Distance between bottom border and bottom of ToolTip text, in pixels
Right - Distance between right border and right end of ToolTip text, in pixels
Result - True on success, otherwise False

Remarks

None.

Related

_GUIToolTip_GetMargin


Function _GUIToolTip_GetMaxTipWidth

Function Reference

_GUIToolTip_GetMaxTipWidth

Retrieves the maximum width for a ToolTip window

#Include <GuiToolTip.au3>
_GUIToolTip_GetMaxTipWidth($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Returns the maximum ToolTip width, in pixels
Failure: -1

Remarks

The maximum ToolTip width value does not indicate a ToolTip window's actual width. Rather, if a ToolTip string
exceeds the maximum width, the control breaks the text into multiple lines, using spaces to determine line
breaks. If the text cannot be segmented into multiple lines, it will be displayed on a single line. The length
of this line may exceed the maximum ToolTip width.

Related

_GUIToolTip_SetMaxTipWidth


Function _GUIToolTip_GetText

Function Reference

_GUIToolTip_GetText

Retrieves the text

#Include <GuiToolTip.au3>
_GUIToolTip_GetText($hWnd, $hTool, $iID)

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Identifier of the tool

Return Value

Success: ToolTip text

Remarks

None.

Related

_GUIToolTip_UpdateTipText


Function _GUIToolTip_GetTipBkColor

Function Reference

_GUIToolTip_GetTipBkColor

Retrieves the background color

#Include <GuiToolTip.au3>
_GUIToolTip_GetTipBkColor($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The background color

Remarks

None.

Related

_GUIToolTip_SetTipBkColor


Function _GUIToolTip_GetTipTextColor

Function Reference

_GUIToolTip_GetTipTextColor

Retrieves the text color

#Include <GuiToolTip.au3>
_GUIToolTip_GetTipTextColor($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: The text color

Remarks

None.

Related

_GUIToolTip_SetTipTextColor


Function _GUIToolTip_GetTitleBitMap

Function Reference

_GUIToolTip_GetTitleBitMap

Retrieves the title bitmap icon

#Include <GuiToolTip.au3>
_GUIToolTip_GetTitleBitMap($hWnd)

Parameters

$hWnd Handle to control

Return Value

Returns the Handle to the ToolTip icon

Remarks

Minimum OS - Windows XP.

Related


Function _GUIToolTip_GetTitleText

Function Reference

_GUIToolTip_GetTitleText

Retrieve the title

#Include <GuiToolTip.au3>
_GUIToolTip_GetTitleText($hWnd)

Parameters

$hWnd Handle to control

Return Value

Returns the ToolTip title

Remarks

Minimum OS - Windows XP.

Related


Function _GUIToolTip_GetToolCount

Function Reference

_GUIToolTip_GetToolCount

Retrieves the tool count

#Include <GuiToolTip.au3>
_GUIToolTip_GetToolCount($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: Count of tools maintained by the ToolTip

Remarks

None.

Related


Function _GUIToolTip_GetToolInfo

Function Reference

_GUIToolTip_GetToolInfo

Retrieves the information about a specific tool

#Include <GuiToolTip.au3>
_GUIToolTip_GetToolInfo($hWnd, $hTool, $iID)

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Identifier of the tool

Return Value

Success: Array with the following format:
[1] - Flags that control the ToolTip display:
1 - Indicates that $iID is the window handle to the tool instead of the ID
2 - Centers the window below the tool specified by $iID
4 - Indicates that text will be displayed in the opposite direction
8 - Indicates that the control should subclass the tool's window to intercept messages
16 - Positions the control next to the tool to which it corresponds
32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION
64 - Causes the control to forward mouse messages to the parent window
128 - Indicates that links in the control text should be parsed
[2] - Handle to the window that contains the tool
[3] - Identifier of the tool
[4] - X coordinate of the upper left corner of the rectangle
[5] - Y coordinate of the upper left corner of the rectangle
[6] - X coordinate of the lower right corner of the rectangle
[7] - Y coordinate of the lower right corner of the rectangle
[8] - Handle to the instance that contains the string resource for the tool
[9] - Application-defined value associated with the tool

Remarks

None.

Related

_GUIToolTip_SetToolInfo


Function _GUIToolTip_HitTest

Function Reference

_GUIToolTip_HitTest

Retrieves the information that a ToolTip control maintains about a tool

#Include <GuiToolTip.au3>
_GUIToolTip_HitTest($hWnd, $hTool, $iX, $iY)

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iX | X position to test
$iY | Y position to test

Return Value

Success: Array with the following format:
[1] - Flags that control the ToolTip display:
1 - Indicates that $iID is the window handle to the tool instead of the ID
2 - Centers the window below the tool specified by $iID
4 - Indicates that text will be displayed in the opposite direction
8 - Indicates that the control should subclass the tool's window to intercept messages
16 - Positions the control next to the tool to which it corresponds
32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION
64 - Causes the control to forward mouse messages to the parent window
128 - Indicates that links in the control text should be parsed
[2] - Handle to the window that contains the tool
[3] - Identifier of the tool
[4] - X coordinate of the upper left corner of the rectangle
[5] - Y coordinate of the upper left corner of the rectangle
[6] - X coordinate of the lower right corner of the rectangle
[7] - Y coordinate of the lower right corner of the rectangle
[8] - Handle to the instance that contains the string resource for the tool
[9] - Application-defined value associated with the tool

Remarks

This message must be sent when the tool has the $TTF_TRACK flag set. $TTM_HITTEST will fail if $TTF_TRACK is
not set, regardless if the hit point is in the tools rectangle or not.

Related


Function _GUIToolTip_NewToolRect

Function Reference

_GUIToolTip_NewToolRect

Sets a new bounding rectangle for a tool

#Include <GuiToolTip.au3>
_GUIToolTip_NewToolRect($hWnd, $hTool, $iID, $iLeft, $iTop, $iRight, $iBottom)

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Application-defined identifier of the tool
$iLeft | X coordinate of the upper left corner of the rectangle
$iTop | Y coordinate of the upper left corner of the rectangle
$iRight | X coordinate of the lower right corner of the rectangle
$iBottom | Y coordinate of the lower right corner of the rectangle

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_Pop

Function Reference

_GUIToolTip_Pop

Removes a displayed ToolTip from view

#Include <GuiToolTip.au3>
_GUIToolTip_Pop($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_PopUp

Function Reference

_GUIToolTip_PopUp

Causes the ToolTip to display at the coordinates of the last mouse message

#Include <GuiToolTip.au3>
_GUIToolTip_PopUp($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

Minimum OS - Windows XP.

Related


Function _GUIToolTip_SetDelayTime

Function Reference

_GUIToolTip_SetDelayTime

Sets the initial, pop-up, and reshow durations

#Include <GuiToolTip.au3>
_GUIToolTip_SetDelayTime($hWnd, $iDuration, $iTime)

Parameters

$hWnd | Handle to control
$iDuration | Flag that specifies which duration value will be retrieved: 0 - Set all three delay times to default settings 1 - Time it takes for subsequent ToolTip windows to appear as the pointer moves from one tool to another 2 - Time the ToolTip window remains visible if the pointer is stationary within a tool's bounding rectangle 3 - Time the pointer must remain stationary within a tool's bounding rectangle before the window appears
$iTime | Delay time in milliseconds

Return Value

None.

Remarks

The default delay times are based on the double-click time. For the default double-click time of 500 ms, the
initial, autopop, and reshow delay times are 500ms, 5000ms, and 100ms respectively.

Related

_GUIToolTip_GetDelayTime


Function _GUIToolTip_SetMargin

Function Reference

_GUIToolTip_SetMargin

Sets the top, left, bottom, and right margins

#Include <GuiToolTip.au3>
_GUIToolTip_SetMargin($hWnd, $iLeft, $iTop, $iRight, $iBottom)

Parameters

$hWnd | Handle to control
$iLeft | Distance between left border and left end of text, in pixels
$iTop | Distance between top border and top of text, in pixels
$iRight | Distance between right border and right end of text, in pixels
$iBottom | Distance between bottom border and bottom of text, in pixels

Return Value

None.

Remarks

None.

Related

_GUIToolTip_GetMargin


Function _GUIToolTip_SetMaxTipWidth

Function Reference

_GUIToolTip_SetMaxTipWidth

Sets the maximum width for a ToolTip window

#Include <GuiToolTip.au3>
_GUIToolTip_SetMaxTipWidth($hWnd, $iWidth)

Parameters

$hWnd | Handle to control
$iWidth | Maximum ToolTip window width to be set

Return Value

Success: The previous maximum ToolTip width

Remarks

The maximum ToolTip width value does not indicate a ToolTip window's actual width. Rather, if a ToolTip string
exceeds the maximum width, the control breaks the text into multiple lines, using spaces to determine line
breaks. If the text cannot be segmented into multiple lines, it will be displayed on a single line. The length
of this line may exceed the maximum ToolTip width.

Related

_GUIToolTip_GetMaxTipWidth


Function _GUIToolTip_SetTipBkColor

Function Reference

_GUIToolTip_SetTipBkColor

Sets the background color

#Include <GuiToolTip.au3>
_GUIToolTip_SetTipBkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to control
$iColor | New background color

Return Value

None.

Remarks

None.

Related

_GUIToolTip_GetTipBkColor


Function _GUIToolTip_SetTipTextColor

Function Reference

_GUIToolTip_SetTipTextColor

Sets the text color

#Include <GuiToolTip.au3>
_GUIToolTip_SetTipTextColor($hWnd, $iColor)

Parameters

$hWnd | Handle to control
$iColor | New text color

Return Value

None.

Remarks

None.

Related

_GUIToolTip_GetTipTextColor


Function _GUIToolTip_SetTitle

Function Reference

_GUIToolTip_SetTitle

Adds a standard icon and title string

#Include <GuiToolTip.au3>
_GUIToolTip_SetTitle($hWnd, $sTitle[, $iIcon = 0])

Parameters

$hWnd | Handle to control
$sTitle | Title string
$iIcon | [optional] Set to one of the values below:. 0 - No icon 1 - Information icon 2 - Warning icon 3 - Error Icon

Return Value

Success: | True
Failure: | False

Remarks

As of Windows XP SP2 and later, $iIcon can contain an HICON value. Any value greater than 3 is assumed to be
an HICON.

Related


Function _GUIToolTip_SetToolInfo

Function Reference

_GUIToolTip_SetToolInfo

Sets the information for a tool

#Include <GuiToolTip.au3>
_GUIToolTip_SetToolInfo($hWnd, $sText[, $iID = 0[, $iLeft = 0[, $iTop = 0[, $iRight = 0[, $iBottom = 0[, $iFlags = 8[, $iParam = 0]]]]]]])

Parameters

$hWnd | Handle to the window that contains the tool
$sText | Text for the ToolTip control
$iID | [optional] Identifier or window handle of the tool
$iLeft | [optional] X coordinate of the upper left corner of the rectangle
$iTop | [optional] Y coordinate of the upper left corner of the rectangle
$iRight | [optional] X coordinate of the lower right corner of the rectangle
$iBottom | [optional] Y coordinate of the lower right corner of the rectangle
$iFlags | [optional] Flags that control the ToolTip display: 1 - Indicates that $iID is the window handle to the tool instead of the ID 2 - Centers the window below the tool specified by $iID 4 - Indicates that text will be displayed in the opposite direction 8 - Indicates that the control should subclass the tool's window to intercept messages 16 - Positions the control next to the tool to which it corresponds 32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION 64 - Causes the control to forward mouse messages to the parent window 128 - Indicates that links in the control text should be parsed
$iParam | [optional] Application-defined value that is associated with the tool

Return Value

None.

Remarks

Some internal properties of a tool are established when the tool is created, and are not recomputed when a
$TTM_SETTOOLINFO message is sent. If you simply assign valuesto a TOOLINFO structure and pass it to the
ToolTip control with a $TTM_SETTOOLINFO message, these properties may be lost. Instead your application should
first request the tool's current TOOLINFO structure by sending a $TTM_GETTOOLINFO message. Then, modify the
members of this structure as needed and pass it back to the ToolTip control with $TTM_SETTOOLINFO. When
calling $TTM_SETTOOLINFO, the string pointed to by the Text member of the TOOLINFO structure must not exceed
80 characters in length.

Related

_GUIToolTip_GetToolInfo


Function _GUIToolTip_SetWindowTheme

Function Reference

_GUIToolTip_SetWindowTheme

Sets the visual style

#Include <GuiToolTip.au3>
_GUIToolTip_SetWindowTheme($hWnd, $sStyle)

Parameters

$hWnd | Handle to control
$sStyle | String that contains the ToolTip visual style to set

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_ToolExists

Function Reference

_GUIToolTip_ToolExists

Determines whether a current tool exists

#Include <GuiToolTip.au3>
_GUIToolTip_ToolExists($hWnd)

Parameters

$hWnd Handle to control

Return Value

True: Tool exists
False: Tool does not exist

Remarks

None.

Related


Function _GUIToolTip_ToolToArray

Function Reference

_GUIToolTip_ToolToArray

Transfers a ToolInfo structure to an array

#Include <GuiToolTip.au3>
_GUIToolTip_ToolToArray($hWnd, ByRef $tToolInfo, $iError)

Parameters

$hWnd | Handle to the control
$tToolInfo | $tagTOOLINFO structure
$iError | Error code to be returned

Return Value

Success: Array with the following format:
[0] - Flags that control the ToolTip display:
1 - Indicates that $iID is the window handle to the tool instead of the ID
2 - Centers the window below the tool specified by $iID
4 - Indicates that text will be displayed in the opposite direction
8 - Indicates that the control should subclass the tool's window to intercept messages
16 - Positions the control next to the tool to which it corresponds
32 - Positions the window at the same coordinates provided by TTM_TRACKPOSITION
64 - Causes the control to forward mouse messages to the parent window
128 - Indicates that links in the control text should be parsed
[1] - Handle to the window that contains the tool
[2] - Identifier of the tool
[3] - X coordinate of the upper left corner of the rectangle
[4] - Y coordinate of the upper left corner of the rectangle
[5] - X coordinate of the lower right corner of the rectangle
[6] - Y coordinate of the lower right corner of the rectangle
[7] - Handle to the instance that contains the string resource for the tool
[8] - Text for the tool
[9] - Application-defined value associated with the tool

Remarks

None.

Related


Function _GUIToolTip_TrackActivate

Function Reference

_GUIToolTip_TrackActivate

Activates or deactivates a tracking ToolTip

#Include <GuiToolTip.au3>
_GUIToolTip_TrackActivate($hWnd[, $fActivate = True[, $hTool = 0[, $iID = 0]]])

Parameters

$hWnd | Handle to control
$fActivate | [optional] True to activate, False to deactivate
$hTool | [optional] Handle to the window that contains the tool
$iID | [optional] Application-defined identifier of the tool

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_TrackPosition

Function Reference

_GUIToolTip_TrackPosition

Sets the position of a tracking ToolTip

#Include <GuiToolTip.au3>
_GUIToolTip_TrackPosition($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to control
$iX | X position in screen coordinates
$iY | Y position in screen coordinates

Return Value

None.

Remarks

The ToolTip chooses where to display the window based on the coordinates you provide with this message. This
causes the ToolTip window to appear beside the tool to which it corresponds. To have ToolTip windows displayed
at specific coordinates, include the $TTF_ABSOLUTE flag in the $iFlags member of the TOOLINFO structure when
adding the tool.

Related


Function _GUIToolTip_TTFToBits

Function Reference

_GUIToolTip_TTFToBits

Decode $TTF_flags to user bit flags

#Include <GuiToolTip.au3>
_GUIToolTip_TTFToBits($iFlags)

Parameters

$iFlags $TTF_ flags

Return Value

Success: User bit flags

Remarks

None.

Related

_GUIToolTip_BitsToTTF


Function _GUIToolTip_Update

Function Reference

_GUIToolTip_Update

Forces the current tool to be redrawn

#Include <GuiToolTip.au3>
_GUIToolTip_Update($hWnd)

Parameters

$hWnd Handle to control

Return Value

None.

Remarks

None.

Related


Function _GUIToolTip_UpdateTipText

Function Reference

_GUIToolTip_UpdateTipText

Sets the ToolTip text for a tool

#Include <GuiToolTip.au3>
_GUIToolTip_UpdateTipText($hWnd, $hTool, $iID, $sText)

Parameters

$hWnd | Handle to control
$hTool | Handle to the window that contains the tool
$iID | Application-defined identifier of the tool
$sText | Text to display in tooltip

Return Value

None.

Remarks

None.

Related

_GUIToolTip_GetText


User Defined Functions

GuiTreeView user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <GuiTreeView.au3>.

User Defined Function | Description
_GUICtrlTreeView_Add | Adds a new item
_GUICtrlTreeView_AddChild | Adds a new item
_GUICtrlTreeView_AddChildFirst | Adds a new item
_GUICtrlTreeView_AddFirst | Adds a new item
_GUICtrlTreeView_BeginUpdate | Prevents updating of the control until the EndUpdate function is called
_GUICtrlTreeView_ClickItem | Click on a item
_GUICtrlTreeView_Create | Create a TreeView control
_GUICtrlTreeView_CreateDragImage | Creates a dragging bitmap for the specified item
_GUICtrlTreeView_CreateSolidBitMap | Creates a solid color bitmap
_GUICtrlTreeView_Delete | Removes an item and all its children
_GUICtrlTreeView_DeleteAll | Removes all items from a tree-view control
_GUICtrlTreeView_DeleteChildren | Deletes all children of a item
_GUICtrlTreeView_Destroy | Delete the control
_GUICtrlTreeView_DisplayRect | Returns the bounding rectangle for a tree item
_GUICtrlTreeView_DisplayRectEx | Returns the bounding rectangle for a tree item
_GUICtrlTreeView_EditText | Begins in-place editing of the specified item's text
_GUICtrlTreeView_EndEdit | Ends the editing of the item's text
_GUICtrlTreeView_EndUpdate | Enables screen repainting that was turned off with the BeginUpdate function
_GUICtrlTreeView_EnsureVisible | Ensures that a item is visible, expanding the parent item or scrolling the control if necessary
_GUICtrlTreeView_Expand | Expands or collapses the list of child items associated with the specified parent item, if any
_GUICtrlTreeView_ExpandedOnce | Indicates if the item's list of child items has been expanded at least once
_GUICtrlTreeView_FindItem | Retrieves a item based on it's text
_GUICtrlTreeView_FindItemEx | Retrieves a item based on a tree path
_GUICtrlTreeView_GetBkColor | Retrieve the text back color
_GUICtrlTreeView_GetBold | Indicates if the item is drawn in a bold style
_GUICtrlTreeView_GetChecked | Indicates if a item has its checkbox checked
_GUICtrlTreeView_GetChildCount | Retrieves the number of children of an parent item
_GUICtrlTreeView_GetChildren | Indicates whether the item children flag is set
_GUICtrlTreeView_GetCount | Retrieves a count of the items
_GUICtrlTreeView_GetCut | Indicates if the item is drawn as if selected as part of a cut and paste operation
_GUICtrlTreeView_GetDropTarget | Indicates whether the item is drawn as a drag and drop target
_GUICtrlTreeView_GetEditControl | Retrieves the handle to the edit control being used to edit a item's text
_GUICtrlTreeView_GetExpanded | Indicates whether the item is expanded
_GUICtrlTreeView_GetFirstChild | Retrieves the first child item of the specified item
_GUICtrlTreeView_GetFirstItem | Retrieves the topmost or very first item
_GUICtrlTreeView_GetFirstVisible | Retrieves the first visible item in the control
_GUICtrlTreeView_GetFocused | Indicates whether the item has focus
_GUICtrlTreeView_GetHeight | Retrieves the current height of the each item
_GUICtrlTreeView_GetImageIndex | Retrieves the normal state image index
_GUICtrlTreeView_GetImageListIconHandle | Retrieve ImageList handle
_GUICtrlTreeView_GetIndent | Retrieves the amount, in pixels, that child items are indented relative to their parent items
_GUICtrlTreeView_GetInsertMarkColor | Retrieves the color used to draw the insertion mark
_GUICtrlTreeView_GetISearchString | Retrieves the incremental search string
_GUICtrlTreeView_GetItemByIndex | Retrieve a item by its position in the list of child items
_GUICtrlTreeView_GetItemHandle | Retrieve the item handle
_GUICtrlTreeView_GetItemParam | Retrieves the application specific value of the item
_GUICtrlTreeView_GetLastChild | Retrieves the last child item of the specified item
_GUICtrlTreeView_GetLineColor | Retrieve the line color
_GUICtrlTreeView_GetNext | Retrieves the next item after the calling item
_GUICtrlTreeView_GetNextChild | Returns the next item at the same level as the specified item
_GUICtrlTreeView_GetNextSibling | Returns the next item at the same level as the specified item
_GUICtrlTreeView_GetNextVisible | Retrieves the next visible item that follows the specified item
_GUICtrlTreeView_GetNormalImageList | Retrieves the normal image list
_GUICtrlTreeView_GetParentHandle | Retrieve the parent handle of item
_GUICtrlTreeView_GetParentParam | Retrieve the parent control ID/Param of item
_GUICtrlTreeView_GetPrev | Retrieves the previous item before the calling item
_GUICtrlTreeView_GetPrevChild | Retrieves the previous child item of a specified item
_GUICtrlTreeView_GetPrevSibling | Returns the previous item before the calling item at the same level
_GUICtrlTreeView_GetPrevVisible | Retrieves the first visible item that precedes the specified item
_GUICtrlTreeView_GetScrollTime | Retrieves the maximum scroll time
_GUICtrlTreeView_GetSelected | Indicates whether the item appears in the selected state
_GUICtrlTreeView_GetSelectedImageIndex | Retrieves the index in the image list of the image displayed for the item when it is selected
_GUICtrlTreeView_GetSelection | Retrieves the currently selected item
_GUICtrlTreeView_GetSiblingCount | Retrieves the number of siblings at the level of an item
_GUICtrlTreeView_GetState | Retrieve the state of the item
_GUICtrlTreeView_GetStateImageIndex | Retrieves the index of the state image to display for the item
_GUICtrlTreeView_GetStateImageList | Retrieves the handle to the state image list
_GUICtrlTreeView_GetText | Retrieve the item text
_GUICtrlTreeView_GetTextColor | Retrieve the text color
_GUICtrlTreeView_GetToolTips | Retrieves the handle to the child ToolTip control
_GUICtrlTreeView_GetTree | Retrieve all items text
_GUICtrlTreeView_GetUnicodeFormat | Retrieves the Unicode character format flag
_GUICtrlTreeView_GetVisible | Indicates whether the item is currently visible in the control image
_GUICtrlTreeView_GetVisibleCount | Returns the number of items that can be fully visible in the control
_GUICtrlTreeView_HitTest | Returns information about the location of a point relative to the control
_GUICtrlTreeView_HitTestEx | Returns information about the location of a point relative to the control
_GUICtrlTreeView_HitTestItem | Returns the item at the specified coordinates
_GUICtrlTreeView_Index | Retrieves the position of the item in the list
_GUICtrlTreeView_InsertItem | Insert an item
_GUICtrlTreeView_IsFirstItem | Indicates whether the tree item is very first
_GUICtrlTreeView_IsParent | Indicates whether one item is the parent of another item
_GUICtrlTreeView_Level | Indicates the level of indentation of a item
_GUICtrlTreeView_SelectItem | Selects the specified item, scrolls the item into view, or redraws the item
_GUICtrlTreeView_SelectItemByIndex | Selects the item based on it's index in the parent list
_GUICtrlTreeView_SetBkColor | Sets the back color
_GUICtrlTreeView_SetBold | Sets whether the item is drawn using a bold sytle
_GUICtrlTreeView_SetChecked | Sets whether a item has it's checkbox checked or not
_GUICtrlTreeView_SetCheckedByIndex | Sets whether an item has it's checkbox checked or not by it's index
_GUICtrlTreeView_SetChildren | Sets whether the item children flag
_GUICtrlTreeView_SetCut | Sets whether the item is drawn as if selected as part of a cut and paste operation
_GUICtrlTreeView_SetDropTarget | Sets whether the item is drawn as a drag and drop target
_GUICtrlTreeView_SetFocused | Sets whether the item appears to have focus
_GUICtrlTreeView_SetHeight | Sets the height of the each item
_GUICtrlTreeView_SetIcon | Set an item icon
_GUICtrlTreeView_SetImageIndex | Sets the index into image list for which image is displayed when a item is in its normal state
_GUICtrlTreeView_SetIndent | Sets the width of indentation for a tree-view control and redraws the control to reflect the new width
_GUICtrlTreeView_SetInsertMark | Sets the insertion mark
_GUICtrlTreeView_SetInsertMarkColor | Sets the color used to draw the insertion mark
_GUICtrlTreeView_SetItemHeight | Sets the height of an individual item
_GUICtrlTreeView_SetItemParam | Sets the value specific to the item
_GUICtrlTreeView_SetLineColor | Sets the line color
_GUICtrlTreeView_SetNormalImageList | Sets the normal image list for the control
_GUICtrlTreeView_SetScrollTime | Sets the maximum scroll time
_GUICtrlTreeView_SetSelected | Sets whether the item appears in the selected state
_GUICtrlTreeView_SetSelectedImageIndex | Sets the selected image index
_GUICtrlTreeView_SetState | Set the state of the specified item
_GUICtrlTreeView_SetStateImageIndex | Sets the index into image list for the state image
_GUICtrlTreeView_SetStateImageList | Sets the state image list for the control
_GUICtrlTreeView_SetText | Set the text of an item
_GUICtrlTreeView_SetTextColor | Sets the text color
_GUICtrlTreeView_SetToolTips | Sets the handle to the child ToolTip control
_GUICtrlTreeView_SetUnicodeFormat | Sets the Unicode character format flag
_GUICtrlTreeView_Sort | Sorts the items


Function _GUICtrlTreeView_Add

Function Reference

_GUICtrlTreeView_Add

Adds a new item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Add($hWnd, $hSibling, $sText[, $iImage = -1[, $iSelImage = -1]])

Parameters

$hWnd | Handle to the control
$hSibling | Sibling item
$sText | Text of the item
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelImage | [optional] Zero based index of the item's icon in the control's image list

Return Value

Success: | The handle to the new item
Failure: | 0

Remarks

The item is added as the last sibling of $hSibling. If the control is sorted, the function inserts the item in
the correct sort order position rather than as the last child of $hSibling.

Related

_GUICtrlTreeView_AddFirst

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_AddChild

Function Reference

_GUICtrlTreeView_AddChild

Adds a new item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_AddChild($hWnd, $hParent, $sText[, $iImage = -1[, $iSelImage = -1]])

Parameters

$hWnd | Handle to the control
$hParent | Parent item
$sText | Text of the item
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelImage | [optional] Zero based index of the item's icon in the control's image list

Return Value

Success: | The handle to the new item
Failure: | 0

Remarks

The item is added as a child of $hParent. It is added to the end of $hParent's list of child items. If the
control is sorted, this function inserts the item in the correct sort order position, rather than as the last
child of $hParent.

Related

_GUICtrlTreeView_AddChildFirst

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_AddChildFirst

Function Reference

_GUICtrlTreeView_AddChildFirst

Adds a new item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_AddChildFirst($hWnd, $hParent, $sText[, $iImage = -1[, $iSelImage = -1]])

Parameters

$hWnd | Handle to the control
$hParent | Parent item
$sText | Text of the item
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelImage | [optional] Zero based index of the item's icon in the control's image list

Return Value

Success: | The handle to the new item
Failure: | 0

Remarks

The item is added as the first child of $hParent. Items that appear after the added item are moved down.

Related

_GUICtrlTreeView_AddChild

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add Child First", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 4, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
_GUICtrlTreeView_AddChildFirst($hTreeView, $hItem, "[00] First Child", 5, 5)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_AddFirst

Function Reference

_GUICtrlTreeView_AddFirst

Adds a new item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_AddFirst($hWnd, $hSibling, $sText[, $iImage = -1[, $iSelImage = -1]])

Parameters

$hWnd | Handle to the control
$hSibling | Sibling item
$sText | Text of the item
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelImage | [optional] Zero based index of the item's icon in the control's image list

Return Value

Success: | The handle to the new item
Failure: | 0

Remarks

The item is added as the first sibling of $hSibling. Items that appear after the added item are moved down.

Related

_GUICtrlTreeView_Add

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Add First", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
For $y = 1 To Random(2, 10, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
Next
Next
_GUICtrlTreeView_AddFirst($hTreeView, $hItem, "[00] New First Item")
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_BeginUpdate

Function Reference

_GUICtrlTreeView_BeginUpdate

Prevents updating of the control until the EndUpdate function is called

#Include <GuiTreeView.au3>
_GUICtrlTreeView_BeginUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_EndUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Begin Update", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To 100
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_ClickItem

Function Reference

_GUICtrlTreeView_ClickItem

Click on a item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_ClickItem($hWnd, $hItem[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 0]]]])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$sButton | [optional] Button to click
$fMove | [optional] If True, the mouse will be moved. If False, the mouse does not move.
$iClicks | [optional] Number of clicks
$iSpeed | [optional] Mouse movement speed

Return Value

Success: | 1.
Failure: | 0 and Set @error

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTreeView

_Main()

Func _Main()

Local $hItem, $hImage, $iImage
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Click Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_ClickItem($hTreeView, $hItem, "left", False, 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
$hWndTreeview = $hTreeView
If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTreeview
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlTreeView_Create

Function Reference

_GUICtrlTreeView_Create

Create a TreeView control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Create($hWnd, $iX, $iY[, $iWidth=150[, $iHeight=150[, $iStyle=0x00000037[, $iExStyle=0x00000000]]]])

Parameters

$hWnd | Handle to parent or owner window
$iX | Horizontal position of the control
$iY | Vertical position of the control
$iWidth | [optional] Control width
$iHeight | [optional] Control height
$iStyle [optional] Control style:
DllStructGetData($TVS_CHECKBOXES - Enables check boxes for items, "") A check box will be displayed only if an image is
associated with the item. When set to this style, the control effectively uses DrawFrameControl to create and
set a state image list containing two images. State image 1 is the unchecked box and state image 2 is the
checked box. Setting the state image to zero removes the check box. Version 5.80 displays a check box even
if no image is associated with the item.
$TVS_DISABLEDRAGDROP - Prevents the control from sending $TVN_BEGINDRAG notification messages
$TVS_EDITLABELS - Allows the user to edit the item labels
DllStructGetData($TVS_FULLROWSELECT - Enables full row selection, "") The entire row of the selected item is highlighted, and
clicking anywhere on an item's row causes it to be selected. This style cannot be used in conjunction with
the DllStructGetData($TVS_HASLINES style, "")
DllStructGetData($TVS_HASBUTTONS - Displays plus and minus buttons next to parent items, "") The user clicks the buttons to
expand or collapse a parent item's list of child items. To include buttons with items at the root, you must
also specify DllStructGetData($TVS_LINESATROOT, "")
$TVS_HASLINES - Uses lines to show the hierarchy of items
$TVS_INFOTIP - Obtains ToolTip information by sending the $TVN_GETINFOTIP notification
DllStructGetData($TVS_LINESATROOT - Uses lines to link items at the root of the control, "") This value is ignored if
DllStructGetData($TVS_HASLINES is not also specified, "")
DllStructGetData($TVS_NOHSCROLL - Disables horizontal scrolling in the control, "") The control will not display any
horizontal scroll bars.
DllStructGetData($TVS_NONEVENHEIGHT - Sets the height of the items to an odd height with the $TVM_SETITEMHEIGHT message, "") By
default the height of items must be an even value.
DllStructGetData($TVS_NOSCROLL - Disables both horizontal and vertical scrolling in the control, "") The control will not
display any scroll bars.
$TVS_NOTOOLTIPS - Disables ToolTips
$TVS_RTLREADING - Causes text to be displayed from right to left
$TVS_SHOWSELALWAYS - Causes a selected item to remain selected when the control loses focus
$TVS_SINGLEEXPAND - Causes the item being selected to expand and the item being unselected to collapse
upon selection. If the mouse is used to single-click the selected item and that item is closed, it will be
expanded. If the user holds down the CTRL key while selecting an item, the item being unselected will not be
collapsed. Version 5.80 causes the item being selected to expand and the item being unselected to collapse
upon selection. If the user holds down the CTRL key while selecting an item, the item being unselected will
not be collapsed.
$TVS_TRACKSELECT - Enables hot tracking
Default: $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS
Forced: $WS_CHILD, $WS_VISIBLE
$iExStyle | [optional] Control extended style

Return Value

Success: | Handle to the control
Failure: | 0

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlTreeView_Destroy

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTreeView

_Main()

Func _Main()

Local $GUI, $hItem
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)
$GUI = GUICreate("(UDF Created) TreeView Create", 400, 300)

$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
For $y = 1 To Random(2, 10, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
$hWndTreeview = $hTreeView
If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTreeview
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_KILLFOCUS ; control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RETURN ; control has the input focus and that the user has pressed the key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
;~ Case $NM_SETCURSOR ; control is setting the cursor in response to a WM_SETCURSOR message
;~ Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
;~ $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
;~ $iIDFrom = DllStructGetData($tinfo, "IDFrom")
;~ $iCode = DllStructGetData($tinfo, "Code")
;~ _DebugPrint("$NM_SETCURSOR" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
;~ "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
;~ "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
;~ "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
;~ "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
;~ Return 0 ; to enable the control to set the cursor
;~ Return 1 ; nonzero to prevent the control from setting the cursor
Case $NM_SETFOCUS ; control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $TVN_BEGINDRAGA, $TVN_BEGINDRAGW
_DebugPrint("$TVN_BEGINDRAG")
Case $TVN_BEGINLABELEDITA, $TVN_BEGINLABELEDITW
_DebugPrint("$TVN_BEGINLABELEDIT")
Case $TVN_BEGINRDRAGA, $TVN_BEGINRDRAGW
_DebugPrint("$TVN_BEGINRDRAG")
Case $TVN_DELETEITEMA, $TVN_DELETEITEMW
_DebugPrint("$TVN_DELETEITEM")
Case $TVN_ENDLABELEDITA, $TVN_ENDLABELEDITW
_DebugPrint("$TVN_ENDLABELEDIT")
Case $TVN_GETDISPINFOA, $TVN_GETDISPINFOW
_DebugPrint("$TVN_GETDISPINFO")
Case $TVN_GETINFOTIPA, $TVN_GETINFOTIPW
_DebugPrint("$TVN_GETINFOTIP")
Case $TVN_ITEMEXPANDEDA, $TVN_ITEMEXPANDEDW
_DebugPrint("$TVN_ITEMEXPANDED")
Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
_DebugPrint("$TVN_ITEMEXPANDING")
Case $TVN_KEYDOWN
_DebugPrint("$TVN_KEYDOWN")
Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
_DebugPrint("$TVN_SELCHANGED")
Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW
_DebugPrint("$TVN_SELCHANGING")
Case $TVN_SETDISPINFOA, $TVN_SETDISPINFOW
_DebugPrint("$TVN_SETDISPINFO")
Case $TVN_SINGLEEXPAND
_DebugPrint("$TVN_SINGLEEXPAND")
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlTreeView_CreateDragImage

Function Reference

_GUICtrlTreeView_CreateDragImage

Creates a dragging bitmap for the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_CreateDragImage($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | The image list handle to which the dragging bitmap was added
Failure: | 0

Remarks

If you create the control without an associated image list, you cannot use this function to create the image
to display during a drag operation. You must implement your own method of creating a drag cursor. You are
responsible for destroying the image list when it is no longer needed.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $GUI, $hItemChild, $hImage, $iImage, $hItem, $fDragging = False, $aDrag, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$GUI = GUICreate("TreeView Create Drage Image", 400, 300)
$hTreeView = GUICtrlGetHandle(GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE))

_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

; Load images
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x0000FF, 16, 16))
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 8, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 8, 1)
$hItemChild = _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)
_GUICtrlTreeView_SelectItem($hTreeView, 0)

; Loop until user exits
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_MOUSEMOVE
If $fDragging Then DrawDragImage($hTreeView, $aDrag)

Case $GUI_EVENT_PRIMARYDOWN
Local $hSelected = _GUICtrlTreeView_GetSelection($hTreeView)
If $hSelected Then
$fDragging = True
; Create drag image
$aDrag = _GUICtrlTreeView_CreateDragImage($hTreeView, $hSelected)
DrawDragImage($hTreeView, $aDrag)
EndIf

Case $GUI_EVENT_PRIMARYUP
If $fDragging Then
$fDragging = False
; delete image list
_GUIImageList_Destroy($aDrag)
_WinAPI_InvalidateRect($hTreeView)
_WinAPI_InvalidateRect(HWnd($GUI))
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete()
EndFunc ;==>_Main

; Draw drag image
Func DrawDragImage(ByRef $hControl, ByRef $aDrag)
Local $tPoint, $hDC
$hDC = _WinAPI_GetWindowDC($hControl)
$tPoint = _WinAPI_GetMousePos(True, $hControl)
_WinAPI_InvalidateRect($hControl)
_GUIImageList_Draw($aDrag, 0, $hDC, DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y"))
_WinAPI_ReleaseDC($hControl, $hDC)
EndFunc ;==>DrawDragImage


Function _GUICtrlTreeView_CreateSolidBitMap

Function Reference

_GUICtrlTreeView_CreateSolidBitMap

Creates a solid color bitmap

#Include <GuiTreeView.au3>
_GUICtrlTreeView_CreateSolidBitMap($hWnd, $iColor, $iWidth, $iHeight)

Parameters

$hWnd | Handle to the window where the bitmap will be displayed
$iColor | The color of the bitmap, stated in RGB
$iWidth | The width of the bitmap
$iHeight | The height of the bitmap

Return Value

Returns the Handle to the bitmap

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Create Solid BitMap", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x0000FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0xFF00FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x000000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlTreeView_CreateSolidBitMap($hTreeView, 0x00FFFF, 16, 16))
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x + 3)
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_Delete

Function Reference

_GUICtrlTreeView_Delete

Removes an item and all its children

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Delete($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] Handle/Control ID of item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_DeleteAll, _GUICtrlTreeView_DeleteChildren

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Delete", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Delete Item")
_GUICtrlTreeView_Delete($hTreeView, $hItem)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_DeleteAll

Function Reference

_GUICtrlTreeView_DeleteAll

Removes all items from a tree-view control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_DeleteAll($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_Delete, _GUICtrlTreeView_DeleteChildren

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Delete All", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Delete All")
_GUICtrlTreeView_DeleteAll($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_DeleteChildren

Function Reference

_GUICtrlTreeView_DeleteChildren

Deletes all children of a item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_DeleteChildren($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item whose children will be deleted

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_Delete, _GUICtrlTreeView_DeleteAll

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hImage, $iImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Delete All", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To 2
$iImage = Random(0, 5, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To 3
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_Expand($hTreeView)

MsgBox(4160, "Information", "Delete Children")
_GUICtrlTreeView_DeleteChildren($hTreeView, $hItem)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_Destroy

Function Reference

_GUICtrlTreeView_Destroy

Delete the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Destroy(ByRef $hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True, Handle is set to 0
Failure: | False

Remarks

Restricted to only be used on TreeViews created with _GUICtrlTreeView_Create

Related

_GUICtrlTreeView_Create

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $GUI, $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$GUI = GUICreate("(UDF Created) TreeView Destroy", 400, 300)

$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To Random(2, 10, 1)
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
For $y = 1 To Random(2, 10, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Child", $y))
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Destroy TreeView Control")
_GUICtrlTreeView_Destroy($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_DisplayRect

Function Reference

_GUICtrlTreeView_DisplayRect

Returns the bounding rectangle for a tree item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_DisplayRect($hWnd, $hItem[, $fTextOnly = False])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item whose rectangle will be returned
$fTextOnly | [optional] If the True, the bounding rectangle includes only the text of the item. Otherwise, it includes the entire line that the item occupies.

Return Value

Success: | Array with the following format:
 | $aRect[0] - X coordinate of the upper left corner of the rectangle
 | $aRect[1] - Y coordinate of the upper left corner of the rectangle
 | $aRect[2] - X coordinate of the lower right corner of the rectangle
 | $aRect[3] - Y coordinate of the lower right corner of the rectangle
Failure: | Set @error

Remarks

None.

Related

_GUICtrlTreeView_DisplayRectEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $aRect, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Display Rect", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
$aRect = _GUICtrlTreeView_DisplayRect($hTreeView, $hItem[2])
MsgBox(4160, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_DisplayRectEx

Function Reference

_GUICtrlTreeView_DisplayRectEx

Returns the bounding rectangle for a tree item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_DisplayRectEx($hWnd, $hItem[, $fTextOnly = False])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item whose rectangle will be returned
$fTextOnly | [optional] If the True, the bounding rectangle includes only the text of the item. Otherwise, it includes the entire line that the item occupies.

Return Value

Success: | $tagRECT structure that holds the bounding rectangle. The coordinates are relative to the upper left corner of the control.
Failure: | Set @error

Remarks

None.

Related

_GUICtrlTreeView_DisplayRect, $tagRECT

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $tRect, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Display RectEx", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
$tRect = _GUICtrlTreeView_DisplayRectEx($hTreeView, $hItem[2])
MsgBox(4160, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", DllStructGetData($tRect, "Left"), _
DllStructGetData($tRect, "Top"), DllStructGetData($tRect, "Right"), DllStructGetData($tRect, "Bottom")))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_EditText

Function Reference

_GUICtrlTreeView_EditText

Begins in-place editing of the specified item's text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_EditText($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item to edit

Return Value

Success: | The handle to the edit control
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_EndEdit, _GUICtrlTreeView_GetEditControl

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $tRect, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Edit Text", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
; turn off unicode at this time dllstruct doesn't support them
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next

; Edit item 0 label
_GUICtrlTreeView_EditText($hTreeView, $hItem[0])
Sleep(500)
Send("This is a test")
Sleep(500)
_GUICtrlTreeView_EndEdit($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_EndEdit

Function Reference

_GUICtrlTreeView_EndEdit

Ends the editing of the item's text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_EndEdit($hWnd, $fCancel = False)

Parameters

$hWnd | Handle to the control
$fCancel | Indicates whether the editing is canceled without being saved to the item. If True, the system cancels editing without saving the changes.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_EditText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $tRect, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView End Edit", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
; turn off unicode at this time dllstruct doesn't support them
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next

; Edit item 0 label
_GUICtrlTreeView_EditText($hTreeView, $hItem[0])
Sleep(500)
Send("This is a test")
Sleep(500)
_GUICtrlTreeView_EndEdit($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_EndUpdate

Function Reference

_GUICtrlTreeView_EndUpdate

Enables screen repainting that was turned off with the BeginUpdate function

#Include <GuiTreeView.au3>
_GUICtrlTreeView_EndUpdate($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_BeginUpdate

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView End Update", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 1 To 100
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_EnsureVisible

Function Reference

_GUICtrlTreeView_EnsureVisible

Ensures that a item is visible, expanding the parent item or scrolling the control if necessary

#Include <GuiTreeView.au3>
_GUICtrlTreeView_EnsureVisible($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | if the system scrolled the items in the tree-view control and no items were expanded
False: | otherwise

Remarks

None.

Related

_GUICtrlTreeView_GetVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[100], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Ensure Visible", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 99
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(40, 99, 1)
MsgBox(4160, "Information", StringFormat("Index %d Visible: %s", $iRand, _GUICtrlTreeView_GetVisible($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_EnsureVisible($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", StringFormat("Index %d Visible: %s", $iRand, _GUICtrlTreeView_GetVisible($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_Expand

Function Reference

_GUICtrlTreeView_Expand

Expands or collapses the list of child items associated with the specified parent item, if any

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Expand($hWnd[, $hItem = 0[, $fExpand = True]])

Parameters

$hWnd | Handle to the control
$hItem | [optional] Handle to the item
$fExpand | [optional] Expand or Collapse, use the following values: True - Expand items False - Collapse items

Return Value

None.

Remarks

None.

Related

_GUICtrlTreeView_ExpandedOnce, _GUICtrlTreeView_GetExpanded

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[5], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Expand", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 4
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Expand All")
_GUICtrlTreeView_Expand($hTreeView)

MsgBox(4160, "Information", "Collapse All")
_GUICtrlTreeView_Expand($hTreeView, 0, False)

MsgBox(4160, "Information", "Expand item 0")
_GUICtrlTreeView_Expand($hTreeView, $hItem[0])

MsgBox(4160, "Information", "Collapse item 0")
_GUICtrlTreeView_Expand($hTreeView, $hItem[0], False)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_ExpandedOnce

Function Reference

_GUICtrlTreeView_ExpandedOnce

Indicates if the item's list of child items has been expanded at least once

#Include <GuiTreeView.au3>
_GUICtrlTreeView_ExpandedOnce($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item has been expanded at least once
False: | Item has not been expanded at least once

Remarks

None.

Related

_GUICtrlTreeView_Expand

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[5], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Expanded Once", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 4
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Expand item 0")
_GUICtrlTreeView_Expand($hTreeView, $hItem[0])

MsgBox(4160, "Information", "Collapse item 0")
_GUICtrlTreeView_Expand($hTreeView, $hItem[0], False)

MsgBox(4160, "Information", "Item 0 expanded at least once? " & _GUICtrlTreeView_ExpandedOnce($hTreeView, $hItem[0]))
MsgBox(4160, "Information", "Item 1 expanded at least once? " & _GUICtrlTreeView_ExpandedOnce($hTreeView, $hItem[1]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_FindItem

Function Reference

_GUICtrlTreeView_FindItem

Retrieves a item based on it's text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_FindItem($hWnd, $sText[, $fInStr = False[, $hStart = 0]])

Parameters

$hWnd | Handle to the control
$sText | Text to search for
$fInStr | [optional] If True, the text can be anywhere in the item's text.
$hStart | [optional] Item to start searching from. If 0, the root item is used.

Return Value

Success: | The handle of the first item that contains the item text
Failure: | 0

Remarks

The search is case insensitive

Related

_GUICtrlTreeView_FindItemEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hItemFound, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Find Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hItemFound = _GUICtrlTreeView_FindItem($hTreeView, "Looking for me?")
If $hItemFound Then
MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
Else
MsgBox(4160, "Information", "Not Found")
EndIf

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_FindItemEx

Function Reference

_GUICtrlTreeView_FindItemEx

Retrieves a item based on a tree path

#Include <GuiTreeView.au3>
_GUICtrlTreeView_FindItemEx($hWnd, $sPath[, $hStart = 0])

Parameters

$hWnd | Handle to the control
$sPath | The path to take, delimiter of your choice, see Opt("GUIDataSeparatorChar")
$hStart | [optional] Item to start searching from. If 0, the root item is used.

Return Value

Success: | The handle of the first item that matches the tree path
Failure: | 0

Remarks

The search is case insensitive

Related

_GUICtrlTreeView_FindItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hItemFound, $htmp_item, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Find ItemEx", 400, 300)
Opt("GUIDataSeparatorChar", "\")

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$htmp_item = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $htmp_item)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hItemFound = _GUICtrlTreeView_FindItemEx($hTreeView, "[03] New Item\[02] New Item\Looking for me?")
If $hItemFound Then
_GUICtrlTreeView_SelectItem($hTreeView, $hItemFound)
MsgBox(4160, "Information", "Item Found:" & @LF & "Handle: " & $hItemFound & @LF & "Text: " & _GUICtrlTreeView_GetText($hTreeView, $hItemFound))
Else
MsgBox(4160, "Information", "Not Found")
EndIf

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetBkColor

Function Reference

_GUICtrlTreeView_GetBkColor

Retrieve the text back color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetBkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Hex RGB Back Color

Remarks

None.

Related

_GUICtrlTreeView_SetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get BkColor", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetBold

Function Reference

_GUICtrlTreeView_GetBold

Indicates if the item is drawn in a bold style

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetBold($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is drawn in bold
False: | Item is not drawn in bold

Remarks

None.

Related

_GUICtrlTreeView_SetBold

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Bold", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Bold? %s", $hRandomItem, _GUICtrlTreeView_GetBold($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetBold($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Bold? %s", $hRandomItem, _GUICtrlTreeView_GetBold($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetChecked

Function Reference

_GUICtrlTreeView_GetChecked

Indicates if a item has its checkbox checked

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetChecked($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item's checkbox is checked
False: | Item's checkbox is not checked

Remarks

None.

Related

_GUICtrlTreeView_SetChecked

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Checked", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Checked? %s", $hRandomItem, _GUICtrlTreeView_GetChecked($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetChecked($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Checked? %s", $hRandomItem, _GUICtrlTreeView_GetChecked($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetChildCount

Function Reference

_GUICtrlTreeView_GetChildCount

Retrieves the number of children of an parent item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetChildCount($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to item

Return Value

Returns the Number of Children

Remarks

None.

Related

_GUICtrlTreeView_GetCount, _GUICtrlTreeView_GetSiblingCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Child Count", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To Random(1, 20, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9)
MsgBox(4160, "Information", StringFormat("Child Count for item index %d: %d", $iRand, _GUICtrlTreeView_GetChildCount($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_Expand($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetChildren

Function Reference

_GUICtrlTreeView_GetChildren

Indicates whether the item children flag is set

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetChildren($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item children flag is set
False: | Item children flag is not set

Remarks

None.

Related

_GUICtrlTreeView_SetChildren

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[11], $htmp_item, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Children", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$htmp_item = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $htmp_item)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[10] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 10), $hTreeView)
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Item 0 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[0]))
MsgBox(4160, "Information", "Item 10 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[10]))
_GUICtrlTreeView_SetChildren($hTreeView, $hItem[10])
MsgBox(4160, "Information", "Item 10 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[10]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetCount

Function Reference

_GUICtrlTreeView_GetCount

Retrieves a count of the items

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Count of items

Remarks

None.

Related

_GUICtrlTreeView_GetChildCount, _GUICtrlTreeView_GetSiblingCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Count", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To Random(10, 20, 1)
$hItem = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Count: " & _GUICtrlTreeView_GetCount($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetCut

Function Reference

_GUICtrlTreeView_GetCut

Indicates if the item is drawn as if selected as part of a cut and paste operation

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetCut($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is cut
False: | Item is not cut

Remarks

None.

Related

_GUICtrlTreeView_SetCut

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Cut", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Cut? %s", $hRandomItem, _GUICtrlTreeView_GetCut($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetCut($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Cut? %s", $hRandomItem, _GUICtrlTreeView_GetCut($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetDropTarget

Function Reference

_GUICtrlTreeView_GetDropTarget

Indicates whether the item is drawn as a drag and drop target

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetDropTarget($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is drawn as a drop target
False: | Item is not drawn as a drop target

Remarks

None.

Related

_GUICtrlTreeView_SetDropTarget

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Drop Target", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Drop Target? %s", $hRandomItem, _GUICtrlTreeView_GetDropTarget($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetDropTarget($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Drop Target? %s", $hRandomItem, _GUICtrlTreeView_GetDropTarget($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetEditControl

Function Reference

_GUICtrlTreeView_GetEditControl

Retrieves the handle to the edit control being used to edit a item's text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetEditControl($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Handle to the edit control
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_EditText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hTreeView

_Main()

Func _Main()

Local $hItem[6], $hImage
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Edit Control", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
; turn off unicode at this time dllstruct doesn't support them
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next

; Edit item 0 label
_GUICtrlTreeView_EditText($hTreeView, $hItem[0])
Sleep(1000)
_GUICtrlTreeView_EndEdit($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview
$hWndTreeview = $hTreeView
If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView)

$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndTreeview
Switch $iCode
Case $NM_CLICK ; The user has clicked the left mouse button within the control
_DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
_DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RCLICK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
_DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
Case $NM_KILLFOCUS ; control has lost the input focus
_DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $NM_RETURN ; control has the input focus and that the user has pressed the key
_DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
;~ Return 1 ; nonzero to not allow the default processing
Return 0 ; zero to allow the default processing
;~ Case $NM_SETCURSOR ; control is setting the cursor in response to a WM_SETCURSOR message
;~ Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
;~ $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
;~ $iIDFrom = DllStructGetData($tinfo, "IDFrom")
;~ $iCode = DllStructGetData($tinfo, "Code")
;~ _DebugPrint("$NM_SETCURSOR" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~ "-->Code:" & @TAB & $iCode & @LF & _
;~ "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
;~ "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
;~ "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
;~ "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
;~ "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
;~ Return 0 ; to enable the control to set the cursor
;~ Return 1 ; nonzero to prevent the control from setting the cursor
Case $NM_SETFOCUS ; control has received the input focus
_DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
"-->IDFrom:" & @TAB & $iIDFrom & @LF & _
"-->Code:" & @TAB & $iCode)
; No return value
Case $TVN_BEGINDRAGA, $TVN_BEGINDRAGW
_DebugPrint("$TVN_BEGINDRAG")
Case $TVN_BEGINLABELEDITA, $TVN_BEGINLABELEDITW
_DebugPrint("$TVN_BEGINLABELEDIT")
MsgBox(4160, "Information", "Edit Control Handle: " & _GUICtrlTreeView_GetEditControl($hTreeView))
Case $TVN_BEGINRDRAGA, $TVN_BEGINRDRAGW
_DebugPrint("$TVN_BEGINRDRAG")
Case $TVN_DELETEITEMA, $TVN_DELETEITEMW
_DebugPrint("$TVN_DELETEITEM")
Case $TVN_ENDLABELEDITA, $TVN_ENDLABELEDITW
_DebugPrint("$TVN_ENDLABELEDIT")
Local $tInfo = DllStructCreate($tagNMHDR & ";" & $tagTVITEMEX, $ilParam)
If DllStructGetData($tInfo, "Text") <> 0 Then
Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
_GUICtrlTreeView_SetText($hTreeView, _GUICtrlTreeView_GetSelection($hTreeView), DllStructGetData($tBuffer, "Text"))
EndIf
Case $TVN_GETDISPINFOA, $TVN_GETDISPINFOW
_DebugPrint("$TVN_GETDISPINFO")
Case $TVN_GETINFOTIPA, $TVN_GETINFOTIPW
_DebugPrint("$TVN_GETINFOTIP")
Case $TVN_ITEMEXPANDED, $TVN_ITEMEXPANDEDW
_DebugPrint("$TVN_ITEMEXPANDED")
Case $TVN_ITEMEXPANDINGA, $TVN_ITEMEXPANDINGW
_DebugPrint("$TVN_ITEMEXPANDING")
Case $TVN_KEYDOWN
_DebugPrint("$TVN_KEYDOWN")
Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
_DebugPrint("$TVN_SELCHANGED")
Case $TVN_SELCHANGINGA, $TVN_SELCHANGINGW
_DebugPrint("$TVN_SELCHANGING")
Case $TVN_SETDISPINFOA, $TVN_SETDISPINFOW
_DebugPrint("$TVN_SETDISPINFO")
Case $TVN_SINGLEEXPAND
_DebugPrint("$TVN_SINGLEEXPAND")
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
ConsoleWrite( _
"!===========================================================" & @LF & _
"+======================================================" & @LF & _
"-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
"+======================================================" & @LF)
EndFunc ;==>_DebugPrint


Function _GUICtrlTreeView_GetExpanded

Function Reference

_GUICtrlTreeView_GetExpanded

Indicates whether the item is expanded

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetExpanded($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is expanded
False: | Item is not expanded

Remarks

None.

Related

_GUICtrlTreeView_Expand

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Expanded", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Expanded? %s", $hRandomItem, _GUICtrlTreeView_GetExpanded($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_Expand($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Expanded? %s", $hRandomItem, _GUICtrlTreeView_GetExpanded($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetFirstChild

Function Reference

_GUICtrlTreeView_GetFirstChild

Retrieves the first child item of the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetFirstChild($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | The handle of the first child item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetLastChild, _GUICtrlTreeView_GetNextChild, _GUICtrlTreeView_GetPrevChild

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get First Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d First Shild? %s", $hRandomItem, _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem[$hRandomItem]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetFirstItem

Function Reference

_GUICtrlTreeView_GetFirstItem

Retrieves the topmost or very first item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetFirstItem($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The handle of the first item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetFirstVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get First Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 6
$hItem = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", StringFormat("First Item? %s", _GUICtrlTreeView_GetFirstItem($hTreeView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetFirstVisible

Function Reference

_GUICtrlTreeView_GetFirstVisible

Retrieves the first visible item in the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetFirstVisible($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | The handle of the first visible item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetFirstItem

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hChild, $hFirst, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get First Visible", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 20
$hItem = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$hChild = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_EnsureVisible($hTreeView, $hItem)
$hFirst = _GUICtrlTreeView_GetFirstVisible($hTreeView)
MsgBox(4160, "Information", "First Visible: " & $hFirst)
_GUICtrlTreeView_SelectItem($hTreeView, $hFirst)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetFocused

Function Reference

_GUICtrlTreeView_GetFocused

Indicates whether the item has focus

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetFocused($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item has focus
False: | Item does not have focus

Remarks

None.

Related

_GUICtrlTreeView_SetFocused

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Focused", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Focused? %s", $hRandomItem, _GUICtrlTreeView_GetFocused($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetFocused($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Focused? %s", $hRandomItem, _GUICtrlTreeView_GetFocused($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetHeight

Function Reference

_GUICtrlTreeView_GetHeight

Retrieves the current height of the each item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetHeight($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Item height in pixels

Remarks

None.

Related

_GUICtrlTreeView_SetHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Height", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", StringFormat("Item Height? %s", _GUICtrlTreeView_GetHeight($hTreeView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetImageIndex

Function Reference

_GUICtrlTreeView_GetImageIndex

Retrieves the normal state image index

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetImageIndex($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Image list index
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_SetImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hRandomImage, $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hRandomImage = Random(0, 5, 1)
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $hRandomImage, $hRandomImage)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Image Index? %s", $hRandomItem, _GUICtrlTreeView_GetImageIndex($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetImageListIconHandle

Function Reference

_GUICtrlTreeView_GetImageListIconHandle

Retrieve ImageList handle

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetImageListIconHandle($hWnd, $iIndex)

Parameters

$hWnd | Handle to the control
$iIndex | ImageList index to retrieve

Return Value

Returns the ImageList handle

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hRandomImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get ImageList Icon Handle", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomImage = Random(0, _GUIImageList_GetImageCount($hImage) - 1, 1)
MsgBox(4160, "Information", StringFormat("ImageList Icon Handle for Image %d? %s", $hRandomImage, _GUICtrlTreeView_GetImageListIconHandle($hTreeView, $hRandomImage)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetIndent

Function Reference

_GUICtrlTreeView_GetIndent

Retrieves the amount, in pixels, that child items are indented relative to their parent items

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetIndent($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the amount of indentation

Remarks

None.

Related

_GUICtrlTreeView_SetIndent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Indent", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Indent: " & _GUICtrlTreeView_GetIndent($hTreeView))

_GUICtrlTreeView_SetIndent($hTreeView, 25)

MsgBox(4160, "Information", "Indent: " & _GUICtrlTreeView_GetIndent($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetInsertMarkColor

Function Reference

_GUICtrlTreeView_GetInsertMarkColor

Retrieves the color used to draw the insertion mark

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetInsertMarkColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Current insertion mark color

Remarks

None.

Related

_GUICtrlTreeView_SetInsertMarkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Insert Mark Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Insert Mark Color: " & _GUICtrlTreeView_GetInsertMarkColor($hTreeView))

_GUICtrlTreeView_SetInsertMarkColor($hTreeView, $COLOR_MONEYGREEN)

$iRand = Random(0, 5, 1)
_GUICtrlTreeView_SetInsertMark($hTreeView, $hItem[$iRand])

MsgBox(4160, "Information", "Insert Mark Color: " & _GUICtrlTreeView_GetInsertMarkColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetISearchString

Function Reference

_GUICtrlTreeView_GetISearchString

Retrieves the incremental search string

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetISearchString($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Incremental search string if the control is in incremental search mode
Failure: | otherwise ""

Remarks

The incremental search string is used to select an item based on characters typed by the user

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hTreeView
Local $sText[6] = ["AutoIt", "freeware", "BASIC-like", "scripting", "language", "automating"]
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get ISearch String", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, $sText[$x], $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

Send($sText[Random(0, 5, 1)])
MsgBox(4160, "Information", "ISearch String: " & _GUICtrlTreeView_GetISearchString($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetItemByIndex

Function Reference

_GUICtrlTreeView_GetItemByIndex

Retrieve a item by its position in the list of child items

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetItemByIndex($hWnd, $hItem, $iIndex)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Zero based index of item in the list of child items

Return Value

Success: | Handle of the item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_Index

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Item By Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 5
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
For $y = 1 To 3
_GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), $x, $x)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Item 3, Child Index 1 Handle: " & _GUICtrlTreeView_GetItemByIndex($hTreeView, $hItem[3], 1))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetItemHandle

Function Reference

_GUICtrlTreeView_GetItemHandle

Retrieve the item handle

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetItemHandle($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] Item ID

Return Value

Success: | Item handle
Failure: | 0

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hItemChild[30], $iYIndex = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Item Handle", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = $iYIndex To $iYIndex + 2
$hItemChild[$y] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child Item", $y), $hItem[$x])
Next
$iYIndex += 3
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Item handle for index %d: %s", $iRand, _GUICtrlTreeView_GetItemHandle($hTreeView, $hItem[$iRand])))
$iRand = Random(0, 29, 1)
MsgBox(4160, "Information", StringFormat("Item handle for child index %d: %s", $iRand, _GUICtrlTreeView_GetItemHandle($hTreeView, $hItemChild[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetItemParam

Function Reference

_GUICtrlTreeView_GetItemParam

Retrieves the application specific value of the item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetItemParam($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] Item ID

Return Value

Success: | Item Param
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_SetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

; Warning do not use SetItemParam on items created with GUICtrlCreateTreeViewItem
; Param is the controlId for items created with the built-in function

Example_Internal()
Example_External()

Func Example_Internal()

Local $hItem[10], $hItemChild[30], $iYIndex = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Item Param", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = $iYIndex To $iYIndex + 2
$hItemChild[$y] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child Item", $y), $hItem[$x])
Next
$iYIndex += 3
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Item Param/ID for index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItem[$iRand])))
$iRand = Random(0, 29, 1)
MsgBox(4160, "Information", StringFormat("Item Param/ID for child index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItemChild[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_Internal

Func Example_External()

Local $GUI, $hItem[10], $hItemChild[30], $iYIndex = 0, $iRand, $iParam = 1, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$GUI = GUICreate("(UDF Created) TreeView Get Item Param", 400, 300)

$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
_GUICtrlTreeView_SetItemParam($hTreeView, $hItem[$x], $iParam)
$iParam += 1
For $y = $iYIndex To $iYIndex + 2
$hItemChild[$y] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
_GUICtrlTreeView_SetItemParam($hTreeView, $hItemChild[$y], $iParam)
$iParam += 1
Next
$iYIndex += 3
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Item Param for index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItem[$iRand])))
$iRand = Random(0, 29, 1)
MsgBox(4160, "Information", StringFormat("Item Param for child index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItemChild[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_External


Function _GUICtrlTreeView_GetLastChild

Function Reference

_GUICtrlTreeView_GetLastChild

Retrieves the last child item of the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetLastChild($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | The handle of the last child item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetFirstChild, _GUICtrlTreeView_GetNextChild, _GUICtrlTreeView_GetPrevChild

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hItemChild[30], $iYIndex = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Last Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = $iYIndex To $iYIndex + 2
$hItemChild[$y] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child Item", $y), $hItem[$x])
Next
$iYIndex += 3
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Last Child for Item %d: %s", $iRand, _GUICtrlTreeView_GetLastChild($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetLastChild($hTreeView, $hItem[$iRand]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetLineColor

Function Reference

_GUICtrlTreeView_GetLineColor

Retrieve the line color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetLineColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Hex RGB Line Color

Remarks

None.

Related

_GUICtrlTreeView_SetLineColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Line Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetNext

Function Reference

_GUICtrlTreeView_GetNext

Retrieves the next item after the calling item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNext($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle of the next item
Failure: | 0

Remarks

If the calling item is the last item, _GUICtrlTreeView_GetNext returns 0, otherwise it will return the next item
including items that aren't visible and child items. To get the next item at the same level as the calling
item use _GUICtrlTreeView_GetNextSibling. To get the next visible item, use _GUICtrlTreeView_GetNextVisible.

Related

_GUICtrlTreeView_GetNextVisible, _GUICtrlTreeView_GetNextSibling, _GUICtrlTreeView_GetPrev

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Next", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 5), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Index 2, Next: " & _GUICtrlTreeView_GetNext($hTreeView, $hItem[2]))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNext($hTreeView, $hItem[2]))

MsgBox(4160, "Information", "Index 4, Next: " & _GUICtrlTreeView_GetNext($hTreeView, $hItem[4]))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNext($hTreeView, $hItem[4]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetNextChild

Function Reference

_GUICtrlTreeView_GetNextChild

Returns the next item at the same level as the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNextChild($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the child item

Return Value

Success: | Handle to the next child item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetFirstChild, _GUICtrlTreeView_GetLastChild, _GUICtrlTreeView_GetPrevChild

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hFirstChild, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Next Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hFirstChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem[2])
_GUICtrlTreeView_SelectItem($hTreeView, $hFirstChild)
MsgBox(4160, "Information", "Index 2, Next Child: " & _GUICtrlTreeView_GetNextChild($hTreeView, $hFirstChild))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNextChild($hTreeView, $hFirstChild))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetNextSibling

Function Reference

_GUICtrlTreeView_GetNextSibling

Returns the next item at the same level as the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNextSibling($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle to the next sibling item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetNext, _GUICtrlTreeView_GetPrevSibling

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hRandItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Next Sibling", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandItem = Random(0, 8, 1)
MsgBox(4160, "Information", StringFormat("Index %d, Next: %s", $hRandItem, _GUICtrlTreeView_GetNextSibling($hTreeView, $hItem[$hRandItem])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNextSibling($hTreeView, $hItem[$hRandItem]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetNextVisible

Function Reference

_GUICtrlTreeView_GetNextVisible

Retrieves the next visible item that follows the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNextVisible($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle to the next visible item
Failure: | 0

Remarks

The specified item must be visible

Related

_GUICtrlTreeView_GetNext, _GUICtrlTreeView_GetPrevVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hRandItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Next Visible", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandItem = Random(0, 8, 1)
MsgBox(4160, "Information", StringFormat("Index %d, Next Visible: %s", $hRandItem, _GUICtrlTreeView_GetNextVisible($hTreeView, $hItem[$hRandItem])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetNextVisible($hTreeView, $hItem[$hRandItem]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetNormalImageList

Function Reference

_GUICtrlTreeView_GetNormalImageList

Retrieves the normal image list

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetNormalImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Handle to image list
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_SetNormalImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Normal ImageList", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 5
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Normal ImageList Handle: " & _GUICtrlTreeView_GetNormalImageList($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetParentHandle

Function Reference

_GUICtrlTreeView_GetParentHandle

Retrieve the parent handle of item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetParentHandle($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] item ID/handle

Return Value

Success: | Handle to Parent item
Failure: | 0

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem, $hChild, $hFirst, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Parent Handle", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 20
$hItem = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$hChild = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hChild)
MsgBox(4160, "Information", "Parent Handle: " & _GUICtrlTreeView_GetParentHandle($hTreeView, $hChild))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetParentHandle($hTreeView, $hChild))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetParentParam

Function Reference

_GUICtrlTreeView_GetParentParam

Retrieve the parent control ID/Param of item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetParentParam($hWnd, $hItem = 0)

Parameters

$hWnd | Handle to the control
$hItem | item ID/Param

Return Value

Success: | The parent control Param
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Example_Internal()
Example_External()

Func Example_Internal()

Local $hItem, $hChild, $hFirst, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Parent Param", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 20
$hItem = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$hChild = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hChild)
MsgBox(4160, "Information", "Parent Param/ID: " & _GUICtrlTreeView_GetParentParam($hTreeView, $hChild)) ; same as controlId

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_Internal

Func Example_External()

Local $GUI, $hItem, $hChild, $hFirst, $iParam = 1, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$GUI = GUICreate("(UDF Created) TreeView Get Parent Param", 400, 300)

$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 20
$hItem = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
_GUICtrlTreeView_SetItemParam($hTreeView, $hItem, $iParam)
$iParam += 1
For $y = 0 To 2
$hChild = _GUICtrlTreeView_AddChild($hTreeView, $hItem, StringFormat("[%02d] New Item", $y))
_GUICtrlTreeView_SetItemParam($hTreeView, $hChild, $iParam)
$iParam += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hChild)
MsgBox(4160, "Information", "Parent Param: " & _GUICtrlTreeView_GetParentParam($hTreeView, $hChild))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_External


Function _GUICtrlTreeView_GetPrev

Function Reference

_GUICtrlTreeView_GetPrev

Retrieves the previous item before the calling item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetPrev($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle of the previous item
Failure: | 0

Remarks

If the calling item is the first item _GUICtrlTreeView_GetPrev returns 0, otherwise it will return the previous
item including items that aren't visible and child items. To get the previous item at the same level as the
calling item use _GUICtrlTreeView_GetPrevChild. To get the previous visible item, use
_GUICtrlTreeView_GetPrevVisible.

Related

_GUICtrlTreeView_GetNext, _GUICtrlTreeView_GetPrevChild, _GUICtrlTreeView_GetPrevVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Prev", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iYItem), $hItem[$x])
$iYItem += 1
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iYItem), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Prev from Index %d: %s", $iRand, _GUICtrlTreeView_GetPrev($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetPrev($hTreeView, $hItem[$iRand]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetPrevChild

Function Reference

_GUICtrlTreeView_GetPrevChild

Retrieves the previous child item of a specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetPrevChild($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle to the previous child item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetNextChild, _GUICtrlTreeView_GetFirstChild, _GUICtrlTreeView_GetLastChild, _GUICtrlTreeView_GetPrev

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hLastChild, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Prev Child", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
For $y = 1 To 4
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 5), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hLastChild = _GUICtrlTreeView_GetLastChild($hTreeView, $hItem[2])
_GUICtrlTreeView_SelectItem($hTreeView, $hLastChild)
MsgBox(4160, "Information", "Index 2, Prev Child: " & _GUICtrlTreeView_GetPrevChild($hTreeView, $hLastChild))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetPrevChild($hTreeView, $hLastChild))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetPrevSibling

Function Reference

_GUICtrlTreeView_GetPrevSibling

Returns the previous item before the calling item at the same level

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetPrevSibling($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle to the previous sibling item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetNextSibling

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hRandItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Prev Sibling", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandItem = Random(0, 8, 1)
MsgBox(4160, "Information", StringFormat("Index %d, Prev: %s", $hRandItem, _GUICtrlTreeView_GetPrevSibling($hTreeView, $hItem[$hRandItem])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetPrevSibling($hTreeView, $hItem[$hRandItem]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetPrevVisible

Function Reference

_GUICtrlTreeView_GetPrevVisible

Retrieves the first visible item that precedes the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetPrevVisible($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Success: | Handle to the previous visible item
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_GetNextVisible, _GUICtrlTreeView_GetPrev

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[20], $hRandItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Prev Visible", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 4), $hTreeView)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
For $x = 10 To 19
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandItem = Random(1, 19, 1)
MsgBox(4160, "Information", StringFormat("Index %d, Prev Visible: %s", $hRandItem, _GUICtrlTreeView_GetPrevVisible($hTreeView, $hItem[$hRandItem])))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_GetPrevVisible($hTreeView, $hItem[$hRandItem]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetScrollTime

Function Reference

_GUICtrlTreeView_GetScrollTime

Retrieves the maximum scroll time

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetScrollTime($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Maximum scroll time, in milliseconds

Remarks

The maximum scroll time is the longest amount of time that a scroll operation can take. Scrolling will be
adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less
time than the maximum.

Related

_GUICtrlTreeView_SetScrollTime

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Scroll Time", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SetScrollTime($hTreeView, 2)
MsgBox(4160, "Information", "Scroll Time: " & _GUICtrlTreeView_GetScrollTime($hTreeView) & " milliseconds")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetSelected

Function Reference

_GUICtrlTreeView_GetSelected

Indicates whether the item appears in the selected state

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetSelected($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is in the selected state
False: | Item is not in the selected state

Remarks

None.

Related

_GUICtrlTreeView_SetSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Selected", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Index %d Selected? %s", $iRand, _GUICtrlTreeView_GetSelected($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SetSelected($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", StringFormat("Index %d Selected? %s", $iRand, _GUICtrlTreeView_GetSelected($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetSelectedImageIndex

Function Reference

_GUICtrlTreeView_GetSelectedImageIndex

Retrieves the index in the image list of the image displayed for the item when it is selected

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetSelectedImageIndex($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Returns the Selected list index

Remarks

None.

Related

_GUICtrlTreeView_SetSelectedImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hImage, $iImage, $iSImage, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Selected Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$iImage = Random(0, 5, 1)
$iSImage = Random(0, 5, 1)
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iSImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$iSImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), $iImage, $iSImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Selected Image Index for Item Index %d? %d", $iRand, _GUICtrlTreeView_GetSelectedImageIndex($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetSelection

Function Reference

_GUICtrlTreeView_GetSelection

Retrieves the currently selected item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetSelection($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Handle to the currently selected item
Failure: | 0 if no item is selected

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Selection", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", "Selection? " & _GUICtrlTreeView_GetSelection($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetSiblingCount

Function Reference

_GUICtrlTreeView_GetSiblingCount

Retrieves the number of siblings at the level of an item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetSiblingCount($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to item

Return Value

Returns the Number of siblings

Remarks

None.

Related

_GUICtrlTreeView_GetCount, _GUICtrlTreeView_GetChildCount

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[100], $hChildItem[100], $iRand, $iChildRand, $iYItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Sibling Count", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
$iRand = Random(2, 9, 1)
For $x = 0 To $iRand
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
$iChildRand = Random(0, 9, 1)
For $y = 0 To $iChildRand
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9)
MsgBox(4160, "Information", StringFormat("Sibling Count for item index %d: %d", $iRand, _GUICtrlTreeView_GetSiblingCount($hTreeView, $hItem[$iRand])))

$iRand = Random(0, 99)
MsgBox(4160, "Information", StringFormat("Sibling Count for Child item index %d: %d", $iRand, _GUICtrlTreeView_GetSiblingCount($hTreeView, $hChildItem[$iRand])))
_GUICtrlTreeView_Expand($hTreeView, _GUICtrlTreeView_GetParentHandle($hTreeView, $hChildItem[$iRand]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetState

Function Reference

_GUICtrlTreeView_GetState

Retrieve the state of the item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetState($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] item ID/handle

Return Value

Success: | The state of the item
Failure: | Set @error

Remarks

None.

Related

_GUICtrlTreeView_SetState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get State", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SetSelected($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", StringFormat("State for Index %d? %s", $iRand, _GUICtrlTreeView_GetState($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetStateImageIndex

Function Reference

_GUICtrlTreeView_GetStateImageIndex

Retrieves the index of the state image to display for the item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetStateImageIndex($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Returns the State image index

Remarks

None.

Related

_GUICtrlTreeView_SetStateImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get State Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y))
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "State Image Index for Item 0: " & _GUICtrlTreeView_GetStateImageIndex($hTreeView, $hItem[0]))
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateStateImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetStateImageList

Function Reference

_GUICtrlTreeView_GetStateImageList

Retrieves the handle to the state image list

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetStateImageList($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Handle to image list on success
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_SetStateImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get State Image List", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "State Image List: " & _GUICtrlTreeView_GetStateImageList($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetText

Function Reference

_GUICtrlTreeView_GetText

Retrieve the item text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetText($hWnd[, $hItem = 0])

Parameters

$hWnd | Handle to the control
$hItem | [optional] item ID/handle

Return Value

Success: | Text from item
Failure: | Empty string

Remarks

None.

Related

_GUICtrlTreeView_SetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Text", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Text for Item %d: %s", $iRand, _GUICtrlTreeView_GetText($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetTextColor

Function Reference

_GUICtrlTreeView_GetTextColor

Retrieve the text color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetTextColor($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Hex RGB Text Color

Remarks

None.

Related

_GUICtrlTreeView_SetTextColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Get Text Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetToolTips

Function Reference

_GUICtrlTreeView_GetToolTips

Retrieves the handle to the child ToolTip control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetToolTips($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Success: | Handle to the child ToolTip control
Failure: | 0 if the control is not using ToolTips

Remarks

When created, controls automatically create a ToolTip control. To cause a control not to use ToolTips, create
the control with the $TVS_NOTOOLTIPS style

Related

_GUICtrlTreeView_SetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get ToolTips", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "ToolTips Handle: " & _GUICtrlTreeView_GetToolTips($hTreeView))

_GUICtrlTreeView_SetToolTips($hTreeView, _GUICtrlTreeView_GetToolTips($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetTree

Function Reference

_GUICtrlTreeView_GetTree

Retrieve all items text

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetTree($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | item ID/handle

Return Value

Success: | Tree Path of Item
Failure: | Empty string

Remarks

Use Opt("GUIDataSeparatorChar", param) to change the separator char used
If $hItem is 0 then an attempt to use current selected is used

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

Opt("GUIDataSeparatorChar", "\")

GUICreate("TreeView Get Tree", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "Tree for Child Index 2: " & _GUICtrlTreeView_GetTree($hTreeView, $hChildItem[2]))
_GUICtrlTreeView_SelectItem($hTreeView, $hChildItem[2])

$iRand = Random(0, 29, 1)
_GUICtrlTreeView_SelectItem($hTreeView, $hChildItem[$iRand])
MsgBox(4160, "Information", StringFormat("Tree for Child Selected Index %d: %s", $iRand, _GUICtrlTreeView_GetTree($hTreeView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetUnicodeFormat

Function Reference

_GUICtrlTreeView_GetUnicodeFormat

Retrieves the Unicode character format flag

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetUnicodeFormat($hWnd)

Parameters

$hWnd Handle to the control

Return Value

True: | Control is using Unicode characters
False: | Control is using ANSI characters

Remarks

None.

Related

_GUICtrlTreeView_SetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get Unicode Format", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlTreeView_GetUnicodeFormat($hTreeView))
_GUICtrlTreeView_SetUnicodeFormat($hTreeView)
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlTreeView_GetUnicodeFormat($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_GetVisible

Function Reference

_GUICtrlTreeView_GetVisible

Indicates whether the item is currently visible in the control image

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetVisible($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is visible in the control image
False: | Item is not visible in the control image

Remarks

None.

Related

_GUICtrlTreeView_EnsureVisible

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[100], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get Visible", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 99
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(40, 99, 1)
MsgBox(4160, "Information", StringFormat("Index %d Visible: %s", $iRand, _GUICtrlTreeView_GetVisible($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_EnsureVisible($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", StringFormat("Index %d Visible: %s", $iRand, _GUICtrlTreeView_GetVisible($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_GetVisibleCount

Function Reference

_GUICtrlTreeView_GetVisibleCount

Returns the number of items that can be fully visible in the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_GetVisibleCount($hWnd)

Parameters

$hWnd Handle to the control

Return Value

Returns the Maximum number of items possibly visible in the control

Remarks

The number of items that can be fully visible may be greater than the number of items in the control. The
control calculates this value by dividing the height of the client window by the height of an item. Note that
the return value is the number of items that can be fully visible. If you can see all of 20 items and part of
one more item, the return value is 20 not 21.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[100], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Get Visible Count", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 99
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Visible: " & _GUICtrlTreeView_GetVisibleCount($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_HitTest

Function Reference

_GUICtrlTreeView_HitTest

Returns information about the location of a point relative to the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_HitTest($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position, relative to the control, to test
$iY | Y position, relative to the control, to test

Return Value

Success: | Value indicating the results of the hit test:
 | 1 - In the client area, but below the last item.
 | 2 - On the bitmap associated with an item
 | 4 - On the text associated with an item
 | 8 - In the indentation associated with an item
 | 16 - On the button associated with an item
 | 32 - In the area to the right of an item
 | 64 - On the state icon for a item that is in a user-defined state
 | 128 - Above the client area
 | 256 - Below the client area
 | 512 - To the left of the client area
 | 1024 - To the right of the client area
Failure: | 0

Remarks

None.

Related

_GUICtrlTreeView_HitTestItem, _GUICtrlTreeView_HitTestEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iYRand, $iXRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Hit Test", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

$iYRand = Random(0, 268, 1)
$iXRand = Random(0, 396, 1)
MsgBox(4160, "Information", StringFormat("Hit Test (%d, %d): %s", $iXRand, $iYRand, _GetHitString(_GUICtrlTreeView_HitTest($hTreeView, $iXRand, $iYRand))))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _GetHitString($iResult)
Switch $iResult
Case 1
Return "In the client area, but below the last item"
Case 2
Return "On the bitmap associated with an item"
Case 4
Return "On the text associated with an item"
Case 8
Return "In the indentation associated with an item"
Case 16
Return "On the button associated with an item"
Case 32
Return "In the area to the right of an item"
Case 64
Return "On the state icon for a item that is in a user-defined state"
Case 128
Return "Above the client area"
Case 256
Return "Below the client area"
Case 512
Return "To the left of the client area"
Case 1024
Return "To the right of the client area"
EndSwitch
EndFunc ;==>_GetHitString

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_HitTestEx

Function Reference

_GUICtrlTreeView_HitTestEx

Returns information about the location of a point relative to the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_HitTestEx($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position to test
$iY | Y position to test

Return Value

Returns a $tagTVHITTESTINFO structure

Remarks

None.

Related

_GUICtrlTreeView_HitTest, _GUICtrlTreeView_HitTestItem, $tagTVHITTESTINFO

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iYRand, $iXRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Hit TestEx", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

$iYRand = Random(0, 268, 1)
$iXRand = Random(0, 396, 1)
MsgBox(4160, "Information", StringFormat("Hit TestEx (%d, %d): %s", $iXRand, $iYRand, _GetHitString(_GUICtrlTreeView_HitTestEx($hTreeView, $iXRand, $iYRand))))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _GetHitString($tHitTest)
Local $iFlags = DllStructGetData($tHitTest, "Flags")
Select
Case BitAND($iFlags, $TVHT_NOWHERE) <> 0
Return "In the client area, but below the last item"
Case BitAND($iFlags, $TVHT_ONITEMICON) <> 0
Return "On the bitmap associated with an item"
Case BitAND($iFlags, $TVHT_ONITEMLABEL) <> 0
Return "On the text associated with an item"
Case BitAND($iFlags, $TVHT_ONITEMINDENT) <> 0
Return "In the indentation associated with an item"
Case BitAND($iFlags, $TVHT_ONITEMBUTTON) <> 0
Return "On the button associated with an item"
Case BitAND($iFlags, $TVHT_ONITEMRIGHT) <> 0
Return "In the area to the right of an item"
Case BitAND($iFlags, $TVHT_ONITEMSTATEICON) <> 0
Return "On the state icon for a item that is in a user-defined state"
Case BitAND($iFlags, $TVHT_ABOVE) <> 0
Return "Above the client area"
Case BitAND($iFlags, $TVHT_BELOW) <> 0
Return "Below the client area"
Case BitAND($iFlags, $TVHT_TORIGHT) <> 0
Return "To the left of the client area"
Case BitAND($iFlags, $TVHT_TOLEFT) <> 0
Return "To the right of the client area"
EndSelect
EndFunc ;==>_GetHitString

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_HitTestItem

Function Reference

_GUICtrlTreeView_HitTestItem

Returns the item at the specified coordinates

#Include <GuiTreeView.au3>
_GUICtrlTreeView_HitTestItem($hWnd, $iX, $iY)

Parameters

$hWnd | Handle to the control
$iX | X position to test
$iY | Y position to test

Return Value

Returns the Handle to the item at the specified point or 0 if no item occupies the point

Remarks

None.

Related

_GUICtrlTreeView_HitTest, _GUICtrlTreeView_HitTestEx

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iYRand, $iXRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Hit Test Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

$iYRand = Random(0, 130, 1)
$iXRand = Random(0, 100, 1)
MsgBox(4160, "Information", StringFormat("Hit Test Item (%d, %d): %s", $iXRand, $iYRand, _GetHitString(_GUICtrlTreeView_HitTestItem($hTreeView, $iXRand, $iYRand))))
_GUICtrlTreeView_SelectItem($hTreeView, _GUICtrlTreeView_HitTestItem($hTreeView, $iXRand, $iYRand))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _GetHitString($iResult)
If $iResult = 0 Then
Return "No Item in Hit area"
Else
Return "Item Handle: " & $iResult
EndIf
EndFunc ;==>_GetHitString

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_Index

Function Reference

_GUICtrlTreeView_Index

Retrieves the position of the item in the list

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Index($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to item

Return Value

Success: | Index position
Failure: | -1

Remarks

If $hItem is a child item the index is the position under the parent
If $hItem has no parent this function will get the index of that item

Related

_GUICtrlTreeView_GetItemByIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 9 To 0 Step -1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 2 To 0 Step -1
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 29, 1)
MsgBox(4160, "Information", StringFormat("Index for Child Item %d: %d", $iRand, _GUICtrlTreeView_Index($hTreeView, $hChildItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, $hChildItem[$iRand])

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Index for Item %d: %d", $iRand, _GUICtrlTreeView_Index($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_InsertItem

Function Reference

_GUICtrlTreeView_InsertItem

Insert an item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_InsertItem($hWnd, $sItem_Text[, $hItem_Parent = 0[, $hItem_After = 0[, $iImage = -1[, $iSelImage = -1]]]])

Parameters

$hWnd | Handle to the control
$sItem_Text | Text of new item
$hItem_Parent | [optional] parent item ID/handle/item
$hItem_After | [optional] item ID/handle/flag to insert new item after
$iImage | [optional] Zero based index of the item's icon in the control's image list
$iSelImage | [optional] Zero based index of the item's icon in the control's image list

Return Value

Success: | The new item handle
Failure: | 0

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hInsert, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Insert Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To 3
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iYItem), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Inserted after index %d: %s", $iRand, _GUICtrlTreeView_InsertItem($hTreeView, "Inserted Item", 0, $hItem[$iRand])))

$iRand = Random(0, 29, 1)
$hInsert = _GUICtrlTreeView_InsertItem($hTreeView, "Inserted Item", _GUICtrlTreeView_GetParentHandle($hTreeView, $hChildItem[$iRand]), $hChildItem[$iRand])
MsgBox(4160, "Information", StringFormat("Inserted after child index %d: %s", $iRand, $hInsert))

$hInsert = _GUICtrlTreeView_InsertItem($hTreeView, "Inserted first child Item", _GUICtrlTreeView_GetParentHandle($hTreeView, $hChildItem[$iRand]), $TVI_FIRST)
MsgBox(4160, "Information", StringFormat("Inserted child index %d firsts: %s", $iRand, $hInsert))
_GUICtrlTreeView_SelectItem($hTreeView, $hInsert)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_IsFirstItem

Function Reference

_GUICtrlTreeView_IsFirstItem

Indicates whether the tree item is very first

#Include <GuiTreeView.au3>
_GUICtrlTreeView_IsFirstItem($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

True: | Item is the first item
False: | Item is not the first item

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Is First Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $iYItem), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Is Index %d First Item? %s", $iRand, _GUICtrlTreeView_IsFirstItem($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_IsParent

Function Reference

_GUICtrlTreeView_IsParent

Indicates whether one item is the parent of another item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_IsParent($hWnd, $hParent, $hItem)

Parameters

$hWnd | Handle to the control
$hParent | Handle to parent item
$hItem | Handle to the item to test

Return Value

True: | $hParent is a parent of $hItem
False: | $hParent is not a parent of $hItem

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Is Parent", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $iYItem), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_Expand($hTreeView, $hItem[0])

MsgBox(4160, "Information", "Is Index 2 Parent of Child Index 2: " & _GUICtrlTreeView_IsParent($hTreeView, $hItem[2], $hChildItem[2]))

MsgBox(4160, "Information", "Is Index 0 Parent of Child Index 2: " & _GUICtrlTreeView_IsParent($hTreeView, $hItem[0], $hChildItem[2]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_Level

Function Reference

_GUICtrlTreeView_Level

Indicates the level of indentation of a item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Level($hWnd, $hItem)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item

Return Value

Returns the Zero based item indentation level

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[4], $hChildItem[120], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Level", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 0 To 4
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $iYItem), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
For $z = 1 To 5
$hChildItem[$iYItem + $z] = _GUICtrlTreeView_AddChild($hTreeView, $hChildItem[$iYItem], StringFormat("[%02d] New Child", $iYItem + $z), 0, 3)
Next
$iYItem += 6
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 99, 1)
MsgBox(4160, "Information", StringFormat("Index %d Levl: %d", $iRand, _GUICtrlTreeView_Level($hTreeView, $hChildItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, $hChildItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SelectItem

Function Reference

_GUICtrlTreeView_SelectItem

Selects the specified item, scrolls the item into view, or redraws the item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SelectItem($hWnd, $hItem[, $iFlag=0])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iFlag | [optional] Action flag: $TVGN_CARET - Sets the selection to the given item $TVGN_DROPHILITE - Redraws the given item in the style used to indicate the target of a drag/drop operation $TVGN_FIRSTVISIBLE - Scrolls the tree view vertically so that the given item is the first visible item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iRand, $iYItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Select Item", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To 3
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SelectItemByIndex

Function Reference

_GUICtrlTreeView_SelectItemByIndex

Selects the item based on it's index in the parent list

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SelectItemByIndex($hWnd, $hItem, $iIndex)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Zero based index of item in the parent list

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iRand, $iYItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Select Item By Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To 3
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SelectItemByIndex($hTreeView, $hItem[$iRand], 1)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetBkColor

Function Reference

_GUICtrlTreeView_SetBkColor

Sets the back color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetBkColor($hWnd, $vRGBColor)

Parameters

$hWnd | Handle to the control
$vRGBColor | New hex RGB Color

Return Value

Returns the Previous Hex RGB color

Remarks

None.

Related

_GUICtrlTreeView_GetBkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set BkColor", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetBold

Function Reference

_GUICtrlTreeView_SetBold

Sets whether the item is drawn using a bold sytle

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetBold($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] True if item is drawn bold, otherwise False

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetBold

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Bold", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Bold? %s", $hRandomItem, _GUICtrlTreeView_GetBold($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetBold($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Bold? %s", $hRandomItem, _GUICtrlTreeView_GetBold($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetChecked

Function Reference

_GUICtrlTreeView_SetChecked

Sets whether a item has it's checkbox checked or not

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetChecked($hWnd, $hItem[, $fCheck = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fCheck | [optional] Value to set checked state to: True - Checked False - Not checked

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetChecked

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Checked", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Checked? %s", $hRandomItem, _GUICtrlTreeView_GetChecked($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetChecked($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Checked? %s", $hRandomItem, _GUICtrlTreeView_GetChecked($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetCheckedByIndex

Function Reference

_GUICtrlTreeView_SetCheckedByIndex

Sets whether an item has it's checkbox checked or not by it's index

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetCheckedByIndex($hWnd, $hItem, $iIndex[, $fCheck = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Zero based index into $hItem list of items
$fCheck | [optional] Value to set checked state to: True - Checked False - Not checked

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $iRandIndex, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Checked By Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
For $y = 0 To 5
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child Item", $y + 1), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
$iRandIndex = Random(0, 5, 1)
MsgBox(4160, "Information", _
StringFormat("Set Child Item index[%d] of Item Index[%d]: %s", $iRandIndex, $hRandomItem, _
_GUICtrlTreeView_SetCheckedByIndex($hTreeView, $hItem[$hRandomItem], $iRandIndex)))
_GUICtrlTreeView_Expand($hTreeView)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetChildren

Function Reference

_GUICtrlTreeView_SetChildren

Sets whether the item children flag

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetChildren($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] Flag setting: True - Item children flag is set False - Item children flag is cleared

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetChildren

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[11], $htmp_item, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Children", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 3
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
$htmp_item = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[4] = GUICtrlCreateTreeViewItem(StringFormat("Looking for me?", $x), $htmp_item)
For $x = 5 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 0 To 2
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $y), $hItem[$x])
Next
Next
$hItem[10] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", 10), $hTreeView)
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Item 0 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[0]))
MsgBox(4160, "Information", "Item 10 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[10]))
_GUICtrlTreeView_SetChildren($hTreeView, $hItem[10])
MsgBox(4160, "Information", "Item 10 has Children? " & _GUICtrlTreeView_GetChildren($hTreeView, $hItem[10]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetCut

Function Reference

_GUICtrlTreeView_SetCut

Sets whether the item is drawn as if selected as part of a cut and paste operation

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetCut($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] Flag setting: True - Item is cut False - Item is not

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetCut

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Cut", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Cut? %s", $hRandomItem, _GUICtrlTreeView_GetCut($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetCut($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Cut? %s", $hRandomItem, _GUICtrlTreeView_GetCut($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetDropTarget

Function Reference

_GUICtrlTreeView_SetDropTarget

Sets whether the item is drawn as a drag and drop target

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetDropTarget($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] Flag setting: True - Item is drawn as a drag and drop target False - Item is not

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetDropTarget

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Drop Target", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Drop Target? %s", $hRandomItem, _GUICtrlTreeView_GetDropTarget($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetDropTarget($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Drop Target? %s", $hRandomItem, _GUICtrlTreeView_GetDropTarget($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetFocused

Function Reference

_GUICtrlTreeView_SetFocused

Sets whether the item appears to have focus

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetFocused($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] Flag setting: True - Item appears to have focus False - Item does not

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetFocused

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Focused", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Focused? %s", $hRandomItem, _GUICtrlTreeView_GetFocused($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetFocused($hTreeView, $hItem[$hRandomItem])
MsgBox(4160, "Information", StringFormat("Item %d Focused? %s", $hRandomItem, _GUICtrlTreeView_GetFocused($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetHeight

Function Reference

_GUICtrlTreeView_SetHeight

Sets the height of the each item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetHeight($hWnd, $iHeight)

Parameters

$hWnd | Handle to the control
$iHeight | New height of every item in pixels. Heights less than 1 will be set to 1. If not even and the control does not have the DllStructGetData($TVS_NONEVENHEIGHT style this value will be rounded down to the nearest even value, "") If -1, the control will revert to using its default item height.

Return Value

Returns the Previous height of the items, in pixels

Remarks

None.

Related

_GUICtrlTreeView_GetHeight

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Height", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", StringFormat("Item Height? %s", _GUICtrlTreeView_GetHeight($hTreeView)))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetIcon

Function Reference

_GUICtrlTreeView_SetIcon

Set an item icon

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetIcon($hWnd[, $hItem = 0[, $sIconFile =""[, $iIconID = 0[, $iImageMode = 6]]]])

Parameters

$hWnd | Handle to the control
$hItem | [optional] item ID/handle
$sIconFile | [optional] The file to extract the icon of
$iIconID | [optional] The iconID to extract of the file
$iImageMode | [optional] 2=normal image / 4=selected image to set

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set Icon", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
_GUICtrlTreeView_SetIcon($hTreeView, $hItem[$x], "shell32.dll", 3)
For $y = 1 To 3
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SetIcon($hTreeView, $hItem[0], "shell32.dll", 4)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetImageIndex

Function Reference

_GUICtrlTreeView_SetImageIndex

Sets the index into image list for which image is displayed when a item is in its normal state

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetImageIndex($hWnd, $hItem, $iIndex)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Image list index

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hRandomImage, $hRandomItem, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUIImageList_AddIcon($hImage, "shell32.dll", 3)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hRandomImage = Random(0, 5, 1)
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $hRandomImage, $hRandomImage)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$hRandomItem = Random(0, UBound($hItem) - 1, 1)
MsgBox(4160, "Information", StringFormat("Item %d Image Index? %s", $hRandomItem, _GUICtrlTreeView_GetImageIndex($hTreeView, $hItem[$hRandomItem])))
_GUICtrlTreeView_SetImageIndex($hTreeView, $hItem[$hRandomItem], 6)
MsgBox(4160, "Information", StringFormat("Item %d Image Index? %s", $hRandomItem, _GUICtrlTreeView_GetImageIndex($hTreeView, $hItem[$hRandomItem])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetIndent

Function Reference

_GUICtrlTreeView_SetIndent

Sets the width of indentation for a tree-view control and redraws the control to reflect the new width

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetIndent($hWnd, $iIndent)

Parameters

$hWnd | Handle to the control
$iIndent | Width, in pixels, of the indentation.

Return Value

None.

Remarks

If the $iIndent parameter is less than the system-defined minimum width, the new width is set to the
system-defined minimum.

Related

_GUICtrlTreeView_GetIndent

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Indent", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Indent: " & _GUICtrlTreeView_GetIndent($hTreeView))

_GUICtrlTreeView_SetIndent($hTreeView, 25)

MsgBox(4160, "Information", "Indent: " & _GUICtrlTreeView_GetIndent($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetInsertMark

Function Reference

_GUICtrlTreeView_SetInsertMark

Sets the insertion mark

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetInsertMark($hWnd, $hItem[, $fAfter = True])

Parameters

$hWnd | Handle to the control
$hItem | Specifies at which item the insertion mark will be placed. If this is 0, the insertion mark is removed.
$fAfter | [optional] Specifies if the insertion mark is placed before or after the item. If this is True, the insertion mark will be placed after the item. If this is False, the insertion mark will be placed before the item.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set Insert Mark", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Set Insert Mark at Item Index[%d]: %s", $iRand, _GUICtrlTreeView_SetInsertMark($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SetInsertMarkColor

Function Reference

_GUICtrlTreeView_SetInsertMarkColor

Sets the color used to draw the insertion mark

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetInsertMarkColor($hWnd, $iColor)

Parameters

$hWnd | Handle to the control
$iColor | Insertion mark color

Return Value

Returns the Previous insertion mark color

Remarks

None.

Related

_GUICtrlTreeView_GetInsertMarkColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hImage, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Insert Mark Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Insert Mark Color: " & _GUICtrlTreeView_GetInsertMarkColor($hTreeView))

_GUICtrlTreeView_SetInsertMarkColor($hTreeView, $COLOR_MONEYGREEN)

$iRand = Random(0, 5, 1)
_GUICtrlTreeView_SetInsertMark($hTreeView, $hItem[$iRand])

MsgBox(4160, "Information", "Insert Mark Color: " & _GUICtrlTreeView_GetInsertMarkColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetItemHeight

Function Reference

_GUICtrlTreeView_SetItemHeight

Sets the height of an individual item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetItemHeight($hWnd, $hItem, $iIntegral)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIntegral | Height of the item. This height is in increments of the standard item height. By default, each item gets one increment of item height. Setting this field to 2 will give the item twice the standard height; setting this field to 3 will give the item three times the standard height; and so on. The control does not draw in this extra area.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[6], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Item Height", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To UBound($hItem) - 1
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x + 1), $hTreeView)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SetItemHeight($hTreeView, $hItem[2], 2)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetItemParam

Function Reference

_GUICtrlTreeView_SetItemParam

Sets the value specific to the item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetItemParam($hWnd, $hItem, $iParam)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iParam | A value to associate with the item

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetItemParam

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

; Warning do not use SetItemParam on items created with GUICtrlCreateTreeViewItem
; Param is the controlId for items created with the built-in function

_Main()

Func _Main()

Local $GUI, $hItem[10], $hItemChild[30], $iYIndex = 0, $iRand, $iParam = 1, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

$GUI = GUICreate("(UDF Created) TreeView Set Item Param", 400, 300)

$hTreeView = _GUICtrlTreeView_Create($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
_GUICtrlTreeView_SetItemParam($hTreeView, $hItem[$x], $iParam)
$iParam += 1
For $y = $iYIndex To $iYIndex + 2
$hItemChild[$y] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Item", $y))
_GUICtrlTreeView_SetItemParam($hTreeView, $hItemChild[$y], $iParam)
$iParam += 1
Next
$iYIndex += 3
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Item Param for index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItem[$iRand])))
$iRand = Random(0, 29, 1)
MsgBox(4160, "Information", StringFormat("Item Param for child index %d: %s", $iRand, _GUICtrlTreeView_GetItemParam($hTreeView, $hItemChild[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetLineColor

Function Reference

_GUICtrlTreeView_SetLineColor

Sets the line color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetLineColor($hWnd, $vRGBColor)

Parameters

$hWnd | Handle to the control
$vRGBColor | New Hex RGB line color

Return Value

Returns the Previous Hex RGB line color

Remarks

None.

Related

_GUICtrlTreeView_GetLineColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Line Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetNormalImageList

Function Reference

_GUICtrlTreeView_SetNormalImageList

Sets the normal image list for the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetNormalImageList($hWnd, $hImageList)

Parameters

$hWnd | Handle to the control
$hImageList | Handle to the image list. If 0, all images are removed

Return Value

Returns the handle to the previous image list

Remarks

None.

Related

_GUICtrlTreeView_GetNormalImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Normal ImageList", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 5
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Normal ImageList Handle: " & _GUICtrlTreeView_GetNormalImageList($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetScrollTime

Function Reference

_GUICtrlTreeView_SetScrollTime

Sets the maximum scroll time

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetScrollTime($hWnd, $iTime)

Parameters

$hWnd | Handle to the control
$iTime | New maximum scroll time, in milliseconds

Return Value

Returns the Previous scroll time, in milliseconds

Remarks

The maximum scroll time is the longest amount of time that a scroll operation can take. Scrolling will be
adjusted so that the scroll will take place within the maximum scroll time. A scroll operation may take less
time than the maximum.

Related

_GUICtrlTreeView_GetScrollTime

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("(Internal) TreeView Set Scroll Time", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Scroll Time: " & _GUICtrlTreeView_GetScrollTime($hTreeView) & " milliseconds")
_GUICtrlTreeView_SetScrollTime($hTreeView, 2)
MsgBox(4160, "Information", "Scroll Time: " & _GUICtrlTreeView_GetScrollTime($hTreeView) & " milliseconds")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetSelected

Function Reference

_GUICtrlTreeView_SetSelected

Sets whether the item appears in the selected state

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetSelected($hWnd, $hItem[, $fFlag = True])

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$fFlag | [optional] True if item is to be selected, otherwise False

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetSelected

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Selected", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $x), $hTreeView)
For $y = 1 To Random(2, 10, 1)
GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $y), $hItem[$x])
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
MsgBox(4160, "Information", StringFormat("Index %d Selected? %s", $iRand, _GUICtrlTreeView_GetSelected($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SetSelected($hTreeView, $hItem[$iRand])
MsgBox(4160, "Information", StringFormat("Index %d Selected? %s", $iRand, _GUICtrlTreeView_GetSelected($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetSelectedImageIndex

Function Reference

_GUICtrlTreeView_SetSelectedImageIndex

Sets the selected image index

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetSelectedImageIndex($hWnd, $hItem, $iIndex)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Image list index

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetSelectedImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hImage, $iImage, $iSImage, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Selected Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 5
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $x, $x)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
$iSImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), $iImage, $iSImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[2])
MsgBox(4160, "Information", StringFormat("Selected Image Index for Item Index 2? %d", _GUICtrlTreeView_GetSelectedImageIndex($hTreeView, $hItem[2])))
_GUICtrlTreeView_SetSelectedImageIndex($hTreeView, $hItem[2], 1)
MsgBox(4160, "Information", StringFormat("Selected Image Index for Item Index 2? %d", _GUICtrlTreeView_GetSelectedImageIndex($hTreeView, $hItem[2])))
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[2])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetState

Function Reference

_GUICtrlTreeView_SetState

Set the state of the specified item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetState($hWnd, $hItem[, $iState = 0[, $iSetState = 0]])

Parameters

$hWnd | Handle to the control
$hItem | item ID/handle to set the icon
$iState | [optional] The new item state, can be one or more of the following: $TVIS_SELECTED - Set item selected $TVIS_CUT - Set item as part of a cut-and-paste operation $TVIS_DROPHILITED - Set item as a drag-and-drop target $TVIS_BOLD - Set item as bold $TVIS_EXPANDED - Expand item $TVIS_EXPANDEDONCE - Set item's list of child items has been expanded at least once $TVIS_EXPANDPARTIAL - Set item as partially expanded
$iSetState | [optional] True if item state is to be set, False remove item state

Return Value

Success: | True
Failure: | False

Remarks

State values can BitOr'ed together as for example BitOr($TVIS_SELECTED, $TVIS_BOLD).

Related

_GUICtrlTreeView_GetState

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

Local $hItem[10], $hImage, $iImage, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set State", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$iImage = Random(0, 5, 1)
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), $iImage, $iImage)
For $y = 1 To Random(2, 10, 1)
$iImage = Random(0, 5, 1)
_GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), $iImage, $iImage)
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SetState($hTreeView, $hItem[$iRand], $TVIS_CUT)
MsgBox(4160, "Information", StringFormat("State for Index %d? %s", $iRand, _GUICtrlTreeView_GetState($hTreeView, $hItem[$iRand])))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetStateImageIndex

Function Reference

_GUICtrlTreeView_SetStateImageIndex

Sets the index into image list for the state image

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetStateImageIndex($hWnd, $hItem, $iIndex)

Parameters

$hWnd | Handle to the control
$hItem | Handle to the item
$iIndex | Image list index

Return Value

Success: | True
Failure: | False

Remarks

This is a 1 based index list

Related

_GUICtrlTreeView_GetStateImageIndex

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set State Image Index", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x))
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y))
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "State Image Index for Item 0: " & _GUICtrlTreeView_GetStateImageIndex($hTreeView, $hItem[0]))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SetStateImageList

Function Reference

_GUICtrlTreeView_SetStateImageList

Sets the state image list for the control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetStateImageList($hWnd, $hImageList)

Parameters

$hWnd | Handle to the control
$hImageList | Handle to the image list. If 0, all images are removed

Return Value

Success: | The handle to the previous image list
Failure: | 0

Remarks

This is a 1 based index list

Related

_GUICtrlTreeView_GetStateImageList

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set State Image List", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "State Image List: " & _GUICtrlTreeView_GetStateImageList($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SetText

Function Reference

_GUICtrlTreeView_SetText

Set the text of an item

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetText($hWnd[, $hItem = 0[, $sText = ""]])

Parameters

$hWnd | Handle to the control
$hItem | [optional] item ID/handle to set the icon
$sText | [optional] The new item text

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_GUICtrlTreeView_GetText

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Text", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

$iRand = Random(0, 9, 1)
_GUICtrlTreeView_SetText($hTreeView, $hItem[$iRand], "This text has been Set")
MsgBox(4160, "Information", StringFormat("Text for Item %d: %s", $iRand, _GUICtrlTreeView_GetText($hTreeView, $hItem[$iRand])))
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[$iRand])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SetTextColor

Function Reference

_GUICtrlTreeView_SetTextColor

Sets the text color

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetTextColor($hWnd, $vRGBColor)

Parameters

$hWnd | Handle to the control
$vRGBColor | New Hex text color

Return Value

Returns the Previous Hex RGB text color

Remarks

None.

Related

_GUICtrlTreeView_GetTextColor

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C

_Main()

Func _Main()

Local $hImage, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES)

GUICreate("TreeView Set Text Color", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
GUISetState()

_GUICtrlTreeView_SetBkColor($hTreeView, $Turquoise)
_GUICtrlTreeView_SetTextColor($hTreeView, $Crimson)
_GUICtrlTreeView_SetLineColor($hTreeView, $COLOR_WHITE)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To _GUIImageList_GetImageCount($hImage) - 1
_GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1), $x, $x)
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Back Color: " & _GUICtrlTreeView_GetBkColor($hTreeView) & @LF & _
"Text Color: " & _GUICtrlTreeView_GetTextColor($hTreeView) & @LF & _
"Line Color: " & _GUICtrlTreeView_GetLineColor($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


Function _GUICtrlTreeView_SetToolTips

Function Reference

_GUICtrlTreeView_SetToolTips

Sets the handle to the child ToolTip control

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetToolTips($hWnd, $hToolTip)

Parameters

$hWnd | Handle to the control
$hToolTip | Handle to a ToolTip control

Return Value

Success: | Handle to the previous ToolTip control
Failure: | 0 if the control is not using ToolTips

Remarks

When created, controls automatically create a ToolTip control. To cause a control not to use ToolTips, create
the control with the DllStructGetData($TVS_NOTOOLTIPS style, "")

Related

_GUICtrlTreeView_GetToolTips

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set ToolTips", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

_GUICtrlTreeView_SelectItem($hTreeView, $hItem[0])
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[0], 2)

MsgBox(4160, "Information", "ToolTips Handle: " & _GUICtrlTreeView_GetToolTips($hTreeView))

_GUICtrlTreeView_SetToolTips($hTreeView, _GUICtrlTreeView_GetToolTips($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_SetUnicodeFormat

Function Reference

_GUICtrlTreeView_SetUnicodeFormat

Sets the Unicode character format flag

#Include <GuiTreeView.au3>
_GUICtrlTreeView_SetUnicodeFormat($hWnd[, $iFormat = True])

Parameters

$hWnd | Handle to the control
$iFormat | [optional] Determines the character set that is used by the control. True - The control will use Unicode characters False - The control will use ANSI characters.

Return Value

Returns the Previous character format flag setting

Remarks

None.

Related

_GUICtrlTreeView_GetUnicodeFormat

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Set Unicode Format", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_CreateNormalImageList()
_GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)

_CreateStateImageList()
_GUICtrlTreeView_SetStateImageList($hTreeView, $hStateImage)

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x), 4, 5)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hItem[$x], 1)
For $y = 1 To 3
$hChildItem[$iYItem] = _GUICtrlTreeView_AddChild($hTreeView, $hItem[$x], StringFormat("[%02d] New Child", $y), 0, 3)
_GUICtrlTreeView_SetStateImageIndex($hTreeView, $hChildItem[$iYItem], 1)
$iYItem += 1
Next
Next
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlTreeView_GetUnicodeFormat($hTreeView))
_GUICtrlTreeView_SetUnicodeFormat($hTreeView)
MsgBox(4160, "Information", "Unicode Format: " & _GUICtrlTreeView_GetUnicodeFormat($hTreeView))

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main

Func _CreateNormalImageList()
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 110)
_GUIImageList_AddIcon($hImage, "shell32.dll", 131)
_GUIImageList_AddIcon($hImage, "shell32.dll", 165)
_GUIImageList_AddIcon($hImage, "shell32.dll", 168)
_GUIImageList_AddIcon($hImage, "shell32.dll", 137)
_GUIImageList_AddIcon($hImage, "shell32.dll", 146)
EndFunc ;==>_CreateNormalImageList

Func _CreateStateImageList()
$hStateImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hStateImage, "shell32.dll", 4)
EndFunc ;==>_CreateStateImageList


Function _GUICtrlTreeView_Sort

Function Reference

_GUICtrlTreeView_Sort

Sorts the items

#Include <GuiTreeView.au3>
_GUICtrlTreeView_Sort($hWnd)

Parameters

$hWnd Handle to the control

Return Value

None.

Remarks

None.

Related

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

$Debug_TV = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $hImage, $hStateImage

_Main()

Func _Main()

Local $hItem[10], $hChildItem[30], $iYItem = 0, $iX = 9, $iY = 29, $iRand, $hTreeView
Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)

GUICreate("TreeView Sort", 400, 300)

$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
_GUICtrlTreeView_SetUnicodeFormat($hTreeView, False)
GUISetState()

_GUICtrlTreeView_BeginUpdate($hTreeView)
For $x = 0 To 9
$iRand = Random(0, 5, 1)
$hItem[$x] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Item", $iX), $hTreeView)
$iX -= 1
For $y = 1 To 3
$iRand = Random(0, 5, 1)
$hChildItem[$iYItem] = GUICtrlCreateTreeViewItem(StringFormat("[%02d] New Child", $iY), $hItem[$x])
$iYItem += 1
$iY -= 1
Next
Next
_GUICtrlTreeView_Expand($hTreeView)
_GUICtrlTreeView_EndUpdate($hTreeView)

MsgBox(4160, "Information", "Sort")
_GUICtrlTreeView_Sort($hTreeView)
_GUICtrlTreeView_SelectItem($hTreeView, $hItem[9])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main


User Defined Functions

IE user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <IE.au3>.

User Defined Function | Description
_IE_Example | Display a new browser window pre-loaded with documents to be used in IE.au3 examples or your own testing
_IE_Introduction | Display introductory information about IE.au3 in a new browser window
_IE_VersionInfo | Returns an array of information about the IE.au3 version
_IEAction | Perform any of a set of simple actions on the Browser.
_IEAttach | Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode).
_IEBodyReadHTML | Returns the HTML inside the <body> tag of the document.
_IEBodyReadText | Returns the Text inside the <body> tag of the document.
_IEBodyWriteHTML | Replaces the HTML inside the <body> tag of the document.
_IECreate | Create an Internet Explorer Browser Window.
_IECreateEmbedded | Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().
_IEDocGetObj | Given any DOM object, returns a reference to the associated document object.
_IEDocInsertHTML | Inserts HTML Text in or around an element.
_IEDocInsertText | Inserts Text in or around an element.
_IEDocReadHTML | Returns the full HTML source of a document.
_IEDocWriteHTML | Replaces the HTML for the entire document.
_IEErrorHandlerDeRegister | Disable a registered user COM error handler
_IEErrorHandlerRegister | Register and enable a user COM error handler
_IEErrorNotify | Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)
_IEFormElementCheckBoxSelect | Set the value of a specified form element.
_IEFormElementGetCollection | Returns a collection object variable representing all Form Elements within a given Form.
_IEFormElementGetObjByName | Returns an object reference to a Form Element by name.
_IEFormElementGetValue | Returns the value of a given Form Element.
_IEFormElementOptionSelect | Set the value of a specified form element.
_IEFormElementRadioSelect | Set the value of a specified form element.
_IEFormElementSetValue | Set the value of a specified Form Element.
_IEFormGetCollection | Returns a collection object variable representing the Forms in the document or a single form by index.
_IEFormGetObjByName | Returns an object reference to a Form by name.
_IEFormImageClick | Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.
_IEFormReset | Reset a specified Form setting the values back to their loaded defaults.
_IEFormSubmit | Submit a specified Form.
_IEFrameGetCollection | Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page or a single Frame or iFrame by index.
_IEFrameGetObjByName | Returns an object reference to a Frame or iFrame by name.
_IEGetObjById | Returns an object variable by id or name.
_IEGetObjByName | Returns an object variable by name or id.
_IEHeadInsertEventScript | Inserts a Javascript into the Head of the document.
_IEImgClick | Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.
_IEImgGetCollection | Returns a collection object variable representing the IMG tags in the document or a single image by index.
_IEIsFrameSet | Checks to see if the specified Window contains a FrameSet.
_IELinkClickByIndex | Simulate a mouse click on a link by 0-based index (in source order).
_IELinkClickByText | Simulate a mouse click on a link with text sub-string matching the string provided.
_IELinkGetCollection | Returns a collection object containing all links in the document or a single link by index.
_IELoadWait | Wait for a browser page load to complete before returning.
_IELoadWaitTimeout | Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.
_IENavigate | Directs an existing browser window to navigate to the specified URL.
_IEPropertyGet | Returns a select property of the Browser or DOM element.
_IEPropertySet | Set a select property of the Browser or DOM element.
_IEQuit | Close the browser and remove the object reference to it.
_IETableGetCollection | Returns a collection object variable representing all the tables in a document or a single table by index.
_IETableWriteToArray | Reads the contents of a Table into an array.
_IETagNameAllGetCollection | Returns a collection object all elements in the document or document hierarchy in source order or a single element by index.
_IETagNameGetCollection | Returns a collection object of all elements in the object with the specified TagName or a single element by index.


Function _IE_Example

Function Reference

_IE_Example

Display a new browser window pre-loaded with documents to be used in IE.au3 examples or your own testing

#include <IE.au3>
_IE_Example ( [$s_module = "basic"] )

Parameters

$s_module [optional] specifies which module to run
basic = (Default) simple HTML page with text, links and images
form = simple HTML page with multiple form elements
frameset = simple HTML page with frames
iframe = simple HTML page with iframes
table = simple HTML page with tables

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

This function displays browser windows pre-populated with HTML and HTML elements that are used throughout the helpfile and IE.au3 examples. You are also encouraged to use them to experiment with the IE.au3 function set.

Related

_IE_Introduction

Example

; *******************************************************
; Example 1 - Create browser windows with each of the example pages displayed.
; The object variable returned can be used just as the object
; variables returned by _IECreate or _IEAttach
; *******************************************************
;
#include <IE.au3>
$oIE_basic = _IE_Example ("basic")
$oIE_form = _IE_Example ("form")
$oIE_table = _IE_Example ("table")
$oIE_frameset = _IE_Example ("frameset")
$oIE_iframe = _IE_Example ("iframe")


Function _IE_Introduction

Function Reference

_IE_Introduction

Display introductory information about IE.au3 in a new browser window

#include <IE.au3>
_IE_Introduction ( [$s_module = "basic"] )

Parameters

$s_module [optional] specifies which module to run
basic = (Default) basic introduction

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

The AutoIt Helpfile does not currently allow UDFs to have general documentation that covers a series of functions, but rather UDF documentation is focused on individual functions. This function is intended to provide that general documentation. It will grow over time.

Related

_IE_Example

Example

; *******************************************************
; Example 1 - Open a browser with the basic IE.au3 introductory text displayed
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Introduction ("basic")


Function _IE_VersionInfo

Function Reference

_IE_VersionInfo

Returns an array of information about the IE.au3 version

#include <IE.au3>
_IE_VersionInfo ( )

Parameters

None.

Return Value

Success: | Returns an array ($IEAU3VersionInfo)
 | $IEAU3VersionInfo[0] = Release Type (T=Test or V=Production)
 | $IEAU3VersionInfo[1] = Major Version
 | $IEAU3VersionInfo[2] = Minor Version
 | $IEAU3VersionInfo[3] = Sub Version
 | $IEAU3VersionInfo[4] = Release Date (YYYYMMDD)
 | $IEAU3VersionInfo[5] = Display Version (e.g. V2.1-0)
Failure: | None

Remarks

The array contents make it easy to determine of the UDF version is higher or lower than a required version.

Related

None.

Example

; *******************************************************
; Example 1 - Retrieve and display IE.au3 version information
; *******************************************************
;
#include <IE.au3>
$aVersion = _IE_VersionInfo ()
MsgBox(0, "IE.au3 Version", $aVersion[5] & " released " & $aVersion[4])


Function _IEAction

Function Reference

_IEAction

Perform any of a set of simple actions on the Browser.

#include <IE.au3>
_IEAction ( ByRef $o_object, $s_action )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$s_action | Action selection (see remarks)

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Action | Description
"back" | Navigates backward one item in the history list.
"blur" | Causes the element to lose focus, but does not set focus on the next element in the tab order.
"click" | Simulates a click on the specified element.
"copy" | Copies the current selection to the clipboard.
"cut" | Copies the current selection to the clipboard and then deletes it.
"delete" | Deletes the current selection.
"disable" | Disables the specified element.
"enable" | Enables the specified element.
"focus" | Causes the element to receive focus.
"forward" | Navigates forward one item in the history list.
"home" | Navigates to the current home or start page.
"invisible" | Sets an object state to hidden.
"paste" | Overwrites the contents of the clipboard on the current selection.
"print" | Opens the print dialog box so the user can print the current page.
"printdefault" | Print directly to default printer (no dialog)
"quit" | Closes the object.
"refresh" | Refreshes the current document.
"saveas" | Opens a dialog box to save the current Web page to a file.
"search" | Navigates to the current search page.
"selectall" | Selects the entire document.
"stop" | Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations.
"unselect" | Clears the current selection.
"visible" | Sets an object state to visible.

Related

_IEPropertySet, _IELoadWait

Example

; *******************************************************
; Example 1 - Open a browser with the "form" example, get a reference
; to the submit button by name and "click" it. This technique
; of submitting forms is useful because many forms rely on JavaScript
; code and "onClick" events on their submit button making _IEFormSubmit()
; not perform as expected
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

; *******************************************************
; Example 2 - Same as Example 1, except instead of using click, give the element focus
; and then use ControlSend to send Enter. Use this technique when the
; browser-side scripting associated with a click action prevents control
; from being automatically returned to your code.
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "submitExample")
$hwnd = _IEPropertyGet($oIE, "hwnd")
_IEAction ($oSubmit, "focus")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

; Wait for Alert window, then click on OK
WinWait("Windows Internet Explorer", "ExampleFormSubmitted")
ControlClick("Windows Internet Explorer", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]")
_IELoadWait ($oIE)


Function _IEAttach

Function Reference

_IEAttach

Attach to the specified instance of Internet Explorer where the search string sub-string matches (based on the selected mode).

#include <IE.au3>
_IEAttach ( $s_string [, $s_mode = "Title" [, $i_instance = 1]] )

Parameters

$s_string | String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window)
$s_mode | [optional] specifies search mode Title = (Default) sub-string of main document title WindowTitle = sub-string of full window title (instead of document title) URL = sub-string or url of the current page Text = sub-string in text from the body of the current page HTML = sub-string in html from the body of the current page HWND = hwnd of the browser window Embedded = title sub-string or hwnd of of the window embedding the control DialogBox = title sub-string or hwnd of modal/modeless dialogbox Instance = $s_string is ignored, one browser reference returned (by matching instance number) from all available browser instances
$i_instance | [optional] 1-based index into group of browsers or embedded browsers matching $s_string and $s_mode. See Remarks.

Return Value

Success: | Returns an object variable pointing to the InternetExplorer Object for all but Embedded and DislogBox modes which return a Window Object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

_IEAttach provides the "dialogbox" parameter to attach to modal and modeless dialogs created by the browser. It is important to note that not all dialogs created through browser interaction can be attached to and controlled in this way. Many of these dialogs are actually standard windows and can be controlled through the traditional AutoIt window functions. A reliable way to tell the difference between these types of windows is to use the "AutoIt Window Info" tool to examine it -- if the window contains a control called "Internet Explorer_Server" then you can attach to it with this function, if it does not it is a standard window and traditional AutoIt windows functions must be used to control it.

HyperTextApplication (.hta) windows may be attached to using the "embedded" option.

The advanced Window Title selection syntax available to the standard Win* functions may be used in place of a title sub-string for the modes "dialogbox" and "embedded".

Use of "$i_instance" with the "embedded" mode: used to return a reference to a specific instance of a WebBrowser and is particularly useful when more than one exists in a particular window. If you pass a window title in $s_string using embedded mode, only the first window matching that title will be used. If the WebBrowser control you desire is in another window you must pass the HWnd of that window rather than the title, or use the advanced Window Title selection syntax available to the standard Win* functions.

Use of "$i_instance" with all modes other than "embedded": used to return a browser reference from a groups of all windows that match the criteria from $s_string and $s_mode. Instance order for DialogBox mode determined by the order returned by WinList() matching the title. For all other modes the Instance order is determined by the Shell.Windows collection.

"$i_instance" values > 1 are set to 1 and a warning message is displayed when used with "hwnd" mode or with "DialogBox" mode when an HWnd is passed in $s_string.

DialogBox and Embedded modes can be used to attach to standard browser windows, but the object returned is that if the top level Window in the browser and not the InternetExplorer object. Window objects do not offer access to all of the attributes of the InternetExplorer object (e.g. status text, address bar etc.). As well, if you attempt to use a function like _IENavigate on such an object you may receive COM errors due to the way that IE7 has implemented Tabs. It may be useful to find browser instances in this way, but it is recommended that you immediately use _IEAttach using one of the other modes and using information that you may have obtained from the Window object in order to get a reference to the associated InternetExplorer object.

Related

_IECreate, _IECreateEmbedded, _IEQuit

Example

; *******************************************************
; Example 1 - Attach to a browser with "AutoIt" in its title, display the URL
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("AutoIt")
MsgBox(0, "The URL", _IEPropertyGet ($oIE, "locationurl"))

; *******************************************************
; Example 2 - Attach to a browser with "The quick brown fox"
; in the text of it's top-level document
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("The quick brown fox", "text")

; *******************************************************
; Example 3 - Attach to a browser control embedded in another window
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("A Window Title", "embedded")

; *******************************************************
; Example 4 - Attach to the 3rd browser control embedded in another window
; Use the advanced window title syntax to use the 2nd window
; with the string 'ICQ' in the title
; *******************************************************
;
#include <IE.au3>
$oIE = _IEAttach ("[REGEXPTITLE:ICQ; INSTANCE:2]", "embedded", 3)

; *******************************************************
; Example 5 - Create an array of object references to all current browser instances
; The first array element will contain the number of instances found
; *******************************************************
;
#include <IE.au3>

Dim $aIE[1]
$aIE[0] = 0

$i = 1
While 1
$oIE = _IEAttach ("", "instance", $i)
If @error = $_IEStatus_NoMatch Then ExitLoop
ReDim $aIE[$i + 1]
$aIE[$i] = $oIE
$aIE[0] = $i
$i += 1
WEnd

MsgBox(0, "Browsers Found", "Number of browser instances in the array: " & $aIE[0])


Function _IEBodyReadHTML

Function Reference

_IEBodyReadHTML

Returns the HTML inside the <body> tag of the document.

#include <IE.au3>
_IEBodyReadHTML ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns HTML included in the <body> of the document
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

This function uses the .innerHTML property of the document Body. .innerHTML is available for nearly all DOM elements using _IEPropertyGet.

Related

_IEBodyReadText, _IEBodyWriteHTML, _IEPropertyGet, _IEDocInsertHTML, _IEDocInsertText, _IEDocReadHTML

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, ready the body HTML,
; append new HTML to the original and write it back to the browser
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEBodyReadHTML ($oIE)
$sHTML = $sHTML & "<p><font color=red size=+5>Big RED text!</font>"
_IEBodyWriteHTML ($oIE, $sHTML)


Function _IEBodyReadText

Function Reference

_IEBodyReadText

Returns the Text inside the <body> tag of the document.

#include <IE.au3>
_IEBodyReadText ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns the Text included in the <body> of the document
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

This function uses the .innerText property of the document Body. .innerText is available for nearly all DOM elements and is a fast convenient method of parsing out just the text in a document using _IEPropertyGet.

Related

_IEBodyReadHTML, _IEBodyWriteHTML, _IEPropertyGet

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, read the body Text
; (the content with all HTML tags removed) and display it in a MsgBox
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Body Text", $sText)


Function _IEBodyWriteHTML

Function Reference

_IEBodyWriteHTML

Replaces the HTML inside the <body> tag of the document.

#include <IE.au3>
_IEBodyWriteHTML ( ByRef $o_object, $s_html )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_html | The HTML string to write to the document

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

You may use _IEBodyReadHTML to read the current HTML contents of the document body, manipulat that string and then write it back with _IEBodyWriteHTML. You may also use _IEDocInsertHTML, _IEDocInsertText and the innerHTML, innerText, outerHTML and outerText features of _IEPropertyGet and _IEPropertySet to control specific elements without rewriting large blocks of text.

Related

_IEBodyReadHTML, _IEBodyReadText, _IEDocInsertHTML, _IEDocInsertText, _IEPropertyGet, _IEPropertySet, _IELoadWait

Example

; *******************************************************
; Example 1 - Open a browser with the iFrame example, get a reference
; to the iFrame with a name of "iFrameTwo" and replace its body HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("iframe")
$oFrame = _IEFrameGetObjByName ($oIE, "iFrameTwo")
_IEBodyWriteHTML ($oFrame, "Hello <b>iFrame!</b>")


Function _IECreate

Function Reference

_IECreate

Create an Internet Explorer Browser Window.

#include <IE.au3>
_IECreate ( [$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = 1]]]]] )

Parameters

$s_Url | [optional] specifies the Url to navigate to upon creation
$f_tryAttach | [optional] specifies whether to try to attach to an existing window 0 = (Default) do not try to attach 1 = Try to attach to an existing window
$f_visible | [optional] specifies whether the browser window will be visible 0 = Browser Window is hidden 1 = (Default) Browser Window is visible
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning
$f_takeFocus | [optional] specifies whether to bring the attached window to focus 0 = Do not bring window into focus 1 = (Default) bring window into focus

Return Value

Success: | Returns an object variable pointing to an InternetExplorer.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Set to true (1) or false (0) depending on the success of $f_tryAttach

Remarks

When using tryAttach, a No Match error will be displayed to the console from _IEAttach. This can be controlled with _IEErrorNotify.

When opening a local HyperTextApplication (.hta) file, Internet Explorer will open a new browser process for it that will not be accessible through the object variable returned by _IECreate. To control this new browser you must use _IEAttach with the "embedded" option.

New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it. There are several workarounds: 1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary), 2) use _IEAttach to connect to the new browser window 3) add the target website to the Trusted Sites security zone in IE, 4) turn off "Protected Mode" in IE, or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites.

Related

_IEAttach, _IECreateEmbedded, _IEQuit, _IENavigate, _IELoadWait

Example

; *******************************************************
; Example 1 - Create a browser window and navigate to a website
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")

; *******************************************************
; Example 2 - Create new browser windows pointing to each of 3 different URLs
; if one does not already exist ($f_tryAttach = 1)
; do not wait for the page loads to complete ($f_wait = 0)
; *******************************************************
;
#include <IE.au3>
_IECreate ("www.autoitscript.com", 1, 1, 0)
_IECreate ("my.yahoo.com", 1, 1, 0)
_IECreate ("www.google.com", 1, 1, 0)

; *******************************************************
; Example 3 - Attempt to attach to an existing browser displaying a particular website URL
; Create a new browser and navigate to that site if one does not already exist
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com", 1)
; Check @extended return value to see if attach was successful
If @extended Then
MsgBox(0, "", "Attached to Existing Browser")
Else
MsgBox(0, "", "Created New Browser")
EndIf

; *******************************************************
; Example 4 - Create an empty browser window and populate it with custom HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = "<h1>Hello World!</h1>"
_IEBodyWriteHTML ($oIE, $sHTML)

; *******************************************************
; Example 5 - Create an invisible browser window, navigate to a website,
; retrieve some information and Quit
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit ($oIE)

; *******************************************************
; Example 6 - Create a browser window attached to a new instance of iexplore.exe
; This is often necessary in order to get a new session cookie context
; (session cookies are shared among all browser instances sharing the same iexplore.exe)
; *******************************************************
;
#include <IE.au3>
ShellExecute ("iexplore.exe", "about:blank")
WinWait ("Blank Page")
$oIE = _IEAttach ("about:blank", "url")
_IELoadWait ($oIE)
_IENavigate ($oIE, "www.autoitscript.com")


Function _IECreateEmbedded

Function Reference

_IECreateEmbedded

Create a Webbrowser object suitable for embedding in an AutoIt GUI with GuiCtrlCreateObj().

#include <IE.au3>
_IECreateEmbedded ( )

Parameters

None.

Return Value

Success: | Returns a Webbrowser object reference
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error

Remarks

No actions can be performed on this object until it has been embedded into a parent application (e.g. you cannot perform an _IENavigate). Because of this restriction, the browser is not automatically navigated to 'about:blank' as is a browser created with _IECreate. You must therefore use _IENavigate to navigate this browser to 'about:blank' after it has been embedded into the parent application and before you attempt any operations that rely on having a document loaded (e.g. _IEBodyWriteHTML).

There are several properties related to an InternetExplorer object (e.g. returned by _IECreate) that do not apply to this object. These include status text, addressbar and others that may exist for a browser, but do not exist for an embedded control.

You may have object visibility issues unless you use the Windows style $WS_CLIPCHILDREN in GUICreate().

_IEQuit cannot be used with this object. The object will be destroyed when its parent GUI is destroyed.

Related

GUICreate, GUICtrlCreateObj, _IEAttach, _IECreate, _IENavigate

Example

; *******************************************************
; Example 1 - Trap COM errors so that 'Back' and 'Forward'
; outside of history bounds does not abort script
; (expect COM errors to be sent to the console)
; *******************************************************
;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

_IEErrorHandlerRegister ()

$oIE = _IECreateEmbedded ()
GUICreate("Embedded Web control Test", 640, 580, _
(@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
$GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

GUISetState() ;Show GUI

_IENavigate ($oIE, "http://www.autoitscript.com")

; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
_IENavigate ($oIE, "http://www.autoitscript.com")
Case $msg = $GUI_Button_Back
_IEAction ($oIE, "back")
Case $msg = $GUI_Button_Forward
_IEAction ($oIE, "forward")
Case $msg = $GUI_Button_Stop
_IEAction ($oIE, "stop")
EndSelect
WEnd

GUIDelete()

Exit


Function _IEDocGetObj

Function Reference

_IEDocGetObj

Given any DOM object, returns a reference to the associated document object.

#include <IE.au3>
_IEDocGetObj ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window, Frame or any DOM object

Return Value

Success: | Returns an object variable pointing to the Document object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

Given any DOM object (e.g. Browser, Window, Frame, iFrame, Document or Document Element) this will return a reference to the associated document object. It is particularly useful when writing generalized functions when you cannot control the type of object that will be passed in.

Related

None.

Example

; *******************************************************
; Example 1 - Open a browser to the AutoIt Homepage, get a reference
; to the document object and display a document attribute
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oDoc = _IEDocGetObj ($oIE)
MsgBox(0, "Document Created Date", $oDoc.fileCreatedDate)


Function _IEDocInsertHTML

Function Reference

_IEDocInsertHTML

Inserts HTML Text in or around an element.

#include <IE.au3>
_IEDocInsertHTML ( ByRef $o_object, $s_string [, $s_where = "beforeend"] )

Parameters

$o_object | Object variable pointing to a document element.
$s_string | The string containing the HTML text to insert.
$s_where | [optional] specifies the string insertion point beforebegin = Inserts string immediately before the object. afterbegin = Inserts string after the start of the object but before all other content in the object. beforeend = (Default) Inserts string immediately before the end of the object but after all other content in the object. afterend = Inserts string immediately after the end of the object.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

The innerHTML, outerHTML, innerText and outerText features of _IEPropertySet can be used to dynamically manipulate inserted content.

Related

_IEDocInsertText, _IEPropertyGet, _IEPropertySet, _IEBodyReadHTML, _IEBodyWriteHTML, _IEDocReadHTML, _IEHeadInsertEventScript

Example

; *******************************************************
; Example 1 - Insert HTML at the top and bottom of a document
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")
$oBody = _IETagNameGetCollection($oIE, "body", 0)
_IEDocInsertHTML($oBody, "<h2>This HTML is inserted After Begin</h2>", "afterbegin")
_IEDocInsertHTML($oBody, "<h2>This HTML is inserted Before End</h2>", "beforeend")

; *******************************************************
; Example 2 - Open a browser with the basic example page, insert HTML
; in and around the DIV tag named "IEAu3Data" and display Body HTML
; *******************************************************
;
$oIE = _IE_Example ("basic")
$oDiv = _IEGetObjByName($oIE, "IEAu3Data")

_IEDocInsertHTML($oDiv, "<b>(HTML beforebegin)</b>", "beforebegin")
_IEDocInsertHTML($oDiv, "<i>(HTML afterbegin)</i>", "afterbegin")
_IEDocInsertHTML($oDiv, "<b>(HTML beforeend)</b>", "beforeend")
_IEDocInsertHTML($oDiv, "<i>(HTML afterend)</i>", "afterend")

ConsoleWrite(_IEBodyReadHTML($oIE) & @CRLF)

; *******************************************************
; Example 3 - Advanced example
; Insert a clock and a referrer string at the top of every page, even when you
; browse to a new location. Uses _IEDocInsertText, _IEDocInsertHTML and
; _IEPropertySet features "innerhtml" and "referrer"
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")

AdlibRegister("UpdateClock", 1000) ; Update clock once per second

; idle as long as the browser window exists
While WinExists(_IEPropertyGet($oIE, "hwnd"))
Sleep(10000)
WEnd

Exit

Func UpdateClock()
Local $curTime = "<b>Current Time is: </b>" & @HOUR & ":" & @MIN & ":" & @SEC
; _IEGetObjByName is expected to return a NoMatch error after navigation
; (before DIV is inserted), so temporarily turn off notification
_IEErrorNotify(False)
Local $oAutoItClock = _IEGetObjByName($oIE, "AutoItClock")
If Not IsObj($oAutoItClock) Then ; Insert DIV element if it wasn't found
;
; Get reference to BODY, insert DIV, get reference to DIV, update time
$oBody = _IETagNameGetCollection($oIE, "body", 0)
_IEDocInsertHTML($oBody, "<div id='AutoItClock'></div>", "afterbegin")
$oAutoItClock = _IEGetObjByName($oIE, "AutoItClock")
_IEPropertySet($oAutoItClock, "innerhtml", $curTime)
;
; Check referrer string, if not blank insert after clock
_IELoadWait($oIE)
$sReferrer = _IEPropertyGet($oIE, "referrer")
If $sReferrer Then _IEDocInsertText($oAutoItClock, _
" Referred by: " & $sReferrer, "afterend")
Else
_IEPropertySet($oAutoItClock, "innerhtml", $curTime) ; update time
EndIf
_IEErrorNotify(True)
EndFunc


Function _IEDocInsertText

Function Reference

_IEDocInsertText

Inserts Text in or around an element.

#include <IE.au3>
_IEDocInsertText ( ByRef $o_object, $s_string [, $s_where = "beforeend"] )

Parameters

$o_object | Object variable pointing to a document element.
$s_string | The string containing the text to insert.
$s_where | [optional] specifies the string insertion point beforebegin = Inserts string immediately before the object. afterbegin = Inserts string after the start of the object but before all other content in the object. beforeend = (Default) Inserts string immediately before the end of the object but after all other content in the object. afterend = Inserts string immediately after the end of the object.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

In the text to be inserted includes HTML tags, they are first converted so that they display as text. The innerHTML, outerHTML, innerText and outerText features of _IEPropertySet can be used to dynamically manipulate inserted content.

Related

_IEDocInsertHTML, _IEPropertyGet, _IEPropertySet, _IEBodyReadHTML, _IEBodyWriteHTML, _IEDocReadHTML, _IEHeadInsertEventScript

Example

; *******************************************************
; Example 1 - Open a browser with the basic example page, insert text
; in and around the first Paragraph tag and display Body HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oP = _IETagNameGetCollection($oIE, "p", 0)

_IEDocInsertText($oP, "(Text beforebegin)", "beforebegin")
_IEDocInsertText($oP, "(Text afterbegin)", "afterbegin")
_IEDocInsertText($oP, "(Text beforeend)", "beforeend")
_IEDocInsertText($oP, "(Text afterend)", "afterend")

ConsoleWrite(_IEBodyReadHTML($oIE) & @CRLF)

; *******************************************************
; Example 2 - Insert HTML at the top and bottom of a document
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oBody = _IETagNameGetCollection($oIE, "body", 0)
_IEDocInsertText($oBody, "This Text is inserted After Begin", "afterbegin")
_IEDocInsertText($oBody, "Notice that <b>Tags</b> are <encoded> before display", "beforeend")

; *******************************************************
; Example 3 - Advanced example
; Insert a clock and a referrer string at the top of every page, even when you
; browse to a new location. Uses _IEDocInsertText, _IEDocInsertHTML and
; _IEPropertySet features "innerhtml" and "referrer"
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")

AdlibRegister("UpdateClock", 1000) ; Update clock once per second

; idle as long as the browser window exists
While WinExists(_IEPropertyGet($oIE, "hwnd"))
Sleep(10000)
WEnd

Exit

Func UpdateClock()
Local $curTime = "<b>Current Time is: </b>" & @HOUR & ":" & @MIN & ":" & @SEC
; _IEGetObjByName is expected to return a NoMatch error after navigation
; (before DIV is inserted), so temporarily turn off notification
_IEErrorNotify(False)
Local $oAutoItClock = _IEGetObjByName($oIE, "AutoItClock")
If Not IsObj($oAutoItClock) Then ; Insert DIV element if it wasn't found
;
; Get reference to BODY, insert DIV, get reference to DIV, update time
$oBody = _IETagNameGetCollection($oIE, "body", 0)
_IEDocInsertHTML($oBody, "<div id='AutoItClock'></div>", "afterbegin")
$oAutoItClock = _IEGetObjByName($oIE, "AutoItClock")
_IEPropertySet($oAutoItClock, "innerhtml", $curTime)
;
; Check referrer string, if not blank insert after clock
_IELoadWait($oIE)
$sReferrer = _IEPropertyGet($oIE, "referrer")
If $sReferrer Then _IEDocInsertText($oAutoItClock, _
" Referred by: " & $sReferrer, "afterend")
Else
_IEPropertySet($oAutoItClock, "innerhtml", $curTime) ; update time
EndIf
_IEErrorNotify(True)
EndFunc


Function _IEDocReadHTML

Function Reference

_IEDocReadHTML

Returns the full HTML source of a document.

#include <IE.au3>
_IEDocReadHTML ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns the HTML included in the <HTML> of the document, including the <HTML> and </HTML> tags
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

This function returns the document source after any client-side modifications (e.g. by AutoIt or by client-side JavaScript). It may therefore be different than what is shown by the browser View Source or by _INetGetSource.

Related

_IEDocWriteHTML, _IEBodyReadHTML, _INetGetSource, _IEDocInsertHTML, _IEDocInsertText

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, read the document HTML
; (all HTML including the <HEAD> and script) and display it in a MsgBox
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$sHTML = _IEDocReadHTML ($oIE)
MsgBox(0, "Document Source", $sHTML)


Function _IEDocWriteHTML

Function Reference

_IEDocWriteHTML

Replaces the HTML for the entire document.

#include <IE.au3>
_IEDocWriteHTML ( ByRef $o_object, $s_html )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_html | The HTML string to write to the document

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

This function completely replaces the content of the document in a browser or a frame. It can be used to create a new page with custom HTML and JavaScript.

It is sometimes necessary to refresh the page after writing with _IEAction($oIE, "refresh") (e,g, after creating a FRAMESET).

Related

_IEDocReadHTML, _IELoadWait

Example

; *******************************************************
; Example 1 - Create an empty browser, write customer HTML to it - in this case a
; FRAMESET - and then update the contents of each of the frames
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = ""
$sHTML &= "<HTML>" & @CR
$sHTML &= "<HEAD>" & @CR
$sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CR
$sHTML &= "</HEAD>" & @CR
$sHTML &= "<FRAMESET rows='25,200'>" & @CR
$sHTML &= " <FRAME NAME=Top SRC=about:blank>" & @CR
$sHTML &= " <FRAMESET cols='100,500'>" & @CR
$sHTML &= " <FRAME NAME=Menu SRC=about:blank>" & @CR
$sHTML &= " <FRAME NAME=Main SRC=about:blank>" & @CR
$sHTML &= " </FRAMESET>" & @CR
$sHTML &= "</FRAMESET>" & @CR
$sHTML &= "</HTML>"
_IEDocWriteHTML ($oIE, $sHTML)
_IEAction ($oIE, "refresh")
Local $oFrameTop = _IEFrameGetObjByName ($oIE, "Top")
Local $oFrameMenu = _IEFrameGetObjByName ($oIE, "Menu")
Local $oFrameMain = _IEFrameGetObjByName ($oIE, "Main")
_IEBodyWriteHTML ($oFrameTop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")')
_IEBodyWriteHTML ($oFrameMenu, '$oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")')
_IEBodyWriteHTML ($oFrameMain, '$oFrameMain = _IEFrameGetObjByName($oIE, "Main")')


Function _IEErrorHandlerDeRegister

Function Reference

_IEErrorHandlerDeRegister

Disable a registered user COM error handler

#include <IE.au3>
_IEErrorHandlerDeRegister ( )

Parameters

None.

Return Value

Success: | Returns 1
Failure: | None

Remarks

See remarks for _IEErrorHandlerRegister.

Related

_IEErrorHandlerRegister

Example

; *******************************************************
; Example 1 - Register and later deregister a custom error handler
; *******************************************************
;
#include <IE.au3>
; Register a customer error handler
_IEErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_IEErrorHandlerDeregister ()
; Do something else

Exit

Func MyErrFunc()
$HexNumber = Hex($oIEErrorHandler.number, 8)
MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _
"Number is: " & $HexNumber & @CRLF & _
"Windescription is: " & $oIEErrorHandler.windescription)
SetError(1) ; something to check for when this function returns
EndFunc ;==>MyErrFunc


Function _IEErrorHandlerRegister

Function Reference

_IEErrorHandlerRegister

Register and enable a user COM error handler

#include <IE.au3>
_IEErrorHandlerRegister ( [$s_functionName = "__IEInternalErrorHandler"] )

Parameters

$s_functionName [optional] String variable with the name of a user-defined COM error handler, defaults to the internal COM error handler in this UDF

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
@Extended: | Contains invalid parameter number

Remarks

Important: When using your own error handler, the Error Object variable used MUST be named $oIEErrorHandler (see example).

AutoIt has the ability to trap COM errors and pass them through a custom error handler using the ObjEvent function. There is a problem with this for UDF writers however because only a single COM error handler can be in use at a time. For the UDF to use a COM error handler it must first deregister the user error handler, install its own and then put the user handler back in place. Unfortunately, by default, the UDF has no way to access the handle of the user error handler.

Using this routine you can register your COM error handler in a way that IE.au3 can gracefully remove and reinstate it when it needs to. You may either point to your own custom error handler or you may use the one developed for IE.au3 (the default). Using the default IE.au3 error handler you will also get some nice diagnostic information written to the console and some global variables that contain information about the trapped errors.

If you instantiate your own COM error handler without using this routine IE.au3 will not be able to trap some COM errors and you may experience some abrupt script terminations as a result.

If you use the default error handler (__IEInternalErrorHandler), the following global variables are set for you to reference: $IEComErrorNumber, $IEComErrorNumberHex, $IEComErrorDescription, $IEComErrorScriptline, $IEComErrorWinDescription, $IEComErrorSource, $IEComErrorHelpFile, $IEComErrorHelpContext, $IEComErrorLastDllError, $IEComErrorComObj and $IEComErrorOutput

You may control the display of COM error messages to the console with _IEErrorNotify.

Related

_IEErrorHandlerDeRegister, _IEErrorNotify

Example

; *******************************************************
; Example 1 - Register and later deregister a custom and the default IE.au3 error handler
; *******************************************************
;
#include <IE.au3>
; Register a customer error handler
_IEErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_IEErrorHandlerDeregister ()
; Do something else
; Register the default IE.au3 COM Error Handler
_IEErrorHandlerRegister ()
; Do more work

Exit

Func MyErrFunc()
; Important: the error object variable MUST be named $oIEErrorHandler
$ErrorScriptline = $oIEErrorHandler.scriptline
$ErrorNumber = $oIEErrorHandler.number
$ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
$ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
$ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
$ErrorSource = $oIEErrorHandler.Source
$ErrorHelpFile = $oIEErrorHandler.HelpFile
$ErrorHelpContext = $oIEErrorHandler.HelpContext
$ErrorLastDllError = $oIEErrorHandler.LastDllError
$ErrorOutput = ""
$ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
$ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
$ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
$ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
$ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
$ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
$ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
$ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
$ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
$ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
MsgBox(0,"COM Error", $ErrorOutput)
SetError(1)
Return
EndFunc ;==>MyErrFunc


Function _IEErrorNotify

Function Reference

_IEErrorNotify

Specifies whether IE.au3 automatically notifies of Warnings and Errors (to the console)

#include <IE.au3>
_IEErrorNotify ( [$f_notify = -1] )

Parameters

$f_notify [optional] specifies whether notification should be on or off
-1 = (Default) return current setting
True = Turn On
False = Turn Off

Return Value

Success: | If $f_notify = -1, returns the current notification setting, else returns 1
Failure: | Returns 0

Remarks

IE.au3 writes diagnostic information, warnings and errors to the console by default. This information can readily be seen when using the SciTe editor to run your scripts.

This function allows you to turn this functionality on or off.

Related

_IEErrorHandlerRegister

Example

; *******************************************************
; Example 1 - Check the current status of _IEErrorNotify, turn it off if on, on if off
; *******************************************************
;
#include <IE.au3>
If _IEErrorNotify () Then
MsgBox(0, "_IEErrorNotify Status", "Notification is ON, turning it OFF")
_IEErrorNotify (False)
Else
MsgBox(0, "_IEErrorNotify Status", "Notification is OFF, turning it ON")
_IEErrorNotify (True)
EndIf


Function _IEFormElementCheckBoxSelect

Function Reference

_IEFormElementCheckBoxSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementCheckBoxSelect ( ByRef $o_object, $s_string [, $s_name = "" [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_string | Value used to match element - treatment based on $s_mode
$s_name | [optional] Name or Id of checkbox(es)
$f_select | [optional] specifies whether element should be checked or unchecked -1 = Return checked state 0 = Uncheck the element 1 = (Default) Check the element
$s_mode | [optional] specify search mode byValue = (Default) value of the checkbox you wish to select byIndex = 0-based index of checkbox you wish to select
$f_fireEvent | [optional] specifies whether to fire OnChange and OnClick events after changing value 0 = do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick events after setting value

Return Value

Success: | If $f_select = -1, returns the current checked state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_Name is optional for this function. If it is omitted, the function will operate on a collection of all <input type=checkbox> elements in the form. If specified, the function will operate on a collection of <input type=checkbox> elements with that name.

Related

_IEFormElementOptionSelect, _IEFormElementRadioSelect, _IEFormElementGetValue, _IEFormElementSetValue

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byValue. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 1, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBasketball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameFootball", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameTennis", "", 0, "byValue")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, "gameBaseball", "", 0, "byValue")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex. Since $s_Name is not specified, operate
; on the collection of all <input type=checkbox> elements in the form
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, 3, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 2, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 3, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 2, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "", 0, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 3 - Open a browser with the form example, get reference to form, select and
; deselect the checkboxes byIndex in the group that shares the name checkboxG2Example
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 1, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 0, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
_IEFormElementCheckboxSelect ($oForm, 1, "checkboxG2Example", 0, "byIndex")
Sleep(1000)
Next


Function _IEFormElementGetCollection

Function Reference

_IEFormElementGetCollection

Returns a collection object variable representing all Form Elements within a given Form.

#include <IE.au3>
_IEFormElementGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Form Elements collection, @EXTENDED = form element count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFormElementGetObjByName, _IEFormElementGetValue, _IEFormElementSetValue, _IEFormSubmit

Example

; *******************************************************
; Example 1 - Get a reference to a specific form element by 0-based index.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 2)
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormElementGetObjByName

Function Reference

_IEFormElementGetObjByName

Returns an object reference to a Form Element by name.

#include <IE.au3>
_IEFormElementGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_name | Specifies the name of the Form Element you wish to match
$i_index | [optional] If the Form Element name occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified Form Elements

Return Value

Success: | Returns an object variable pointing to the Form Element object, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

If the desired form element does not have a name or ID, _IEFormElementGetCollection to get a reference by index

Related

_IEFormElementGetCollection, _IEFormElementGetValue, _IEFormElementSetValue, _IEFormSubmit

Example

; *******************************************************
; Example 1 - Get a reference to a specific form element by name.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormElementGetValue

Function Reference

_IEFormElementGetValue

Returns the value of a given Form Element.

#include <IE.au3>
_IEFormElementGetValue ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Form Element object

Return Value

Success: | Returns the string value of the given Form Element
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

See remarks for _IEFormElementSetValue.

Related

_IEFormElementSetValue, _IEFormElementGetCollection, _IEFormElementGetObjByName, _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, set the value of a text
; form element, retrieve and display the value from the element
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
$IEAu3Version = _IE_VersionInfo ()
_IEFormElementSetValue ($oText, $IEAu3Version[5])
MsgBox(0, "Form Element Value", _IEFormElementGetValue ($oText))


Function _IEFormElementOptionSelect

Function Reference

_IEFormElementOptionSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementOptionSelect ( ByRef $o_object, $s_string [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

Parameters

$o_object | Form Element Object of type "Select Option"
$s_string | Value used to match element - treatment based on $s_mode
$f_select | [optional] specifies whether element should be selected or deselected -1 = Return selected state 0 = Deselect the element 1 = (Default) Select the element
$s_mode | [optional] specifies search mode byValue = (Default) value of the option you wish to select byText = text of the option you wish to select byIndex = 0-based index of option you wish to select
$f_fireEvent | [optional] specifies whether to fire OnChange and OnClick events after changing value 0 = do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick events after setting value

Return Value

Success: | If $f_select = -1, returns the current selected state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

Related

_IEFormElementCheckBoxSelect, _IEFormElementRadioSelect, _IEFormElementGetValue, _IEFormElementSetValue

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, get reference
; to select element, cycle 10 times selecting options byValue, byText and byIndex
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "selectExample")
For $i = 1 To 10
_IEFormElementOptionSelect ($oSelect, "Freepage", 1, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "midipage.html", 1, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 0, 1, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, get reference
; to select multiple element, cycle 5 times selecting and then deselecting
; options byValue, byText and byIndex.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "multipleSelectExample")
For $i = 1 To 5
_IEFormElementOptionSelect ($oSelect, "Carlos", 1, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Name2", 1, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 5, 1, "byIndex")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Carlos", 0, "byText")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, "Name2", 0, "byValue")
Sleep(1000)
_IEFormElementOptionSelect ($oSelect, 5, 0, "byIndex")
Sleep(1000)
Next

; *******************************************************
; Example 3 - Open a browser with the form example, get reference to form, get reference
; to select element, check to see if the option "Freepage" is selected and
; report result. Repeat for the option with index 0 and for the option
; with value of 'midipage.html'
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "selectExample")
If _IEFormElementOptionSelect ($oSelect, "Freepage", -1, "byText") Then
MsgBox(0, "Option Selected", "Option Freepage is selected")
Else
MsgBox(0, "Option Selected", "Option Freepage is Not selected")
EndIf
If _IEFormElementOptionSelect ($oSelect, 0, -1, "byIndex") Then
MsgBox(0, "Option Selected", "The First (index 0) option is selected")
Else
MsgBox(0, "Option Selected", "The First (index 0) option is Not selected")
EndIf
If _IEFormElementOptionSelect ($oSelect, "midipage.html", -1, "byValue") Then
MsgBox(0, "Option Selected", "The option with value 'midipage.html' is selected")
Else
MsgBox(0, "Option Selected", "The option with value 'midipage.html' is NOT selected")
EndIf


Function _IEFormElementRadioSelect

Function Reference

_IEFormElementRadioSelect

Set the value of a specified form element.

#include <IE.au3>
_IEFormElementRadioSelect ( ByRef $o_object, $s_string , $s_name [, $f_select = 1 [, $s_mode = "byValue" [, $f_fireEvent = 1]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$s_string | Value used to match element - treatment based on $s_mode
$s_name | Name or Id of Radio Group
$f_select | [optional] specifies whether element should be selected or deselected -1 = Return selected state 0 = Unselect the element 1 = (Default) Select the element
$s_mode | [optional] specifies search mode byValue = (Default) value of the radio you wish to select byIndex = 0-based index of radio you wish to select
$f_fireEvent | [optional] specifies whether to fire OnChange and OnClick events after changing value 0 = do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick events after setting value

Return Value

Success: | If $f_select = -1, returns the current selected state, else returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The $f_fireEvent parameter is significant only if the form element has an onChange event associated with it.

$s_Name is a mandatory parameter for this function. Radio buttons are operated upon in groups sharing the same name. No more than one element within a group may be selected at a given time - when one item is selected, all others are deselected.

Related

_IEFormElementOptionSelect, _IEFormElementCheckBoxSelect, _IEFormElementGetValue, _IEFormElementSetValue

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get reference to form, select
; each radio button byValue, then deselect the last item leaving none selected.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementRadioSelect ($oForm, "vehicleAirplane", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleTrain", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleBoat", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 1, "byValue")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, "vehicleCar", "radioExample", 0, "byValue")
Sleep(1000)
Next

; *******************************************************
; Example 2 - Open a browser with the form example, get reference to form, select
; each radio button byIndex, then deselect the last item leaving none selected.
; Note: You will likely need to scroll down on the page to see the changes
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
For $i = 1 To 5
_IEFormElementRadioSelect ($oForm, 3, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 2, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 1, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 0, "radioExample", 1, "byIndex")
Sleep(1000)
_IEFormElementRadioSelect ($oForm, 0, "radioExample", 0, "byIndex")
Sleep(1000)
Next


Function _IEFormElementSetValue

Function Reference

_IEFormElementSetValue

Set the value of a specified Form Element.

#include <IE.au3>
_IEFormElementSetValue ( ByRef $o_object, $s_newvalue [, $f_fireEvent = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form Element object
$s_newvalue | The new value to be set into the Form Element
$f_fireEvent | [optional] specifies whether to fire an OnChange event after changing value 0 = Do not fire OnChange or OnClick event after setting value 1 = (Default) fire OnChange and OnClick event after setting value

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

While all Form Elements have a value, only text oriented elements use their value attribute in an obvious fashion (type text, textarea, hidden, password and file). The value of other form elements does not affect what is displayed in the user interface, but rather the value that is returned by the element when it is selected or activated.

See _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect and _IEFormImageClick for more information.

Note: You cannot use _IEFormElementSetValue to set the value of an INPUT TYPE=FILE element. Browser security restrictions prevent this element from being scripted. See the example below for a workaround.

Related

_IEFormElementGetValue, _IEFormElementGetCollection, _IEFormElementGetObjByName, _IEFormElementOptionSelect, _IEFormElementCheckboxSelect, _IEFormElementRadioSelect

Example

; *******************************************************
; Example 1 - Open a browser with the form example, set the value of a text form element
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! This works!")

; *******************************************************
; Example 2 - Get a reference to a specific form element and set its value.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 3 - Login to Hotmail
; *******************************************************
;
#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

; *******************************************************
; Example 4 - Set the value of an INPUT TYPE=FILE element
; (security restrictions prevent using _IEFormElementSetValue)
; *******************************************************
;
#include <IE.au3>

$oIE = _IE_Example("form")
$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oInputFile = _IEFormElementGetObjByName($oForm, "fileExample")

; Assign input focus to the field and then send the text string
_IEAction($oInputFile, "focus")
Send("C:\myfile.txt")

; *******************************************************
; Example 5 - Set the value of an INPUT TYPE=FILE element
; Same as previous example, but with invisible window
; (security restrictions prevent using _IEFormElementSetValue)
; *******************************************************
;
#include <IE.au3>

$oIE = _IE_Example("form")

; Hide the browser window to demonstrate sending text to invisible window
_IEAction($oIE, "invisible")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oInputFile = _IEFormElementGetObjByName($oForm, "fileExample")

; Assign input focus to the field and then send the text string
_IEAction($oInputFile, "focus")
$hIE = _IEPropertyGet($oIE, "hwnd")
ControlSend($hIE, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "C:\myfile.txt")

MsgBox(0, "Success", "Value set to C:\myfile.txt")
_IEAction($oIE, "visible")


Function _IEFormGetCollection

Function Reference

_IEFormGetCollection

Returns a collection object variable representing the Forms in the document or a single form by index.

#include <IE.au3>
_IEFormGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame or iFrame object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable with a collection of all forms in the document, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFormGetObjByName, _IEFormReset, _IEFormSubmit

Example

; *******************************************************
; Example 1 - Get a reference to a specific form by 0-based index,
; in this case the first form on the page
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 2 - Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
MsgBox(0, "Form Info", $oForm.name)
Next

; *******************************************************
; Example 3 - Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each
; demonstrating use of form index
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms - 1
$oForm = _IEFormGetCollection ($oIE, $i)
MsgBox(0, "Form Info", $oForm.name)
Next


Function _IEFormGetObjByName

Function Reference

_IEFormGetObjByName

Returns an object reference to a Form by name.

#include <IE.au3>
_IEFormGetObjByName ( ByRef $o_object, $s_name [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_name | Specifies the name of the Form you wish to match
$i_index | [optional] If Form name occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified Forms

Return Value

Success: | Returns an object variable pointing to the Form object, @EXTENDED = form count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

If the desired form does not have a name or ID, _IEFormGetCollection to get a reference by index

Related

_IEFormGetCollection, _IEFormReset, _IEFormSubmit

Example

; *******************************************************
; Example 1 - Get a reference to a specific form by name. In this case, submit a query
; to the Google search engine. Note that the names of the form and form
; elements can be found by viewing the page HTML source
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)


Function _IEFormImageClick

Function Reference

_IEFormImageClick

Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src.

#include <IE.au3>
_IEFormImageClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )

Parameters

$o_object | Object variable of any DOM element (will be converted to the associated document object)
$s_linkText | Value used to match element - treatment based on $s_mode
$s_mode | [optional] specifies search mode src = (Default) match the url of the image name = match the name of the image alt = match the alternate text of the image
$i_index | [optional] If the img text occurs more than once, specifies which instance you want by 0-based index
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

The <input type=image> form element is handled differently from all others. It is not recognized by Internet Explorer as a member of the form element collection and this function therefore gives you other means of getting a reference to it within the document using src, name or alt strings. Regardless of the object passed to this function, it looks for the form element within the full document context.

Related

_IEImgClick, _IEImgGetCollection, _IELoadWait

Example

; *******************************************************
; Example 1 - Open a browser with the form example, click on the
; <input type=image> form element with matching alt text
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "AutoIt Homepage", "alt")

; *******************************************************
; Example 2 - Open a browser with the form example, click on the <input type=image>
; form element with matching img source URL (sub-string)
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "autoit_6_240x100.jpg", "src")

; *******************************************************
; Example 3 - Open a browser with the form example, click on the
; <input type=image> form element with matching name
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
_IEFormImageClick ($oIE, "imageExample", "name")


Function _IEFormReset

Function Reference

_IEFormReset

Reset a specified Form setting the values back to their loaded defaults.

#include <IE.au3>
_IEFormReset ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Form object

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFormSubmit, _IEFormGetObjByName, _IEFormGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the form example, fill in a form field and
; reset the form back to default values
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! It works!")
_IEFormReset ($oForm)


Function _IEFormSubmit

Function Reference

_IEFormSubmit

Submit a specified Form.

#include <IE.au3>
_IEFormSubmit ( ByRef $o_object [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Form object
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

For many HTML forms it is not sufficient to use _IEFormSubmit() because there is often custom JavaScript tied to an onClick event for its Submit button. In these cases you'll need to simulate a click of the submit button instead of using _IEFormSubmit(). See the example for the "click" action of _IEAction().
As well, some form processing relies on the "value" of the submit button being passed along with the rest of the form data (often when there is more than one submit button in the form and they are designed to trigger different results). This function will not result in a submit button value being passed. The solution is to use the "click" action of _IEAction() as above.
If you experience trouble with the automatic _IELoadWait called by default, please set $f_wait parameter to 0 and call _IELoadWait from your script, passing it the InternetExplorer object.

Related

_IEFormReset, _IEFormGetObjByName, _IEFormGetCollection, _IEFormElementGetObjByName, _IEFormElementGetCollection, _IELoadWait

Example

; *******************************************************
; Example 1 - Open a browser with the form example, fill in a form field and submit the form
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! It works!")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 2 - Get a reference to a specific form element and set its value.
; In this case, submit a query to the Google search engine
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Example 3 - Get a reference to a specific form element and set its value.
; Call _IELoadWait manually if the default _IELoadWait experiences trouble.
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm, 0)
_IELoadWait($oIE)


Function _IEFrameGetCollection

Function Reference

_IEFrameGetCollection

Returns a collection object containing the frames in a FrameSet or the iFrames on a normal page or a single Frame or iFrame by index.

#include <IE.au3>
_IEFrameGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Frames collection, @EXTENDED = Frame count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

Although MSDN documents the return value for this function as a collection object, it cannot be looped through with a For...Next loop like a standard collection object. You must instead step through the collection by index - see example.

Related

_IEIsFrameSet, _IEFrameGetObjByName

Example

; *******************************************************
; Example 1 - Open frameset example, get collection of frames
; and loop through them displaying their source URL's
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("frameset")
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
For $i = 0 to ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection ($oIE, $i)
MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))
Next


Function _IEFrameGetObjByName

Function Reference

_IEFrameGetObjByName

Returns an object reference to a Frame or iFrame by name.

#include <IE.au3>
_IEFrameGetObjByName ( ByRef $o_object, $s_name )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_name | Name of the Frame you wish to match

Return Value

Success: | Returns an object variable pointing to the Window object in a Frame, @EXTENDED = Frame count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The object returned by this function is a window object which allows access to the document contained within. You may also want to access the frame or iframe tag and its properties - to do this, use _IETagNameGetCollection.

Related

_IEFrameGetCollection

Example

; *******************************************************
; Example 1 - Open iFrame example, get a reference to the iFrame
; with a name of "iFrameTwo" and replace its body HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("iframe")
$oFrame = _IEFrameGetObjByName ($oIE, "iFrameTwo")
_IEBodyWriteHTML ($oFrame, "Hello <b>iFrame!</b>")
_IELoadWait ($oFrame)


Function _IEGetObjById

Function Reference

_IEGetObjById

Returns an object variable by id or name.

#include <IE.au3>
_IEGetObjById ( ByRef $o_object, $s_Id)

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_Id | Specifies id or name of the object you wish to match

Return Value

Success: | Returns an object variable pointing to the specified Object
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 7 ($_IEStatus_NoMatch) = No Match

Remarks

This function will return an object reference to any object in the document with a specified id or name. DOM elements can have Name or ID attributes or both. A specific ID can be assigned to only a single element while a specific Name can be assigned to multiple elements. In Internet Explorer, the Name and ID namespaces are shared.

Related

_IEGetObjByName

Example

; *******************************************************
; Example 1 - Open a browser to the basic example, get an object reference
; to the DIV element with the ID "line1". Display the innerText
; of this element to the console.
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oDiv = _IEGetObjById ($oIE, "line1")
ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CRLF)


Function _IEGetObjByName

Function Reference

_IEGetObjByName

Returns an object variable by name or id.

#include <IE.au3>
_IEGetObjByName ( ByRef $o_object, $s_Id [, $i_index = 0] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_Id | Specifies name or id of the object you wish to match
$i_index | [optional] If name of id occurs more than once, specifies instance by 0-based index 0 (Default) or positive integer returns an indexed instance -1 returns a collection of the specified objects

Return Value

Success: | Returns an object variable pointing to the specified Object, @EXTENDED = specified object count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

This function will return an object reference to any object in the document with a specified name or id. DOM elements can have Name or ID attributes or both. A specific ID can be assigned to only a single element while a specific Name can be assigned to multiple elements. In Internet Explorer, the Name and ID namespaces are shared.

Related

_IEGetObjById

Example

; *******************************************************
; Example 1 - Open a browser to the form example, get an object reference
; to the element with the name "ExampleForm". In this case the
; result is identical to using $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEGetObjByName ($oIE, "ExampleForm")


Function _IEHeadInsertEventScript

Function Reference

_IEHeadInsertEventScript

Inserts a Javascript into the Head of the document.

#include <IE.au3>
_IEHeadInsertEventScript ( ByRef $o_object, $s_htmlFor, $s_event, $s_script )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_htmlFor | The HTML element for event monitoring (e.g. "document", "window" or an element ID)
$s_event | The event to monitor (e.g. "onclick" or "oncontextmenu")
$s_script | Javascript string to be executed

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

Using ObjEvent, AutoIt is able to be notified of events via COM, but it manages them asynchronously (rather than synchronously as they are handled in the browser context). This routine allows you to inject code that is managed inside the browser context.

Note that elements that do not have an ID assigned can still be used by obtaining their "uniqueID" property with _IEPropertyGet

Related

_IEDocInsertHTML, _IEPropertyGet, _IEDocInsertText

Example

; *******************************************************
; Example 1 - Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone clicks on the document
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "document", "onclick", "alert('Someone clicked the document!');")

; *******************************************************
; Example 2 - Open a browser with the basic example page, insert an
; event script into the head of the document that creates
; a JavaScript alert when someone tries to right-click on the
; document and then the event script returns "false" to prevent
; the right-click context menu from appearing
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "document", "oncontextmenu", "alert('No Context Menu');return false")

; *******************************************************
; Example 3 - Open a browser with the basic example page, insert an
; event script into the head of the document that creates a
; JavaScript alert when we are about to navigate away from the
; page and presents the option to cancel the operation.
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "window", "onbeforeunload", _
"alert('Example warning follows...');return 'Pending changes may be lost';")
_IENavigate($oIE, "www.autoitscript.com")

; *******************************************************
; Example 4 - Open a browser with the basic example page, insert an
; event script into the head of the document that prevents
; selection of text in the document
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example()
_IEHeadInsertEventScript ($oIE, "document", "ondrag", "return false;")
_IEHeadInsertEventScript ($oIE, "document", "onselectstart", "return false;")

; *******************************************************
; Example 5 - Open a browser with the AutoIt homepage, insert an
; event script into the head of the document that prevents
; navigation when any link is clicked and log the URL of the
; clicked link to the console
; *******************************************************
;
#include <IE.au3>

$oIE = _IECreate("http://www.autoitscript.com")
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
$sLinkId = _IEPropertyGet($oLink, "uniqueid")
_IEHeadInsertEventScript($oIE, $sLinkId, "onclick", "return false;")
ObjEvent($oLink, "_Evt_")
Next

While 1
Sleep(100)
WEnd

Func _Evt_onClick()
Local $o_link = @COM_EventObj
ConsoleWrite($o_link.href & @CRLF)
EndFunc


Function _IEImgClick

Function Reference

_IEImgClick

Simulate a mouse click on an image. Match by sub-string match of alt text, name, or src.

#include <IE.au3>
_IEImgClick ( ByRef $o_object, $s_linkText [, $s_mode = "src" [, $i_index = 0 [, $f_wait = 1]]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_linkText | Text to match the content of the attribute specified in $s_mode
$s_mode | [optional] specifies search mode src = (Default) match the url of the image name = match the name of the image alt = match the alternate text of the image
$i_index | [optional] If the img text occurs more than once, specify which instance you want by 0-based index
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEImgGetCollection, _IEFormImageClick, _IELoadWait

Example

; *******************************************************
; Example 1 - Click on IMG by Alt text
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoIt Homepage Image", "alt")

; *******************************************************
; Example 2 - Click on IMG by name
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "AutoItImage", "name")

; *******************************************************
; Example 3 - Click on IMG by src sub-string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "autoit_6_240x100.jpg", "src")

; *******************************************************
; Example 4 - Click on IMG by full src string
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEImgClick ($oIE, "http://www.autoitscript.com/images/autoit_6_240x100.jpg")


Function _IEImgGetCollection

Function Reference

_IEImgGetCollection

Returns a collection object variable representing the IMG tags in the document or a single image by index.

#include <IE.au3>
_IEImgGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame or iFrame object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable with a collection of all IMG tags in the document, @EXTENDED = img count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IEFormImageClick, _IEImgClick

Example

; *******************************************************
; Example 1 - Create browser at AutoIt homepage, get a reference to
; the 6th Image on the page (note: the first image is index 0)
; and display information about it
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/")
$oImg = _IEImgGetCollection ($oIE, 5)
$sInfo = "Src: " & $oImg.src & @CR
$sInfo &= "FileName: " & $oImg.nameProp & @CR
$sInfo &= "Height: " & $oImg.height & @CR
$sInfo &= "Width: " & $oImg.width & @CR
$sInfo &= "Border: " & $oImg.border
MsgBox(0, "4th Image Info", $sInfo)

; *******************************************************
; Example 2 - Create browser at AutoIt homepage, get Img collection
; and display src URL for each
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/")
$oImgs = _IEImgGetCollection ($oIE)
$iNumImg = @extended
MsgBox(0, "Img Info", "There are " & $iNumImg & " images on the page")
For $oImg In $oImgs
MsgBox(0, "Img Info", "src=" & $oImg.src)
Next


Function _IEIsFrameSet

Function Reference

_IEIsFrameSet

Checks to see if the specified Window contains a FrameSet.

#include <IE.au3>
_IEIsFrameSet ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application, Window or Frame object

Return Value

Success: | Returns 1 if the object references a FrameSet page
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
@Extended: | Contains invalid parameter number

Remarks

_IEFrameGetCollection does not specify whether the referenced frames are part of a FrameSet or whether they are iFrames. If frames exist on a page and this function return False, then the frames are iFrames.

Related

_IEFrameGetCollection

Example

; *******************************************************
; Example 1 - Display the frameset example, get frame collection,
; check number of frames, display number of frames or iFrames present
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("frameset")
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
If _IEIsFrameSet ($oIE) Then
MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
Else
MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
EndIf
Else
MsgBox(0, "Frame Info", "Page contains no frames")
EndIf


Function _IELinkClickByIndex

Function Reference

_IELinkClickByIndex

Simulate a mouse click on a link by 0-based index (in source order).

#include <IE.au3>
_IELinkClickByIndex ( ByRef $o_object, $i_index [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | 0-based index of the link you wish to match
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

Not all elements that appear to be links actually are. It is common practice to attach onClick JavaScript events to other DOM elements to simulate the behavior of links. To activate such elements, use "click" with _IEAction.

Related

_IELinkClickByText, _IELoadWait

Example

; *******************************************************
; Example 1 - Open browser with basic example, click on the 3rd
; link on the page (note: the first link is index 0)
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IELinkClickByIndex ($oIE, 2)


Function _IELinkClickByText

Function Reference

_IELinkClickByText

Simulate a mouse click on a link with text sub-string matching the string provided.

#include <IE.au3>
_IELinkClickByText ( ByRef $o_object, $s_linkText [, $i_index = 0[, $f_wait = 1]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_linkText | Text displayed on the web page for the desired link to click
$i_index | [optional] If the link text occurs more than once, specify which instance you want by 0-based index
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 7 ($_IEStatus_NoMatch) = No Match
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

Not all elements that appear to be links actually are. It is common practice to attach onClick JavaScript events to other DOM elements to simulate the behavior of links. To activate such elements, use "click" with _IEAction.

Related

_IELinkClickByIndex, _IELoadWait

Example

; *******************************************************
; Example 1 - Open browser with basic example, click on the link
; with text "user forum"
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IELinkClickByText ($oIE, "user forum")

; *******************************************************
; Example 2 - Open browser to the AutoIt homepage, loop through the links
; on the page and click on the link with text "wallpaper"
; using a sub-string match.
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")

$sMyString = "wallpaper"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
$sLinkText = _IEPropertyGet($oLink, "innerText")
If StringInStr($sLinkText, $sMyString) Then
_IEAction($oLink, "click")
ExitLoop
EndIf
Next


Function _IELinkGetCollection

Function Reference

_IELinkGetCollection

Returns a collection object containing all links in the document or a single link by index.

#include <IE.au3>
_IELinkGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object collection of all links in the document, @EXTENDED = link count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

Not all elements that appear to be links actually are. It is common practice to attach onClick JavaScript events to other DOM elements to simulate the behavior of links. To activate such elements, use "click" with _IEAction.

Related

None.

Example

; *******************************************************
; Example 1 - Open browser with basic example, get link collection,
; loop through items and display the associated link URL references
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
MsgBox(0, "Link Info", $oLink.href)
Next


Function _IELoadWait

Function Reference

_IELoadWait

Wait for a browser page load to complete before returning.

#include <IE.au3>
_IELoadWait ( ByRef $o_object [, $i_delay = 0 [, $i_timeout = -1]] )

Parameters

$o_object | Object variable of an InternetExplorer.Application or DOM element
$i_delay | [optional] Milliseconds to wait before checking status
$i_timeout | [optional] Period of time to wait before exiting function (default = 300000 ms aka 5 min)

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.). Most functions that do this also allow you to turn this off with a $f_wait parameter if you do not want the wait or if you want to call it yourself.

When document objects or DOM elements are passed to _IELoadWait, it will check the readyState of the container elements up to and including the parentWindow.

Browser scripting security restrictions may sometimes prevent _IELoadWait from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors. In these cases you may need to avoid calling _IELoadWait and attempt to employ other methods of insuring that the page load has completed. These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait for the browser yourself (e.g. _IELoadWait($oIE)).

The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here.

Related

_IELoadWaitTimeout, _IECreate, _IENavigate, _IEFormSubmit, _IELinkClickByText, _IELinkClickByIndex, _IEImgClick, _IEFormImageClick, _IEBodyWriteHTML, _IEDocWriteHTML, _IEAction

Example

; *******************************************************
; Example 1 - Open the AutoIt forum page, tab to the "View new posts"
; link and activate the link with the enter key.
; Then wait for the page load to complete before moving on.
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}")
Send("{ENTER}")
_IELoadWait ($oIE)


Function _IELoadWaitTimeout

Function Reference

_IELoadWaitTimeout

Retrieve or set the current value in milliseconds _IELoadWait will try before timing out.

#include <IE.au3>
_IELoadWaitTimeout ( [$i_timeout = -1] )

Parameters

$i_timeout [optional] retrieve or specify the number of milliseconds
0 or positive integer sets timeout to this value
-1 = (Default) returns the current timeout value (stored in global variable $__IELoadWaitTimeout)

Return Value

Success: | If $i_timeout = -1, returns the current timeout value, else returns 1
Failure: | None

Remarks

There is no way to completely disable the Timeout value. You can functionally do this however by setting it to a very large positive integer. The initial timeout value is 30000 ms (5 minutes).

Related

_IELoadWait

Example

; *******************************************************
; Example 1 - Obtain current timeout value
; *******************************************************
;
#include <IE.au3>
$iCurrentTimeout = _IELoadWaitTimeout ()

; *******************************************************
; Example 2 - Set timeout to 1 minute (60000 milliseconds)
; *******************************************************
;
#include <IE.au3>
_IELoadWaitTimeout (60000)


Function _IENavigate

Function Reference

_IENavigate

Directs an existing browser window to navigate to the specified URL.

#include <IE.au3>
_IENavigate ( ByRef $o_object, $s_url [, $f_wait = 1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$s_url | URL to navigate to (e.g. "http://www.autoitscript.com")
$f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning

Return Value

Success: | Returns -1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 1 ($_IEStatus_GeneralError) = General Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
 | 8 ($_IEStatus_AccessIsDenied) = Access Is Denied
 | 9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@Extended: | Contains invalid parameter number

Remarks

This function always returns a value of -1. This is because the navigate method has no useful return value and therefore nothing can be implied from it. You will need to employ other methods to determine success or failure of the navigation.

New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it. There are several workarounds: 1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary), 2) use _IEAttach to connect to the new browser window 3) add the target website to the Trusted Sites security zone in IE, 4) turn off "Protected Mode" in IE, or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites.

Related

_IECreate, _IECreateEmbedded, _IELoadWait

Example

; *******************************************************
; Example 1 - Create a browser window and navigate to a website,
; wait 5 seconds and navigate to another
; wait 5 seconds and navigate to another
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")
Sleep(5000)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?")
Sleep(5000)
_IENavigate ($oIE, "http://www.autoitscript.com/forum/index.php?showforum=9")

; *******************************************************
; Example 2 - Create a browser window and navigate to a website,
; do not wait for page load to complete before moving to next line
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com", 0)
MsgBox(0, "_IENavigate()", "This code executes immediately")


Function _IEPropertyGet

Function Reference

_IEPropertyGet

Returns a select property of the Browser or DOM element.

#include <IE.au3>
_IEPropertyGet ( ByRef $o_object, $s_property )

Parameters

$o_object | Object variable of an InternetExplorer.Application or DOM element
$s_property | Property selection (see remarks)

Return Value

Success: | Value of selected Property
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following tables provide a description of each property available for use. Some properties to DOM elements, others to the browser.

Browser Properties

Property | Description
"addressbar" | Retrieves a Boolean value indicating whether the browser address bar is visible or hidden.
"browserx" | Retrieves the x-coordinate of the top left corner of a document element, relative to the browser.
"browsery" | Retrieves the y-coordinate of the top left corner of a document element, relative to the browser.
"busy" | Retrieves a Boolean value indicating whether the object is engaged in a navigation or downloading operation.
"contenteditable" | Retrieves a Boolean value that indicates whether the object can be edited with mouse and keyboard.
"fullscreen" | Retrieves a Boolean value that indicates whether the browser is in full-screen or normal window mode.
"height" | Retrieves the height of the browser main window or a document element.
"hwnd" | Retrieves the handle of the Internet Explorer main window. Can be used in most AutoIt Win* functions.
"innerhtml" | Retrieves the rendered HTML of an element excluding the beginning and ending element tags.
"innertext" | Retrieves the rendered Text (but not any tags) of an element. Typically identical to outertext.
"isdisabled" | Retrieves the value indicating whether the user can interact with the object.
"left" | Retrieves the screen coordinate of the left edge of the main window of the object.
"locationname" | Retrieves the name of the resource that Internet Explorer is currently displaying.
"locationurl" | Retrieves the URL of the resource that Internet Explorer is currently displaying.
"menubar" | Retrieves a Boolean value that indicates whether the browser menu bar is visible.
"offline" | Retrieves a Boolean value that indicates whether the browser is currently operating in offline mode.
"outertext" | Retrieves the rendered Text (but not any tags) of an element. Typically identical to innertext.
"outerhtml" | Retrieves the rendered HTML of an element including the beginning and ending element tags.
"readystate" | Retrieves the ready state of the object.
"referrer" | Retrieves a string of the URL of the page from which the current page was accessed (but only if accessed via a link on that page, else the string is null).
"resizable" | Retrieves a value that indicates whether the object can be resized.
"screenx" | Retrieves the x-coordinate of the top left corner of a document object or the browser, relative to the screen.
"screeny" | Retrieves the y-coordinate of the top left corner of a document object or the browser, relative to the screen.
"silent" | Retrieves a value that indicates whether the browser can show dialog boxes.
"statusbar" | Retrieves a value that indicates whether the status bar for the object is visible.
"statustext" | Retrieves the text in the status bar for the object.
"theatermode" | Retrieves a Boolean value indicating whether the browser is in Theater Mode. In theater mode, the browser main window fills the entire screen and displays a toolbar with a minimal set of navigational buttons.
"title" | Retrieves the document title. Note that this is different than the window title which typically starts with the document title, but has additional text specified in the windows registry appended to it.
"toolbar" | Retrieves a Boolean value indicating whether the tool bar of the browser is visible or hidden.
"top" | Retrieves the screen coordinate of the top edge of the main window of the object.
"visible" | Retrieves a value that indicates whether the object is visible or hidden.
"width" | Retrieves the width of the browser main window or a document element.
"uniqueid" | Retrieves an ID assigned by the DOM that is unique among all elements. This can be used in any context that requires an element ID.

ClientInfo Properties

Property | Description
"appcodename" | Retrieves the code name of the browser (the property has a default value of Mozilla).
"appminorversion" | Retrieves the application's minor version value.
"appname" | Retrieves the name of the browser (the property has a default value of Microsoft Internet Explorer).
"appversion" | Retrieves the platform and version of the browser.
"browserlanguage" | Retrieves the current browser language (the value will be one of these Language Codes).
"cookieenabled" | Retrieves whether client-side persistent cookies are enabled in the browser. Persistent cookies are those that are stored on the client-side computer.
"cpuclass" | Retrieves a string denoting the CPU class (the return values can be found here).
"javaenabled" | Returns whether Java is enabled.
"online" | Retrieves a value indicating whether the system is in global offline mode.
"platform" | Retrieves the name of the user's operating system (the return values can be found here).
"systemlanguage" | Retrieves the default language used by the operating system (the value will be one of these Language Codes).
"useragent" | Retrieves a string equivalent to the HTTP user-agent request header.
"userlanguage" | Retrieves the operating system's natural language setting (the value will be one of these Language Codes).
"vcard" | Returns an array containing each attribute in the userProfile object (a list of attributes can be found here). The return is a two dimentional array, where the first dimention has two elements. The first element (0) contains the attribute names, the second element (1) contains the corresponding values. The second dimention has 29 elements (0 to 28).

Related

_IEPropertySet, _IEBodyReadHTML, _IEBodyReadText, _IEBodyWriteHTML, _IEDocInsertHTML, _IEDocInsertText, _IEHeadInsertEventScript

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, check to see if the
; addressbar is visible, if it is turn it off, if it is not turn it on
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
If _IEPropertyGet ($oIE, "addressbar") Then
MsgBox(0, "AddressBar Status", "AddressBar Visible, turning it off")
_IEPropertySet ($oIE, "addressbar", False)
Else
MsgBox(0, "AddressBar Status", "AddressBar Invisible, turning it on")
_IEPropertySet ($oIE, "addressbar", True)
EndIf

; *******************************************************
; Example 2 - Open a browser with the form example and get a reference to the form
; textarea element. Get the coordinates and dimensions of the text area,
; outline its shape with the mouse and come to rest in the center
; *******************************************************
;
$oIE = _IE_Example("form")

$oForm = _IEFormGetObjByName($oIE, "ExampleForm")
$oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")

; Get coordinates and dimensions of the textarea
$iScreenX = _IEPropertyGet($oTextArea, "screenx")
$iScreenY = _IEPropertyGet($oTextArea, "screeny")
$iBrowserX = _IEPropertyGet($oTextArea, "browserx")
$iBrowserY = _IEPropertyGet($oTextArea, "browserY")
$iWidth = _IEPropertyGet($oTextArea, "width")
$iHeight = _IEPropertyGet($oTextArea, "height")

; Outline the textarea with the mouse, come to rest in the center
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY + $iHeight)
MouseMove($iScreenX, $iScreenY)
MouseMove($iScreenX + $iWidth/2, $iScreenY + $iHeight/2)


Function _IEPropertySet

Function Reference

_IEPropertySet

Set a select property of the Browser or DOM element.

#include <IE.au3>
_IEPropertySet ( ByRef $o_object, $s_property, $newvalue )

Parameters

$o_object | Object variable of an InternetExplorer.Application
$s_property | Property selection (see remarks)
$newvalue | The new value to be set into the Browser Property

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following table provide a description of each property available for use. Some properties to DOM elements, others to the browser.

Browser Properties

Property | Description
"addressbar" | Specifies whether the address bar of the object is visible or hidden.
"contenteditable" | Specifies a Boolean value that indicates whether the object can be edited with mouse and keyboard.
"height" | Specifies the height of the browser main window.
"innerhtml" | Sets the rendered HTML of an element excluding the beginning and ending element tags.
"innertext" | Sets the rendered Text (but not any tags) of an element. Typically identical to outertext.
"left" | Specifies the screen coordinate of the left edge of the browser main window.
"menubar" | Specifies a Boolean value that indicates whether the browser menu bar is visible.
"offline" | Specifies a Boolean value that indicates whether the browser is currently operating in offline mode.
"outertext" | Sets the rendered Text (but not any tags) of an element. Typically identical to innertext.
"outerhtml" | Sets the rendered HTML of an element including the beginning and ending element tags.
"resizable" | Specifies a Boolean value that indicates whether the object can be resized.
"silent" | Specifies a Boolean value that indicates whether the browser can show dialog boxes.
"statusbar" | Specifies a value that indicates whether the browser status bar is visible.
"statustext" | Specifies the text in the browser status bar.
"theatermode" | Specifies a Boolean value indicating whether the browser is in Theater Mode. In theater mode, the browser main window fills the entire screen and displays a toolbar with a minimal set of navigational buttons.
"title" | Sets the document title. Note that this is different than the window title which typically starts with the document title, but has additional text specified in the windows registry appended to it.
"toolbar" | Specifies a Boolean value indicating whether the tool bar of the browser is visible or hidden.
"top" | Specifies the screen coordinate of the top edge of the browser main window.
"width" | Specifies the width of the browser main window.

Related

_IEPropertyGet, _IEAction, _IEBodyWriteHTML, _IEDocInsertHTML, _IEDocInsertText

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, check to see if the
; addressbar is visible, if it is not turn it on. Then change
; the text displayed in the statusbar
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
If Not _IEPropertyGet ($oIE, "statusbar") Then _IEPropertySet ($oIE, "statusbar", True)
_IEPropertySet ($oIE, "statustext", "Look What I can Do")
Sleep(1000)
_IEPropertySet ($oIE, "statustext", "I can change the status text")


Function _IEQuit

Function Reference

_IEQuit

Close the browser and remove the object reference to it.

#include <IE.au3>
_IEQuit ( ByRef $o_object )

Parameters

$o_object Object variable of an InternetExplorer.Application

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

_IEQuit is particularly important when creating or working with invisible instances of Internet Explorer. When AutoIt exits when working with visible instances of a browser, the browser continues to run and the visible window is left for the user to manage. When the browser instance is invisible however, when AutoIt exits the browser process is left running and there is no user interface to interact with and an orphan Iexplore.exe process is left running on the system. It is therefore good practice to call _IEQuit whenever the browser process is not needed after the script exists.

_IEQuit is not allowed with embedded browser objects created with _IECreateEmbedded. The browser processes associated with those objects will close when their parent GUI window is destroyed.

Related

_IEAttach, _IECreate

Example

; *******************************************************
; Example 1 - Create an invisible browser window, navigate to a
; website, retrieve some information and Quit
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit ($oIE)


Function _IETableGetCollection

Function Reference

_IETableGetCollection

Returns a collection object variable representing all the tables in a document or a single table by index.

#include <IE.au3>
_IETableGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window or Frame object
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object collection of all tables in the document, @EXTENDED = table count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_IETableWriteToArray

Example

; *******************************************************
; Example 1 - Open a browser with the table example, get a reference to the first table
; on the page (index 0) and read its contents into a 2-D array
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE, 0)
$aTableData = _IETableWriteToArray ($oTable)

; *******************************************************
; Example 2 - Open a browser with the table example, get a reference to the
; table collection and display the number of tables on the page
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE)
$iNumTables = @extended
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")


Function _IETableWriteToArray

Function Reference

_IETableWriteToArray

Reads the contents of a Table into an array.

#include <IE.au3>
_IETableWriteToArray ( ByRef $o_object [, $f_transpose] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Table object
$f_transpose | [optional] Boolean value specifying whether to swap the rows and columns in the output array

Return Value

Success: | Returns a 2-dimensional array containing the contents of the Table
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

When table cells span multiple columns or rows, blank array elements are added to properly align the results. Data in spanning cells will be in the left or uppermost array elements.

Tables are often nested in HTML documents. If all of your data is unexpectedly returned in a single array element, you may need to reference a more deeply nested table to this function.

Related

_IETableGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the table example, get a reference to the second table
; on the page (index 1) and read its contents into a 2-D array
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE, 1)
$aTableData = _IETableWriteToArray ($oTable)

; *******************************************************
; Example 2 - Same as Example 1, except transpose the output array and display
; the results with _ArrayDisplay()
; *******************************************************
;
#include <IE.au3>
#include <Array.au3>
$oIE = _IE_Example ("table")
$oTable = _IETableGetCollection ($oIE, 1)
$aTableData = _IETableWriteToArray ($oTable, True)
_ArrayDisplay($aTableData)


Function _IETagNameAllGetCollection

Function Reference

_IETagNameAllGetCollection

Returns a collection object all elements in the document or document hierarchy in source order or a single element by index.

#include <IE.au3>
_IETagNameAllGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the Tag collection, @EXTENDED = Tag count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The DOM is hierarchical, so if the object passed is the document object, all elements in the document are returned. If the object passed in is an object inside the document (e.g. a TABLE object), then only the elements inside that object are returned.

Related

_IETagNameGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the basic example, get the collection
; of all elements and display the tagname and innerText of each
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Next


Function _IETagNameGetCollection

Function Reference

_IETagNameGetCollection

Returns a collection object of all elements in the object with the specified TagName or a single element by index.

#include <IE.au3>
_IETagNameGetCollection ( ByRef $o_object, $s_TagName [, $i_index = -1] )

Parameters

$o_object | Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM
$s_TagName | TagName of collection to return (e.g. IMG, TR etc.)
$i_index | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection

Return Value

Success: | Returns an object variable containing the specified Tag collection, @EXTENDED = specified Tag count
Failure: | Returns 0 and sets @ERROR
@Error: | 0 ($_IEStatus_Success) = No Error
 | 3 ($_IEStatus_InvalidDataType) = Invalid Data Type
 | 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
 | 5 ($_IEStatus_InvalidValue) = Invalid Value
 | 7 ($_IEStatus_NoMatch) = No Match
@Extended: | Contains invalid parameter number

Remarks

The DOM is hierarchical, so if the object passed is the document object, the specified elements in the document are returned. If the object passed is an object inside the document (e.g. a TABLE object), then only the specified elements inside that object are returned.

Related

_IETagNameAllGetCollection

Example

; *******************************************************
; Example 1 - Open a browser with the form example, get the collection
; of all INPUT tags and display the formname and type of each
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("form")
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
MsgBox(0, "Form Input Type", "Form: " & $oInput.form.name & " Type: " & $oInput.type)
Next


User Defined Functions

Inet user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Inet.au3>.

User Defined Function | Description
_GetIP | Get public IP address of a network/computer.
_INetExplorerCapable | Converts a string to IE(Internet Explorer) capable line
_INetGetSource | Gets the source from an URL without writing a temp file.
_INetMail | Opens default user's mail client with given address, subject, and body.
_INetSmtpMail | Sends an email without using an external email program.
_TCPIpToName | Resolves IP adress to Hostname(s)


Function _GetIP

Function Reference

_GetIP

Get public IP address of a network/computer.

#include <INet.au3>
_GetIP ( )

Parameters

None

Return Value

Success: | Returns the public IP Address
Failure: | Returns -1 and sets @ERROR = 1

Remarks

This only returns the Public IP address of a computer or network (i.e. the public IP on the WAN link of your NAT router). The address is determined by accessing an external IP discovery web site like checkip.dyndns.org or www.whatismyip.com.

Related

None.

Example

#include <Inet.au3>
$PublicIP = _GetIP()
MsgBox(0, "IP Address", "Your IP Address is: " & $PublicIP)


Function _INetExplorerCapable

Function Reference

_INetExplorerCapable

Converts a string to IE(Internet Explorer) capable line

#include <INet.au3>
_INetExplorerCapable ( $s_IEString )

Parameters

$s_IEString String to be converted

Return Value

Success: | Converted string
Failure: | Blank string and @error = 1

Remarks

This converts IE uncapable characters to '%' and their hex value

Related

None.

Example

#include <INet.au3>

MsgBox(0, "", _INetExplorerCapable(InputBox("", "Enter a string to convert into browser readable text")))


Function _INetGetSource

Function Reference

_INetGetSource

Gets the source from an URL without writing a temp file.

#include <INet.au3>
_INetGetSource ( $s_URL )

Parameters

$s_URL | (The URL of the site.) eg 'www.autoitscript.com'
$bString | [optional] If True the data is returned in string format, otherwise binary format.

Return Value

Remarks

None.

Related

INetGet, _IEDocReadHTML

Example

#include <INet.au3>
ConsoleWrite(_INetGetSource('http://www.autoitscript.com'))


Function _INetMail

Function Reference

_INetMail

Opens default user's mail client with given address, subject, and body.

#include <INet.au3>
_INetMail ( $s_MailTo, $s_MailSubject, $s_MailBody )

Parameters

$s_MailTo | Address for the E-Mail
$s_MailSubject | Subject for the E-Mail
$s_MailBody | Body for the E-Mail

Return Value

Success: | Process identifier for the E-Mail client
Failure: | Returns 0 and sets @error to non-zero.

Remarks

None.

Related

_INetSmtpMail

Example

#include <INet.au3>

$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $body))


Function _INetSmtpMail

Function Reference

_INetSmtpMail

Sends an email without using an external email program.

#include <INet.au3>
_INetSmtpMail ( $s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress [,$s_Subject [,$as_Body [,$s_helo [,$s_first [,$b_trace]]]]])

Parameters

$s_SmtpServer | Smtp server the eMail is to be sent though May be either alpha or a numeric IP address. In order to fight spam, many ISPs require this to be their server. eg "smtp.ispdomain.com", "mail.ispdomain.com" or "192.168.1.1"
$s_FromName | The name you wish the message to appear to be sent from. eg "Bob Smith"
$s_FromAddress | The email address you wish the message to appear to be sent from. eg "bob.smith@mydomain.com".
$s_ToAddress | The email address the message is to go to. eg "jane.brown@yourdomain.com"
$s_Subject | [optional] The subject of the email.
$as_Body | [optional] The body of the email as a single dimensional array of strings. Each value in the array will be terminated with a @CRLF in the email.
$s_helo | [optional] identifier for the smtp server connection (by default @ComputerName). If Smtp server require a "EHLO" string just set the string to "EHLO " & @ComputerName.
$s_first | [optional] string sent before helo for the smtp server connection (by default {SPACE}). To not send any character this parameter must equal -1, some SMTP server required it.
$b_trace | [optional] trace the dialog in a splash window

Return Value

Success: | Returns 1
Failure: | Returns 0 and set @error
@error: | 1 - Invalid Parameters
 | 2 - Unable to start TCP
 | 3 - Unable to resolve IP
 | 4 - Unable to create socket
 | 5x - Cannot open SMTP session. x indicates the index number of last command issued to the SMTP server.
 | 50x - Cannot send body. x indicates the line number of $as_Body (first line is 0).
 | 5000 - Cannot close SMTP session

Remarks

This function sends a email directly through an SMTP server without the use of a third party email client. Requires AutoIt3 v 3.1.1.97 or better.

Related

_INetMail

Example

#include <INet.au3>

$s_SmtpServer = "mysmtpserver.com.au"
$s_FromName = "My Name"
$s_FromAddress = "From eMail Address"
$s_ToAddress = "To eMail Address"
$s_Subject = "My Test UDF"
Dim $as_Body[2]
$as_Body[0] = "Testing the new email udf"
$as_Body[1] = "Second Line"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
$err = @error
If $Response = 1 Then
MsgBox(0, "Success!", "Mail sent")
Else
MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf


Function _TCPIpToName

Function Reference

_TCPIpToName

Resolves IP adress to Hostname(s)

#include <iNet.au3>
_TCPIpToName ( $sIp [,$iOption = 0 [, $hDll_Ws2_32 = "Ws2_32.dll" ]] )

Parameters

$sIp | Ip Adress in dotted (v4) Format
$iOption | [optional] Default = 0 0 = Return String Hostname 1 = Return Array (see Remarks)
$hDll_Ws2_32 | [optional] Handle to Ws2_32.dll

Return Value

Success: | Hostname or Array (see Remarks)
Failure: | ""
@Error: | 0 = No error.
 | 1 = inet_addr DllCall Failed
 | 2 = inet_addr Failed
 | 3 = gethostbyaddr DllCall Failed
 | 4 = gethostbyaddr Failed, WSAGetLastError = @Extended
 | 5 = gethostbyaddr Failed, WSAGetLastError Failed
 | 6 = strlen/sZStringRead Failed
 | 7 = Error reading Aliases Array

Remarks

A successfull WSAStartup (Done by TCPStartup) is required.
if $iOption = 1 then the returned Array looks Like this:
$aResult[0] = Number of elements
$aResult[1] = "Hostname"
$aResult[2] = "Alias 1"
$aResult[3] = "Alias 2"
...

Related

TCPStartup, TCPNameToIP

Example

; Example 1
#include <inet.au3>
Dim $sResult, $sIp
TCPStartup()
$sIp = TCPNameToIP("hiddensoft.com")
$sResult = _TCPIpToName ($sIp)
If @error Then
MsgBox(0, "_TCPIpToName()", "@error = " & @error & @LF & "@extended = " & @extended)
Else
MsgBox(0, "hiddensoft.com realy is:", $sResult)
EndIf

; Example 2
#include <array.au3>
#include <inet.au3>
Dim $aResult, $sIp
TCPStartup()
$sIp = _GetIP()
$aResult = _TCPIpToName ($sIp, 1)
If @error Then
MsgBox(0, "_TCPIpToName()", "@error = " & @error & @LF & "@extended = " & @extended)
Else
_ArrayDisplay($aResult, "Local Hostname(s)")
EndIf


User Defined Functions

Math user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Math.au3>.

User Defined Function | Description
_Degree | Converts radians to degrees.
_MathCheckDiv | Checks if NumA is divisable by NumB
_Max | Evaluates which of the two numbers is higher.
_Min | Evaluates which of the two numbers is lower.
_Radian | Converts degrees to radians.


Function _Degree

Function Reference

_Degree

Converts radians to degrees.

#include <Math.au3>
_Degree ( $nRadians )

Parameters

$nRadians Radians to be converted into degrees.

Return Value

Success: | Degrees converted from radians.
Failure: | Blank string and @error set to 1.

Remarks

Can be used in conjunction with the Sin(), Cos(), and Tan() functions.

Related

_Radian, Sin, Cos, Tan, ASin, ACos, ATan

Example

#include <Math.au3>

$radians = 3.14159265358979
$degrees = _Degree($radians)

MsgBox(0, "Radians to Degrees", $radians & " radians = " & $degrees & " degrees")


Function _MathCheckDiv

Function Reference

_MathCheckDiv

Checks if NumA is divisable by NumB

#include <Math.au3>
_MathCheckDiv ( $i_NumA, $i_NumB )

Parameters

$i_NumA | Number to check
$i_NumB | Number to divide by

Return Value

Success: | Returns 1 for not divisable,
 | 2 for divisable.
Failure: | Returns -1 and @error = 1 if not valid numbers.

Remarks

This function will also enable checking if a number is even/odd by making the second parameter = 2

Related

None.

Example

#include <math.au3>
$I_Var = InputBox('Odd or Even', 'Enter a number:')
$I_Result = _MathCheckDiv($I_Var, 2)
If $I_Result = -1 Or @error = 1 Then
MsgBox(0,'','You did not enter a valid number')
ElseIf $I_Result = 1 Then
MsgBox(0,'','Number is odd')
ElseIf $I_Result = 2 Then
MsgBox(0,'','Number is even')
Else
MsgBox(0,'','Could not parse $I_Result')
EndIf


Function _Max

Function Reference

_Max

Evaluates which of the two numbers is higher.

#include <Math.au3>
_Max ( $nNum1, $nNum2 )

Parameters

$nNum1 | First number.
$nNum2 | Second number.

Return Value

Success: | Returns the higher of the two numbers.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $nNum1 isn't a number.
 | 2 = $nNum2 isn't a number.

Remarks

This function works with floats as well as integers.

Related

_Min

Example

#include <Math.au3>

$x = _Max(25, 10) ; returns 25


Function _Min

Function Reference

_Min

Evaluates which of the two numbers is lower.

#include <Math.au3>
_Min ( $nNum1, $nNum2 )

Parameters

$nNum1 | First number.
$nNum2 | Second number.

Return Value

Success: | Returns the lower of the two numbers.
Failure: | Returns 0.
@Error: | 0 = No error.
 | 1 = $nNum1 isn't a number.
 | 2 = $nNum2 isn't a number.

Remarks

This function works with floats as well as integers.

Related

_Max

Example

#include <Math.au3>

$x = _Min(25, 10) ; returns 10


Function _Radian

Function Reference

_Radian

Converts degrees to radians.

#include <Math.au3>
_Radian ( $nDegrees )

Parameters

$nDegrees Degrees to be converted into radians.

Return Value

Success: | Radians converted from degrees.
Failure: | Blank string and @error set to 1

Remarks

Can be used in conjunction with the Sin(), Cos(), and Tan() functions.

Related

_Degree, Sin, Cos, Tan, ASin, ACos, ATan

Example

#include <Math.au3>

$degrees = 35
$radians = _Radian($degrees)

MsgBox(0, "Degrees to Radians", $degrees & " degrees = " & $radians & " radians")


User Defined Functions

Memory user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Memory.au3>.

User Defined Function | Description
_MemGlobalAlloc | Allocates the specified number of bytes from the heap
_MemGlobalFree | Frees the specified global memory object and invalidates its handle
_MemGlobalLock | Locks a global memory object and returns a pointer to the first byte of the object's memory block
_MemGlobalSize | Retrieves the current size of the specified global memory object
_MemGlobalUnlock | Decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE
_MemMoveMemory | Moves memory either forward or backward, aligned or unaligned
_MemVirtualAlloc | Reserves or commits a region of pages in the virtual address space of the calling process
_MemVirtualAllocEx | Reserves a region of memory within the virtual address space of a specified process
_MemVirtualFree | Releases a region of pages within the virtual address space of a process
_MemVirtualFreeEx | Releases a region of pages within the virtual address space of a process


Function _MemGlobalAlloc

Function Reference

_MemGlobalAlloc

Allocates the specified number of bytes from the heap

#Include <Memory.au3>
_MemGlobalAlloc($iBytes[, $iFlags = 0])

Parameters

$iBytes | The number of bytes to allocate. If this parameter is zero and the $iFlags parameter specifies $GMEM_MOVEABLE, the function returns a handle to a memory object that is marked as discarded.
$iFlags | [optional] The memory allocation attributes: $GMEM_FIXED - Allocates fixed memory. The return value is a pointer. $GMEM_MOVEABLE - Allocates movable memory. Memory blocks are never moved in physical memory, but they can be moved within the default heap. The return value is a handle to the memory object. To translate the handle into a pointer, use the _MemGlobalLock function. This value cannot be combined with $GMEM_FIXED. $GMEM_ZEROINIT - Initializes memory contents to zero $GHND - Combines $GMEM_MOVEABLE and $GMEM_ZEROINIT $GPTR - Combines $GMEM_FIXED and $GMEM_ZEROINIT

Return Value

Success: | Handle to the newly allocated memory object
Failure: | 0

Remarks

Windows memory management does not provide a separate local heap and global heap. If this function succeeds,
it allocates at least the amount of memory requested. If the actual amount allocated is greater than the
amount requested, the process can use the entire amount. To determine the actual number of bytes allocated,
use the _MemGlobalSize function. If the heap does not contain sufficient free space to satisfy the request,
this function returns NULL. Memory allocated with this function is guaranteed to be aligned on an 8 byte
boundary. To execute dynamically generated code, use the _MemVirtualAlloc function to allocate memory and the
_Mem_VirtualProtect function to grant $PAGE_EXECUTE access. To free the memory, use the _MemGlobalFree
function.

Related

_MemGlobalLock, _MemGlobalSize, _MemVirtualAlloc, _MemGlobalFree

See Also

Search GlobalAlloc in MSDN Library


Function _MemGlobalFree

Function Reference

_MemGlobalFree

Frees the specified global memory object and invalidates its handle

#Include <Memory.au3>
_MemGlobalFree($hMem)

Parameters

$hMem Handle to the global memory object

Return Value

Success: | 0
Failure: | $hMem

Remarks

None.

Related

_MemGlobalAlloc

See Also

Search GlobalFree in MSDN Library


Function _MemGlobalLock

Function Reference

_MemGlobalLock

Locks a global memory object and returns a pointer to the first byte of the object's memory block

#Include <Memory.au3>
_MemGlobalLock($hMem)

Parameters

$hMem Handle to the global memory object

Return Value

Success: | Pointer to the first byte of the memory block
Failure: | 0

Remarks

None.

Related

_MemGlobalUnlock, _MemGlobalAlloc

See Also

Search GlobalLock in MSDN Library


Function _MemGlobalSize

Function Reference

_MemGlobalSize

Retrieves the current size of the specified global memory object

#Include <Memory.au3>
_MemGlobalSize($hMem)

Parameters

$hMem Handle to the global memory object

Return Value

Success: | size of the specified global memory object, in bytes
Failure: | 0

Remarks

None.

Related

_MemGlobalAlloc

See Also

Search GlobalSize in MSDN Library


Function _MemGlobalUnlock

Function Reference

_MemGlobalUnlock

Decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE

#Include <Memory.au3>
_MemGlobalUnlock($hMem)

Parameters

$hMem Handle to the global memory object

Return Value

None.

Remarks

None.

Related

_MemGlobalLock

See Also

Search GlobalUnlock in MSDN Library


Function _MemMoveMemory

Function Reference

_MemMoveMemory

Moves memory either forward or backward, aligned or unaligned

#Include <Memory.au3>
_MemMoveMemory($pSource, $pDest, $iLength)

Parameters

$pSource | Pointer to the source of the move
$pDest | Pointer to the destination of the move
$iLength | Specifies the number of bytes to be copied

Return Value

None.

Remarks

None.

Related

See Also

Search RtlMoveMemory in MSDN Library


Function _MemVirtualAlloc

Function Reference

_MemVirtualAlloc

Reserves or commits a region of pages in the virtual address space of the calling process

#Include <Memory.au3>
_MemVirtualAlloc($pAddress, $iSize, $iAllocation, $iProtect)

Parameters

$pAddress | Specifies the desired starting address of the region to allocate
$iSize | Specifies the size, in bytes, of th region
$iAllocation | Specifies the type of allocation: $MEM_COMMIT - Allocates physical storage in memory or in the paging file on disk for the specified region of pages. $MEM_RESERVE - Reserves a range of the process's virtual address space without allocating any physical storage. $MEM_TOP_DOWN - Allocates memory at the highest possible address
$iProtect | Type of access protection: $PAGE_READONLY - Enables read access to the committed region of pages $PAGE_READWRITE - Enables read and write access to the committed region $PAGE_EXECUTE - Enables execute access to the committed region $PAGE_EXECUTE_READ - Enables execute and read access to the committed region $PAGE_EXECUTE_READWRITE - Enables execute, read, and write access to the committed region of pages $PAGE_GUARD - Pages in the region become guard pages $PAGE_NOACCESS - Disables all access to the committed region of pages $PAGE_NOCACHE - Allows no caching of the committed regions of pages

Return Value

Success: | Memory address pointer
Failure: | 0

Remarks

None.

Related

_MemVirtualFree, _MemGlobalAlloc

See Also

Search VirtualAlloc in MSDN Library


Function _MemVirtualAllocEx

Function Reference

_MemVirtualAllocEx

Reserves a region of memory within the virtual address space of a specified process

#Include <Memory.au3>
_MemVirtualAllocEx($hProcess, $pAddress, $iSize, $iAllocation, $iProtect)

Parameters

$hProcess | Handle to process
$pAddress | Specifies the desired starting address of the region to allocate
$iSize | Specifies the size, in bytes, of th region
$iAllocation | Specifies the type of allocation: $MEM_COMMIT - Allocates physical storage in memory or in the paging file on disk for the specified region of pages. $MEM_RESERVE - Reserves a range of the process's virtual address space without allocating any physical storage. $MEM_TOP_DOWN - Allocates memory at the highest possible address
$iProtect | Type of access protection: $PAGE_READONLY - Enables read access to the committed region of pages $PAGE_READWRITE - Enables read and write access to the committed region $PAGE_EXECUTE - Enables execute access to the committed region $PAGE_EXECUTE_READ - Enables execute and read access to the committed region $PAGE_EXECUTE_READWRITE - Enables execute, read, and write access to the committed region of pages $PAGE_GUARD - Pages in the region become guard pages $PAGE_NOACCESS - Disables all access to the committed region of pages $PAGE_NOCACHE - Allows no caching of the committed regions of pages

Return Value

Returns a Memory address pointer

Remarks

None.

Related

_MemVirtualFreeEx

See Also

Search VirtualAllocEx in MSDN Library


Function _MemVirtualFree

Function Reference

_MemVirtualFree

Releases a region of pages within the virtual address space of a process

#Include <Memory.au3>
_MemVirtualFree($pAddress, $iSize, $iFreeType)

Parameters

$pAddress | Points to the base address of the region of pages to be freed
$iSize | Specifies the size, in bytes, of the region to be freed
$iFreeType | Specifies the type of free operation: $MEM_DECOMMIT - Decommits the specified region of committed pages $MEM_RELEASE - Releases the specified region of reserved pages

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_MemVirtualAlloc

See Also

Search VirtualFree in MSDN Library


Function _MemVirtualFreeEx

Function Reference

_MemVirtualFreeEx

Releases a region of pages within the virtual address space of a process

#Include <Memory.au3>
_MemVirtualFreeEx($hProcess, $pAddress, $iSize, $iFreeType)

Parameters

$hProcess | Handle to a process
$pAddress | A pointer to the starting address of the region of memory to be freed
$iSize | The size of the region of memory to free, in bytes
$iFreeType | Specifies the type of free operation: $MEM_DECOMMIT - Decommits the specified region of committed pages $MEM_RELEASE - Releases the specified region of reserved pages

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_MemVirtualAllocEx

See Also

Search VirtualFreeEx in MSDN Library


User Defined Functions

Misc user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Misc.au3>.

User Defined Function | Description
_ChooseColor | Creates a Color dialog box that enables the user to select a color
_ChooseFont | Creates a Font dialog box that enables the user to choose attributes for a logical font.
_ClipPutFile | Copy Files to Clipboard Like Explorer does
_Iif | Perform a boolean test within an expression.
_IsPressed | Check if key has been pressed
_MouseTrap | Confine the Mouse Cursor to specified coords.
_Singleton | Enforce a design paradigm where only one instance of the script may be running.
_VersionCompare | Compares two file versions for equality


Function _ChooseColor

Function Reference

_ChooseColor

Creates a Color dialog box that enables the user to select a color

#Include <Misc.au3>
_ChooseColor([$iReturnType = 0 [, $iColorRef = 0 [, $iRefType = 0 [, $hWndOwnder = 0]]]])

Parameters

$iReturnType | [optional] Determines return type, valid values: 0 - COLORREF rgbcolor 1 - BGR hex 2 - RGB hex
$iColorRef | [optional] Default selected Color
$iRefType | [optional] Type of $iColorRef passed in, valid values: 0 - COLORREF rgbcolor 1 - BGR hex 2 - RGB hex
$hWndOwnder | [optional] Handle to the window that owns the dialog box

Return Value

Success: | Color returned
Failure: | -1

Remarks

None.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>

Opt('MustDeclareVars', 1)

_Color_Example()

Func _Color_Example()
Local $GUI, $Btn_COLORREF, $Btn_BGR, $Btn_RGB, $iMemo

$GUI = GUICreate("_ChooseColor() Example", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL))
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")
$Btn_COLORREF = GUICtrlCreateButton("COLORREF", 70, 10, 80, 40)
$Btn_BGR = GUICtrlCreateButton("BGR", 160, 10, 80, 40)
$Btn_RGB = GUICtrlCreateButton("RGB", 250, 10, 80, 40)
GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $Btn_COLORREF
_ShowChoice($GUI, $iMemo, 0, _ChooseColor(0, 255, 0, $GUI), "COLORREF color of your choice: ")
Case $Btn_BGR
_ShowChoice($GUI, $iMemo, 1, _ChooseColor(2, 0x808000, 1, $GUI), "BGR Hex color of your choice: ")
Case $Btn_RGB
_ShowChoice($GUI, $iMemo, 2, _ChooseColor(2, 0x0080C0, 2, $GUI), "RGB Hex color of your choice: ")
EndSwitch
WEnd
EndFunc ;==>_Color_Example

Func _ShowChoice($GUI, $iMemo, $Type, $Choose, $sMessage)
Local $cr
If $Choose <> -1 Then

If $Type = 0 Then ; convert COLORREF to RGB for this example
$cr = Hex($Choose, 6)
GUISetBkColor('0x' & StringMid($cr, 5, 2) & StringMid($cr, 3, 2) & StringMid($cr, 1, 2), $GUI)
Else
GUISetBkColor($Choose, $GUI)
EndIf

GUICtrlSetData($iMemo, $sMessage & $Choose & @CRLF, 1)

Else
GUICtrlSetData($iMemo, "User Canceled Selction" & @CRLF, 1)
EndIf
EndFunc ;==>_ShowChoice


Function _ChooseFont

Function Reference

_ChooseFont

Creates a Font dialog box that enables the user to choose attributes for a logical font.

#Include <Misc.au3>
_ChooseFont([$sFontName = "Courier New" [, $iPointSize = 10 [, $iColorRef = 0 [, $iFontWeight = 0 [, $iItalic = False [, $iUnderline = False [, $iStrikethru = False [, $hWndOwner = 0]]]]]]]])

Parameters

$sFontName | [optional] Default font name
$iPointSize | [optional] Pointsize of font
$iColorRef | [optional] COLORREF rgbColors
$iFontWeight | [optional] Font Weight
$iItalic | [optional] Italic
$iUnderline | [optional] Underline
$iStrikethru | [optional] Strikethru
$hWndOwner | [optional] Handle to the window that owns the dialog box

Return Value

Success: | Array in the following format:
 | [0] - contains the number of elements
 | [1] - attributes = BitOr of italic:2, undeline:4, strikeout:8
 | [2] - fontname
 | [3] - font size = point size
 | [4] - font weight = = 0-1000
 | [5] - COLORREF rgbColors
 | [6] - Hex BGR Color
 | [7] - Hex RGB Color
Failure: | -1

Remarks

None.

Related

Example

#include <Misc.au3>

Local $a_font

; Example 1
$a_font = _ChooseFont("Arial", 8)
If (@error) Then
MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf

; Example 2
$a_font = _ChooseFont()
If (@error) Then
MsgBox(0, "", "Error _ChooseFont: " & @error)
Exit
Else
MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf

; Example 3
Local $FontName = $a_font[2]
Local $FontSize = $a_font[3]
Local $ColorRef = $a_font[5]
Local $FontWeight = $a_font[4]
Local $Italic = BitAND($a_font[1], 2)
Local $Underline = BitAND($a_font[1], 4)
Local $Strikethru = BitAND($a_font[1], 8)
$a_font = _ChooseFont($FontName, $FontSize, $ColorRef, $FontWeight, $Italic, $Underline, $Strikethru)
If (@error) Then
MsgBox(0, "", "Error _ChooseFont: " & @error)
Else
MsgBox(0, "", "Font Name: " & $a_font[2] & @LF & "Size: " & $a_font[3] & @LF & "Weight: " & $a_font[4] & @LF & "COLORREF rgbColors: " & $a_font[5] & @LF & "Hex BGR Color: " & $a_font[6] & @LF & "Hex RGB Color: " & $a_font[7])
EndIf


Function _ClipPutFile

Function Reference

_ClipPutFile

Copy Files to Clipboard Like Explorer does

#Include <Misc.au3>
_ClipPutFile($sFile [, $sSeparator = "|"])

Parameters

$sFile | Full Path to File(s)
$sSeparator | [optional] Separator for multiple Files, Default = '|'

Return Value

Success: | True
Failure: | False and set @error
@error: | 1 - Unable to Open Clipboard
 | 2 - Unable to Empty Cipboard
 | 3 - GlobalAlloc Failed
 | 4 - GlobalLock Failed
 | 5 - Unable to Create H_DROP
 | 6 - Unable to Update Clipboard
 | 7 - Unable to Close Clipboard
 | 8 - GlobalUnlock Failed

Remarks

None.

Related

Example

#include <Misc.au3>
Local $fTest
$fTest = _ClipPutFile(@ScriptFullPath & "|" & @ScriptDir & "|" & @SystemDir)
If Not $fTest Then
MsgBox(0,"_ClipPutFile() call Failed","@error = " & @error)
Else
MsgBox(0,"_ClipPutFile()","Content of Clipboard:" & @CRLF & ClipGet())
EndIf


Function _Iif

Function Reference

_Iif

Perform a boolean test within an expression.

#Include <Misc.au3>
_Iif($fTest, $vTrueVal, $vFalseVal)

Parameters

$fTest | Boolean test.
$vTrueVal | Value to return if $fTest is true.
$vFalseVal | Value to return if $fTest is false.

Return Value

Success: | True: $vTrueVal
Failure: | False: $vFalseVal

Remarks

None.

Related

Example

#include <Misc.au3>

Dim $i_Count, $i_Index

For $i_Index = 1 To 2
MsgBox(4096, "Count", "This dialog has displayed " & String($i_Index) & _
" time" & _Iif($i_Index > 1, "s", "") & " so far")
Next

Exit


Function _IsPressed

Function Reference

_IsPressed

Check if key has been pressed

#Include <Misc.au3>
_IsPressed($sHexKey [, $vDLL = 'user32.dll'])

Parameters

$sHexKey | Key to check for
$vDLL | [optional] Handle to dll or default to user32.dll

Return Value

True: | 1
False: | 0

Remarks

If calling this function repeatidly, should open 'user32.dll' and pass in handle.
Make sure to close at end of script
01 Left mouse button
02 Right mouse button
04 Middle mouse button (three-button mouse)
05 Windows 2000/XP: X1 mouse button
06 Windows 2000/XP: X2 mouse button
08 BACKSPACE key
09 TAB key
0C CLEAR key
0D ENTER key
10 SHIFT key
11 CTRL key
12 ALT key
13 PAUSE key
14 CAPS LOCK key
1B ESC key
20 SPACEBAR
21 PAGE UP key
22 PAGE DOWN key
23 END key
24 HOME key
25 LEFT ARROW key
26 UP ARROW key
27 RIGHT ARROW key
28 DOWN ARROW key
29 SELECT key
2A PRINT key
2B EXECUTE key
2C PRINT SCREEN key
2D INS key
2E DEL key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
5B Left Windows key
5C Right Windows key
60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
6A Multiply key
6B Add key
6C Separator key
6D Subtract key
6E Decimal key
6F Divide key
70 F1 key
71 F2 key
72 F3 key
73 F4 key
74 F5 key
75 F6 key
76 F7 key
77 F8 key
78 F9 key
79 F10 key
7A F11 key
7B F12 key
7C-7F F13 key - F16 key
80H-87H F17 key - F24 key
90 NUM LOCK key
91 SCROLL LOCK key
A0 Left SHIFT key
A1 Right SHIFT key
A2 Left CONTROL key
A3 Right CONTROL key
A4 Left MENU key
A5 Right MENU key
BA ;
BB =
BC ,
BD -
BE .
BF /
C0 `
DB [
DC \
DD ]

Related

Example

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1
Sleep ( 250 )
If _IsPressed("23", $dll) Then
MsgBox(0,"_IsPressed", "End Key Pressed")
ExitLoop
EndIf
WEnd
DllClose($dll)


Function _MouseTrap

Function Reference

_MouseTrap

Confine the Mouse Cursor to specified coords.

#Include <Misc.au3>
_MouseTrap([$iLeft = 0 [, $iTop = 0 [, $iRight = 0 [, $iBottom = 0]]]])

Parameters

$iLeft | [optional] Left coord
$iTop | [optional] Top coord
$iRight | [optional] Right coord
$iBottom | [optional] Bottom coord

Return Value

Success: | True
Failure: | False

Remarks

Use _MouseTrap() with no params to release the Mouse Cursor

Related

Example

#include <GuiConstantsEx.au3>
#include <Misc.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $GUI, $coords[4]

$GUI = GUICreate("Mouse Trap Example", 392, 323)

GUISetState()

While 1
$coords = WinGetPos($GUI)
_MouseTrap($coords[0], $coords[1], $coords[0] + $coords[2], $coords[1] + $coords[3])
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;
EndSwitch
WEnd
_MouseTrap()
Exit
EndFunc ;==>_Main


Function _Singleton

Function Reference

_Singleton

Enforce a design paradigm where only one instance of the script may be running.

#Include <Misc.au3>
_Singleton($sOccurenceName [, $iFlag = 0])

Parameters

$sOccurenceName | String to identify the occurrence of the script. This string may not contain the \ character unless you are placing the object in a namespace (See Remarks).
$iFlag | [optional] Behavior options. 0 - Exit the script with the exit code -1 if another instance already exists. 1 - Return from the function without exiting the script. 2 - Allow the object to be accessed by anybody in the system. This is useful if specifying a "Global\" object in a multi-user environment.

Return Value

Success: | The handle to the object used for synchronization (a mutex).
Failure: | 0

Remarks

You can place the object in a namespace by prefixing your object name with either "Global\" or "Local\". "Global\" objects combined with the flag 2 are useful in multi-user environments.

Related

Example

#include <Misc.au3>
if _Singleton("test",1) = 0 Then
Msgbox(0,"Warning","An occurence of test is already running")
Exit
EndIf
Msgbox(0,"OK","the first occurence of test is running")


Function _VersionCompare

Function Reference

_VersionCompare

Compares two file versions for equality

#Include <Misc.au3>
_VersionCompare($sVersion1, $sVersion2)

Parameters

$sVersion1 | IN - The first version
$sVersion2 | IN - The second version

Return Value

Success: | Following Values:
 | 0 - Both versions equal
 | 1 - Version 1 greater
 | -1 - Version 2 greater
Failure: | @error will be set in the event of a catasrophic error

Remarks

This will try to use a numerical comparison but fall back on a lexicographical comparison.
See @extended for details about which type was performed.

Related


User Defined Functions

NamedPipes user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <NamedPipes.au3>.

User Defined Function | Description
_NamedPipes_CallNamedPipe | Performs a read/write operation on a named pipe
_NamedPipes_ConnectNamedPipe | Enables a named pipe server process to wait for a client process to connect
_NamedPipes_CreateNamedPipe | Creates an instance of a named pipe
_NamedPipes_CreatePipe | Creates an anonymous pipe
_NamedPipes_DisconnectNamedPipe | Disconnects the server end of a named pipe instance from a client process
_NamedPipes_GetNamedPipeHandleState | Retrieves information about a specified named pipe
_NamedPipes_GetNamedPipeInfo | Retrieves information about the specified named pipe
_NamedPipes_PeekNamedPipe | Copies data from a pipe into a buffer without removing it from the pipe
_NamedPipes_SetNamedPipeHandleState | Sets the read mode and the blocking mode of the specified named pipe
_NamedPipes_TransactNamedPipe | Reads and writes to a named pipe in one network operation
_NamedPipes_WaitNamedPipe | Waits for an instance of a named pipe to become available


Function _NamedPipes_CallNamedPipe

Function Reference

_NamedPipes_CallNamedPipe

Performs a read/write operation on a named pipe

#Include <NamedPipes.au3>
_NamedPipes_CallNamedPipe($sPipeName, $pInpBuf, $iInpSize, $pOutBuf, $iOutSize, ByRef $iRead[, $iTimeOut = 0])

Parameters

$sPipeName | Pipe name
$pInpBuf | Pointer to the buffer containing the data written to the pipe
$iInpSize | Size of the write buffer, in bytes
$pOutBuf | Pointer to the buffer that receives the data read from the pipe
$iOutSize | Size of the read buffer, in bytes
$iRead | On return, contains the number of bytes read from the pipe
$iTimeOut | [optional] Number of milliseconds to wait for the named pipe to be available. In addition to numeric values, the following special values can be specified: -1 - Wait indefinitely 0 - Uses the default time-out specified in the call to the CreateNamedPipe 1 - Do not wait. If the pipe is not available, return an error

Return Value

Success: | True
Failure: | False

Remarks

Calling CallNamedPipe is equivalent to calling the CreateFile (or WaitNamedPipe, if CreateFile cannot open
the pipe immediately), TransactNamedPipe, and CloseHandle functions. CreateFile is called with an access flag
of GENERIC_READ | GENERIC_WRITE, and an inherit handle flag of False. CallNamedPipe fails if the pipe is a
byte-type pipe.

Related

_NamedPipes_WaitNamedPipe, _NamedPipes_TransactNamedPipe

See Also

Search CallNamedPipe in MSDN Library


Function _NamedPipes_ConnectNamedPipe

Function Reference

_NamedPipes_ConnectNamedPipe

Enables a named pipe server process to wait for a client process to connect

#Include <NamedPipes.au3>
_NamedPipes_ConnectNamedPipe($hNamedPipe[, $pOverlapped = 0])

Parameters

$hNamedPipe | Handle to the server end of a named pipe instance
$pOverlapped | [optional] Pointer to a $tagOVERLAPPED structure. If hNamedPipe was opened with $FILE_FLAG_OVERLAPPED, pOverlapped must not be 0. If hNamedPipe was created with $FILE_FLAG_OVERLAPPED and pOverlapped is not 0, the $tagOVERLAPPED structure should contain a handle to a manual reset event object. If hNamedPipe was not opened with $FILE_FLAG_OVERLAPPED, the function does not return until a client is connected or an error occurs. Successful synchronous operations result in the function returning a nonzero value if a client connects after the function is called.

Return Value

Success: | True
Failure: | False

Remarks

If a client connects before the function is called, the function returns zero and GetLastError will return
ERROR_PIPE_CONNECTED. This can happen if a client connects in the interval between the call to CreateNamedPipe
and the call to ConnectNamedPipe. In this situation, there is a good connection between client and server even
though the function returns zero.

Related

_NamedPipes_CreateNamedPipe, $tagOVERLAPPED

See Also

Search ConnectNamedPipe in MSDN Library


Function _NamedPipes_CreateNamedPipe

Function Reference

_NamedPipes_CreateNamedPipe

Creates an instance of a named pipe

#Include <NamedPipes.au3>
_NamedPipes_CreateNamedPipe($sName[, $iAccess = 2[, $iFlags = 2[, $iACL = 0[, $iType = 1[, $iRead = 1[, $iWait = 0[, $iMaxInst = 25[, $iOutBufSize = 4096[, $iInpBufSize = 4096[, $iDefTimeout = 5000[, $pSecurity = 0]]]]]]]]]]])

Parameters

$sName | Pipe name with the following format: \\.\pipe\pipename. The pipename part of the name can include any character other than a backslash, including numbers and special characters. The pipe name string can be up to 256 characters long. Pipe names are not case sensitive.
$iAccess | [optional] The pipe access mode. Must be one of the following: 0 - The flow of data in the pipe goes from client to server only (inbound) 1 - The flow of data in the pipe goes from server to client only (outbound) 2 - The pipe is bi-directional (duplex)
$iFlags | [optional] The pipe flags. Can be any combination of the following: 1 - If you attempt to create multiple instances of a pipe with this flag, creation of the first instance succeeds, but creation of the next instance fails. 2 - Overlapped mode is enabled. If this mode is enabled functions performing read, write, and connect operations that may take a significant time to be completed can return immediately. 4 - Write-through mode is enabled. This mode affects only write operations on byte type pipes and only when the client and server are on different computers.
$iACL | [optional] Security ACL flags. Can be any combination of the following: 1 - The caller will have write access to the named pipe's discretionary ACL 2 - The caller will have write access to the named pipe's owner 4 - The caller will have write access to the named pipe's security ACL
$iType | [optional] Pipe type mode. Must be one of the following: 0 - Data is written to the pipe as a stream of bytes 1 - Data is written to the pipe as a stream of messages
$iRead | [optional] Pipe read mode. Must be one of the following: 0 - Data is read from the pipe as a stream of bytes 1 - Data is read from the pipe as a stream of messages
$iWait | [optional] Pipe wait mode. Must be one of the following: 0 - Blocking mode is enabled. When the pipe handle is specified in ReadFile, WriteFile, or ConnectNamedPipe, the operation is not completed until there is data to read, all data is written, or a client is connected. 1 - Nonblocking mode is enabled. ReadFile, WriteFile, and ConnectNamedPipe always return immediately.
$iMaxInst | [optional] The maximum number of instances that can be created for this pipe
$iOutBufSize | [optional] The number of bytes to reserve for the output buffer
$iInpBufSize | [optional] The number of bytes to reserve for the input buffer
$iDefTimeOut | [optional] The default time out value, in milliseconds
$pSecurity | [optional] A pointer to a tagSECURITY_ATTRIBUTES structure that specifies a security descriptor for the new named pipe and determines whether child processes can inherit the returned handle. If pSecurity is 0, the named pipe gets a default security descriptor and the handle cannot be inherited. The ACLs in the default security descriptor for a named pipe grant full control to the LocalSystem account administrators, and the creator owner. They also grant read access to members of the Everyone group and the anonymous account.

Return Value

Success: | Handle to the server end of a named pipe instance
Failure: | -1

Remarks

None.

Related

_NamedPipes_ConnectNamedPipe, _NamedPipes_CreatePipe

See Also

Search CreateNamedPipe in MSDN Library


Function _NamedPipes_CreatePipe

Function Reference

_NamedPipes_CreatePipe

Creates an anonymous pipe

#Include <NamedPipes.au3>
_NamedPipes_CreatePipe(ByRef $hReadPipe, ByRef $hWritePipe [, $tSecurity = 0 [, $iSize = 0]])

Parameters

$hReadPipe | Variable that receives the read handle for the pipe
$hWritePipe | Variable that receives the write handle for the pipe
$tSecurity | [optional] tagSECURITY_ATTRIBUTES structure that determines if the returned handle can be inherited by child processes. If 0, the handles cannot be inherited.
$iSize | [optional] The size of the buffer for the pipe, in bytes. If 0, the system uses the default buffer size.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_NamedPipes_CreateNamedPipe

See Also

Search CreatePipe in MSDN Library


Function _NamedPipes_DisconnectNamedPipe

Function Reference

_NamedPipes_DisconnectNamedPipe

Disconnects the server end of a named pipe instance from a client process

#Include <NamedPipes.au3>
_NamedPipes_DisconnectNamedPipe($hNamedPipe)

Parameters

$hNamedPipe Handle to the server end of a named pipe instance.

Return Value

Success: | True
Failure: | False

Remarks

If the client end of the named pipe is open, the DisconnectNamedPipe function forces that end of the named
pipe closed. The client receives an error the next time it attempts to access the pipe. A client that is
forced off a pipe must still use the CloseHandle function to close its end of the pipe.

Related

See Also

Search DisconnectNamedPipe in MSDN Library


Function _NamedPipes_GetNamedPipeHandleState

Function Reference

_NamedPipes_GetNamedPipeHandleState

Retrieves information about a specified named pipe

#Include <NamedPipes.au3>
_NamedPipes_GetNamedPipeHandleState($hNamedPipe)

Parameters

$hNamedPipe Handle to the server end of a named pipe instance

Return Value

Success: | Array with the following format:
 | $aState[0] - True if pipe handle is in nonblocking mode, otherwise blocking mode
 | $aState[1] - True if pipe handle is in message-read mode, otherwise byte read mode
 | $aState[2] - Number of current pipe instances
 | $aState[3] - Maximum number of bytes to be collected on the client's computer before transmission
 | $aState[4] - Maximum time, in milliseconds, that can pass before a remote named pipe transfers information | over the network.
 | $aState[5] - User name string associated with the client application. The server can only retrieve this | information if the client opened the pipe with the SECURITY_IMPERSONATION access privilige.
Failure: | Set @error

Remarks

None.

Related

_NamedPipes_SetNamedPipeHandleState

See Also

Search GetNamedPipeHandleState in MSDN Library


Function _NamedPipes_GetNamedPipeInfo

Function Reference

_NamedPipes_GetNamedPipeInfo

Retrieves information about the specified named pipe

#Include <NamedPipes.au3>
_NamedPipes_GetNamedPipeInfo($hNamedPipe)

Parameters

$hNamedPipe Handle to the named pipe instance. The handle must have GENERIC_READ access to the named pipe

Return Value

Success: | Array with the following format:
 | $aInfo[0] - True if handle refers to server end, otherwise client end
 | $aInfo[1] - True for a message pipe, otherwise byte pipe
 | $aInfo[2] - Size of the buffer for outgoing data, in bytes
 | $aInfo[3] - Size of the buffer for incoming data, in bytes
 | $aInfo[4] - Maximum number of pipe instances that can be created
Failure: | Set @error

Remarks

None.

Related

See Also

Search GetNamedPipeInfo in MSDN Library


Function _NamedPipes_PeekNamedPipe

Function Reference

_NamedPipes_PeekNamedPipe

Copies data from a pipe into a buffer without removing it from the pipe

#Include <NamedPipes.au3>
_NamedPipes_PeekNamedPipe($hNamedPipe)

Parameters

$hNamedPipe Handle to the pipe

Return Value

Success: | Array with the following format:
 | $aInfo[0] - Data read from the pipe
 | $aInfo[1] - Bytes read from the pipe
 | $aInfo[2] - Total bytes available to be read
 | $aInfo[3] - Bytes remaining to be read for this message
Failure: | Set @error

Remarks

None.

Related

See Also

Search PeekNamedPipe in MSDN Library


Function _NamedPipes_SetNamedPipeHandleState

Function Reference

_NamedPipes_SetNamedPipeHandleState

Sets the read mode and the blocking mode of the specified named pipe

#Include <NamedPipes.au3>
_NamedPipes_SetNamedPipeHandleState($hNamedPipe, $iRead, $iWait [, $iBytes = 0 [, $iTimeOut = 0]])

Parameters

$hNamedPipe | Handle to the named pipe instance
$iRead | Pipe read mode. Must be one of the following: 0 - Data is read from the pipe as a stream of bytes 1 - Data is read from the pipe as a stream of messages
$iWait | Pipe wait mode. Must be one of the following: 0 - Blocking mode is enabled 1 - Nonblocking mode is enabled
$iBytes | [optional] Maximum number of bytes collected on the client computer before transmission to the server
$iTimeout | [optional] Maximum time, in milliseconds, that can pass before a remote named pipe transfers information

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_NamedPipes_GetNamedPipeHandleState

See Also

Search SetNamedPipeHandleState in MSDN Library


Function _NamedPipes_TransactNamedPipe

Function Reference

_NamedPipes_TransactNamedPipe

Reads and writes to a named pipe in one network operation

#Include <NamedPipes.au3>
_NamedPipes_TransactNamedPipe($hNamedPipe, $pInpBuf, $iInpSize, $pOutBuf, $iOutSize [, $pOverlapped = 0])

Parameters

$hNamedPipe | The handle to the named pipe
$pInpBuf | Pointer to the buffer containing the data to be written to the pipe
$iInpSize | Size of the write buffer, in bytes
$pOutBuf | Pointer to the buffer that receives the data read from the pipe
$iOutSize | Size of the read buffer, in bytes
$pOverlapped | [optional] Pointer to a $tagOVERLAPPED structure. This structure is required if hNamedPipe was opened with $FILE_FLAG_OVERLAPPED. If hNamedPipe was opened with $FILE_FLAG_OVERLAPPED, pOverlapped must not be 0. If hNamedPipe was opened with $FILE_FLAG_OVERLAPPED and pOverlapped is not 0, TransactNamedPipe is executed as an overlapped operation. The $tagOVERLAPPED structure should contain a manual reset event object. If the operation cannot be completed immediately, TransactNamedPipe returns False and GetLastError will return ERROR_IO_PENDING.

Return Value

Success: | the Number of bytes read from the pipe
Failure: | Set @error

Remarks

TransactNamedPipe fails if the server did not create the pipe as a message-type pipe or if the pipe handle is
not in message-read mode.

Related

$tagOVERLAPPED, _NamedPipes_CallNamedPipe

See Also

Search TransactNamedPipe in MSDN Library


Function _NamedPipes_WaitNamedPipe

Function Reference

_NamedPipes_WaitNamedPipe

Waits for an instance of a named pipe to become available

#Include <NamedPipes.au3>
_NamedPipes_WaitNamedPipe($sPipeName [, $iTimeOut = 0])

Parameters

$sPipeName | The name of the named pipe. The string must include the name of the computer on which the server process is executing. A period may be used for the servername if the pipe is local.
$iTimeout | [optional] The number of milliseconds that the function will wait for the named pipe to be available. You can also use one of the following values: -1 - The function does not return until an instance of the named pipe is available 0 - The time-out interval is the default value specified by the server process

Return Value

Success: | True
Failure: | False

Remarks

If no instances of the specified named pipe exist the WaitNamedPipe function returns immediately

Related

_NamedPipes_CallNamedPipe

See Also

Search WaitNamedPipe in MSDN Library


User Defined Functions

NetShare user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <NetShare.au3>.

User Defined Function | Description
_Net_Share_ConnectionEnum | Lists all connections made to a shared resource
_Net_Share_FileClose | Forces a resource to close
_Net_Share_FileEnum | Returns information about open files on a server
_Net_Share_FileGetInfo | Retrieves information about a particular opening of a server resource
_Net_Share_PermStr | Returns the string representation of a resource's permissions
_Net_Share_ResourceStr | Returns the string representation of a resource
_Net_Share_SessionDel | Ends a network session between a server and a workstation
_Net_Share_SessionEnum | Provides information about sessions established on a server
_Net_Share_SessionGetInfo | Retrieves information about a session established between a server and workstation
_Net_Share_ShareAdd | Shares a server resource
_Net_Share_ShareCheck | Checks whether or not a server is sharing a device
_Net_Share_ShareDel | Deletes a share name from a server's list of shared resources
_Net_Share_ShareEnum | Retrieves information about each shared resource on a server
_Net_Share_ShareGetInfo | Retrieves information about a particular shared resource on a server
_Net_Share_ShareSetInfo | Shares a server resource
_Net_Share_StatisticsGetSvr | Retrieves operating statistics for a server
_Net_Share_StatisticsGetWrk | Retrieves operating statistics for a workstation


Function _Net_Share_ConnectionEnum

Function Reference

_Net_Share_ConnectionEnum

Lists all connections made to a shared resource

#Include <NetShare.au3>
_Net_Share_ConnectionEnum($sServer, $sQualifier)

Parameters

$sServer | String that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank the local computer is used.
$sQualifier | Specifies a share name or computer name of interest. If it is a share name, then all of the connections made to that share name are listed. If it is a computer name, the function lists all connections made from that computer to the server specified.

Return Value

Success: | Array with the following format:
 | [0][0] - Number of entries in array
 | [1][0] - Connection identification number
 | [1][1] - Type of connection. Can be combination of:
 | $STYPE_DISKTREE - Print queue
 | $STYPE_PRINTQ - Disk drive
 | $STYPE_DEVICE - Communication device
 | $STYPE_IPC - IPC
 | $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
 | $STYPE_TEMPORARY - A temporary share
 | [1][2] - Number of files currently open as a result of the connection
 | [1][3] - Number of users on the connection
 | [1][4] - Number of seconds that the connection has been established
 | [1][5] - If the server sharing the resource is running with user level security, this member describes | which user made the connection. If the server is running with share level security, this member describes | which computer made the connection.
 | [1][6] - Specifies either the share name of the server's shared resource or the computername of the client
Failure: | Set @error

Remarks

Administrator, Server or Print Operator or Power User group membership is required to execute this function

Related

_Net_Share_FileEnum, _Net_Share_SessionEnum, _Net_Share_ShareEnum

See Also

Search NetConnectionEnum in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $sShare, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit
$sShare = InputBox("NetWork Demo", "Enter Share Name:", "MyShare", "", 200, 130)
If @error Then Exit

; Enumerate network connections
$aInfo = _Net_Share_ConnectionEnum ($sServer, $sShare)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Connection ID ...........: " & $aInfo[$iI][0])
MemoWrite("Connection type..........: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Number of files open ....: " & $aInfo[$iI][2])
MemoWrite("Number of users .........: " & $aInfo[$iI][3])
MemoWrite("Connection time .........: " & $aInfo[$iI][4])
MemoWrite("Username ................: " & $aInfo[$iI][5])
MemoWrite("Network name ............: " & $aInfo[$iI][6])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_FileClose

Function Reference

_Net_Share_FileClose

Forces a resource to close

#Include <NetShare.au3>
_Net_Share_FileClose($sServer, $iFileID)

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$iFileID | Specifies the file identifier of the opened resource instance to close

Return Value

Success: | True
Failure: | False

Remarks

Only members of the Administrators or Server Operators local group can execute this function

Related

See Also

Search NetFileClose in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Enumerate open files on the server
$aInfo = _Net_Share_FileEnum ($sServer)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])

; Force close any file open named "Test.txt"
For $iI = 1 To $aInfo[0][0]
If StringInStr($aInfo[$iI][3], "Test.txt") > 0 Then
_Net_Share_FileClose ($sServer, $aInfo[$iI][0])
MemoWrite("Closed file")
EndIf
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_FileEnum

Function Reference

_Net_Share_FileEnum

Returns information about open files on a server

#Include <NetShare.au3>
_Net_Share_FileEnum([$sServer = ""[, $sBaseName = ""[, $sUserName = ""]]])

Parameters

$sServer | [optional] String that contains the name of the server on which the function is to execute. A blank specifies the local computer.
$sBaseName | [optional] String containing a qualifier for the returned information. If blank all open resources are enumerated. If not blank, the function enumerates only resources that have $sBaseName as a prefix.
$sUserName | [optional] String that specifies the name of the user. If not blank $sUserName serves as a qualifier to the enumeration.

Return Value

Success: | Array with the following format:
 | [0][0] - Number of entries in the array (n)
 | [1][0] - ID number assigned to the resource when it is opened
 | [1][1] - Access permissions associated with the opening application:
 | 1 - Permission to read a resource and execute the resource
 | 2 - Permission to write to a resource.
 | 4 - Permission to create a resource
 | 8 - Execute permission
 | 16 - Delete permission
 | 32 - Change attribute permission
 | 64 - Change ACL permission
 | [1][2] - Contains the number of file locks on the resource
 | [1][3] - Specifies the path of the opened resource
 | [1][4] - Specifies which user or which computer opened the resource
Failure: | Set @error

Remarks

Only members of the Administrators or Server Operators local group can execute this function

Related

_Net_Share_ConnectionEnum, _Net_Share_SessionEnum, _Net_Share_ShareEnum

See Also

Search NetFileEnum in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Enumerate open files on the server
$aInfo = _Net_Share_FileEnum ($sServer)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Resource ID .............: " & $aInfo[$iI][0])
MemoWrite("Resource permissions ....: " & _Net_Share_PermStr ($aInfo[$iI][1]))
MemoWrite("Resource locks ..........: " & $aInfo[$iI][2])
MemoWrite("Resource path ...........: " & $aInfo[$iI][3])
MemoWrite("Resource user ...........: " & $aInfo[$iI][4])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_FileGetInfo

Function Reference

_Net_Share_FileGetInfo

Retrieves information about a particular opening of a server resource

#Include <NetShare.au3>
_Net_Share_FileGetInfo($sServer, $iFileID)

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$iFileID | File identifier of the resource for which to return information. The value of this parameter must have been returned in a previous enumeration call.

Return Value

Success: | Array with the following format:
 | [0] - ID number assigned to the resource when it is opened
 | [1] - Access permissions associated with the opening application:
 | 1 - Permission to read a resource and execute the resource
 | 2 - Permission to write to a resource.
 | 4 - Permission to create a resource
 | 8 - Execute permission
 | 16 - Delete permission
 | 32 - Change attribute permission
 | 64 - Change ACL permission
 | [2] - Contains the number of file locks on the resource
 | [3] - Specifies the path of the opened resource
 | [4] - Specifies which user or which computer opened the resource
Failure: | Set @error

Remarks

Administrator, Server or Print Operator or Power User group membership is required to execute this function

Related

_Net_Share_SessionGetInfo, _Net_Share_ShareGetInfo

See Also

Search NetFileGetInfo in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aFile, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Enumerate open files on the server
$aFile = _Net_Share_FileEnum ($sServer)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aFile[0][0])
MemoWrite()

; Get information for each open file (same as $aFile info)
For $iI = 1 To $aFile[0][0]
$aInfo = _Net_Share_FileGetInfo ($sServer, $aFile[$iI][0])
MemoWrite("Error ...................: " & @error)
MemoWrite("File permissions ........: " & _Net_Share_PermStr ($aInfo[1]))
MemoWrite("File locks ..............: " & $aInfo[2])
MemoWrite("File path ...............: " & $aInfo[3])
MemoWrite("File user ...............: " & $aInfo[4])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_PermStr

Function Reference

_Net_Share_PermStr

Returns the string representation of a resource's permissions

#Include <NetShare.au3>
_Net_Share_PermStr($iPerm)

Parameters

$iPerm The resource's permissions:
1 - Permission to read data from a resource and to execute
2 - Permission to write data to the resource
4 - Permission to create an instance of the resource
8 - Permission to execute the resource
16 - Permission to delete the resource
32 - Permission to modify the resource's attributes
64 - Permission to modify the permissions assigned to a resource

Return Value

Returns a Permissions string

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Enumerate open files on the server
$aInfo = _Net_Share_FileEnum ($sServer)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Resource ID .............: " & $aInfo[$iI][0])
MemoWrite("Resource permissions ....: " & _Net_Share_PermStr ($aInfo[$iI][1]))
MemoWrite("Resource locks ..........: " & $aInfo[$iI][2])
MemoWrite("Resource path ...........: " & $aInfo[$iI][3])
MemoWrite("Resource user ...........: " & $aInfo[$iI][4])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ResourceStr

Function Reference

_Net_Share_ResourceStr

Returns the string representation of a resource

#Include <NetShare.au3>
_Net_Share_ResourceStr($iResource)

Parameters

$iResource Resource type. Can be a combination of:
$STYPE_DISKTREE - Print queue
$STYPE_PRINTQ - Disk drive
$STYPE_DEVICE - Communication device
$STYPE_IPC - IPC
$STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
$STYPE_TEMPORARY - A temporary share

Return Value

Returns a Resource type string

Remarks

None.

Related

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $sShare, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

$sShare = InputBox("NetWork Demo", "Enter Share Name:", "MyShare", "", 200, 130)
If @error Then Exit

; Enumerate network connections
$aInfo = _Net_Share_ConnectionEnum ($sServer, $sShare)
MemoWrite("Error ...................: " & @error)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Connection ID ...........: " & $aInfo[$iI][0])
MemoWrite("Connection type..........: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Number of files open ....: " & $aInfo[$iI][2])
MemoWrite("Number of users .........: " & $aInfo[$iI][3])
MemoWrite("Connection time .........: " & $aInfo[$iI][4])
MemoWrite("Username ................: " & $aInfo[$iI][5])
MemoWrite("Network name ............: " & $aInfo[$iI][6])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_SessionDel

Function Reference

_Net_Share_SessionDel

Ends a network session between a server and a workstation

#Include <NetShare.au3>
_Net_Share_SessionDel([$sServer = "" [, $sClientName = "" [, $sUserName = ""]]])

Parameters

$sServer | [optional] Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$sClientName | [optional] Specifies the computer name of the client to disconnect. If blank, then all the sessions of the user identified by the username parameter will be deleted on the server specified by $sServer.
$sUserName | [optional] Specifies the name of the user whose session is to be terminated. If this parameter is blank, all user sessions from the client specified by the $sClientName parameter are to be terminated.

Return Value

Success: | True
Failure: | False

Remarks

Only members of the Administrators or Server Operators local group can execute this function. You must pass
either $sClientName or $sUserName (or both) for this function to work.

Related

_Net_Share_ShareDel

See Also

Search NetSessionDel in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Delete all our sessions on the server
_Net_Share_SessionDel ($sServer, @ComputerName)
MemoWrite("Error ...................: " & @error)

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_SessionEnum

Function Reference

_Net_Share_SessionEnum

Provides information about sessions established on a server

#Include <NetShare.au3>
_Net_Share_SessionEnum([$sServer = ""[, $sClientName = ""[, $sUserName = ""]]])

Parameters

$sServer | [optional] String that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank the local computer is used.
$sClientName | [optional] Specifies the name of the computer session for which information is to be returned. If this parameter is blank, the function returns information for all computer sessions on the server.
$sUserName | [optional] Specifies the name of the user for which information is to be returned. If this parameter is blank, the function returns information for all users.

Return Value

Success: | Array with the following format:
 | [0][0] - Number of entries in array
 | [1][0] - Name of the computer that established the session
 | [1][1] - Name of the user who established the session
 | [1][2] - Number of files, devices, and pipes opened during the session
 | [1][3] - Number of seconds the session has been active
 | [1][4] - Number of seconds the session has been idle
 | [1][5] - Specifies how the user established the session:
 | 1 - User established session using a guest account
 | 2 - User established session without using password encryption
 | [1][6] - Specifies the type of client that established the session
 | [1][7] - Name of the transport that the client is using
Failure: | Set @error

Remarks

Only members of the Administrators or Server Operators local group can execute this function

Related

_Net_Share_ConnectionEnum, _Net_Share_FileEnum, _Net_Share_ShareEnum

See Also

Search NetSessionEnum in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Enumerate network sessions
$aInfo = _Net_Share_SessionEnum ($sServer, @ComputerName)
MemoWrite("Error ..........: " & @error)
MemoWrite("Entries read ...: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Computer name ..: " & $aInfo[$iI][0])
MemoWrite("User name.......: " & $aInfo[$iI][1])
MemoWrite("Resources open .: " & $aInfo[$iI][2])
MemoWrite("Seconds active .: " & $aInfo[$iI][3])
MemoWrite("Seconds idle ...: " & $aInfo[$iI][4])
MemoWrite("Connection type : " & $aInfo[$iI][5])
MemoWrite("Client type ....: " & $aInfo[$iI][6])
MemoWrite("Transport ......: " & $aInfo[$iI][7])
MemoWrite()
Next

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_SessionGetInfo

Function Reference

_Net_Share_SessionGetInfo

Retrieves information about a session established between a server and workstation

#Include <NetShare.au3>
_Net_Share_SessionGetInfo($sServer, $sClientName, $sUserName)

Parameters

$sServer | String that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank the local computer is used.
$sClientName | Specifies the name of the computer session for which information is to be returned. This parameter cannot be blank.
$sUserName | String that specifies the name of the user whose session information is to be returned. This parameter cannot be blank.

Return Value

Success: | Array with the following format:
 | [0] - Name of the computer that established the session
 | [1] - Name of the user who established the session
 | [2] - Number of files, devices, and pipes opened during the session
 | [3] - Number of seconds the session has been active
 | [4] - Number of seconds the session has been idle
 | [5] - Specifies how the user established the session:
 | 1 - User established session using a guest account
 | 2 - User established session without using password encryption
 | [6] - Specifies the type of client that established the session
Failure: | Set @error

Remarks

Only members of the Administrators or Server Operators local group can execute this function

Related

_Net_Share_FileGetInfo, _Net_Share_ShareGetInfo

See Also

Search NetSessionGetInfo in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $sServer, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server and share information
$sServer = InputBox("NetWork Demo", "Enter Server Name:", "\\MyServer", "", 200, 130)
If @error Then Exit

; Get session information
$aInfo = _Net_Share_SessionGetInfo ($sServer, @ComputerName, "Administrator")
MemoWrite("Error ..........: " & @error)
MemoWrite("Computer name ..: " & $aInfo[0])
MemoWrite("User name ......: " & $aInfo[1])
MemoWrite("Resources open .: " & $aInfo[2])
MemoWrite("Seconds active .: " & $aInfo[3])
MemoWrite("Seconds idle ...: " & $aInfo[4])
MemoWrite("Connection type : " & $aInfo[5])
MemoWrite("Client type ....: " & $aInfo[6])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareAdd

Function Reference

_Net_Share_ShareAdd

Shares a server resource

#Include <NetShare.au3>
_Net_Share_ShareAdd($sServer, $sShare, $iType, $sPath [, $sComment = "" [, $iMaxUses = -1]])

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$sShare | Share name of a resource
$iType | Contains the type of the shared resource. Can be a combination of: $STYPE_DISKTREE - Disk drive $STYPE_PRINTQ - Print queue $STYPE_DEVICE - Communication device $STYPE_IPC - IPC $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server $STYPE_TEMPORARY - A temporary share
$sPath | Local path for the shared resource. For disks, this is the path being shared. For print queues, this is the name of the print queue being shared.
$sComment | [optional] String that contains an comment about the shared resource
$iMaxUses | [optional] The maximum number of concurrent connections that the shared resource can accommodate. The number of connections is unlimited if the value specified is –1.

Return Value

Success: | True
Failure: | False

Remarks

Only members of the Administrators, System Operators, or Power Users local group can add file shares with a
call to this function. The Print Operator can add printer shares.

Related

_Net_Share_ShareCheck, _Net_Share_ShareDel

See Also

Search NetApiBufferFree in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox (4096, "Information", "Share add error : " & @error)
MemoWrite ("Share added")
Else
MemoWrite ("Share exists")
EndIf

; Show information about all local shares
$aInfo = _Net_Share_ShareEnum (@ComputerName)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Share name ..............: " & $aInfo[$iI][0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Comment .................: " & $aInfo[$iI][2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[$iI][3]))
MemoWrite("Maximum connections .....: " & $aInfo[$iI][4])
MemoWrite("Current connections .....: " & $aInfo[$iI][5])
MemoWrite("Local path ..............: " & $aInfo[$iI][6])
MemoWrite("Password ................: " & $aInfo[$iI][7])
MemoWrite()
Next

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox (4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareCheck

Function Reference

_Net_Share_ShareCheck

Checks whether or not a server is sharing a device

#Include <NetShare.au3>
_Net_Share_ShareCheck($sServer, $sShare)

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$sShare | Specifies the name of the device to check for shared access

Return Value

Succcess: | the Type of the shared device. Can be a combination of:
 | $STYPE_DISKTREE - Print queue
 | $STYPE_PRINTQ - Disk drive
 | $STYPE_DEVICE - Communication device
 | $STYPE_IPC - IPC
 | $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
 | $STYPE_TEMPORARY - A temporary share
Failure: | -1 - Share does not exist

Remarks

No special group membership is required to successfully execute this function

Related

_Net_Share_ShareAdd, _Net_Share_ShareDel

See Also

Search NetShareCheck in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox (4096, "Information", "Share add error : " & @error)
MemoWrite ("Share added")
Else
MemoWrite ("Share exists")
EndIf

; Show information about all local shares
$aInfo = _Net_Share_ShareEnum (@ComputerName)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Share name ..............: " & $aInfo[$iI][0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Comment .................: " & $aInfo[$iI][2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[$iI][3]))
MemoWrite("Maximum connections .....: " & $aInfo[$iI][4])
MemoWrite("Current connections .....: " & $aInfo[$iI][5])
MemoWrite("Local path ..............: " & $aInfo[$iI][6])
MemoWrite("Password ................: " & $aInfo[$iI][7])
MemoWrite()
Next

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox (4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareDel

Function Reference

_Net_Share_ShareDel

Deletes a share name from a server's list of shared resources

#Include <NetShare.au3>
_Net_Share_ShareDel($sServer, $sShare)

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$sShare | Specifies the name of the share to delete

Return Value

Success: | True
Failure: | False

Remarks

Only members of the Administrators, Server Operators, or Power Users local group, or those with Server
Operator group membership, can successfully delete file shares with this function. The Print Operator can
delete printer shares.

Related

_Net_Share_ShareAdd, _Net_Share_ShareCheck, _Net_Share_SessionDel

See Also

Search NetShareDel in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox (4096, "Information", "Share add error : " & @error)
MemoWrite ("Share added")
Else
MemoWrite ("Share exists")
EndIf

; Show information about all local shares
$aInfo = _Net_Share_ShareEnum (@ComputerName)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Share name ..............: " & $aInfo[$iI][0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Comment .................: " & $aInfo[$iI][2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[$iI][3]))
MemoWrite("Maximum connections .....: " & $aInfo[$iI][4])
MemoWrite("Current connections .....: " & $aInfo[$iI][5])
MemoWrite("Local path ..............: " & $aInfo[$iI][6])
MemoWrite("Password ................: " & $aInfo[$iI][7])
MemoWrite()
Next

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox (4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareEnum

Function Reference

_Net_Share_ShareEnum

Retrieves information about each shared resource on a server

#Include <NetShare.au3>
_Net_Share_ShareEnum([$sServer = ""])

Parameters

$sServer [optional] String that specifies the DNS or NetBIOS name of the remote server on which the function is to
execute. If this parameter is blank the local computer is used.

Return Value

Success: | Array with the following format:
 | [0][0] - Number of entries in array
 | [1][0] - Share name of a resource
 | [1][1] - Type of the shared resource. Can be a combination of:
 | $STYPE_DISKTREE - Print queue
 | $STYPE_PRINTQ - Disk drive
 | $STYPE_DEVICE - Communication device
 | $STYPE_IPC - IPC
 | $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
 | $STYPE_TEMPORARY - A temporary share
 | [1][2] - Contains an optional comment about the shared resource
 | [1][3] - Indicates the shared resource's permissions:
 | 1 - Permission to read data from a resource and to execute
 | 2 - Permission to write data to the resource
 | 4 - Permission to create an instance of the resource
 | 8 - Permission to execute the resource
 | 16 - Permission to delete the resource
 | 32 - Permission to modify the resource's attributes
 | 64 - Permission to modify the permissions assigned to a resource
 | [1][4] - Maximum number of concurrent connections for the resource
 | [1][5] - Indicates the number of current connections to the resource
 | [1][6] - Specifies the local path for the shared resource
 | [1][7] - Specifies the share's password
Failure: | Set @error

Remarks

Administrator, Power User, Print Operator, or Server Operator group membership is required to execute this
function.

Related

_Net_Share_FileEnum, _Net_Share_SessionEnum, _Net_Share_ConnectionEnum

See Also

Search NetShareEnum in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox (4096, "Information", "Share add error : " & @error)
MemoWrite ("Share added")
Else
MemoWrite ("Share exists")
EndIf

; Show information about all local shares
$aInfo = _Net_Share_ShareEnum (@ComputerName)
MemoWrite("Entries read ............: " & $aInfo[0][0])
For $iI = 1 To $aInfo[0][0]
MemoWrite("Share name ..............: " & $aInfo[$iI][0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[$iI][1]))
MemoWrite("Comment .................: " & $aInfo[$iI][2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[$iI][3]))
MemoWrite("Maximum connections .....: " & $aInfo[$iI][4])
MemoWrite("Current connections .....: " & $aInfo[$iI][5])
MemoWrite("Local path ..............: " & $aInfo[$iI][6])
MemoWrite("Password ................: " & $aInfo[$iI][7])
MemoWrite()
Next

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox (4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareGetInfo

Function Reference

_Net_Share_ShareGetInfo

Retrieves information about a particular shared resource on a server

#Include <NetShare.au3>
_Net_Share_ShareGetInfo($sServer, $sShare)

Parameters

$sServer | String that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank the local computer is used.
$sShare | Name of the share for which to return information

Return Value

Success: | Array with the following format:
 | [0] - Share name of a resource
 | [1] - Type of the shared resource. Can be a combination of:
 | $STYPE_DISKTREE - Print queue
 | $STYPE_PRINTQ - Disk drive
 | $STYPE_DEVICE - Communication device
 | $STYPE_IPC - IPC
 | $STYPE_SPECIAL - Special share reserved for IPC$ or remote administration of the server
 | $STYPE_TEMPORARY - A temporary share
 | [2] - Contains an optional comment about the shared resource
 | [3] - Indicates the shared resource's permissions:
 | 1 - Permission to read data from a resource and to execute
 | 2 - Permission to write data to the resource
 | 4 - Permission to create an instance of the resource
 | 8 - Permission to execute the resource
 | 16 - Permission to delete the resource
 | 32 - Permission to modify the resource's attributes
 | 64 - Permission to modify the permissions assigned to a resource
 | [4] - Indicates the maximum number of connections that the resource can have
 | [5] - Indicates the number of current connections to the resource
 | [6] - Specifies the local path for the shared resource
 | [7] - Specifies the share's password
Failure: | Set @error

Remarks

Only members of the Administrators, Server Operators, or Power Users local group, or those with Print or
Server Operator group membership, can successfully execute this function.

Related

_Net_Share_FileGetInfo, _Net_Share_SessionGetInfo, _Net_Share_ShareSetInfo

See Also

Search NetShareGetInfo in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox(4096, "Information", "Share add error : " & @error)
MemoWrite("Share added")
Else
MemoWrite("Share exists")
EndIf

; Show information about the share we added
$aInfo = _Net_Share_ShareGetInfo (@ComputerName, $sShareName)
MemoWrite("Share name ..............: " & $aInfo[0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[1]))
MemoWrite("Comment .................: " & $aInfo[2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[3]))
MemoWrite("Maximum connections .....: " & $aInfo[4])
MemoWrite("Current connections .....: " & $aInfo[5])
MemoWrite("Local path ..............: " & $aInfo[6])
MemoWrite("Password ................: " & $aInfo[7])

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox(4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_ShareSetInfo

Function Reference

_Net_Share_ShareSetInfo

Shares a server resource

#Include <NetShare.au3>
_Net_Share_ShareSetInfo($sServer, $sShare, $sComment, $iMaxUses)

Parameters

$sServer | Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is blank, the local computer is used.
$sShare | Specifies the name of the share to set information on
$sComment | String that contains an optional comment about the shared resource
$iMaxUses | Indicates the maximum number of connections that the resource can accommodate. The number of connections is unlimited if this value is –1.

Return Value

Success: | True
Failure: | False

Remarks

Only members of the Administrators or Power Users local group or those with Print or Server Operator group
membership, can successfully execute this function. The Print Operator can set information only about Printer
shares.

Related

_Net_Share_ShareGetInfo

See Also

Search NetShareSetInfo in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $iI, $aInfo
Local Const $sShareName = "AutoIt Share"

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; See if the share exists
If _Net_Share_ShareCheck (@ComputerName, $sShareName) = -1 Then
; Create a share on the local computer
_Net_Share_ShareAdd (@ComputerName, $sShareName, 0, "C:\", "AutoIt Share Comment")
If @error Then MsgBox(4096, "Information", "Share add error : " & @error)
MemoWrite("Share added")
Else
MemoWrite("Share exists")
EndIf

; Change share information
_Net_Share_ShareSetInfo (@ComputerName, $sShareName, "New Comment", 4)

; Show information about the share we added
$aInfo = _Net_Share_ShareGetInfo (@ComputerName, $sShareName)
MemoWrite("Share name ..............: " & $aInfo[0])
MemoWrite("Share type...............: " & _Net_Share_ResourceStr ($aInfo[1]))
MemoWrite("Comment .................: " & $aInfo[2])
MemoWrite("Permissions .............: " & _Net_Share_PermStr ($aInfo[3]))
MemoWrite("Maximum connections .....: " & $aInfo[4])
MemoWrite("Current connections .....: " & $aInfo[5])
MemoWrite("Local path ..............: " & $aInfo[6])
MemoWrite("Password ................: " & $aInfo[7])

; Delete the share
_Net_Share_ShareDel (@ComputerName, $sShareName)
If @error Then MsgBox(4096, "Information", "Share delete error : " & @error)
MemoWrite("Share deleted")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_StatisticsGetSvr

Function Reference

_Net_Share_StatisticsGetSvr

Retrieves operating statistics for a server

#Include <NetShare.au3>
_Net_Share_StatisticsGetSvr([$sServer = ""])

Parameters

$sServer [optional] Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If
this parameter is blank, the local computer is used.

Return Value

Success: | Array with the following format:
 | [ 0] - Indicates the time when statistics collection started. The value is stored as the number of seconds | that have elapsed since 00:00:00, January 1, 1970, GMT.
 | [ 1] - Indicates the number of times a file is opened on a server
 | [ 2] - Indicates the number of times a server device is opened
 | [ 3] - Indicates the number of server print jobs spooled
 | [ 4] - Indicates the number of times the server session started
 | [ 5] - Indicates the number of times the server session disconnected
 | [ 6] - Indicates the number of times the server sessions failed with error
 | [ 7] - Indicates the number of server password violations
 | [ 8] - Indicates the number of server access permission errors
 | [ 9] - Indicates the number of server system errors
 | [10] - Number of server bytes sent to the network
 | [11] - Number of server bytes received from the network
 | [12] - Indicates the average server response time (in milliseconds)
 | [13] - Indicates the number of times the server required a request buffer but failed to allocate one
 | [14] - Indicates the number of times the server required a big buffer but failed to allocate one
Failure: | Set @error

Remarks

No special group membership is required to obtain workstation statistics. Only members of the Administrators
or Server Operators local group can successfully execute this function on a remote server.

Related

_Net_Share_StatisticsGetWrk

See Also

Search NetStatisticsGet in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get server statistics
$aInfo = _Net_Share_StatisticsGetSvr (@ComputerName)
MemoWrite("Statistics started ......: " & $aInfo[ 0])
MemoWrite("Times file opened .......: " & $aInfo[ 1])
MemoWrite("Times device opened .....: " & $aInfo[ 2])
MemoWrite("Print jobs spooled ......: " & $aInfo[ 3])
MemoWrite("Sessions started ........: " & $aInfo[ 4])
MemoWrite("Sessions disconnected ...: " & $aInfo[ 5])
MemoWrite("Session errors ..........: " & $aInfo[ 6])
MemoWrite("Password violations .....: " & $aInfo[ 7])
MemoWrite("Permission errors .......: " & $aInfo[ 8])
MemoWrite("Server system errors ....: " & $aInfo[ 9])
MemoWrite("Network bytes sent ......: " & $aInfo[10])
MemoWrite("Network bytes recv ......: " & $aInfo[11])
MemoWrite("Average response time ...: " & $aInfo[12])
MemoWrite("Req buffer failures .....: " & $aInfo[13])
MemoWrite("Big buffer failures .....: " & $aInfo[14])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Net_Share_StatisticsGetWrk

Function Reference

_Net_Share_StatisticsGetWrk

Retrieves operating statistics for a workstation

#Include <NetShare.au3>
_Net_Share_StatisticsGetWrk([$sWorkStation = ""])

Parameters

$sWorkStation [optional] Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If
this parameter is blank, the local computer is used.

Return Value

Success: | Array with the following format:
 | [ 0] - Statistics collection start time. The value is stored as the number of seconds elapsed since 00:00:00, | January 1, 1970.
 | [ 1] - Bytes received by the workstation
 | [ 2] - Server message blocks (SMBs) received by the workstation
 | [ 3] - Bytes that have been read by paging I/O requests
 | [ 4] - Bytes that have been read by non-paging I/O requests
 | [ 5] - Bytes that have been read by cache I/O requests
 | [ 6] - Bytes that have been read by disk I/O requests
 | [ 7] - Bytes transmitted by the workstation
 | [ 8] - SMBs transmitted by the workstation
 | [ 9] - Bytes that have been written by paging I/O requests
 | [10] - Bytes that have been written by non-paging I/O requests
 | [11] - Bytes that have been written by cache I/O requests
 | [12] - Bytes that have been written by disk I/O requests
 | [13] - Network operations that failed to begin
 | [14] - Network operations that failed to complete
 | [15] - Read operations initiated by the workstation
 | [16] - Random access reads initiated by the workstation
 | [17] - Read requests the workstation has sent to servers
 | [18] - Read requests the workstation has sent to servers that are greater than twice the size of the server's | negotiated buffer size.
 | [19] - Read requests the workstation has sent to servers that are less than 1/4 of the size of the server's | negotiated buffer size.
 | [20] - Write operations initiated by the workstation
 | [21] - Random access writes initiated by the workstation
 | [22] - Write requests the workstation has sent to servers
 | [23] - Write requests the workstation has sent to servers that are greater than twice the size of the server's | negotiated buffer size.
 | [24] - Write requests the workstation has sent to servers that are less than 1/4 of the size of the server's | negotiated buffer size.
 | [25] - Raw read requests made by the workstation that have been denied
 | [26] - Raw write requests made by the workstation that have been denied
 | [27] - Network errors received by the workstation
 | [28] - Workstation sessions that were established
 | [29] - Imes the workstation attempted to create a session but failed
 | [30] - Connections that have failed
 | [31] - PCNET connections that have succeeded
 | [32] - LanManager 20 connections that have succeeded
 | [33] - LanManager 21 connections that have succeeded
 | [34] - Windows NT connections that have succeeded
 | [35] - Times the workstation was disconnected by a network server
 | [36] - Sessions that have expired on the workstation
 | [37] - Network connections established by the workstation
 | [38] - Failed network connections for the workstation
 | [39] - Current requests that have not been completed
Failure: | Set @error

Remarks

No special group membership is required to obtain workstation statistics. Only members of the Administrators
or Server Operators local group can successfully execute this function on a remote server.

Related

_Net_Share_StatisticsGetSvr

See Also

Search NetStatisticsGet in MSDN Library

Example

#include <GuiConstantsEx.au3>
#include <NetShare.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $aInfo

; Create GUI
$hGUI = GUICreate("NetShare", 400, 300)

; Create memo control
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()

; Get workstation statistics
$aInfo = _Net_Share_StatisticsGetWrk (@ComputerName)
MemoWrite("NetStatisticsGetWrk")
MemoWrite("Statistics started ......: " & $aInfo[ 0])
MemoWrite("Bytes received ..........: " & $aInfo[ 1])
MemoWrite("SMBs received ...........: " & $aInfo[ 2])
MemoWrite("Paging I/O bytes ........: " & $aInfo[ 3])
MemoWrite("Non-paging I/O bytes ....: " & $aInfo[ 4])
MemoWrite("Cache I/O bytes ..... ...: " & $aInfo[ 5])
MemoWrite("Disk I/O bytes ..........: " & $aInfo[ 6])
MemoWrite("Bytes transmitted .......: " & $aInfo[ 7])
MemoWrite("SMBs transmitted ........: " & $aInfo[ 8])
MemoWrite("Paging I/O bytes ........: " & $aInfo[ 9])
MemoWrite("Non-paging I/O bytes ....: " & $aInfo[10])
MemoWrite("Cache I/O bytes .........: " & $aInfo[11])
MemoWrite("Disk I/O bytes ..........: " & $aInfo[12])
MemoWrite("Failed ops begin ........: " & $aInfo[13])
MemoWrite("Failed ops completed ....: " & $aInfo[14])
MemoWrite("Read operations .........: " & $aInfo[15])
MemoWrite("Random access reads .....: " & $aInfo[16])
MemoWrite("Read requests sent ......: " & $aInfo[17])
MemoWrite("Read requests big .......: " & $aInfo[18])
MemoWrite("Read requests small .....: " & $aInfo[19])
MemoWrite("Write operations ........: " & $aInfo[20])
MemoWrite("Random access writes ....: " & $aInfo[21])
MemoWrite("Write requests sent .....: " & $aInfo[22])
MemoWrite("Write requests big ......: " & $aInfo[23])
MemoWrite("Write requests small ....: " & $aInfo[24])
MemoWrite("Denied raw reads ........: " & $aInfo[25])
MemoWrite("Denied raw writes .......: " & $aInfo[26])
MemoWrite("Network errors ..........: " & $aInfo[27])
MemoWrite("Sessions established ....: " & $aInfo[28])
MemoWrite("Failed sessions .........: " & $aInfo[29])
MemoWrite("Failed connections ......: " & $aInfo[30])
MemoWrite("PCNET connections .......: " & $aInfo[31])
MemoWrite("NetShare 20 connections .: " & $aInfo[32])
MemoWrite("NetShare 21 connections .: " & $aInfo[33])
MemoWrite("WinNT connections .......: " & $aInfo[34])
MemoWrite("Disconnects .............: " & $aInfo[35])
MemoWrite("Sessions expired ........: " & $aInfo[36])
MemoWrite("Connections made ........: " & $aInfo[37])
MemoWrite("Connections failed ......: " & $aInfo[38])
MemoWrite("Incomplete requests .....: " & $aInfo[39])

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

Process user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Process.au3>.

User Defined Function | Description
_ProcessGetName | Returns a string containing the process name that belongs to a given PID.
_ProcessGetPriority | Get the priority of an open process
_RunDOS | Executes a DOS command in a hidden command window.


Function _ProcessGetName

Function Reference

_ProcessGetName

Returns a string containing the process name that belongs to a given PID.

#include <Process.au3>
_ProcessGetName ( $iPID )

Parameters

$iPID The PID of a currently running process.

Return Value

Success: | Returns The name of the process.
Failure: | Returns Blank string and sets the @error
@error: | 1 - Process doesn't exist
 | 2 - Error getting process list
 | 3 - No processes found

Remarks

Supplementary to ProcessExists().

Related

ProcessExists

Example

#include <Process.au3>

Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]", "")
$pid = WinGetProcess("[CLASS:Notepad]", "")
$name = _ProcessGetName($pid)

MsgBox(0, "Notepad - " & $pid, $name)


Function _ProcessGetPriority

Function Reference

_ProcessGetPriority

Get the priority of an open process

#include <Process.au3>
_ProcessGetPriority ($i_PID)

Parameters

$i_PID Process ID (Int) of process to be examined.

Return Value

Success: | Returns integer corressponding to the processes's priority:
 | 0 - Idle/Low
 | 1 - Below Normal (Not supported on Windows 95/98/ME)
 | 2 - Normal
 | 3 - Above Normal (Not supported on Windows 95/98/ME)
 | 4 - High
 | 5 - Realtime
Failure: | Returns -1 and sets @Error to 1

Remarks

None.

Related

ProcessSetPriority

Example

#include<process.au3>

Dim $i_Priority_Level, $i_Notepad_PID, $i_ArrayItem
Dim $a_RunLevels[3] = [0, 2, 4] ;low, normal, high priorities
;Get Priority Level of this instance of AutoIt Scripting Engine
$i_Priority_Level = _ProcessGetPriority (@AutoItPID)
MsgBox(0, "AutoIt Script", "Should be 2: " & $i_Priority_Level)
$i_Notepad_PID = Run(@ComSpec & ' /k notepad.exe', '', @SW_HIDE)
For $i_ArrayItem = 0 To 2
ProcessSetPriority($i_Notepad_PID, $a_RunLevels[$i_ArrayItem])
$i_Priority_Level = _ProcessGetPriority ($i_Notepad_PID)
MsgBox(0, "Notepad Priority", "Should be " & $a_RunLevels[$i_ArrayItem] & ": " & $i_Priority_Level)
Next
ProcessClose('notepad.exe')


Function _RunDOS

Function Reference

_RunDOS

Executes a DOS command in a hidden command window.

#include <Process.au3>
_RunDOS ( $sCommand )

Parameters

$sCommand Command to execute

Return Value

Success: | Returns the exit code of the command
Failure: | Returns 0 and sets @error to non-zero.

Remarks

None.

Related

None.

Example

#include <Process.au3>
$rc = _RunDos("start Http://www.autoitscript.com")


User Defined Functions

ScreenCapture user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <ScreenCapture.au3>.

User Defined Function | Description
_ScreenCapture_Capture | Captures a region of the screen
_ScreenCapture_CaptureWnd | Captures a screen shot of a specified window
_ScreenCapture_SaveImage | Saves an image to file
_ScreenCapture_SetBMPFormat | Sets the bit format that will be used for BMP screen captures
_ScreenCapture_SetJPGQuality | Sets the quality level that will be used for JPEG screen captures
_ScreenCapture_SetTIFColorDepth | Sets the color depth used for TIFF screen captures
_ScreenCapture_SetTIFCompression | Sets the compression used for TIFF screen captures


Function _ScreenCapture_Capture

Function Reference

_ScreenCapture_Capture

Captures a region of the screen

#Include <ScreenCapture.au3>
_ScreenCapture_Capture([$sFileName = "" [, $iLeft = 0 [, $iTop = 0 [, $iRight = -1 [, $iBottom = -1 [, $fCursor = True]]]]]])

Parameters

$sFileName | [optional] Full path and extension of the image file
$iLeft | [optional] X coordinate of the upper left corner of the rectangle
$iTop | [optional] Y coordinate of the upper left corner of the rectangle
$iRight | [optional] X coordinate of the lower right corner of the rectangle. If this is -1, the current screen width will be used.
$iBottom | [optional] Y coordinate of the lower right corner of the rectangle. If this is -1, the current screen height will be used.
$fCursor | [optional] If True the cursor will be captured with the image

Return Value

None.

Remarks

If FileName is not blank this function will capture the screen and save it to file. If FileName is blank, this
function will capture the screen and return a HBITMAP handle to the bitmap image. In this case, after you are
finished with the bitmap you must call _WinAPI_DeleteObject to delete the bitmap handle.

Requires GDI+: GDI+ requires a redistributable for applications that
run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems.

Related

_WinAPI_DeleteObject, _ScreenCapture_SaveImage

Example

#include <ScreenCapture.au3>

; Capture full screen
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image1.jpg")

; Capture region
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", 0, 0, 796, 596)


Function _ScreenCapture_CaptureWnd

Function Reference

_ScreenCapture_CaptureWnd

Captures a screen shot of a specified window

#Include <ScreenCapture.au3>
_ScreenCapture_CaptureWnd($sFileName, $hWnd [, $iLeft = 0 [, $iTop = 0 [, $iRight = -1 [, $iBottom = -1 [, $fCursor = True]]]]])

Parameters

$sFileName | Full path and extension of the image file
$hWnd | Handle to the window to be captured
$iLeft | [optional] X coordinate of the upper left corner of the client rectangle
$iTop | [optional] Y coordinate of the upper left corner of the client rectangle
$iRight | [optional] X coordinate of the lower right corner of the rectangle
$iBottom | [optional] Y coordinate of the lower right corner of the rectangle
$fCursor | [optional] If True the cursor will be captured with the image

Return Value

None.

Remarks

If FileName is not blank this function will capture the screen and save it to file. If FileName is blank, this
function will capture the screen and return a HBITMAP handle to the bitmap image. In this case, after you are
finished with the bitmap you must call _WinAPI_DeleteObject to delete the bitmap handle. All coordinates are in
client coordinate mode.

Requires GDI+: GDI+ requires a redistributable for applications that
run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems.

Related

_WinAPI_DeleteObject

Example

#include <ScreenCapture.au3>

_Main()

Func _Main()
Local $hGUI

; Create GUI
$hGUI = GUICreate("Screen Capture", 400, 300)
GUISetState()

; Capture window
_ScreenCapture_CaptureWnd (@MyDocumentsDir & "\GDIPlus_Image.jpg", $hGUI)

EndFunc ;==>_Main


Function _ScreenCapture_SaveImage

Function Reference

_ScreenCapture_SaveImage

Saves an image to file

#Include <ScreenCapture.au3>
_ScreenCapture_SaveImage($sFileName, $hBitmap [, $fFreeBmp = True])

Parameters

$sFileName | Full path and extension of the bitmap file to be saved
$hBitmap | HBITMAP handle
$fFreeBmp | [optional] If True, hBitmap will be freed on a successful save

Return Value

Success: | True
Failure: | False

Remarks

This function saves a bitmap to file, converting it to the image format specified by the file name extension.
For Windows XP, the valid extensions are BMP, GIF, JPEG, PNG and TIF.

Requires GDI+: GDI+ requires a redistributable for applications that
run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me operating systems.

Related

_ScreenCapture_Capture

Example

#include <ScreenCapture.au3>

_Main()

Func _Main()
Local $hBmp

; Capture full screen
$hBmp = _ScreenCapture_Capture ("")

; Save bitmap to file
_ScreenCapture_SaveImage (@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp)

EndFunc ;==>_Main


Function _ScreenCapture_SetBMPFormat

Function Reference

_ScreenCapture_SetBMPFormat

Sets the bit format that will be used for BMP screen captures

#Include <ScreenCapture.au3>
_ScreenCapture_SetBMPFormat($iFormat)

Parameters

$iFormat Image bits per pixel (bpp) setting:
0 = 16 bpp; 5 bits for each RGB component
1 = 16 bpp; 5 bits for red, 6 bits for green and 5 bits blue
2 = 24 bpp; 8 bits for each RGB component
3 = 32 bpp; 8 bits for each RGB component. No alpha component.
4 = 32 bpp; 8 bits for each RGB and alpha component

Return Value

None.

Remarks

If not explicitly set, BMP screen captures default to 24 bpp

Related

Example

#include <ScreenCapture.au3>

; Capture full screen
_ScreenCapture_SetBMPFormat(0)
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image.bmp")


Function _ScreenCapture_SetJPGQuality

Function Reference

_ScreenCapture_SetJPGQuality

Sets the quality level that will be used for JPEG screen captures

#Include <ScreenCapture.au3>
_ScreenCapture_SetJPGQuality($iQuality)

Parameters

$iQuality The quality level of the image. Must be in the range of 0 to 100.

Return Value

None.

Remarks

If not explicitly set, JPEG screen captures default to a quality level of 100

Related


Function _ScreenCapture_SetTIFColorDepth

Function Reference

_ScreenCapture_SetTIFColorDepth

Sets the color depth used for TIFF screen captures

#Include <ScreenCapture.au3>
_ScreenCapture_SetTIFColorDepth($iDepth)

Parameters

$iDepth Image color depth:
0 - Default encoder color depth
24 - 24 bit
32 - 32 bit

Return Value

None.

Remarks

If not explicitly set, TIFF screen captures default to 24 bits

Related

_ScreenCapture_SetTIFCompression


Function _ScreenCapture_SetTIFCompression

Function Reference

_ScreenCapture_SetTIFCompression

Sets the compression used for TIFF screen captures

#Include <ScreenCapture.au3>
_ScreenCapture_SetTIFCompression($iCompress)

Parameters

$iCompress Image compression type:
0 - Default encoder compression
1 - No compression
2 - LZW compression

Return Value

None.

Remarks

If not explicitly set, TIF screen captures default to LZW compression

Related

_ScreenCapture_SetTIFColorDepth


User Defined Functions

Security user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Security.au3>.

User Defined Function | Description
_Security__AdjustTokenPrivileges | Enables or disables privileges in the specified access token
_Security__GetAccountSid | Retrieves the security identifier (SID) for an account
_Security__GetLengthSid | Returns the length, in bytes, of a valid SID
_Security__GetTokenInformation | Retrieves a specified type of information about an access token
_Security__ImpersonateSelf | Obtains an access token that impersonates the calling process security context
_Security__IsValidSid | Validates a SID
_Security__LookupAccountName | Retrieves a security identifier (SID) for the account and the name of the domain
_Security__LookupAccountSid | Retrieves the name of the account for a SID
_Security__LookupPrivilegeValue | Retrieves the locally unique identifier (LUID) for a privilege value
_Security__OpenProcessToken | Returns the process handle of the calling process
_Security__OpenThreadToken | Opens the access token associated with a thread
_Security__OpenThreadTokenEx | Opens the access token associated with a thread, impersonating the client's security context if required
_Security__SetPrivilege | Enables or disables a local token privilege
_Security__SidToStringSid | Converts a binary SID to a string
_Security__SidTypeStr | Converts a Sid type to string form
_Security__StringSidToSid | Converts a String SID to a binary SID


Function _Security__AdjustTokenPrivileges

Function Reference

_Security__AdjustTokenPrivileges

Enables or disables privileges in the specified access token

#Include <Security.au3>
_Security__AdjustTokenPrivileges($hToken, $fDisableAll, $pNewState, $iBufferLen [, $pPrevState = 0 [, $pRequired = 0]])

Parameters

$hToken | Handle to the access token that contains privileges to be modified
$fDisableAll | If True, the function disables all privileges and ignores the NewState parameter. If False, the function modifies privileges based on the information pointed to by the $pNewState parameter.
$pNewState | Pointer to a $tagTOKEN_PRIVILEGES structure that contains the privilege and it's attributes
$iBufferLen | Size, in bytes, of the buffer pointed to by $pNewState
$pPrevState | [optional] Pointer to a $tagTOKEN_PRIVILEGES structure that specifies the previous state of the privilege that the function modified. This can be 0
$pRequired | [optional] Pointer to a variable that receives the required size, in bytes, of the buffer pointed to by $pPrevState. This parameter can be 0 if $pPrevState is 0.

Return Value

Success: | True
Failure: | False

Remarks

This function cannot add new privileges to an access token. It can only enable or disable the token's existing
privileges.

Related

$tagTOKEN_PRIVILEGES

See Also

Search AdjustTokenPrivileges in MSDN Library


Function _Security__GetAccountSid

Function Reference

_Security__GetAccountSid

Retrieves the security identifier (SID) for an account

#Include <Security.au3>
_Security__GetAccountSid($sAccount [, $sSystem = ""])

Parameters

$sAccount | Specifies the account name. Use a fully qualified string in the domain_name\user_name format to ensure that the function finds the account in the desired domain.
$sSystem | [optional] Name of the system. This string can be the name of a remote computer. If this string is blank, the account name translation begins on the local system. If the name cannot be resolved on the local system, this function will try to resolve the name using domain controllers trusted by the local system.

Return Value

Success: | Returns a binary SID in a byte strucutre
Failure: | 0

Remarks

None.

Related

_Security__LookupAccountSid


Function _Security__GetLengthSid

Function Reference

_Security__GetLengthSid

Returns the length, in bytes, of a valid SID

#Include <Security.au3>
_Security__GetLengthSid($pSID)

Parameters

$pSID Pointer to a SID

Return Value

Success: | Length of SID
Failure: | 0

Remarks

None.

Related

_Security__IsValidSid

See Also

Search GetLengthSid in MSDN Library


Function _Security__GetTokenInformation

Function Reference

_Security__GetTokenInformation

Retrieves a specified type of information about an access token

#Include <Security.au3>
_Security__GetTokenInformation($hToken, $iClass)

Parameters

$hToken | A handle to an access token from which information is retrieved. If $iClass specifies $sTokenSource, the handle must have $TOKEN_QUERY_SOURCE access. For all other $iClass values, the handle must have $TOKEN_QUERY access.
$iClass | Specifies a value to identify the type of information the function retrieves

Return Value

Success: | A byte structure filled with the requested information
Failure: | 0

Remarks

None.

Related

See Also

Search GetTokenInformation in MSDN Library


Function _Security__ImpersonateSelf

Function Reference

_Security__ImpersonateSelf

Obtains an access token that impersonates the calling process security context

#Include <Security.au3>
_Security__ImpersonateSelf([$iLevel = 2])

Parameters

$iLevel [optional] Impersonation level of the new token:
0 - Anonymous. The server process cannot obtain identification information about the client, and it cannot
impersonate the client.
1 - Identification. The server process can obtain information about the client, such as security identifiers
and privileges, but it cannot impersonate the client.
2 - Impersonation. The server process can impersonate the clients security context on its local system. The
server cannot impersonate the client on remote systems.
3 - Delegation. The server process can impersonate the client's security context on remote systems.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_Security__OpenThreadTokenEx

See Also

Search ImpersonateSelf in MSDN Library


Function _Security__IsValidSid

Function Reference

_Security__IsValidSid

Validates a SID

#Include <Security.au3>
_Security__IsValidSid($pSID)

Parameters

$pSID Pointer to a SID

Return Value

Success: | True: SID is valid
Failure: | False: SID is not valid

Remarks

None.

Related

_Security__GetLengthSid

See Also

Search IsValidSid in MSDN Library


Function _Security__LookupAccountName

Function Reference

_Security__LookupAccountName

Retrieves a security identifier (SID) for the account and the name of the domain

#Include <Security.au3>
_Security__LookupAccountName($sAccount [, $sSystem = ""])

Parameters

$sAccount | Specifies the account name. Use a fully qualified string in the domain_name\user_name format to ensure that the function finds the account in the desired domain.
$sSystem | [optional] Name of the system. This string can be the name of a remote computer. If this string is blank, the account name translation begins on the local system. If the name cannot be resolved on the local system, this function will try to resolve the name using domain controllers trusted by the local system.

Return Value

Success: | Array with the following format:
 | $aAcct[0] - SID String
 | $aAcct[1] - Domain name
 | $aAcct[2] - SID type, which can be one of the following values:
 | 1 - Indicates a user SID
 | 2 - Indicates a group SID
 | 3 - Indicates a domain SID
 | 4 - Indicates an alias SID
 | 5 - Indicates a SID for a well-known group
 | 6 - Indicates a SID for a deleted account
 | 7 - Indicates an invalid SID
 | 8 - Indicates an unknown SID type
 | 9 - Indicates a SID for a computer
Failure: | Set @error

Remarks

None.

Related

_Security__LookupAccountSid

See Also

Search LookupAccountName in MSDN Library


Function _Security__LookupAccountSid

Function Reference

_Security__LookupAccountSid

Retrieves the name of the account for a SID

#Include <Security.au3>
_Security__LookupAccountSid($vSID)

Parameters

$vSID Either a binary SID or a string SID

Return Value

Success: | Array with the following format:
 | $aAcct[0] - Account name
 | $aAcct[1] - Domain name
 | $aAcct[2] - SID type, which can be one of the following values:
 | 1 - Indicates a user SID
 | 2 - Indicates a group SID
 | 3 - Indicates a domain SID
 | 4 - Indicates an alias SID
 | 5 - Indicates a SID for a well-known group
 | 6 - Indicates a SID for a deleted account
 | 7 - Indicates an invalid SID
 | 8 - Indicates an unknown SID type
 | 9 - Indicates a SID for a computer
Failure: | 0 and set @error

Remarks

None.

Related

_Security__LookupAccountName, _Security__GetAccountSid

See Also

Search LookupAccountSid in MSDN Library


Function _Security__LookupPrivilegeValue

Function Reference

_Security__LookupPrivilegeValue

Retrieves the locally unique identifier (LUID) for a privilege value

#Include <Security.au3>
_Security__LookupPrivilegeValue($sSystem, $sName)

Parameters

$sSystem | Specifies the name of the system on which the privilege name is retrieved. If blank, the function attempts to find the privilege name on the local system.
$sName | Specifies the name of the privilege

Return Value

Success: | LUID by which the privilege is known
Failure: | 0

Remarks

None.

Related

See Also

Search LookupPrivilegeValue in MSDN Library


Function _Security__OpenProcessToken

Function Reference

_Security__OpenProcessToken

Returns the process handle of the calling process

#Include <Security.au3>
_Security__OpenProcessToken($hProcess, $iAccess)

Parameters

$hProcess | A handle to the process whose access token is opened. The process must have been given the $PROCESS_QUERY_INFORMATION access permission.
$iAccess | Specifies an access mask that specifies the requested types of access to the access token.

Return Value

Success: | A pointer to a handle that identifies the newly opened access token when the function returns.
Failure: | 0

Remarks

Close the access token handle returned by calling _WinAPI_CloseHandle

Related

_Security__OpenThreadToken

See Also

Search OpenProcessToken in MSDN Library


Function _Security__OpenThreadToken

Function Reference

_Security__OpenThreadToken

Opens the access token associated with a thread

#Include <Security.au3>
_Security__OpenThreadToken($iAccess[, $hThread = 0 [, $fOpenAsSelf = False]])

Parameters

$iAccess | Access mask that specifies the requested types of access to the access token. These requested access types are reconciled against the token's discretionary access control list (DACL) to determine which accesses are granted or denied.
$hThread | [optional] Handle to the thread whose access token is opened
$fOpenAsSelf | [optional] Indicates whether the access check is to be made against the security context of the thread calling the OpenThreadToken function or against the security context of the process for the calling thread. If this parameter is False, the access check is performed using the security context for the calling thread. If the thread is impersonating a client, this security context can be that of a client process. If this parameter is True, the access check is made using the security context of the process for the calling thread.

Return Value

Success: | Handle to the newly opened access token
Failure: | 0

Remarks

None.

Related

_Security__OpenThreadTokenEx, _Security__OpenProcessToken

See Also

Search OpenThreadToken in MSDN Library


Function _Security__OpenThreadTokenEx

Function Reference

_Security__OpenThreadTokenEx

Opens the access token associated with a thread, impersonating the client's security context if required

#Include <Security.au3>
_Security__OpenThreadTokenEx($iAccess[, $hThread = 0 [, $fOpenAsSelf = False]])

Parameters

$iAccess | Access mask that specifies the requested types of access to the access token. These requested access types are reconciled against the token's discretionary access control list (DACL) to determine which accesses are granted or denied.
$hThread | [optional] Handle to the thread whose access token is opened
$fOpenAsSelf | [optional] Indicates whether the access check is to be made against the security context of the thread calling the OpenThreadToken function or against the security context of the process for the calling thread. If this parameter is False, the access check is performed using the security context for the calling thread. If the thread is impersonating a client, this security context can be that of a client process. If this parameter is True, the access check is made using the security context of the process for the calling thread.

Return Value

Success: | Handle to the newly opened access token
Failure: | 0

Remarks

None.

Related

_Security__OpenThreadToken, _Security__ImpersonateSelf


Function _Security__SetPrivilege

Function Reference

_Security__SetPrivilege

Enables or disables a local token privilege

#Include <Security.au3>
_Security__SetPrivilege($hToken, $sPrivilege, $fEnable)

Parameters

$hToken | Handle to a token
$sPrivilege | Privilege name
$fEnable | Privilege setting: True - Enable privilege False - Disable privilege

Return Value

Success: | True
Failure: | False

Remarks

None.

Related


Function _Security__SidToStringSid

Function Reference

_Security__SidToStringSid

Converts a binary SID to a string

#Include <Security.au3>
_Security__SidToStringSid($pSID)

Parameters

$pSID Pointer to a binary SID to be converted

Return Value

Success: | SID in string form
Failure: | Empty string

Remarks

None.

Related

_Security__StringSidToSid

See Also

Search ConvertSidToStringSid in MSDN Library

Example

#include <Security.au3>

$account=@UserName
$sid =_Security__GetAccountSid($account)
$stringSID = _Security__SidToStringSid(DllStructGetPtr($sid,1))
MsgBox(0, "SID", "User = " & $account & @CRLF & "SID = " & $stringSID)


Function _Security__SidTypeStr

Function Reference

_Security__SidTypeStr

Converts a Sid type to string form

#Include <Security.au3>
_Security__SidTypeStr($iType)

Parameters

$iType Sid type

Return Value

Returns a Sid type in string form

Remarks

None.

Related


Function _Security__StringSidToSid

Function Reference

_Security__StringSidToSid

Converts a String SID to a binary SID

#Include <Security.au3>
_Security__StringSidToSid($sSID)

Parameters

$sSID String SID to be converted

Return Value

Success: | SID in a byte structure
Failure: | 0

Remarks

None.

Related

_Security__SidToStringSid

See Also

Search ConvertStringSidToSid in MSDN Library


User Defined Functions

SendMessage user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <SendMessage.au3>.

User Defined Function | Description
_SendMessage | Wrapper for commonly used Dll Call
_SendMessageA | Wrapper for commonly used Dll Call (Force Ansi Call)


Function _SendMessage

Function Reference

_SendMessage

Wrapper for commonly used Dll Call

#Include <SendMessage.au3>
_SendMessage($hWnd, $iMsg [, $wParam = 0 [, $lParam = 0 [, $iReturn = 0 [, $wParamType = "wparam" [, $lParamType = "lparam" [, $sReturnType = "lparam"]]]]]])

Parameters

$hWnd | Window/control handle
$iMsg | Message to send to control (number)
$wParam | [optional] Specifies additional message-specific information
$lParam | [optional] Specifies additional message-specific information
$iReturn | [optional] What to return: 0 - Return value from dll call 1 - $ihWnd 2 - $iMsg 3 - $wParam 4 - $lParam <0 or > 4 - array same as dllcall
$wParamType | [optional] See DllCall in Related
$lParamType | [optional] See DllCall in Related
$sReturnType | [optional] See DllCall in Related

Return Value

Success: | User selected value from the DllCall() result
Failure: | @error is set

Remarks

None.

Related

_SendMessageA, DllCall

Example

#include <SendMessage.au3>

_Main()

Func _Main()
Local Const $Off = 2, $On = -1

Opt("WinTitleMatchMode", 4)
$hwnd = WinGetHandle('classname=Progman')
_ToggleMonitor($hWnd, $Off)
Sleep ( 3000 )
_ToggleMonitor($hWnd, $On)
EndFunc

Func _ToggleMonitor($hwnd, $OnOff)
Local Const $WM_SYSCOMMAND = 274
Local Const $SC_MONITORPOWER = 61808
_SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff)
If @error Then
MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error)
Exit
EndIf
EndFunc


Function _SendMessageA

Function Reference

_SendMessageA

Wrapper for commonly used Dll Call (Force Ansi Call)

#Include <SendMessage.au3>
_SendMessageA($hWnd, $iMsg [, $wParam = 0 [, $lParam = 0 [, $iReturn = 0 [, $wParamType = "wparam" [, $lParamType = "lparam" [, $sReturnType = "lparam"]]]]]])

Parameters

$hWnd | Window/control handle
$iMsg | Message to send to control (number)
$wParam | [optional] Specifies additional message-specific information
$lParam | [optional] Specifies additional message-specific information
$iReturn | [optional] What to return: 0 - Return value from dll call 1 - $ihWnd 2 - $iMsg 3 - $wParam 4 - $lParam <0 or > 4 - array same as dllcall
$wParamType | [optional] See DllCall in Related
$lParamType | [optional] See DllCall in Related
$sReturnType | [optional] See DllCall in Related

Return Value

Success: | User selected value from the DllCall() result
Failure: | @error is set

Remarks

None.

Related

_SendMessage, DllCall


User Defined Functions

Sound user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Sound.au3>.

User Defined Function | Description
_SoundClose | Closes a sound previously opened with _SoundOpen.
_SoundLength | Returns the length of the soundfile.
_SoundOpen | Opens a sound file for use with other _Sound functions.
_SoundPause | Pause a playing sound.
_SoundPlay | Play a sound file.
_SoundPos | Returns the current position of the sound.
_SoundResume | Resume a paused sound.
_SoundSeek | Seeks the sound to the specified position
_SoundStatus | Returns the status of the sound
_SoundStop | Stop a playing sound.


Function _SoundClose

Function Reference

_SoundClose

Closes a sound previously opened with _SoundOpen.

#include <Sound.au3>
_SoundClose ( $aSnd_id )

Parameters

$aSnd_id Sound ID array as returned by _SoundOpen()

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Failure
 | 3 = Invalid Sound ID. Use return array from _SoundOpen().

Remarks

None.

Related

_SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf

If _SoundClose($sound) = 1 Then
MsgBox(0, "Success", "The sound was closed successfully")
Else
MsgBox(0, "Error", "The file was not closed successfully")
EndIf


Function _SoundLength

Function Reference

_SoundLength

Returns the length of the soundfile.

#include <Sound.au3>
_SoundLength ( $aSnd_id [, $iMode ] )

Parameters

$aSnd_id | Sound ID array as returned by _SoundOpen() or a file name
$iMode | [optional] This flag determines the format of the returned sound length 1 = hh:mm:ss where h = hours, m = minutes and s = seconds 2 = milliseconds

Return Value

Success: | Sound Length
Failure: | 0 and set @error
@error: | 1 = $iMode is invalid
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or valid file name.

Remarks

This function will return the best available value for the length of the file regardless of encoding method or parameter type.

Related

_SoundPos, _SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
MsgBox(0, "Sound Length", "The Sound has a length of:" & @CRLF & "hh:mm:ss - " & _
_SoundLength($sound, 1) & @CRLF & "Milliseconds - " & _SoundLength($sound, 2))


Function _SoundOpen

Function Reference

_SoundOpen

Opens a sound file for use with other _Sound functions.

#include <Sound.au3>
_SoundOpen ( $sFile )

Parameters

$sFile Path to sound file

Return Value

Success: | Returns a 4-element array containing the following information:
 | $array[0] = Sound file ID string
 | $array[1] = VBR length correction factor
 | $array[2] = VBR timing correction factor
 | $array[3] = Sound ID marker
Failure: | 0 and set @error
@error: | 1 = MCI open error
 | 2 = File does not exist
@Extended: | 0 = No Error
 | Integer other than 0 = MCI Error

Remarks

Although many of the _Sound functions will accept the filename as a parameter, if there is a possibility of the file being VBR (variable bit rate) encoded it is highly recommended to use _SoundOpen initially and then use the returned array as the identity parameter in other _Sound...() functions. This is because because the MCI DLL assumes all files are CBR (constant bit rate) encoded and produces incorrect results from those _Sound...() functions dealing with length and position when the sound file has been VBR (variable bit rate) encoded. If using the array as the ID parameter with the _Sound...() functions which alter the VBR correction factors (_SoundStop) the ID array will be updated when needed.
The individual elements of the returned array have no utility outside the _Sound functions and their internal use is transparent to the user.

Related

_SoundClose, _SoundLength, _SoundPause, _SoundPlay, _SoundPos, _SoundResume, _SoundStatus, _SoundStop

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundClose($sound)


Function _SoundPause

Function Reference

_SoundPause

Pause a playing sound.

#include <Sound.au3>
_SoundPause ( $aSnd_id )

Parameters

$aSnd_id Sound ID array as returned by _SoundOpen() or a file name

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Pause Failed
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

None.

Related

_SoundResume, _SoundOpen, _SoundPlay

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound)
Sleep(1000)
_SoundPause($sound)
Sleep(1000)
_SoundResume($sound)
While 1
Sleep(100)
If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd

_SoundClose($sound)


Function _SoundPlay

Function Reference

_SoundPlay

Play a sound file.

#include <Sound.au3>
_SoundPlay ( $aSnd_id [, $iWait ] )

Parameters

$aSnd_id | Sound ID array as returned by _SoundOpen() or a file name
$iWait | [optional] This flag determines if the script should wait for the sound to finish before continuing: 1 = wait until sound has finished 0 = continue script while sound is playing (default)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Play Failed
 | 2 = $iWait parameter is invalid
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

None.

Related

_SoundPause, _SoundStop, _SoundSeek, _SoundOpen, _SoundResume

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 1)

_SoundClose($sound)


Function _SoundPos

Function Reference

_SoundPos

Returns the current position of the sound.

#include <Sound.au3>
_SoundPos ( $aSnd_id [, $iMode ] )

Parameters

$aSnd_id | Sound ID array as returned by _SoundOpen() or a file name
$iMode | [optional] This flag determines which format the position of the sound is returned in 1 = hh:mm:ss where h = hours, m = minutes and s = seconds 2 = milliseconds

Return Value

Success: | Sound Position
Failure: | 0 and set @error
@error: | 1 = $iMode is invalid
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

It is recommended to open a sound file with _SoundOpen() and pass the ID array rather than use the file name in this function. A VBR encoded file is very unlikely to return the correct position if the file name is passed directly to this function.

Related

_SoundLength, _SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 0)
$splashtext = SplashTextOn("Current Position", _SoundPos($sound, 1), 300, 90, Default, Default, 18, Default, 55)
While 1
Sleep(100)
ControlSetText("Current Position", "", "Static1", _SoundPos($sound, 1))
If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd
_SoundClose($sound)


Function _SoundResume

Function Reference

_SoundResume

Resume a paused sound.

#include <Sound.au3>
_SoundResume ( $aSnd_id )

Parameters

$aSnd_id Sound ID array as returned by _SoundOpen() or a file name

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Pause Failed
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

_SoundPlay() will also resume playing after a sound has been paused in some cases.

Related

_SoundPause, _SoundPlay, _SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound)
Sleep(1000)
_SoundPause($sound)
Sleep(1000)
_SoundResume($sound)
While 1
Sleep(100)
If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd

_SoundClose($sound)


Function _SoundSeek

Function Reference

_SoundSeek

Seeks the sound to the specified position

#include <Sound.au3>
_SoundSeek (ByRef $aSnd_id, $iHour, $iMin, $iSec )

Parameters

$aSnd_id | Sound ID array as returned by _SoundOpen()
$iHour | Hour to seek to
$iMin | Minute to seek to
$iSec | Second to seek to

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Failure
 | 3 = Invalid Sound ID. Use return array from _SoundOpen().

Remarks

After using _SoundSeek on a sound, _SoundPlay must be used to resume playing.
The use of the ID array returned from _SoundOpen is mandatory with this function to ensure that the file plays from the correct position regardless of encoding type. The ID array should be updated by the function as the VBR timing correction factor may have been altered.

Related

_SoundPlay

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound, 0)

;play one second of sound
Sleep(1000)

;seek to 2 seconds into sound
_SoundSeek($sound, 0, 0, 2)
ConsoleWrite("After _SoundSeek: " & _SoundPos($sound, 2) & " _SoundStatus: " &_SoundStatus($sound)& @CRLF)
_SoundSeek($sound, 0, 0, 1)
ConsoleWrite("After _SoundSeek1: " & _SoundPos($sound, 2) & " _SoundStatus: " &_SoundStatus($sound)& @CRLF)

_SoundPlay($sound, 0)
While 1
Sleep(100)
If _SoundPos($sound, 2) >= _SoundLength($sound, 2) Then ExitLoop
WEnd

_SoundClose($sound)


Function _SoundStatus

Function Reference

_SoundStatus

Returns the status of the sound

#include <Sound.au3>
_SoundStatus ( $aSnd_id )

Parameters

$aSnd_id Sound ID array as returned by _SoundOpen() or a file name

Return Value

Success: | Sound Status
Failure: | 0 and set @error
@error: | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

From MSDN:
All devices can return the "not ready", "paused", "playing", and "stopped" values.
Some devices can return the additional "open", "parked", "recording", and "seeking" values.

Related

_SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf

ConsoleWrite("After _SoundOpen: " & _SoundStatus($sound) & @CRLF)

_SoundPlay($sound)
ConsoleWrite("After _SoundPlay: " & _SoundStatus($sound) & @CRLF)

Sleep(1000)

_SoundPause($sound)
ConsoleWrite("After _SoundPause: " & _SoundStatus($sound) & @CRLF)

Sleep(1000)
_SoundResume($sound)

While 1
Sleep(100)
If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then ExitLoop
WEnd

_SoundClose($sound)


Function _SoundStop

Function Reference

_SoundStop

Stop a playing sound.

#include <Sound.au3>
_SoundStop (ByRef $aSnd_id )

Parameters

$aSnd_id Sound ID array as returned by _SoundOpen() or a file name (must be a variable)

Return Value

Success: | 1
Failure: | 0 and set @error
@error: | 1 = Stop Failed
 | 3 = Invalid Sound ID. Use return array from _SoundOpen() or a valid file name.

Remarks

_SoundPlay() will replay the sound from the beginning.

Related

_SoundPlay, _SoundOpen

Example

#include <Sound.au3>

;open sound file : must be modified if run under Vista
$sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav")
If @error = 2 Then
MsgBox(0, "Error", "The file does not exist")
Exit
ElseIf @extended <> 0 Then
$extended = @extended ;assign because @extended will be set after DllCall
$stText = DllStructCreate("char[128]")
$errorstring = DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $extended, "ptr", DllStructGetPtr($stText), "int", 128)
MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
MsgBox(0, "Success", "The file opened successfully")
EndIf
_SoundPlay($sound)
While 1
Sleep(100)
If _SoundPos($sound, 2) >= 1000 Then
_SoundStop($sound)
ExitLoop
EndIf
WEnd

;show that sound starts from beginning after stopped
_SoundPlay($sound, 1)

_SoundClose($sound)


User Defined Functions

SQLite user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <SQLite.au3>.

User Defined Function | Description
_SQLite_Changes | Returns number of changes (excluding triggers) of the last transaction
_SQLite_Close | Close a SQLite database.
_SQLite_Display2DResult | Returns or prints a 2Dimensional array formated to Console
_SQLite_Encode | Encodes strings or binary data for use in SQLite query's
_SQLite_ErrCode | Returns last error code (numeric)
_SQLite_ErrMsg | Returns a string describing in english the error condition for the most recent sqlite3_* API call
_SQLite_Escape | Escapes a string
_SQLite_Exec | Executes a SQLite query, does not handle results.
_SQLite_FetchData | Fetches 1 row of data from a _SQLite_Query() based query
_SQLite_FetchNames | Read out the Column names of a _SQLite_Query() based query
_SQLite_GetTable | Passes Out a 1Dimensional Array Containing Tablenames and Data of Executed Query.
_SQLite_GetTable2d | Passes out a 2Dimensional array containing Column names and Data of executed Query
_SQLite_LastInsertRowID | Returns the ROWID of the most recent insert in the database
_SQLite_LibVersion | Returns the version number of the library
_SQLite_Open | Opens/creates a SQLite database.
_SQLite_Query | Prepares a SQLite Query
_SQLite_QueryFinalize | Finalizes an _SQLite_Query() based query. The query is interrupted.
_SQLite_QueryReset | Reset a _SQLite_Query() based query
_SQLite_QuerySingleRow | Read out the first row of the result from the specified query.
_SQLite_SafeMode | Disable or Enable Safe mode
_SQLite_SetTimeout | Sets timeout for busy handler
_SQLite_Shutdown | Unloads SQLite.dll
_SQLite_SQLiteExe | Executes commands in SQLite.exe
_SQLite_Startup | Loads SQLite.dll
_SQLite_TotalChanges | Returns number of all changes (including triggers) of all transactions


Function _SQLite_Changes

Function Reference

_SQLite_Changes

Returns number of changes (excluding triggers) of the last transaction

#include <SQLite.au3>
_SQLite_Changes ( [ $hDB ] )

Parameters

$hDB [optional] An open database, default is the last opened database

Return Value

Success: | Returns number of changes
Failure: | Returns 0
@error | 1 - Error calling SQLite API 'sqlite3_changes'
 | 2 - Call prevented by SafeMode

Remarks

None.

Related

None.

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE test (a, b);") ; Create Table
_SQLite_Exec(-1,"INSERT INTO test VALUES ('1', '2');") ; Insert Row 1
_SQLite_Exec(-1,"INSERT INTO test VALUES ('3', '4');") ; Insert Row 2
MsgBox(0,"SQLite","The Last Query changed " & _SQLite_Changes() & " Rows" & @CR & _
"All Query changed " & _SQLite_TotalChanges() & " Rows")
_SQLite_Close()
_SQLite_Shutdown()


Function _SQLite_Close

Function Reference

_SQLite_Close

Close a SQLite database.

#include <SQLite.au3>
_SQLite_Close ( [ $hDB ] )

Parameters

$hDB [optional] Database handle.

Return Value

Success: | Returns $SQLITE_OK.
Failure: | Return value can be compared against $SQLITE_* constants.
@error: | -1 - SQLite reported an error (Check Return value)
 | 1 - Error calling SQLite API 'sqlite3_close'
 | 2 - Call prevented by SafeMode

Remarks

If no database handle is given, the last opened database will be closed.

Related

_SQLite_Open

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; Open a :memory: database
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf
_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_Display2DResult

Function Reference

_SQLite_Display2DResult

Returns or prints a 2Dimensional array formated to Console

#include <SQLite.au3>
_SQLite_Display2DResult ( $aResult [, $iCellWidth = 0 [, $bReturn = 0 ]] )

Parameters

$aResult | The array to be displayed
$iCellWidth | [optional] specifies the size of a data field
$bReturn | [optional] if True the formated string is returned, not displayed if False formated string send to StdOut

Return Value

Success: | none or formated string
Failure: | @error = 1 - $aResult is no array or has wrong dimension

Remarks

None.

Related

_SQLite_GetTable2d

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; Open a :memory: database
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf

;Example Table
; Name | Age
; -----------------------
; Alice | 43
; Bob | 28
; Cindy | 21

If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; Query
$iRval = _SQLite_GetTable2d (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
_SQLite_Display2DResult($aResult)

;~ $aResult looks like this:
;~
;~ Name Age
;~ Alice 43
;~ Bob 28
;~ Cindy 21
;~
;~ If the dimensions would be switched in _SQLite_GetTable2d the result would look like this:
;~
;~ Name Alice Bob Cindy
;~ Age 43 28 21

Else
MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_Encode

Function Reference

_SQLite_Encode

Encodes strings or binary data for use in SQLite query's

#include <SQLite.au3>
_SQLite_Encode ( $vData )

Parameters

$vData Data To be encoded (String, Number or Binary)

Return Value

Success: | Returns encoded string
Failure: | Returns empty string and sets @error to 1

Remarks

The encoded string is already wrapped with single quotes.
For example chr(0) & chr(1) would look like X'0001'
The encoded string is decoded by Sqlite which stores the data in binary state.

Related

_SQLite_Escape

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hFile, $vData, $sFileName, $sData, $hQuery, $aRow, $sMsg
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE IF NOT EXISTS Test (data blob);")
$vData = Binary("Hello" & Chr(0) & "World"); = 48656C6C6F00576F726C64
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES (" & $sData & ");")
$vData = Binary(Chr(0) & @CRLF); = 000D0A
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES (" & $sData & ");")
$vData = Binary(Chr(0)); = 00 but this is interpreted as Number and returns 0000000000000000
$sData = _SQLite_Encode($vData)
_SQLite_Exec(-1,"INSERT INTO Test VALUES ( " & $sData & " );")
_SQLite_Query(-1,"SELECT * FROM Test;",$hQuery)
While _SQLite_FetchData ($hQuery, $aRow, 1) = $SQLITE_OK
$sMsg &= Hex($aRow[0]) & @CR
WEnd
MsgBox(0,"Result",$sMsg)
_SQLite_Close()
_SQLite_Shutdown()


Function _SQLite_ErrCode

Function Reference

_SQLite_ErrCode

Returns last error code (numeric)

#include <SQLite.au3>
_SQLite_ErrCode ( [ $hDB ] )

Parameters

$hDB [optional] An open database, default is the last opened database

Return Value

Success: | Return value can be compared against $SQLITE_* constants
Failure: | Returns 0
@error: | 1 - error calling SQLite API 'sqlite3_errcode'
 | 2 - Call Prevented by SafeMode

Remarks

None.

Related

_SQLite_ErrMsg

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
If $SQLITE_OK <> _SQLite_Exec(-1,"CREATE TABLE test ('a', 'b');") Then _ ; a Quote is missing
MsgBox(0,"SQLite Error","Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg())
_SQLite_Close()
_SQLite_Shutdown()


Function _SQLite_ErrMsg

Function Reference

_SQLite_ErrMsg

Returns a string describing in english the error condition for the most recent sqlite3_* API call

#include <SQLite.au3>
_SQLite_ErrMsg ( [ $hDB ] )

Parameters

$hDB [optional] An open database, default is the last opened database

Return Value

Success: | Returns error message
Failure: | @error = 1 - error calling SQLite API 'sqlite3_errmsg16'
 | 2 - Call Prevented by SafeMode

Remarks

None.

Related

_SQLite_ErrCode

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
If $SQLITE_OK <> _SQLite_Exec(-1,"CREATE TABLE test ('a', 'b');") Then _ ; a Quote is missing
MsgBox(0,"SQLite Error","Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg())
_SQLite_Close()
_SQLite_Shutdown()


Function _SQLite_Escape

Function Reference

_SQLite_Escape

Escapes a string

#include <SQLite.au3>
_SQLite_Escape ( $sString [, $iBuffSize ] )

Parameters

$sString | string to escape
$iBuffSize | [optional] the result will be truncated if its longer

Return Value

Success: | Returns escaped string
Failure: | Returns empty string and sets @error
@error: | 1 - Error Calling SQLite API 'sqlite3_mprintf'
 | 2 - Error converting string to UTF-8
 | 3 - Error reading escaped string

Remarks

The escaped string is already wrapped with single quotes.
For example "It's a fine day" would look like "It''s a fine day"
For binary data use _SQLite_Encode()

Related

_SQLite_Encode

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
Local $sTestString,$i,$aRow
For $i = 1 To 255
$sTestString &= Chr($i)
Next
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE test (a)")
_SQLite_Exec(-1,"INSERT INTO test VALUES (" & _SQLite_Escape($sTestString) & ")")
_SQLite_QuerySingleRow(-1,"SELECT a FROM test LIMIT 1",$aRow)
If $aRow[0] = $sTestString Then ConsoleWrite("! identical !" & @CRLF)
_SQLite_Shutdown()


Function _SQLite_Exec

Function Reference

_SQLite_Exec

Executes a SQLite query, does not handle results.

#include <SQLite.au3>
_SQLite_Exec ( $hDB, $sSQL [, $sCallBack ] )

Parameters

$hDB | An open database, use -1 to use last opened database
$sSQL | SQL statement to be executed
$sCallback | [optional] if specified the function will be called for each row

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check return value)
 | 1 - Error calling SQLite API 'sqlite3_exec'
 | 2 - Call prevented by SafeMode
 | 3 - Error Processing Callback from within _SQLite_GetTable2d
 | 4 - Error while converting SQL statement to UTF-8

Remarks

The Callback function must accept 1 parameter and can return $SQLITE_ABORT to stop processing (See example).
The first row in the Callback sequence will be the column names.

Related

_SQLite_Query, _SQLite_GetTable, _SQLite_GetTable2d

Example

#include <sqlite.au3>
#include <sqlite.dll.au3>

Local $hQuery,$aRow
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
; Whithout $sCallback its an Resultless query
_SQLite_Exec(-1,"Create table tblTest (a,b int,c single not null);" & _
"Insert into tblTest values ('1',2,3);" & _
"Insert into tblTest values (Null,5,6);")

$d = _SQLite_Exec(-1,"Select oid,* From tblTest","_cb") ; _cb Will be called for each row
Func _cb($aRow)
For $s In $aRow
ConsoleWrite($s & @TAB)
Next
ConsoleWrite(@CRLF)
; Return $SQLITE_ABORT ; Would Abort the process and trigger an @error in _SQLite_Exec()
EndFunc
_SQLite_Close()
_SQLite_Shutdown()

; Output:
;~ rowid a b c
;~ 1 1 2 3
;~ 2 5 6


Function _SQLite_FetchData

Function Reference

_SQLite_FetchData

Fetches 1 row of data from a _SQLite_Query() based query

#include <SQLite.au3>
_SQLite_FetchData ( $hQuery, ByRef $aRow [, $fBinary = False [, $fDoNotFinalize = False]] )

Parameters

$hQuery | Queryhandle passed out by _SQLite_Query()
$aRow | A 1 dimensional array containing a row of data
$fBinary | [optional] Switch for binary mode ($aRow will be a array of binary strings)
$fDoNotFinalize | [optional] Switch can be set to TRUE if you need to keep the query unfinalized for further use. (It is then the caller's responsability to invoke _SQLite_QueryFinalize before Shutdown.)

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check return value)
 | 1 - Error calling SQLite API 'sqlite3_step'
 | 2 - Error calling SQLite API 'sqlite3_data_count'
 | 3 - Error calling SQLite API 'sqlite3_column_text16'
 | 4 - Error calling SQLite API 'sqlite3_column_type'
 | 5 - Error calling SQLite API 'sqlite3_column_bytes'
 | 6 - Error calling SQLite API 'sqlite3_column_blob'
 | 7 - Call prevented by SafeMode

Remarks

None.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $aNames
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; open :memory: Database
_SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');")
_SQlite_Query (-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery)
_SQLite_FetchNames ($hQuery, $aNames)
ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CRLF)
While _SQLite_FetchData ($hQuery, $aRow, False, False) = $SQLITE_OK ; Read Out the next Row
ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CRLF)
WEnd
_SQLite_QueryFinalize($hQuery)
_SQLite_Exec (-1, "DROP TABLE aTest;")
_SQLite_Close ()
_SQLite_Shutdown ()

;~ Output:
;~
;~ rowid a b c
;~ 3 a 1 Hello
;~ 2 b 3
;~ 1 c 2 World


Function _SQLite_FetchNames

Function Reference

_SQLite_FetchNames

Read out the Column names of a _SQLite_Query() based query

#include <SQLite.au3>
_SQLite_FetchNames ( $hQuery, ByRef $aNames )

Parameters

$hQuery | Query handle generated by SQLite_Query()
$aNames | 1 dimensional array containing the Column names

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check return value)
 | 1 - Error calling SQLite API 'sqlite3_data_count'
 | 2 - Error calling SQLite API 'sqlite3_column_name16'
 | 3 - Call prevented by SafeMode

Remarks

None.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $aNames
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; open :memory: Database
_SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');")
_SQlite_Query (-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery)
_SQLite_FetchNames ($hQuery, $aNames) ; Read out Column Names
ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CRLF)
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
ConsoleWrite(StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CRLF)
WEnd
_SQLite_Exec (-1, "DROP TABLE aTest;")
_SQLite_Close ()
_SQLite_Shutdown ()

;~ Output:
;~
;~ rowid a b c
;~ 3 a 1 Hello
;~ 2 b 3
;~ 1 c 2 World


Function _SQLite_GetTable

Function Reference

_SQLite_GetTable

Passes Out a 1Dimensional Array Containing Tablenames and Data of Executed Query.

#include <SQLite.au3>
_SQLite_GetTable ( $hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $iColumns [, $iCharSize = 64 ] )

Parameters

$hDB | An open database, use -1 To use last opened database
$sSQL | SQL Statement to be executed
$aResult | Passes out the result
$iRows | Passes out the amount of 'data' Rows
$iColumns | Passes out the amount of columns
$iCharSize | [optional] Specifies the maximal size of a data field

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check Return value)
 | 1 - Error calling SQLite API 'sqlite3_get_table'
 | 2 - Error calling SQLite API 'sqlite3_free_table'
 | 3 - Call prevented by SafeMode
 | 4 - Error While converting SQL statement to UTF-8

Remarks

The number of values inserted into $aResult will be (($iRows) + 1) * ($iColumns)
this number is inserted into $aResult[0].
A NULL will be returned as numeric 0
This Function uses more memory than _SQlite_Query() / _SQLite_Fetch*()... but it's faster.
If you do not need a result (or if there will be none) consider using
_SQLite_Execute() or _SQLite_Exec().

Related

_SQLite_GetTable2d, _SQLite_Exec, _SQlite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; Open a :memory: database
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf

;Example Table
; Name | Age
; -----------------------
; Alice | 43
; Bob | 28
; Cindy | 21

If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; Query
$iRval = _SQLite_GetTable (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
;~ $aResult Looks Like this:
;~ [0] = 8
;~ [1] = Name
;~ [2] = Age
;~ [3] = Alice
;~ [4] = 43
;~ [5] = Bob
;~ [6] = 28
;~ [7] = Cindy
;~ [8] = 21
_ArrayDisplay($aResult, "Query Result")
Else
MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_GetTable2d

Function Reference

_SQLite_GetTable2d

Passes out a 2Dimensional array containing Column names and Data of executed Query

#include <SQLite.au3>
_SQLite_GetTable2d ( $hDB, $sSQL, ByRef $aResult, ByRef $iRows, ByRef $iColumns [, $iCharSize [, $fSwichDimensions = False ]] )

Parameters

$hDB | An Open Database, Use -1 To use Last Opened Database
$sSQL | SQL Statement to be executed
$aResult | Passes out the result
$iRows | Passes out the amount of 'data' Rows
$iColumns | Passes out the amount of columns
$iCharSize | [optional] Specifies the maximal size of a data field
$fSwichDimensions | [optional] Switches dimensions of $aResult

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check Return value)
 | 1 - Error Calling _SQLite_Query
 | 2 - Error calling SQLite API 'sqlite3_free_table'
 | 3 - Call prevented by SafeMode
 | 4 - Abort, Interrupt or @error set by Callback (@extended set to SQLite error)
 | 5 - Error while converting SQL statement to UTF-8

Remarks

The number of values inserted into $aResult will be (($iRows) + 1) * ($iColumns)
A NULL will be returned as Numeric 0
This function uses more memory
than _SQlite_Query() / _SQLite_Fetch*()... but it's Faster.
If you do not need a result (or if there will be none) consider using SQLite_Exec().

Related

_SQLite_GetTable, _SQLite_Exec, _SQlite_Query, _SQLite_Display2DResult

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; Open a :memory: database
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf

;Example Table
; Name | Age
; -----------------------
; Alice | 43
; Bob | 28
; Cindy | 21

If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; Query
$iRval = _SQLite_GetTable2d (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
_SQLite_Display2DResult($aResult)

;~ $aResult looks like this:
;~
;~ Name Age
;~ Alice 43
;~ Bob 28
;~ Cindy 21
;~
;~ If the dimensions would be switched in _SQLite_GetTable2d the result would look like this:
;~
;~ Name Alice Bob Cindy
;~ Age 43 28 21

Else
MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_LastInsertRowID

Function Reference

_SQLite_LastInsertRowID

Returns the ROWID of the most recent insert in the database

#include <SQLite.au3>
_SQLite_LastInsertRowID ( [ $hDB ] )

Parameters

$hDB [optional] An open database, use -1 to use last opened database

Return Value

Success: | Returns ROWID
Failure: | Returns 0
@error: | 1 - Error calling SQLite API 'sqlite3_last_insert_rowid'
 | 2 - Call prevented by SafeMode

Remarks

None.

Related

None.

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <Array.au3>

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; Open a :memory: database
If @error Then
MsgBox(16, "SQLite Error", "Can't Load Database!")
Exit - 1
EndIf

;Example Table
; Name | Age
; -----------------------
; Alice | 43
; Bob | 28
; Cindy | 21

; _SQLite_Exec() and _SQLite_Execute() are quite similar
If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; _SQLite_LastInsertRowID() tells us Cindy's row
MsgBox( 0, "_SQLite_LastInsertRowID()", _SQLite_LastInsertRowID() )

; Query
$iRval = _SQLite_GetTable (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
;~ $aResult Looks Like this:
;~ [0] = 8
;~ [1] = Name
;~ [2] = Age
;~ [3] = Alice
;~ [4] = 43
;~ [5] = Bob
;~ [6] = 28
;~ [7] = Cindy
;~ [8] = 21
_ArrayDisplay($aResult, "Query Result")
Else
MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_LibVersion

Function Reference

_SQLite_LibVersion

Returns the version number of the library

#include <SQLite.au3>
_SQLite_LibVersion ( )

Parameters

None.

Return Value

Success: | Returns SQLite version string
Failure: | @error = 1

Remarks

Requieres SQLite.dll in Current or System directory.

Related

None.

Example


Function _SQLite_Open

Function Reference

_SQLite_Open

Opens/creates a SQLite database.

#include <SQLite.au3>
_SQLite_Open ( [ $sDatabase_Filename = ":memory:" [,$iAccessMode [,$iEncoding ]]] )

Parameters

$sDatabase_Filename | [optional] Database filename, by default will opens an in memory database.
$iAccessMode | [optional] access mode flags. Defaults to $SQLITE_OPEN_READWRITE + $SQLITE_OPEN_CREATE
$iEncoding | [optional] encoding mode flag, only used at creation time. Defaults to $SQLITE_ENCODING_UTF8

Return Value

Success: | Returns database handle.
Failure: | Returns 0.
@error: | -1 - SQLite Reported an Error (Check @extended Value)
@extended: | value can be compared against $SQLITE_* constants

Remarks

There is no need to store the database handle.
Functions that use the handle are using the last opened by default.

To create a database encoded in UFT16 just create it with $iEncoding=$SQLITE_ENCODING_UTF16.

Related

_SQLite_Close

Example


Function _SQLite_Query

Function Reference

_SQLite_Query

Prepares a SQLite Query

#include <SQLite.au3>
_SQLite_Query ( $hDB, $sSQL, ByRef $hQuery )

Parameters

$hDB | An open database, use -1 to use last opened database
$sSQL | SQL statement to be executed
$hQuery | Passes out a query handle

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check return value)
 | 1 - Error calling SQLite API 'sqlite3_prepare16_v2'
 | 2 - Call prevented by SafeMode

Remarks

None.

Related

_SQLite_FetchData, _SQLite_FetchNames, _SQLite_Exec, _SQLite_GetTable, _SQLite_GetTable2d, _SQLite_QueryFinalize, _SQLite_QueryReset, _SQLite_QuerySingleRow, _SQLite_SetTimeout

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $sMsg
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; open :memory: Database
_SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);") ; CREATE a Table
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") ; INSERT Data
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');") ; INSERT Data
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") ; INSERT Data
_SQlite_Query (-1, "SELECT c FROM aTest ORDER BY a;", $hQuery) ; the query
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
$sMsg &= $aRow[0]
WEnd
_SQLite_Exec (-1, "DROP TABLE aTest;") ; Remove the table
MsgBox(0,"SQLite","Get Data using a Query : " & $sMsg )
_SQLite_Close()
_SQLite_Shutdown()

;~ Output:
;~
;~ Hello World


Function _SQLite_QueryFinalize

Function Reference

_SQLite_QueryFinalize

Finalizes an _SQLite_Query() based query. The query is interrupted.

#include <SQLite.au3>
_SQLite_QueryFinalize ( $hQuery )

Parameters

$hQuery Query handle generated by SQLite_Query()

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an Error (Check Return value)
 | 1 - Error calling SQLite API 'sqlite3_finalize'
 | 2 - Call prevented by SafeMode

Remarks

The _SQLite_QueryFinalize function is called to delete a prepared SQL statement obtained by a previous call to _SQLite_Query. If the statement was executed successfully, or not executed at all, then SQLITE_OK is returned. If execution of the statement failed then an error code is returned.

All prepared statements must finalized before _SQLite_Close is called or else the close will fail with a return code of SQLITE_BUSY.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $aNames
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; open :memory: Database
_SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');")
_SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');")
_SQlite_Query (-1, "SELECT ROWID,* FROM aTest ORDER BY a;", $hQuery)
_SQLite_FetchNames ($hQuery, $aNames) ; Read out the Tablenames
MsgBox(0,"SQLite","Row ID is : " & StringFormat(" %-10s %-10s %-10s %-10s ", $aNames[0], $aNames[1], $aNames[2], $aNames[3]) & @CRLF)
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK ; This get 1 row at a time
MsgBox(0,"SQLite","Get Data using FetchData : " & StringFormat(" %-10s %-10s %-10s %-10s ", $aRow[0], $aRow[1], $aRow[2], $aRow[3]) & @CRLF)
_SQLite_QueryFinalize ($hQuery) ; This will stop the query, getting more rows
WEnd
_SQLite_Exec (-1, "DROP TABLE aTest;")
_SQLite_Close ()
_SQLite_Shutdown ()

;~ Output:
;~
;~ rowid a b c
;~ 3 a 1 Hello


Function _SQLite_QueryReset

Function Reference

_SQLite_QueryReset

Reset a _SQLite_Query() based query

#include <SQLite.au3>
_SQLite_QueryReset ( $hQuery )

Parameters

$hQuery Query handle generated by SQLite_Query()

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check Return value)
 | 1 - Error calling SQLite API 'sqlite3_reset'
 | 2 - Call prevented by SafeMode

Remarks

If you want to re-execute the same query with different parameters, you should just use sqlite3_reset() instead of sqlite3_finalize(). This will reset the query so that it is ready to be executed again.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $hQuery, $aRow, $iSwitch
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE tblTest (a,b,c);")
_SQLite_Exec(-1,"INSERT INTO tblTest VALUES ('1','1','1');" & _ ; Row 1
"INSERT INTO tblTest VALUES ('2','2','2');" & _ ; Row 2
"INSERT INTO tblTest VALUES ('3','3','3');") ; Row 3
_SQLite_Query(-1,"SELECT RowID,* FROM tblTest;",$hQuery)
While _SQLite_FetchData($hQuery,$aRow) = $SQLITE_OK
$iSwitch = MsgBox(4+64, "Row: " & $aRow[0], $aRow[1] & "," & $aRow[2] & "," & $aRow[3] & @LF & _
"Continue Looping?")
If $iSwitch = 6 Then ; Yes
If $aRow[0] = 3 Then _SQLite_QueryReset($hQuery)
Else ; No
_SQLite_QueryFinalize($hQuery)
ExitLoop
EndIf
WEnd
_SQLite_Close()
_SQLite_Shutdown()


Function _SQLite_QuerySingleRow

Function Reference

_SQLite_QuerySingleRow

Read out the first row of the result from the specified query.

#include <SQLite.au3>
_SQLite_QuerySingleRow ( $hDB, $sSQL, ByRef $aRow )

Parameters

$hDB | An open database, use -1 to use last opened database
$sSQL | SQL statement to be executed
$aRow | Passes out the amount of 'data' rows

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite Reported an Error (Check Return value)
 | 1 - Error Calling _SQLite_Query
 | 2 - Call prevented by SafeMode
 | 3 - Error Calling _SQLite_FetchData
 | 4 - Error Calling _SQLite_QueryFinalize

Remarks

None.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $aRow
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open () ; open :memory: Database
_SQLite_Exec(-1,"CREATE TEMP TABLE settings (key,value);")
_SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('1','setting one');")
_SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('2','setting two');")
_SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('3','setting Three');")
_SQLite_Exec(-1,"INSERT INTO settings (key,value) VALUES ('4','setting Four');")
_SQLite_QuerySingleRow(-1,"SELECT value FROM settings WHERE key = '2' LIMIT 1;",$aRow) ; Select single row and single field !
MsgBox(0,"setting two:",$aRow[0])
_SQLite_Close ()
_SQLite_Shutdown ()


Function _SQLite_SafeMode

Function Reference

_SQLite_SafeMode

Disable or Enable Safe mode

#include <SQLite.au3>
_SQLite_SafeMode ( $fSafeModeState )

Parameters

$fSafeModeState True or False to enable or disable SafeMode

Return Value

Returns $SQLITE_OK

Remarks

Safe mode prevents SQLite from crashing which can be caused by passing invalid query or database handles.
It's enabled by default.

Related

None.

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_SafeMode(False)
_SQLite_Exec(-1,"CREATE tblTest (a,b,c);"); No database open, this will crash due to SafeMode = false
_SQLite_Shutdown()


Function _SQLite_SetTimeout

Function Reference

_SQLite_SetTimeout

Sets timeout for busy handler

#include <SQLite.au3>
_SQLite_SetTimeout ( [ $hDB = -1 [, $iTimeout = 1000 ]] )

Parameters

$hDB | [optional] An open database, use -1 to use last opened database
$iTimeout | [optional] Timeout [msec]

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | -1 - SQLite reported an error (Check Return value)
 | 1 - Error calling SQLite API 'sqlite3_busy_timeout'
 | 2 - Call prevented by SafeMode

Remarks

This routine sets a busy handler that sleeps for a while when a table is locked. The handler will sleep multiple times until at least "ms" milliseconds of sleeping have been done. After "ms" milliseconds of sleeping, the handler returns 0 which causes sqlite3_exec() to return SQLITE_BUSY.

Related

_SQLite_Query

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <File.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)

Local $sDatabase, $hDB_a, $hDB_b, $iTimer, $iRval
$sDatabase = _TempFile()
$hDB_a = _SQLite_Open($sDatabase)
$hDB_b = _SQLite_Open($sDatabase)

_SQLite_Exec($hDB_a,"BEGIN EXCLUSIVE;")
_SQLite_Exec($hDB_a,"CREATE TABLE test (a,b,c);")
_SQLite_Exec($hDB_a,"INSERT INTO test VALUES (1,2,3);")
; Table 'test' is Busy now...

_SQLite_SetTimeout($hDB_b,0)
$iTimer = TimerInit()
$iRval = _SQLite_Exec($hDB_b,"SELECT * FROM test") ; This will fail
MsgBox(0,"_SQLite_SetTimeout Example No Timeout", "Time: " & TimerDiff($iTimer) & @CRLF _
& "Error: " & _SQLite_ErrMsg($hDB_b) & @CRLF)
_SQLite_SetTimeout($hDB_b,5000)
$iTimer = TimerInit()
$iRval = _SQLite_Exec($hDB_b,"SELECT * FROM test") ; This will fail
MsgBox(0,"_SQLite_SetTimeout Example 5 Sec Timeout", "Time: " & TimerDiff($iTimer) & @CRLF _
& "Error: " & _SQLite_ErrMsg($hDB_b) & @CRLF)
_SQLite_Exec($hDB_a,"END;")
_SQLite_Close($hDB_a)
_SQLite_Close($hDB_b)
_SQLite_Shutdown()
FileDelete($sDatabase)


Function _SQLite_Shutdown

Function Reference

_SQLite_Shutdown

Unloads SQLite.dll

#include <SQLite.au3>
_SQLite_Shutdown ( )

Parameters

None.

Return Value

None.

Remarks

If _SQLite_Startup() failed or was not executed, an AutoIt runtime error will be thrown, and the script will terminate!
AutoIt automatically closes any dlls it opened, but calling _SQLite_Shutdown is still a good idea.

Related

_SQLite_Startup

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
_SQLite_Startup ()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
_SQLite_Shutdown ()


Function _SQLite_SQLiteExe

Function Reference

_SQLite_SQLiteExe

Executes commands in SQLite.exe

#include <SQLite.au3>
_SQLite_SQLiteExe ( $sDatabaseFile, $sInput, ByRef $sOutput [, $sSQLiteExeFilename = "SQLite3.exe" ] )

Parameters

$sDatabaseFile | Database filename
$sInput | Commands for SQLite.exe
$sOutput | Raw output from SQLite.exe
$sSQLiteExeFilename | [optional] Path to SQlite.exe

Return Value

Success: | Returns $SQLITE_OK
Failure: | Return value can be compared against $SQLITE_* constants
@error: | 1 - Can't create new Database
 | 2 - SQLite3.exe not Found
 | 3 - SQL error / incomplete SQL
 | 4 - Can't open input file

Remarks

Run SQLite.exe, press enter and type .Help for more info about the SQLite3.exe Commands.

SQLite3.exe can be found at the SQLite Web site. A copy with an help file can be found in AutoIt3\Extras\SQLite dir.

Related

None.

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <file.au3>

;Filenames
Local $sTsvFile = FileGetShortName(_TempFile(@ScriptDir,"~",".tsv"))
Local $sDbFile = FileGetShortName(_TempFile(@ScriptDir,"~",".db"))

;Create Tsv File
FileWriteLine($sTsvFile,"a" & @TAB & "b" & @TAB & "c")
FileWriteLine($sTsvFile,"a1" & @TAB & "b1" & @TAB & "c1")
FileWriteLine($sTsvFile,"a2" & @TAB & "b2" & @TAB & "c2")

;import (using SQLite3.exe)
Local $sIn,$sOut,$i, $sCreate = "CREATE TABLE TblImport (";
for $i = 1 To _StringCountOccurance(FileReadLine($sTsvFile,1),@TAB) + 1
$sCreate &= "Column_" & $i & ","
Next
$sCreate = StringTrimRight($sCreate,1) & ");"
$sIn = $sCreate & @CRLF ; Create Table
$sIn &= ".separator \t" & @CRLF ; Select @TAB as Separator
$sIn &= ".import '" & $sTsvFile & "' TblImport" & @CRLF
_SQLite_SQLiteExe($sDbFile,$sIn,$sOut,-1,true)

If @error = 0 Then
;Show Table (using SQLite3.dll)
Local $iRows,$iColumns,$aRes
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open($sDbFile)
_SQLite_GetTable2d(-1,"SELECT ROWID,* FROM TblImport;",$aRes,$iRows,$iColumns)
_SQLite_Display2DResult($aRes) ; Output to Console
_SQLite_Close()
_SQLite_Shutdown()
Else
If @error = 2 Then
ConsoleWrite("ERROR: Sqlite3.exe file not found" & @CRLF)
Else
ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF)
EndIf
EndIf

;Remove Temp Files
FileDelete($sTsvFile)
FileDelete($sDbFile)

;~ Output:
;~ rowid Column_1 Column_2 Column_3
;~ 1 a b c
;~ 2 a1 b1 c1
;~ 3 a2 b2 c2

Func _StringCountOccurance($sSearchString,$sSubString,$fCaseSense = 0) ; Returns Number of $sSubString in $sSearchString
Local $iOccCnt = 1
Do
If StringInStr($sSearchString,$sSubString,$fCaseSense,$iOccCnt) > 0 Then
$iOccCnt += 1
Else
ExitLoop
EndIf
Until 0
Return $iOccCnt - 1
EndFunc


Function _SQLite_Startup

Function Reference

_SQLite_Startup

Loads SQLite.dll

#include <SQLite.au3>
_SQLite_Startup ( [ $sDll_Filename = "sqlite3.dll" [, $bUTF8ErrorMsg = False ]] )

Parameters

$sDll_Filename | [optional] Dll filename
$bUTF8ErrorMsg | [optional] to force ConsoleWrite to display UTF8 chars

Return Value

Success: | Returns path to SQLite3.dll
Failure: | @error = 1

Remarks

Requieres SQLite3.dll in @ScriptDir or @SystemDir.

If SQLite3.dll.au3 is included the dll will be created in @SystemDir.
If not successfull a temporary file will be created that will be destroyed at _SQLite_Shutdown().

If $bUTF8ErrorMsg is not zero prints UTF8 formated string prints to console.
This allows application as SCiTE to display those characters if configures with output.code.page=65001.
This is the case when running SCiTE under a non-english version as Vista(fr).

Related

_SQLite_Shutdown

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

Local $sSQliteDll
$sSQliteDll = _SQLite_Startup ()
If @error Then
MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
MsgBox(0,"SQLite3.dll Loaded",$sSQliteDll)
_SQLite_Shutdown ()


Function _SQLite_TotalChanges

Function Reference

_SQLite_TotalChanges

Returns number of all changes (including triggers) of all transactions

#include <SQLite.au3>
_SQLite_TotalChanges ( [ $hDB ] )

Parameters

$hDB [optional] An open database, default is the last opened database

Return Value

Success: | Returns number of changes
Failure: | Returns 0.
@error: | 1 - Error calling SQLite API 'sqlite3_changes'
 | 2 - Call prevented by SafeMode

Remarks

None.

Related

None.

Example

#include <SQLite.au3>
#include <SQLite.dll.au3>

_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CRLF)
_SQLite_Open()
_SQLite_Exec(-1,"CREATE TABLE test (a, b);") ; Create Table
_SQLite_Exec(-1,"INSERT INTO test VALUES ('1', '2');") ; Insert Row 1
_SQLite_Exec(-1,"INSERT INTO test VALUES ('3', '4');") ; Insert Row 2
MsgBox(0,"SQLite","The Last Query changed " & _SQLite_Changes() & " Rows" & @CRLF & _
"All Query changed " & _SQLite_TotalChanges() & " Rows")
_SQLite_Close()
_SQLite_Shutdown()


User Defined Functions

String user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <String.au3>.

User Defined Function | Description
_HexToString | Convert a hex string to a string.
_StringBetween | Returns the string between the start search string and the end search string.
_StringEncrypt | An RC4 based string encryption function.
_StringExplode | Splits up a string into substrings depending on the given delimiters as PHP Explode v5.
_StringInsert | Inserts a string within another string.
_StringProper | Changes a string to proper case, same a =Proper function in Excel
_StringRepeat | Repeats a string a specified number of times.
_StringReverse | Reverses the contents of the specified string.
_StringToHex | Convert a string to a hex string.


Function _HexToString

Function Reference

_HexToString

Convert a hex string to a string.

#Include <String.au3>
_HexToString($strHex)

Parameters

$strHex an hexadecimal string

Return Value

Success: | Returns a string
Failure: | Returns -1 and sets @error to 1

Remarks

None.

Related

_StringToHex

Example

#include <string.au3>
$String = "I like AutoIt3"
$Hex = _StringToHex($String)
MsgBox(0, "Hex", "Original String: " & $String & @LF & " Hex: " & $Hex)

$Hex = "49206C696B65204175746F497433"
$String = _HexToString($Hex)
MsgBox(0, "Hex", "Original Hex: " & $Hex & @LF & " String: " & $String)


Function _StringBetween

Function Reference

_StringBetween

Returns the string between the start search string and the end search string.

#Include <String.au3>
_StringBetween($s_String, $s_Start, $s_End [, $v_Case = -1])

Parameters

$s_String | The string to search.
$s_Start | The beginning of the string to find. Passing a blank string starts at the beginning
$s_End | The end of the string to find. Passing a blank string searches from $s_Start to end
$v_Case | [optional] Case sensitive search. Default or -1 is not Case sensitive else Case sensitive.

Return Value

Success: | A 0 based $array[0] contains the first found string.
Failure: | 0
@error: | 1 - No inbetween string found.

Remarks

2009/05/03 Script breaking change, removed 5th parameter

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <String.au3>
#include <Array.au3>

_Main()

Func _Main()
Local $aArray1 = _StringBetween('[18][20][3][5][500][60]', '[', ']')
_ArrayDisplay($aArray1, 'Default Search')
EndFunc ;==>_Main


Function _StringEncrypt

Function Reference

_StringEncrypt

An RC4 based string encryption function.

#Include <String.au3>
_StringEncrypt($i_Encrypt, $s_EncryptText, $s_EncryptPassword [, $i_EncryptLevel = 1])

Parameters

$i_Encrypt | 1 to encrypt, 0 to decrypt.
$s_EncryptText | Text to encrypt/decrypt.
$s_EncryptPassword | Password to encrypt/decrypt with.
$i_EncryptLevel | [optional] Level to encrypt/decrypt. Default = 1

Return Value

Success: | The Encrypted/Decrypted string.
Failure: | Blank string and @error = 1

Remarks

WARNING: This function has an extreme timespan if the encryption level or encrypted string are too large!

Related

Example

#include <GuiConstantsEx.au3>
#include <String.au3>

Opt("MustDeclareVars", 1)

_Main()

Func _Main()
Local $WinMain, $EditText, $InputPass, $InputLevel, $UpDownLevel, $EncryptButton, $DecryptButton, $string
; GUI and String stuff
$WinMain = GUICreate('Encryption tool', 400, 400)
; Creates window
$EditText = GUICtrlCreateEdit('', 5, 5, 380, 350)
; Creates main edit
$InputPass = GUICtrlCreateInput('', 5, 360, 100, 20, 0x21)
; Creates the password box with blured/centered input
$InputLevel = GUICtrlCreateInput(1, 110, 360, 50, 20, 0x2001)
$UpDownLevel = GUICtrlSetLimit(GUICtrlCreateUpdown($InputLevel), 10, 1)
; These two make the level input with the Up|Down ability
$EncryptButton = GUICtrlCreateButton('Encrypt', 170, 360, 105, 35)
; Encryption button
$DecryptButton = GUICtrlCreateButton('Decrypt', 285, 360, 105, 35)
; Decryption button
GUICtrlCreateLabel('Password', 5, 385)
GUICtrlCreateLabel('Level', 110, 385)
; Simple text labels so you know what is what
GUISetState()
; Shows window

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $EncryptButton
GUISetState(@SW_DISABLE, $WinMain) ; Stops you from changing anything
$string = GUICtrlRead($EditText) ; Saves the editbox for later
GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.') ; Friendly message
GUICtrlSetData($EditText, _StringEncrypt(1, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel)))
; Calls the encryption. Sets the data of editbox with the encrypted string
; The encryption starts with 1/0 to tell it to encrypt/decrypt
; The encryption then has the string that we saved for later from edit box
; It then reads the password box & Reads the level box
GUISetState(@SW_ENABLE, $WinMain) ; This turns the window back on
Case $DecryptButton
GUISetState(@SW_DISABLE, $WinMain) ; Stops you from changing anything
$string = GUICtrlRead($EditText) ; Saves the editbox for later
GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.') ; Friendly message
GUICtrlSetData($EditText, _StringEncrypt(0, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel)))
; Calls the encryption. Sets the data of editbox with the encrypted string
; The encryption starts with 1/0 to tell it to encrypt/decrypt
; The encryption then has the string that we saved for later from edit box
; It then reads the password box & Reads the level box
GUISetState(@SW_ENABLE, $WinMain) ; This turns the window back on
EndSwitch
WEnd ; Continue loop untill window is closed
Exit
EndFunc ;==>_Main


Function _StringExplode

Function Reference

_StringExplode

Splits up a string into substrings depending on the given delimiters as PHP Explode v5.

#Include <String.au3>
_StringExplode($sString, $sDelimiter [, $iLimit] )

Parameters

$sString | String to be split
$sDelimiter | Delimiter to split on (split is performed on entire string, not individual characters)
$iLimit | [optional] Maximum elements to be returned =0 : (default) Split on every instance of the delimiter >0 : Split until limit, last element will contain remaining portion of the string <0 : Split on every instance, removing limit count from end of the array

Return Value

Success an array containing the exploded strings.

Remarks

Use negative limit values to remove the first possible elements.

Related

Example

#include <String.au3>
#include <Array.au3>

$text = "one##two##three##four##five##six##seven##eight"
$array1 = _StringExplode($text, "##", 0)
_ArrayDisplay($array1, "StringExplode 0")

;DISPLAYED
;[0] = one
;[1] = two
;[2] = three
;[3] = four
;[4] = five
;[5] = six
;[6] = seven
;[7] = eight

$array2 = _StringExplode($text, "##", 4)
_ArrayDisplay($array2, "StringExplode 4")

;DISPLAYED
;[0] = one
;[1] = two
;[2] = three
;[3] = four
;[4] = five##six##seven##eight

$array3 = _StringExplode($text, "##", -3)
_ArrayDisplay($array3, "StringExplode -3")

;DISPLAYED
;[0] = one
;[1] = two
;[2] = three
;[3] = four
;[4] = five


Function _StringInsert

Function Reference

_StringInsert

Inserts a string within another string.

#Include <String.au3>
_StringInsert($s_String, $s_InsertString, $i_Position)

Parameters

$s_String | Original string
$s_InsertString | String to be inserted
$i_Position | Position to insert string (negatives values count from right hand side)

Return Value

Success | Returns new modified string
Failure | Returns original string and set @error
@Error: | 1 - Source string empty
 | 2 - Insert string empty
 | 3 - Invalid position

Remarks

Use negative position values to insert string from the right hand side.

Related

Example

#include<string.au3>
; Inserts three "moving" underscores and prints them to the console
For $i_loop = -20 To 20
ConsoleWrite($i_loop & @TAB & _StringInsert ("Supercalifragilistic", "___", $i_loop) & @CRLF)
Next


Function _StringProper

Function Reference

_StringProper

Changes a string to proper case, same a =Proper function in Excel

#Include <String.au3>
_StringProper($s_String)

Parameters

$s_String Input string

Return Value

Success: | Returns proper string
Failure: | Returns ""

Remarks

This function will capitalize every character following a None Apha character.

Related

Example

#include <String.au3>
;Will return : Somebody Lastnames
Msgbox(0,'',_StringProper("somebody lastnames"))
;Will return : Some.Body Last(Name)
Msgbox(0,'',_StringProper("SOME.BODY LAST(NAME)"))
Exit


Function _StringRepeat

Function Reference

_StringRepeat

Repeats a string a specified number of times.

#Include <String.au3>
_StringRepeat($sString, $iRepeatCount)

Parameters

$sString | String to repeat
$iRepeatCount | Number of times to repeat the string

Return Value

Success: | Returns string with specified number of repeats
Failure: | Returns an empty string and sets @error
@Error: | 0 - No error
 | 1 - One of the parameters is invalid

Remarks

None.

Related

Example

#include <String.au3>

Msgbox(0,'',_StringRepeat("+-",40))
Exit


Function _StringReverse

Function Reference

_StringReverse

Reverses the contents of the specified string.

#Include <String.au3>
_StringReverse($s_String)

Parameters

$s_String String to reverse

Return Value

Success: | Returns reversed string
Failure: | Returns an empty string and sets @error
@Error: | 0 = No error
 | 1 = One of the parameters is invalid
 | 2 = Dll error

Remarks

None.

Related

Example

#include <String.au3>
Msgbox(0,'',_StringReverse("esreveR"))
Exit


Function _StringToHex

Function Reference

_StringToHex

Convert a string to a hex string.

#Include <String.au3>
_StringToHex($strChar)

Parameters

$strChar string to be converted.

Return Value

Success: | Returns an hex string
Failure: | Returns -1 and sets @error to 1

Remarks

None.

Related

_HexToString

Example

#include <string.au3>
$String = "I like AutoIt3"
$Hex = _StringToHex($String)
MsgBox(0, "Hex", "Original String: " & $String & @LF & " Hex: " & $Hex)

$Hex = "49206C696B65204175746F497433"
$String = _HexToString($Hex)
MsgBox(0, "Hex", "Original Hex: " & $Hex & @LF & " String: " & $String)


User Defined Functions

StructureConstants user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <StructureConstants.au3>.

User Defined Function | Description
$tagBITMAPINFO | This structure defines the dimensions and color information of a Windows-based device-independent bitmap (DIB).
$tagBLENDFUNCTION | $tagBLENDFUNCTION structure controls blending by specifying the blending functions for source and destination bitmaps
$tagCOLORSCHEME | Contains information for the drawing of buttons in a toolbar or rebar
$tagCOMBOBOXEXITEM | Contains information about an item in a ComboBoxEx control
$tagDTPRANGE | Specifies a date and time, in coordinated universal time (UTC)
$tagDTPTIME | Specifies a date and time, in coordinated universal time (UTC)
$tagEVENTLOGRECORD | Contains information about an event record
$tagFILETIME | Contains the number of 100-nanosecond intervals since January 1, 1601
$tagGDIPBITMAPDATA | Bitmap Data
$tagGDIPENCODERPARAM | $tagGDIPENCODERPARAM structure
$tagGDIPENCODERPARAMS | $tagGDIPENCODERPARAMS structure
$tagGDIPIMAGECODECINFO | $tagGDIPIMAGECODECINFO structure
$tagGDIPPENCODERPARAMS | tagGDIPPENCODERPARAMS structure
$tagGDIPRECTF | $tagGDIPRECTF structure
$tagGDIPSTARTUPINPUT | $tagGDIPSTARTUPINPUT structure
$tagGDIPSTARTUPOUTPUT | $tagGDIPSTARTUPOUTPUT structure
$tagGETIPAddress | Contains information for all 4 fields of the IP Address control
$tagGUID | Represents a globally unique identifier (GUID)
$tagHDITEM | Contains information about an item in a header control
$tagIMAGEINFO | Contains information about an image in an image list
$tagKBDLLHOOKSTRUCT | Contains information about a low-level keyboard input event
$tagLOGFONT | Defines the attributes of a font
$tagLVFINDINFO | Contains information used when searching for a list-view item
$tagLVHITTESTINFO | Contains information about a hit test
$tagLVITEM | Specifies or receives the attributes of a list-view item
$tagMARGINS | Defines the margins of windows that have visual styles applied
$tagMCHITTESTINFO | Carries information specific to hit-testing points for a month calendar control
$tagMCMONTHRANGE | Retrieves date information that represents the high and low limits of a month calendar control's display
$tagMCRANGE | Contains information for setting the minimum and maximum allowable dates for a month calendar control
$tagMCSELRANGE | Specifies a date and time, in coordinated universal time (UTC)
$tagMENUINFO | Contains information about a menu
$tagMENUITEMINFO | Contains information about a menu item
$tagNETRESOURCE | tagNETRESOURCE structure
$tagNMCBEDRAGBEGIN | Contains information used with the $CBEN_DRAGBEGIN notification message
$tagNMCBEENDEDIT | Contains information about the conclusion of an edit operation within a ComboBoxEx control
$tagNMCOMBOBOXEX | Contains information specific to ComboBoxEx items for use with notification messages
$tagNMDATETIMECHANGE | Contains information about a change that has taken place in a date and time picker (DTP) control
$tagNMDATETIMEFORMAT | Contains information about a portion of the format string that defines a callback field within a date and time picker (DTP) control
$tagNMDATETIMEFORMATQUERY | Contains information about the control callback field
$tagNMDATETIMEKEYDOWN | Carries information used to describe and handle a $DTN_WMKEYDOWN notification message
$tagNMDATETIMESTRING | Contains information specific to an edit operation that has taken place in the control
$tagNMDAYSTATE | Carries information required to process the $MCN_GETDAYSTATE notification me
$tagNMHDDISPINFO | Contains information used in handling $HDN_GETDISPINFO notification messages
$tagNMHDFILTERBTNCLICK | Specifies or receives the attributes of a filter button click
$tagNMHDR | Contains information about a notification message
$tagNMHEADER | Contains information about control notification messages
$tagNMIPADDRESS | Contains information for the $IPN_FIELDCHANGED notification message
$tagNMITEMACTIVATE | Sent by a list-view control when the user activates an item
$tagNMLISTVIEW | Contains information about a list-view notification message
$tagNMLVCUSTOMDRAW | Contains information specific to an NM_CUSTOMDRAW (list view) notification message sent by a list-view control
$tagNMLVDISPINFO | Contains information about an $LVN_GETDISPINFO or $LVN_SETDISPINFO notification message
$tagNMLVFINDITEM | Contains information the owner needs to find items requested by a virtual list view control
$tagNMLVGETINFOTIP | Contains and receives list-view item information needed to display a ToolTip for an item
$tagNMLVKEYDOWN | Contains information used in processing the $LVN_KEYDOWN notification message
$tagNMLVSCROLL | Provides information about a scrolling operation
$tagNMMOUSE | Contains information used with mouse notification messages
$tagNMOBJECTNOTIFY | Contains information used with the $TBN_GETOBJECT, $TCN_GETOBJECT, $RBN_GETOBJECT, and $PSN_GETOBJECT notification messages
$tagNMRBAUTOSIZE | Contains information used in handling the $RBN_AUTOSIZE notification messages
$tagNMREBAR | Contains information used in handling various rebar notification messages
$tagNMREBARAUTOBREAK | Contains information used with the $RBN_AUTOBREAK notification
$tagNMREBARCHEVRON | Contains information used in handling the RBN_CHEVRONPUSHED notification message
$tagNMREBARCHILDSIZE | Contains information used in handling the RBN_CHILDSIZE notification message
$tagNMSELCHANGE | Carries information required to process the $MCN_SELCHANGE notification message
$tagNMTBHOTITEM | Contains information used with the $TBN_HOTITEMCHANGE notification
$tagNMTCKEYDOWN | Contains information used in processing the $LVN_KEYDOWN notification message
$tagNMTOOLBAR | Contains information used to process toolbar notification messages
$tagNMTREEVIEW | Contains information about a tree-view notification message
$tagNMTVCUSTOMDRAW | Contains information specific to an NM_CUSTOMDRAW (tree view) notification message sent by a tree-view control
$tagNMTVDISPINFO | Contains and receives display information for a tree-view item
$tagNMTVGETINFOTIP | Contains and receives tree-view item information needed to display a ToolTip for an item
$tagNMTVKEYDOWN | Contains information about a keyboard event in a tree-view control
$tagOPENFILENAME | Contains information information that the GetOpenFileName and GetSaveFileName functions use to initialize an Open or Save As dialog box
$tagOVERLAPPED | Contains information used in asynchronous (or overlapped) input and output (I/O).
$tagPOINT | Defines the x- and y- coordinates of a point
$tagPROCESS_INFORMATION | Contains information about a newly created process and its primary thread
$tagREBARBANDINFO | Contains information about an item in a ComboBoxEx control
$tagRECT | Defines the coordinates of the upper-left and lower-right corners of a rectangle
$tagSCROLLBARINFO | Contains scroll bar information
$tagSCROLLINFO | Contains scroll bar parameters to be set by the $SBM_SETSCROLLINFO message, or retrieved by the $SBM_GETSCROLLINFO message
$tagSECURITY_ATTRIBUTES | Contains the security descriptor for an object and specifies whether the handle retrieved by specifying this structure is inheritable
$tagSIZE | Stores an ordered pair of integers, typically the width and height of a rectangle
$tagSTARTUPINFO | Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time
$tagSYSTEMTIME | Specifies a date and time, in coordinated universal time (UTC)
$tagTBBUTTON | Contains information about a button in a toolbar
$tagTBBUTTONINFO | Contains or receives information for a specific button in a toolbar
$tagTIME_ZONE_INFORMATION | Specifies information specific to the time zone
$tagTOKEN_PRIVILEGES | Contains information about a set of privileges for an access token
$tagTVHITTESTINFO | Contains information used to determine the location of a point relative to a tree-view control
$tagTVITEMEX | Specifies or receives attributes of a tree-view item
$tagWIN32_FIND_DATA | Contains the data found when finding a file
$tagWINDOWPLACEMENT | The WINDOWPLACEMENT structure contains information about the placement of a window on the screen
$tagWINDOWPOS | The WINDOWPOS structure contains information about the size and position of a window


Keyword $tagBITMAPINFO

Keyword Reference

$tagBITMAPINFO

This structure defines the dimensions and color information of a Windows-based device-independent bitmap (DIB).

Global Const $tagBITMAPINFO = "dword Size;long Width;long Height;word Planes;word BitCount;dword Compression;dword SizeImage;" & _
"long XPelsPerMeter;long YPelsPerMeter;dword ClrUsed;dword ClrImportant;dword RGBQuad"

Parameters

Size | The number of bytes required by the structure, minus the size of the RGBQuad data
Width | Specifies the width of the bitmap, in pixels
Height | Specifies the height of the bitmap, in pixels
Planes | Specifies the number of planes for the target device. This must be set to 1
BitCount | Specifies the number of bits-per-pixel
Compression | Specifies the type of compression for a compressed bottom-up bitmap
SizeImage | Specifies the size, in bytes, of the image
XPelsPerMeter | Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap
YPelsPerMeter | Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap
ClrUsed | Specifies the number of color indexes in the color table that are actually used by the bitmap
ClrImportant | Specifies the number of color indexes that are required for displaying the bitmap
RGBQuad | An array of tagRGBQUAD structures. The elements of the array that make up the color table.

Remarks

None.

Related


Keyword $tagBLENDFUNCTION

Keyword Reference

$tagBLENDFUNCTION

$tagBLENDFUNCTION structure controls blending by specifying the blending functions for source and destination bitmaps

Global Const $tagBLENDFUNCTION = "byte Op;byte Flags;byte Alpha;byte Format"

Parameters

Op | Specifies the source blend operation:
Flags | Must be zero
Alpha | Specifies an alpha transparency value to be used on the entire source bitmap. This value is combined with any per-pixel alpha values in the source bitmap. If set to 0, it is assumed that your image is transparent. Set to 255 (opaque) when you only want to use per-pixel alpha values.
Format | This member controls the way the source and destination bitmaps are interpreted: $AC_SRC_ALPHA - This flag is set when the bitmap has an Alpha channel (that is, per-pixel alpha). Note that the APIs use premultiplied alpha, which means that the red, green and blue channel values in the bitmap must be premultiplied with the alpha channel value.

Remarks

The source bitmap used with $tagBLENDFUNCTION must be 32 bpp

Related


Keyword $tagCOLORSCHEME

Keyword Reference

$tagCOLORSCHEME

Contains information for the drawing of buttons in a toolbar or rebar

Global Const $tagCOLORSCHEME = "dword Size;dword BtnHighlight;dword BtnShadow"

Parameters

Size | Size of this structure, in bytes
BtnHighlight | The COLORREF value that represents the highlight color of the buttons. Use $CLR_DEFAULT for the default highlight color.
BtnShadow | The COLORREF value that represents the shadow color of the buttons. Use $CLR_DEFAULT for the default shadow color.

Remarks

None.

Related


Keyword $tagCOMBOBOXEXITEM

Keyword Reference

$tagCOMBOBOXEXITEM

Contains information about an item in a ComboBoxEx control

Global Const $tagCOMBOBOXEXITEM = "int Mask;int Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & _
"int Indent;int Param"

Parameters

Mask | A set of bit flags that specify attributes. Can be a combination of the following values. CBEIF_DI_SETITEM - Set this flag when processing CBEN_GETDISPINFO CBEIF_IMAGE - The iImage member is valid or must be filled in. CBEIF_INDENT - The iIndent member is valid or must be filled in. CBEIF_LPARAM - The lParam member is valid or must be filled in. CBEIF_OVERLAY - The iOverlay member is valid or must be filled in. CBEIF_SELECTEDIMAGE - The iSelectedImage member is valid or must be filled in. CBEIF_TEXT - The pszText member is valid or must be filled in.
Item | The zero-based index of the item.
Text | A pointer to a character buffer that contains or receives the item's text.
TextMax | The length of pszText, in TCHARs. If text information is being set, this member is ignored.
Image | The zero-based index of an image within the image list.
SelectedImage | The zero-based index of an image within the image list.
OverlayImage | The one-based index of an overlay image within the image list.
Indent | The number of indent spaces to display for the item. Each indentation equals 10 pixels.
Param | A value specific to the item.

Remarks

None.

Related


Keyword $tagDTPRANGE

Keyword Reference

$tagDTPRANGE

Specifies a date and time, in coordinated universal time (UTC)

Global Const $tagDTPRANGE = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & _
"word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & _
"word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid"

Parameters

MinYear | Minimum year
MinMonth | Minimum month
MinDOW | Minimum day of week
MinDay | Minimum day
MinHour | Minimum hour
MinMinute | Minimum minute
MinSecond | Minimum second
MinMSecond | Minimum milliseconds
MaxYear | Maximum year
MaxMonth | Maximum month
MaxDOW | Maximum day of week
MaxDay | Maximum day
MaxHour | Maximum hour
MaxMinute | Maximum Minute
MaxSecond | Maximum second
MaxMSecond | Maximum milliseconds
MinValid | If True, minimum data is valid
MaxValid | If True, maximum data is valid

Remarks

None.

Related


Keyword $tagDTPTIME

Keyword Reference

$tagDTPTIME

Specifies a date and time, in coordinated universal time (UTC)

Global Const $tagDTPTIME = "short Year;short Month;short DOW;short Day;short Hour;short Minute;short Second;short MSecond"

Parameters

Year | Year
Month | Month
DOW | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSecond | Milliseconds

Remarks

None.

Related


Keyword $tagEVENTLOGRECORD

Keyword Reference

$tagEVENTLOGRECORD

Contains information about an event record

Global Const $tagEVENTLOGRECORD = "int Length;int Reserved;int RecordNumber;int TimeGenerated;int TimeWritten;int EventID;" & _
"short EventType;short NumStrings;short EventCategory;short ReservedFlags;int ClosingRecordNumber;int StringOffset;" & _
"int UserSidLength;int UserSidOffset;int DataLength;int DataOffset"

Parameters

Length | The size of this event record, in bytes
Reserved | Reserved
RecordNumber | The number of the record
TimeGenerated | The time at which this entry was submitted
TimeWritten | The time at which this entry was received by the service to be written to the log
EventID | The event identifier
EventType | The type of event
NumStrings | The number of strings present in the log
EventCategory | The category for this event
ReservedFlags | Reserved
ClosingRecordNumber | Reserved
StringOffset | The offset of the description strings within this event log record
UserSidLength | The size of the UserSid member, in bytes
UserSidOffset | The offset of the security identifier (SID) within this event log record
DataLength | The size of the event-specific data (at the position indicated by DataOffset), in bytes
DataOffset | The offset of the event-specific information within this event log record, in bytes

Remarks

None.

Related


Keyword $tagFILETIME

Keyword Reference

$tagFILETIME

Contains the number of 100-nanosecond intervals since January 1, 1601

Global Const $tagFILETIME = "dword Lo;dword Hi"

Parameters

Lo | The low order part of the file time
Hi | The high order part of the file time

Remarks

None.

Related


Keyword $tagGDIPBITMAPDATA

Keyword Reference

$tagGDIPBITMAPDATA

Bitmap Data

Global Const $tagGDIPBITMAPDATA = "uint Width;uint Height;int Stride;uint Format;ptr Scan0;ptr Reserved"

Parameters

Width | Number of pixels in one scan line of the bitmap
Height | Number of scan lines in the bitmap
Stride | Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up
Format | Specifies the pixel format of the bitmap
Scan0 | Pointer to the first (index 0) scan line of the bitmap
Reserved | Reserved for future use

Remarks

None.

Related


Keyword $tagGDIPENCODERPARAM

Keyword Reference

$tagGDIPENCODERPARAM

$tagGDIPENCODERPARAM structure

Global Const $tagGDIPENCODERPARAM = "byte GUID[16];dword Count;dword Type;ptr Values"

Parameters

GUID | Indentifies the parameter category (GDI_EPG constants)
Count | Number of values in the array pointed to by the Value member
Type | Identifies the data type of the parameters (GDI_EPT constants)
Values | Pointer to an array of values. Each value has the type specified by the Type member.

Remarks

None.

Related


Keyword $tagGDIPENCODERPARAMS

Keyword Reference

$tagGDIPENCODERPARAMS

$tagGDIPENCODERPARAMS structure

Global Const $tagGDIPENCODERPARAMS = "dword Count;byte Params[0]"

Parameters

Count | Number of $tagGDIPENCODERPARAM structures in the array
Params | Start of $tagGDIPENCODERPARAM structures

Remarks

None.

Related


Keyword $tagGDIPIMAGECODECINFO

Keyword Reference

$tagGDIPIMAGECODECINFO

$tagGDIPIMAGECODECINFO structure

Global Const $tagGDIPIMAGECODECINFO = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & _
"ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask"

Parameters

CLSID | Codec identifier (GUID structure)
FormatID | File format identifier (GUID structure)
CodecName | Pointer to a Unicode null terminated string that contains the codec name
DllName | Pointer to a Unicode null terminated string that contains the path name of the DLL in which the codec resides. If the codec is not in a DLL, this pointer is 0.
FormatDesc | Pointer to a Unicode null terminated string that contains the name of the file format used by the codec.
FileExt | Pointer to a Unicode null terminated string that contains all filename extensions associated with the codec. The extensions are separated by semicolons.
MimeType | Pointer to a null-terminated string that contains the mime type of the codec
Flags | Combination of $GDIP_ICF flags
Version | Indicates the version of the codec
SigCount | Indicates the number of signatures used by the file format associated with the codec
SigSize | Indicates the number of bytes in each signature
SigPattern | Pointer to an array of bytes that contains the pattern for each signature
SigMask | Pointer to an array of bytes that contains the mask for each signature

Remarks

None.

Related


Keyword $tagGDIPPENCODERPARAMS

Keyword Reference

$tagGDIPPENCODERPARAMS

tagGDIPPENCODERPARAMS structure

Global Const $tagGDIPPENCODERPARAMS = "dword Count;byte Params[0]"

Parameters

Count | Number of tagGDIPENCODERPARAM structures in the array
Params | Start of tagGDIPENCODERPARAM structures

Remarks

None.

Related


Keyword $tagGDIPRECTF

Keyword Reference

$tagGDIPRECTF

$tagGDIPRECTF structure

Global Const $tagGDIPRECTF = "float X;float Y;float Width;float Height"

Parameters

X | X coordinate of upper left hand corner of rectangle
Y | Y coordinate of upper left hand corner of rectangle
Width | Rectangle width
Height | Rectangle height

Remarks

None.

Related


Keyword $tagGDIPSTARTUPINPUT

Keyword Reference

$tagGDIPSTARTUPINPUT

$tagGDIPSTARTUPINPUT structure

Global Const $tagGDIPSTARTUPINPUT = "int Version;ptr Callback;int NoThread;int NoCodecs"

Parameters

Version | Specifies the version of Microsoft Windows GDI+
Callback | Pointer to a callback function that GDI+ can call, on debug builds, for assertions and warnings
NoThread | Boolean value that specifies whether to suppress the GDI+ background thread. If you set this member to True, GdiplusStartup returns a pointer to a hook function and a pointer to an unhook function. You must call those functions appropriately to replace the background thread. If you do not want to be responsible for calling the hook and unhook functions, set this member to False.
NoCodecs | Boolean value that specifies whether you want GDI+ to suppress external image codecs. GDI+ version 1.0 does not support external image codecs, so this parameter is ignored.

Remarks

None.

Related


Keyword $tagGDIPSTARTUPOUTPUT

Keyword Reference

$tagGDIPSTARTUPOUTPUT

$tagGDIPSTARTUPOUTPUT structure

Global Const $tagGDIPSTARTUPOUTPUT = "ptr HookProc;ptr UnhookProc"

Parameters

HookProc | Receives a pointer to a hook function
UnhookProc | Receives a pointer to an unhook function

Remarks

None.

Related


Keyword $tagGETIPAddress

Keyword Reference

$tagGETIPAddress

Contains information for all 4 fields of the IP Address control

Global Const $tagGETIPAddress = "ubyte Field4;ubyte Field3;ubyte Field2;ubyte Field1"

Parameters

Field4 | contains bits 0 through 7
Field3 | contains bits 8 through 15
Field2 | contains bits 16 through 23
Field1 | contains bits 24 through 31

Remarks

None.

Related


Keyword $tagGUID

Keyword Reference

$tagGUID

Represents a globally unique identifier (GUID)

Global Const $tagGUID = "int Data1;short Data2;short Data3;byte Data4[8]"

Parameters

Data1 | Data 1 element
Data2 | Data 2 element
Data3 | Data 2 element
Data4 | Data 2 element

Remarks

None.

Related


Keyword $tagHDITEM

Keyword Reference

$tagHDITEM

Contains information about an item in a header control

Global Const $tagHDITEM = "int Mask;int XY;ptr Text;hwnd hBMP;int TextMax;int Fmt;int Param;int Image;int Order;int Type;ptr pFilter;int State"

Parameters

Mask | Flags indicating which other structure members contain valid data or must be filled in
XY | Width or height of the item
Text | Address of Item string
hBMP | Handle to the item bitmap
TextMax | Length of the item string
Fmt | Flags that specify the item's format
Param | Application-defined item data
Image | Zero-based index of an image within the image list
Order | Order in which the item appears within the header control, from left to right
Type | Type of filter specified by pFilter
pFilter | Address of an application-defined data item
State | Item state

Remarks

None.

Related


Keyword $tagIMAGEINFO

Keyword Reference

$tagIMAGEINFO

Contains information about an image in an image list

Global Const $tagIMAGEINFO = "hwnd hBitmap;hwnd hMask;int Unused1;int Unused2;int Left;int Top;int Right;int Bottom"

Parameters

hBitmap | Handle to the bitmap that contains the images
hMask | Handle to a monochrome bitmap that contains the masks for the images
Unused1 | Not used
Unused2 | Not used
Left | Left side of the rectangle of the image
Top | Top of the rectangle of the image
Right | Right side of the rectangle of the image
Bottom | Bottom of the rectangle of the image

Remarks

None.

Related


Keyword $tagKBDLLHOOKSTRUCT

Keyword Reference

$tagKBDLLHOOKSTRUCT

Contains information about a low-level keyboard input event

Global Const $tagKBDLLHOOKSTRUCT = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo"

Parameters

vkCode | Specifies a virtual-key code. The code must be a value in the range 1 to 254
scanCode | Specifies a hardware scan code for the key
flags | Specifies the extended-key flag, event-injected flag, context code, and transition-state flag. This member is specified as follows. An application can use the following values to test the keystroke flags: $LLKHF_EXTENDED - Test the extended-key flag $LLKHF_INJECTED - Test the event-injected flag $LLKHF_ALTDOWN - Test the context code $LLKHF_UP - Test the transition-state flag 0 - Specifies whether the key is an extended key, such as a function key or a key on the numeric keypad The value is 1 if the key is an extended key; otherwise, it is 0 1 to 3 - Reserved 4 - Specifies whether the event was injected. The value is 1 if the event was injected; otherwise, it is 0 5 - Specifies the context code. The value is 1 if the ALT key is pressed; otherwise, it is 0 6 - Reserved 7 - Specifies the transition state. The value is 0 if the key is pressed and 1 if it is being released
time | Specifies the time stamp for this message, equivalent to what GetMessageTime would return for this message
dwExtraInfo | Specifies extra information associated with the message

Remarks

None.

Related


Keyword $tagLOGFONT

Keyword Reference

$tagLOGFONT

Defines the attributes of a font

Global Const $tagLOGFONT = "int Height;int Width;int Escapement;int Orientation;int Weight;byte Italic;byte Underline;" & _
"byte Strikeout;byte CharSet;byte OutPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;char FaceName[32]"

Parameters

Height | Height, in logical units, of the font's character cell or character
Width | Specifies the average width, in logical units, of characters in the font
Escapement | Specifies the angle, in tenths of degrees, between the escapement vector and the X axis
Orientation | Specifies the angle, in tenths of degrees, between each character's base line and the X axis
Weight | Specifies the weight of the font in the range 0 through 1000
Italic | Specifies an italic font if set to True
Underline | Specifies an underlined font if set to True
StrikeOut | Specifies a strikeout font if set to True
CharSet | Specifies the character set
OutPrecision | Specifies the output precision
ClipPrecision | Specifies the clipping precision
Quality | Specifies the output quality
PitchAndFamily | Specifies the pitch and family of the font
FaceName | Specifies the typeface name of the font

Remarks

None.

Related


Keyword $tagLVFINDINFO

Keyword Reference

$tagLVFINDINFO

Contains information used when searching for a list-view item

Global Const $tagLVFINDINFO = "int Flags;ptr Text;int Param;int X;int Y;int Direction"

Parameters

Flags | Type of search to perform. This member can be set to one or more of the following values: $LVFI_PARAM - Searches for a match between this structure's Param member and the Param member of an item. If $LVFI_PARAM is specified, all other flags are ignored. $LVFI_PARTIAL - Checks to see if the item text begins with the string pointed to by the Text member. This value implies use of $LVFI_STRING. $LVFI_STRING - Searches based on the item text. Unless additional values are specified, the item text of the matching item must exactly match the string pointed to by the Text member. $LVFI_WRAP - Continues the search at the beginning if no match is found LVFI_NEARESTXY - Finds the item nearest to the position specified in the X and Y members, in the direction specified by the Direction member. This flag is supported only by large icon and small icon modes.
Text | Address of a string to compare with the item text. It is valid if $LVFI_STRING or $LVFI_PARTIAL is set in the Flags member.
Param | Value to compare with the Param member of an item's $LVITEM structure. It is valid only if $LVFI_PARAM is set in the flags member.
X | Initial X search position. It is valid only if $LVFI_NEARESTXY is set in the Flags member.
Y | Initial Y search position. It is valid only if $LVFI_NEARESTXY is set in the Flags member.
Direction | Virtual key code that specifies the direction to search. The following codes are supported: VK_LEFT VK_RIGHT VK_UP VK_DOWN VK_HOME VK_END VK_PRIOR VK_NEXT This member is valid only if $LVFI_NEARESTXY is set in the flags member.

Remarks

None.

Related


Keyword $tagLVHITTESTINFO

Keyword Reference

$tagLVHITTESTINFO

Contains information about a hit test

Global Const $tagLVHITTESTINFO = "int X;int Y;int Flags;int Item;int SubItem"

Parameters

X | X position to hit test
Y | Y position to hit test
Flags | Results of a hit test. Can be one or more of the following values: $LVHT_ABOVE - The position is above the control's client area $LVHT_BELOW - The position is below the control's client area $LVHT_NOWHERE - The position is inside the client window, but it is not over a list item $LVHT_ONITEMICON - The position is over an item's icon $LVHT_ONITEMLABEL - The position is over an item's text $LVHT_ONITEMSTATEICON - The position is over the state image of an item $LVHT_TOLEFT - The position is to the left of the client area $LVHT_TORIGHT - The position is to the right of the client area
Item | Receives the index of the matching item. Or if hit-testing a subitem, this value represents the subitem's parent item.
SubItem | Receives the index of the matching subitem. When hit-testing an item, this member will be zero.

Remarks

None.

Related


Keyword $tagLVITEM

Keyword Reference

$tagLVITEM

Specifies or receives the attributes of a list-view item

Global Const $tagLVITEM = "int Mask;int Item;int SubItem;int State;int StateMask;ptr Text;int TextMax;int Image;int Param;" & _
"int Indent;int GroupID;int Columns;ptr pColumns"

Parameters

Mask | Set of flags that specify which members of this structure contain data to be set or which members are being requested. This member can have one or more of the following flags set: $LVIF_COLUMNS - The Columns member is valid $LVIF_DI_SETITEM - The operating system should store the requested list item information $LVIF_GROUPID - The GroupID member is valid $LVIF_IMAGE - The Image member is valid $LVIF_INDENT - The Indent member is valid $LVIF_NORECOMPUTE - The control will not generate LVN_GETDISPINFO to retrieve text information $LVIF_PARAM - The Param member is valid $LVIF_STATE - The State member is valid $LVIF_TEXT - The Text member is valid
Item | Zero based index of the item to which this structure refers
SubItem | One based index of the subitem to which this structure refers
State | Indicates the item's state, state image, and overlay image
StateMask | Value specifying which bits of the state member will be retrieved or modified
Text | Pointer to a string containing the item text
TextMax | Number of bytes in the buffer pointed to by Text, including the string terminator
Image | Index of the item's icon in the control's image list
Param | Value specific to the item
Indent | Number of image widths to indent the item
GroupID | Identifier of the tile view group that receives the item
Columns | Number of tile view columns to display for this item
pColumns | Pointer to the array of column indices

Remarks

None.

Related


Keyword $tagMARGINS

Keyword Reference

$tagMARGINS

Defines the margins of windows that have visual styles applied

Global Const $tagMARGINS = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight"

Parameters

cxLeftWidth | Width of the left border that retains its size
cxRightWidth | Width of the right border that retains its size
cyTopHeight | Height of the top border that retains its size
cyBottomHeight | Height of the bottom border that retains its size

Remarks

None.

Related


Keyword $tagMCHITTESTINFO

Keyword Reference

$tagMCHITTESTINFO

Carries information specific to hit-testing points for a month calendar control

Global Const $tagMCHITTESTINFO = "int Size;int X;int Y;int Hit;short Year;short Month;short DOW;short Day;short Hour;" & _
"short Minute;short Second;short MSeconds"

Parameters

Size | Size of this structure, in bytes
X | X position of the point to be hit tested
Y | Y position of the point to be hit tested
Hit | Results of the hit test operation. This value will be one of the following: $MCHT_CALENDARBK - The given point was in the calendar's background $MCHT_CALENDARDATE - The given point was on a particular date within the calendar $MCHT_CALENDARDATENEXT - The given point was over a date from the next month $MCHT_CALENDARDATEPREV - The given point was over a date from the previous month $MCHT_CALENDARDAY - The given point was over a day abbreviation $MCHT_CALENDARWEEKNUM - The given point was over a week number $MCHT_NOWHERE - The given point was not on the month calendar control $MCHT_TITLEBK - The given point was over the background of a month's title $MCHT_TITLEBTNNEXT - The given point was over the button at the top right corner $MCHT_TITLEBTNPREV - The given point was over the button at the top left corner $MCHT_TITLEMONTH - The given point was in a month's title bar, over a month name $MCHT_TITLEYEAR - The given point was in a month's title bar, over the year value
Year | Year
Month | Month
DOW | DOW
Day | Day
Hour | Hour
Minute | Minute
Second | Seconds
MSeconds | Milliseconds

Remarks

None.

Related


Keyword $tagMCMONTHRANGE

Keyword Reference

$tagMCMONTHRANGE

Retrieves date information that represents the high and low limits of a month calendar control's display

Global Const $tagMCMONTHRANGE = "short MinYear;short MinMonth;short MinDOW;short MinDay;short MinHour;short MinMinute;short MinSecond;" & _
"short MinMSeconds;short MaxYear;short MaxMonth;short MaxDOW;short MaxDay;short MaxHour;short MaxMinute;short MaxSecond;" & _
"short MaxMSeconds;short Span"

Parameters

MinYear | Year
MinMonth | Month
MinDOW | DOW
MinDay | Day
MinHour | Hour
MinMinute | Minute
MinSecond | Seconds
MinMSeconds | Milliseconds
MaxYear | Year
MaxMonth | Month
MaxDOW | DOW
MaxDay | Day
MaxHour | Hour
MaxMinute | Minute
MaxSecond | Seconds
MaxMSeconds | Milliseconds
Span | Range, in months, spanned by the two limits

Remarks

None.

Related


Keyword $tagMCRANGE

Keyword Reference

$tagMCRANGE

Contains information for setting the minimum and maximum allowable dates for a month calendar control

Global Const $tagMCRANGE = "short MinYear;short MinMonth;short MinDOW;short MinDay;short MinHour;short MinMinute;short MinSecond;" & _
"short MinMSeconds;short MaxYear;short MaxMonth;short MaxDOW;short MaxDay;short MaxHour;short MaxMinute;short MaxSecond;" & _
"short MaxMSeconds;short MinSet;short MaxSet"

Parameters

MinYear | Year
MinMonth | Month
MinDOW | DOW
MinDay | Day
MinHour | Hour
MinMinute | Minute
MinSecond | Seconds
MinMSeconds | Milliseconds
MaxYear | Year
MaxMonth | Month
MaxDOW | DOW
MaxDay | Day
MaxHour | Hour
MaxMinute | Minute
MaxSecond | Seconds
MaxMSeconds | Milliseconds
MinSet | A minimum limit is set for the control
MaxSet | A maximum limit is set for the control

Remarks

None.

Related


Keyword $tagMCSELRANGE

Keyword Reference

$tagMCSELRANGE

Specifies a date and time, in coordinated universal time (UTC)

Global Const $tagMCSELRANGE = "short MinYear;short MinMonth;short MinDOW;short MinDay;short MinHour;short MinMinute;short MinSecond;" & _
"short MinMSeconds;short MaxYear;short MaxMonth;short MaxDOW;short MaxDay;short MaxHour;short MaxMinute;short MaxSecond;" & _
"short MaxMSeconds"

Parameters

MinYear | Year
MinMonth | Month
MinDOW | DOW
MinDay | Day
MinHour | Hour
MinMinute | Minute
MinSecond | Seconds
MinMSeconds | Milliseconds
MaxYear | Year
MaxMonth | Month
MaxDOW | DOW
MaxDay | Day
MaxHour | Hour
MaxMinute | Minute
MaxSecond | Seconds
MaxMSeconds | Milliseconds

Remarks

None.

Related


Keyword $tagMENUINFO

Keyword Reference

$tagMENUINFO

Contains information about a menu

Global Const $tagMENUINFO = "int Size;int Mask;int Style;int YMax;int hBack;int ContextHelpID;ptr MenuData"

Parameters

Size | Specifies the size, in bytes, of the structure
Mask | Members to retrieve or set. This member can be one or more of the following values: $MIM_APPLYTOSUBMENUS - Settings apply to the menu and all of its submenus $MIM_BACKGROUND - Retrieves or sets the hBack member $MIM_HELPID - Retrieves or sets the ContextHelpID member $MIM_MAXHEIGHT - Retrieves or sets the YMax member $MIM_MENUDATA - Retrieves or sets the MenuData member $MIM_STYLE - Retrieves or sets the Style member
Style | Style of the menu. It can be one or more of the following values: $MNS_AUTODISMISS - Menu automatically ends when mouse is outside the menu for approximately 10 seconds $MNS_CHECKORBMP - The same space is reserved for the check mark and the bitmap $MNS_DRAGDROP - Menu items are OLE drop targets or drag sources $MNS_MODELESS - Menu is modeless $MNS_NOCHECK - No space is reserved to the left of an item for a check mark $MNS_NOTIFYBYPOS - A WM_MENUCOMMAND message is sent instead of a WM_COMMAND message when a selection is made
YMax | Maximum height of the menu in pixels
hBack | Brush to use for the menu's background
ContextHelpID | The context help identifier
MenuData | An application defined value

Remarks

None.

Related


Keyword $tagMENUITEMINFO

Keyword Reference

$tagMENUITEMINFO

Contains information about a menu item

Global Const $tagMENUITEMINFO = "int Size;int Mask;int Type;int State;int ID;int SubMenu;int BmpChecked;int BmpUnchecked;" & _
"int ItemData;ptr TypeData;int CCH;int BmpItem"

Parameters

Size | Specifies the size, in bytes, of the structure
Mask | Members to retrieve or set. This member can be one or more of these values: $MIIM_BITMAP - Retrieves or sets the BmpItem member $MIIM_CHECKMARKS - Retrieves or sets the BmpChecked and BmpUnchecked members $MIIM_DATA - Retrieves or sets the ItemData member $MIIM_FTYPE - Retrieves or sets the Type member $MIIM_ID - Retrieves or sets the ID member $MIIM_STATE - Retrieves or sets the State member $MIIM_STRING - Retrieves or sets the TypeData member $MIIM_SUBMENU - Retrieves or sets the SubMenu member $MIIM_TYPE - Retrieves or sets the Type and TypeData members
Type | Menu item type. This member can be one or more of the following values: $MFT_BITMAP - Displays the menu item using a bitmap $MFT_MENUBARBREAK - Places the menu item on a new line or in a new column $MFT_MENUBREAK - Places the menu item on a new line or in a new column $MFT_OWNERDRAW - Assigns responsibility for drawing the menu item to the menu owner $MFT_RADIOCHECK - Displays selected menu items using a radio button mark $MFT_RIGHTJUSTIFY - Right justifies the menu item and any subsequent items $MFT_RIGHTORDER - Specifies that menus cascade right to left $MFT_SEPARATOR - Specifies that the menu item is a separator
State | Menu item state. This member can be one or more of these values: $MFS_CHECKED - Checks the menu item $MFS_DEFAULT - Specifies that the menu item is the default $MFS_DISABLED - Disables the menu item and grays it so that it cannot be selected $MFS_ENABLED - Enables the menu item so that it can be selected $MFS_GRAYED - Disables the menu item and grays it so that it cannot be selected $MFS_HILITE - Highlights the menu item
ID | Application-defined 16-bit value that identifies the menu item
SubMenu | Handle to the drop down menu or submenu associated with the menu item
BmpChecked | Handle to the bitmap to display next to the item if it is selected
BmpUnchecked | Handle to the bitmap to display next to the item if it is not selected
ItemData | Application-defined value associated with the menu item
TypeData | Content of the menu item
CCH | Length of the menu item text
BmpItem | Handle to the bitmap to be displayed

Remarks

None.

Related


Keyword $tagNETRESOURCE

Keyword Reference

$tagNETRESOURCE

tagNETRESOURCE structure

Global Const $tagNETRESOURCE = "int Scope;int Type;int DisplayType;int Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider"

Parameters

Scope | Scope of the enumeration: $RESOURCE_CONNECTED - Enumerate currently connected resources $RESOURCE_GLOBALNET - Enumerate all resources on the network $RESOURCE_REMEMBERED - Enumerate remembered connections
Type | Set of bit flags identifying the type of resource: $RESOURCETYPE_ANY - All resources $RESOURCETYPE_DISK - Disk resources $RESOURCETYPE_PRINT - Print resources
DisplayType | Display options for the network object in a network browsing user interface: $RESOURCEDISPLAYTYPE_DOMAIN - The object should be displayed as a domain $RESOURCEDISPLAYTYPE_SERVER - The object should be displayed as a server $RESOURCEDISPLAYTYPE_SHARE - The object should be displayed as a share $RESOURCEDISPLAYTYPE_GENERIC - The method used to display the object does not matter
Usage | Set of bit flags describing how the resource can be used. Note that this member can be specified only if the Scope member is equal to $RESOURCE_GLOBALNET. This member can be one of the following values: $RESOURCEUSAGE_CONNECTABLE - The resource is a connectable resource; the name pointed to by RemoteName can be passed to the _WNet_AddConnection function to make a network connection. $RESOURCEUSAGE_CONTAINER - The resource is a container resource; the name pointed to by RemoteName can be passed to the WNet_OpenEnum function to enumerate the resources in the container.
LocalName | If the Scope member is equal to $RESOURCE_CONNECTED or $RESOURCE_REMEMBERED, this member is a pointer to a null terminated character string that specifies the name of a local device. This member is 0 if the connection does not use a device.
RemoteName | If the entry is a network resource, this member is a pointer to a null terminated string that specifies the remote network name. If the entry is a current or persistent connection, RemoteName points to the network name associated with the name pointed to by the LocalName member.
Comment | Pointer to a null-terminated string that contains a comment supplied by the network provider
Provider | Pointer to a null-terminated string that contains the name of the provider that owns the resource. This member can be NULL if the provider name is unknown. To retrieve the provider name, you can call the _WNet_GetProviderName function.

Remarks

None.

Related


Keyword $tagNMCBEDRAGBEGIN

Keyword Reference

$tagNMCBEDRAGBEGIN

Contains information used with the $CBEN_DRAGBEGIN notification message

Global Const $tagNMCBEDRAGBEGIN = $tagNMHDR & ";int ItemID;char Text[1024]"

Parameters

$tagNMHDR | Contains information about a notification message
ItemID | The zero-based index of the item being dragged. This value will always be -1, indicating that the item being dragged is the item displayed in the edit portion of the control.
Text | The character buffer that contains the text of the item being dragged

Remarks

None.

Related


Keyword $tagNMCBEENDEDIT

Keyword Reference

$tagNMCBEENDEDIT

Contains information about the conclusion of an edit operation within a ComboBoxEx control

Global Const $tagNMCBEENDEDIT = $tagNMHDR & ";int fChanged;int NewSelection;char Text[1024];int Why"

Parameters

$tagNMHDR | Contains information about a notification message
fChanged | Indicating whether the contents of the control's edit box have changed
NewSelection | The zero-based index of the item that will be selected after completing the edit operation This value can be $CB_ERR if no item will be selected
Text | A zero-terminated string that contains the text from within the control's edit box
Why | The action that generated the $CBEN_ENDEDIT notification message This value can be one of the following: $CBENF_DROPDOWN - The user activated the drop-down list $CBENF_ESCAPE - The user pressed ESC $CBENF_KILLFOCUS - The edit box lost the keyboard focus $CBENF_RETURN - The user completed the edit operation by pressing ENTER

Remarks

None.

Related


Keyword $tagNMCOMBOBOXEX

Keyword Reference

$tagNMCOMBOBOXEX

Contains information specific to ComboBoxEx items for use with notification messages

Global Const $tagNMCOMBOBOXEX = $tagNMHDR & ";int Mask;int Item;ptr Text;int TextMax;int Image;" & _
"int SelectedImage;int OverlayImage;int Indent;int Param"

Parameters

$tagNMHDR | Contains information about a notification message
Mask | A set of bit flags that specify attributes. Can be a combination of the following values. CBEIF_DI_SETITEM - Set this flag when processing CBEN_GETDISPINFO CBEIF_IMAGE - The iImage member is valid or must be filled in. CBEIF_INDENT - The iIndent member is valid or must be filled in. CBEIF_LPARAM - The lParam member is valid or must be filled in. CBEIF_OVERLAY - The iOverlay member is valid or must be filled in. CBEIF_SELECTEDIMAGE - The iSelectedImage member is valid or must be filled in. CBEIF_TEXT - The pszText member is valid or must be filled in.
Item | The zero-based index of the item.
Text | A pointer to a character buffer that contains or receives the item's text.
TextMax | The length of pszText, in TCHARs. If text information is being set, this member is ignored.
Image | The zero-based index of an image within the image list.
SelectedImage | The zero-based index of an image within the image list.
OverlayImage | The one-based index of an overlay image within the image list.
Indent | The number of indent spaces to display for the item. Each indentation equals 10 pixels.
Param | A value specific to the item.

Remarks

None.

Related


Keyword $tagNMDATETIMECHANGE

Keyword Reference

$tagNMDATETIMECHANGE

Contains information about a change that has taken place in a date and time picker (DTP) control

Global Const $tagNMDATETIMECHANGE = $tagNMHDR & ";int Flag;short Year;short Month;short DOW;short Day;" & _
"short Hour;short Minute;short Second;short MSecond"

Parameters

$tagNMHDR | Contains information about a notification message
Flag | Indicates if the control is set to "no date" status. This flag also specifies whether the contents of the date are valid and contain current time information. This value can be one of the following: $GDT_NONE - The control is set to "no date" status $GDT_VALID - The control is not set to the "no date" status
Year | Year
Month | Month
DOW | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSecond | Milliseconds

Remarks

This structure is used with the $DTN_DATETIMECHANGE notification message

Related


Keyword $tagNMDATETIMEFORMAT

Keyword Reference

$tagNMDATETIMEFORMAT

Contains information about a portion of the format string that defines a callback field within a date and time picker (DTP) control

Global Const $tagNMDATETIMEFORMAT = $tagNMHDR & ";ptr Format;short Year;short Month;short DOW;short Day;" & _
"short Hour;short Minute;short Second;short MSecond;ptr pDisplay;char Display[64]"

Parameters

$tagNMHDR | Contains information about a notification message
Format | Pointer to a null terminated string that defines the control callback field. The string comprises one or more "X" characters.
Year | Year
Month | Month
DOW | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSecond | Milliseconds
pDisplay | Pointer to a null terminated string that contains the display text of the control. By default, this is the address of the Display member of this structure. It is acceptable to have pDisplay point to an existing string. In this case, you don't need to assign a value to Display. However, the string that pDisplay points to must remain valid until another $DTN_FORMAT notification is sent or until the control is destroyed.
Display | 64 character buffer that is to receive the null terminated string that the control will display. It is not necessary to fill the entire buffer.

Remarks

It carries the string that defines the callback field and contains a buffer to receive the string that will
be displayed in the callback field. This structure is used with the $DTN_FORMAT notification message.

Related


Keyword $tagNMDATETIMEFORMATQUERY

Keyword Reference

$tagNMDATETIMEFORMATQUERY

Contains information about the control callback field

Global Const $tagNMDATETIMEFORMATQUERY = $tagNMHDR & ";ptr Format;int SizeX;int SizeY"

Parameters

$tagNMHDR | Contains information about a notification message
Format | Pointer to a null terminated string that defines the control callback field. The string comprises one or more "X" characters.
SizeX | Must be filled with the maximum width of the text that will be displayed in the callback field
SizeY | Must be filled with the maximum height of the text that will be displayed in the callback field

Remarks

It contains a string (taken from the control's format string) that defines a callback field. The structure
receives the maximum allowable size of the text that will be displayed in the callback field. This structure
is used with the $DTN_FORMATQUERY notification message.

Related


Keyword $tagNMDATETIMEKEYDOWN

Keyword Reference

$tagNMDATETIMEKEYDOWN

Carries information used to describe and handle a $DTN_WMKEYDOWN notification message

Global Const $tagNMDATETIMEKEYDOWN = $tagNMHDR & ";int VirtKey;ptr Format;short Year;short Month;short DOW;" & _
"short Day;short Hour;short Minute;short Second;short MSecond"

Parameters

$tagNMHDR | Contains information about a notification message
VirtKey | Virtual key code that represents the key that the user pressed
Format | Pointer to a null terminated string that defines the control callback field. The string comprises one or more "X" characters.
Year | Year
Month | Month
DOW | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSecond | Milliseconds

Remarks

None.

Related


Keyword $tagNMDATETIMESTRING

Keyword Reference

$tagNMDATETIMESTRING

Contains information specific to an edit operation that has taken place in the control

Global Const $tagNMDATETIMESTRING = $tagNMHDR & ";ptr UserString;short Year;short Month;short DOW;short Day;" & _
"short Hour;short Minute;short Second;short MSecond;int Flags"

Parameters

$tagNMHDR | Contains information about a notification message
UserString | Address of the null terminated string that the user entered
Year | Year
Month | Month
DOW | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSecond | Milliseconds
Flags | Return field. Set this member to $GDT_VALID to indicate that the date is valid or to $GDT_NONE to set the control to "no date" status ($DTS_SHOWNONE style only).

Remarks

This message is used with the $DTN_USERSTRING notification message.

Related


Keyword $tagNMDAYSTATE

Keyword Reference

$tagNMDAYSTATE

Carries information required to process the $MCN_GETDAYSTATE notification me

Global Const $tagNMDAYSTATE = $tagNMHDR & ";short Year;short Month;short DOW;short Day;short Hour;" & _
"short Minute;short Second;short MSeconds;int DayState;ptr pDayState"

Parameters

$tagNMHDR | Contains information about a notification message
Year | Year
Month | Month
DOW | DOW
Day | Day
Hour | Hour
Minute | Minute
Second | Seconds
MSeconds | Milliseconds
DayState | The total number of elements that must be in the array at pDayState
pDayState | Address of an array of MONTHDAYSTATE (DWORD bit field that holds the state of each day in a month) Each bit (1 through 31) represents the state of a day in a month. If a bit is on, the corresponding day will be displayed in bold; otherwise it will be displayed with no emphasis. The buffer at this address must be large enough to contain at least DayState elements.

Remarks

None.

Related


Keyword $tagNMHDDISPINFO

Keyword Reference

$tagNMHDDISPINFO

Contains information used in handling $HDN_GETDISPINFO notification messages

Global Const $tagNMHDDISPINFO = "hwnd WndFrom;int IDFrom;int Code;int Item;int Mask;ptr Text;int TextMax;int Image;int lParam"

Parameters

WndFrom | Window handle to the control sending a message
IDFrom | Identifier of the control sending a message
Code | Notification code
Item | Zero based index of the item in the header control
Mask | Set of bit flags specifying which members of the structure must be filled in by the owner of the control. This value can be a combination of the following values: $HDI_TEXT - The Text field must be filled in $HDI_IMAGE - The Image field must be filled in $HDI_LPARAM - The lParam field must be filled in $HDI_DI_SETITEM - A return value. Indicates that the control should store the item information and not ask for it again.
Text | Pointer to a null terminated string containing the text that will be displayed for the header item
TextMax | Size of the buffer that Text points to
Image | Zero based index of an image within the image list. The specified image will be displayed with the header item, but it does not take the place of the item's bitmap. If iImage is set to $I_IMAGECALLBACK, the control requests image information for this item by using an $HDN_GETDISPINFO notification message.
lParam | An application-defined value to associate with the item

Remarks

None.

Related


Keyword $tagNMHDFILTERBTNCLICK

Keyword Reference

$tagNMHDFILTERBTNCLICK

Specifies or receives the attributes of a filter button click

Global Const $tagNMHDFILTERBTNCLICK = $tagNMHDR & ";int Item;int Left;int Top;int Right;int Bottom"

Parameters

$tagNMHDR | Contains information about a notification message
Item | Zero based index of the control to which this structure refers
Left | X coordinate of the upper left corner of the rectangle
Top | Y coordinate of the upper left corner of the rectangle
Right | X coordinate of the lower right corner of the rectangle
Bottom | Y coordinate of the lower right corner of the rectangle

Remarks

None.

Related


Keyword $tagNMHDR

Keyword Reference

$tagNMHDR

Contains information about a notification message

Global Const $tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"

Parameters

hWndFrom | Window handle to the control sending a message
IDFrom | Identifier of the control sending a message
Code | Notification code

Remarks

None.

Related


Keyword $tagNMHEADER

Keyword Reference

$tagNMHEADER

Contains information about control notification messages

Global Const $tagNMHEADER = $tagNMHDR & ";int Item;int Button;ptr pItem"

Parameters

$tagNMHDR | Contains information about a notification message
Item | Zero based index of the control to which this structure refers
Button | Index of the mouse button used to generate the notification message. This member can be one of the following values: 0 - Left button 1 - Right button 2 - Middle button
pItem | Optional pointer to a tagHDITEM structure containing information about the item specified by Item. The mask member of the tagHDITEM structure indicates which of its members are valid.

Remarks

None.

Related


Keyword $tagNMIPADDRESS

Keyword Reference

$tagNMIPADDRESS

Contains information for the $IPN_FIELDCHANGED notification message

Global Const $tagNMIPADDRESS = $tagNMHDR & ";int Field;int Value"

Parameters

$tagNMHDR | Contains information about a notification message
Field | The zero-based number of the field that was changed.
Value | The new value of the field specified in the iField member. While processing the $IPN_FIELDCHANGED notification, this member can be set to any value that is within the range of the field and the control will place this new value in the field.

Remarks

None.

Related


Keyword $tagNMITEMACTIVATE

Keyword Reference

$tagNMITEMACTIVATE

Sent by a list-view control when the user activates an item

Global Const $tagNMITEMACTIVATE = $tagNMHDR & ";int Index;int SubItem;int NewState;int OldState;" & _
"int Changed;int X;int Y;int lParam;int KeyFlags"

Parameters

$tagNMHDR | Contains information about a notification message
Index | Index of the list-view item. If the item index is not used for the notification, this member will contain -1
SubItem | One-based index of the subitem. If the subitem index is not used for the notification or the notification does not apply to a subitem, this member will contain zero.
NewState | New item state. This member is zero for notification messages that do not use it
OldState | Old item state. This member is zero for notification messages that do not use it
Changed | Set of flags that indicate the item attributes that have changed. This member is zero for notifications that do not use it. This member can have one or more of the following flags set: $LVIF_COLUMNS - The Columns member is valid $LVIF_DI_SETITEM - The operating system should store the requested list item information $LVIF_GROUPID - The GroupID member is valid $LVIF_IMAGE - The Image member is valid $LVIF_INDENT - The Indent member is valid $LVIF_NORECOMPUTE - The control will not generate LVN_GETDISPINFO to retrieve text information $LVIF_PARAM - The Param member is valid $LVIF_STATE - The State member is valid $LVIF_TEXT - The Text member is valid
X | Specifies the x-coordinate of the point
Y | Specifies the y-coordinate of the point
lParam | Application-defined value of the item. This member is undefined for notification messages that do not use it
KeyFlags | Modifier keys that were pressed at the time of the activation. This member contains zero or a combination of the following flags: $LVKF_ALT - The key is pressed. $LVKF_CONTROL - The key is pressed. $LVKF_SHIFT - The key is pressed.

Remarks

None.

Related


Keyword $tagNMLISTVIEW

Keyword Reference

$tagNMLISTVIEW

Contains information about a list-view notification message

Global Const $tagNMLISTVIEW = $tagNMHDR & ";int Item;int SubItem;int NewState;int OldState;int Changed;" & _
"int ActionX;int ActionY;int Param"

Parameters

$tagNMHDR | Contains information about a notification message
Item | Identifies the item, or -1 if not used
SubItem | Identifies the subitem, or zero if none
NewState | New item state
OldState | Old item state
Changed | Set of flags that indicate the item attributes that have changed
ActionX | X position at which the event occurred
ActionY | Y position at which the event occurred
Param | Application-defined value of the item

Remarks

None.

Related


Keyword $tagNMLVCUSTOMDRAW

Keyword Reference

$tagNMLVCUSTOMDRAW

Contains information specific to an NM_CUSTOMDRAW (list view) notification message sent by a list-view control

Global Const $tagNMLVCUSTOMDRAW = $tagNMHDR & ";dword dwDrawStage;hwnd hdc;int Left;int Top;int Right;int Bottom;" & _
"dword dwItemSpec;uint uItemState;long lItemlParam;int clrText;int clrTextBk;int iSubItem;dword dwItemType;int clrFace;int iIconEffect;" & _
"int iIconPhase;int iPartId;int iStateId;int TextLeft;int TextTop;int TextRight;int TextBottom;uint uAlign"

Parameters

$tagNMHDR | Contains information about a notification message
dwDrawStage The current drawing stage. This is one of the following values:
Global Values:
$CDDS_POSTERASE - After the erasing cycle is complete.
$CDDS_POSTPAINT - After the painting cycle is complete.
$CDDS_PREERASE - Before the erasing cycle begins.
$CDDS_PREPAINT - Before the painting cycle begins.
Item-specific Values:
$CDDS_ITEM - Indicates that the dwItemSpec, uItemState, and lItemlParam members are valid.
$CDDS_ITEMPOSTERASE - After an item has been erased.
$CDDS_ITEMPOSTPAINT - After an item has been drawn.
$CDDS_ITEMPREERASE - Before an item is erased.
$CDDS_ITEMPREPAINT - Before an item is drawn.
$CDDS_SUBITEM - Flag combined with $CDDS_ITEMPREPAINT or $CDDS_ITEMPOSTPAINT if a subitem is being drawn.
This will only be set if $CDRF_NOTIFYITEMDRAW is returned from $CDDS_PREPAINT.
hdc A handle to the control's device context.
Use this handle to a device context (HDC) to perform any Microsoft Windows Graphics Device Interface (GDI) functions.
Left | X coordinate of the upper left corner of the rectangle of the area being drawn. This member is initialized only by the $CDDS_ITEMPREPAINT notification
Top | Y coordinate of the upper left corner of the rectangle of the area being drawn. This member is initialized only by the $CDDS_ITEMPREPAINT notification
Right | X coordinate of the lower right corner of the rectangle of the area being drawn. This member is initialized only by the $CDDS_ITEMPREPAINT notification
Bottom | Y coordinate of the lower right corner of the rectangle of the area being drawn. This member is initialized only by the $CDDS_ITEMPREPAINT notification
dwItemSpec | The item number
uItemState The current item state. This value is a combination of the following flags:
$CDIS_CHECKED - The item is checked.
$CDIS_DEFAULT - The item is in its default state.
$CDIS_DISABLED - The item is disabled.
$CDIS_FOCUS - The item is in focus.
$CDIS_GRAYED - The item is grayed.
$CDIS_HOT - The item is currently under the pointer ("hot").
$CDIS_INDETERMINATE - The item is in an indeterminate state.
$CDIS_MARKED - The item is marked. The meaning of this is determined by the implementation.
$CDIS_SELECTED - The item is selected.
$CDIS_SHOWKEYBOARDCUES - Version 6.0 Comctl32. The item is a keyboard cue.
$CDIS_NEARHOT - The item is part of a control that is currently under the mouse pointer ("hot"), but the item is not "hot" itself.
The meaning of this is determined by the implementation.
$CDIS_OTHERSIDEHOT - The item is part of a splitbutton that is currently under the mouse pointer ("hot"), but the item is not "hot" itself.
The meaning of this is determined by the implementation.
$CDIS_DROPHILITED - The item is currently the drop target of a drag-and-drop operation.
lItemlParam | Application-defined item data.
clrText | COLORREF value representing the color that will be used to display text foreground in the list-view control.
clrTextBk | COLORREF value representing the color that will be used to display text background in the list-view control.
iSubItem | Index of the subitem that is being drawn. If the main item is being drawn, this member will be zero.
dwItemType Version 6.0. DWORD that contains the type of the item to draw. This member can be one of the following values:
$LVCDI_ITEM - An item is to be drawn.
$LVCDI_GROUP - A group is to be drawn.
clrFace | Version 6.0. COLORREF value representing the color that will be used to display the face of an item.
iIconEffect | Version 6.0. Value of type int that specifies the effect that is applied to an icon, such as Glow, Shadow, or Pulse.
iIconPhase | Version 6.0. Value of type int that specifies the phase of an icon.
iPartId | Version 6.0. Value of type int that specifies the ID of the part of an item to draw.
iStateId | Version 6.0. Value of type int that specifies the ID of the state of an item to draw.
TextLeft | X coordinate of the upper left corner of the rectangle in which the text is to be drawn
TextTop | Y coordinate of the upper left corner of the rectangle in which the text is to be drawn
TextRight | X coordinate of the lower right corner of the rectangle in which the text is to be drawn
TextBottom | Y coordinate of the lower right corner of the rectangle in which the text is to be drawn
uAlign Version 6.0. UINT that specifies how a group should be aligned. This member can be one of the following values:
$LVGA_HEADER_CENTER - Center the group.
$LVGA_HEADER_LEFT - Align the group on the left.
$LVGA_HEADER_RIGHT - Align the group on the right.

Remarks

$LVxxx_ constants require ListViewConstants.au3, $CDxx_ constants require WindowsConstants.au3

Related


Keyword $tagNMLVDISPINFO

Keyword Reference

$tagNMLVDISPINFO

Contains information about an $LVN_GETDISPINFO or $LVN_SETDISPINFO notification message

Global Const $tagNMLVDISPINFO = $tagNMHDR & ";int Mask;int Item;int SubItem;int State;int StateMask;" & _
"ptr Text;int TextMax;int Image;int Param;int Indent;int GroupID;int Columns;ptr pColumns"

Parameters

$tagNMHDR | Contains information about a notification message
Mask | Set of flags that specify which members of this structure contain data to be set or which members are being requested. This member can have one or more of the following flags set: $LVIF_COLUMNS - The Columns member is valid $LVIF_DI_SETITEM - The operating system should store the requested list item information $LVIF_GROUPID - The GroupID member is valid $LVIF_IMAGE - The Image member is valid $LVIF_INDENT - The Indent member is valid $LVIF_NORECOMPUTE - The control will not generate LVN_GETDISPINFO to retrieve text information $LVIF_PARAM - The Param member is valid $LVIF_STATE - The State member is valid $LVIF_TEXT - The Text member is valid
Item | Zero based index of the item to which this structure refers
SubItem | One based index of the subitem to which this structure refers
State | Indicates the item's state, state image, and overlay image
StateMask | Value specifying which bits of the state member will be retrieved or modified
Text | Pointer to a string containing the item text
TextMax | Number of bytes in the buffer pointed to by Text, including the string terminator
Image | Index of the item's icon in the control's image list
Param | Value specific to the item
Indent | Number of image widths to indent the item
GroupID | Identifier of the tile view group that receives the item
Columns | Number of tile view columns to display for this item
pColumns | Pointer to the array of column indices

Remarks

None.

Related


Keyword $tagNMLVFINDITEM

Keyword Reference

$tagNMLVFINDITEM

Contains information the owner needs to find items requested by a virtual list view control

Global Const $tagNMLVFINDITEM = $tagNMHDR & ";int Start;int Flags;ptr Text;int Param;int X;int Y;int Direction"

Parameters

$tagNMHDR | Contains information about a notification message
Start | Index of the item at which the search will start
Flags | Type of search to perform. This member can be set to one or more of the following values: $LVFI_PARAM - Searches for a match between this structure's Param member and the Param member of an item. If $LVFI_PARAM is specified, all other flags are ignored. $LVFI_PARTIAL - Checks to see if the item text begins with the string pointed to by the Text member. This value implies use of $LVFI_STRING. $LVFI_STRING - Searches based on the item text. Unless additional values are specified, the item text of the matching item must exactly match the string pointed to by the Text member. $LVFI_WRAP - Continues the search at the beginning if no match is found LVFI_NEARESTXY - Finds the item nearest to the position specified in the X and Y members, in the direction specified by the Direction member. This flag is supported only by large icon and small icon modes.
Text | Address of a string to compare with the item text. It is valid if $LVFI_STRING or $LVFI_PARTIAL is set in the Flags member.
Param | Value to compare with the Param member of an item's $LVITEM structure. It is valid only if $LVFI_PARAM is set in the flags member.
X | Initial X search position. It is valid only if $LVFI_NEARESTXY is set in the Flags member.
Y | Initial Y search position. It is valid only if $LVFI_NEARESTXY is set in the Flags member.
Direction | Virtual key code that specifies the direction to search. The following codes are supported: VK_LEFT VK_RIGHT VK_UP VK_DOWN VK_HOME VK_END VK_PRIOR VK_NEXT This member is valid only if $LVFI_NEARESTXY is set in the flags member.

Remarks

This notification gives an application (or the notification receiver) the opportunity to customize an incremental search.
For example, if the search items are numeric, the application can perform a numerical search instead of a string search.
The application sets the Param member to the result of the search, or to another application defined value to fail the
search and indicate to the control how to proceed

Related


Keyword $tagNMLVGETINFOTIP

Keyword Reference

$tagNMLVGETINFOTIP

Contains and receives list-view item information needed to display a ToolTip for an item

Global Const $tagNMLVGETINFOTIP = $tagNMHDR & ";int Flags;ptr Text;int TextMax;int Item;int SubItem;int lParam"

Parameters

$tagNMHDR | Contains information about a notification message
Flags | Either zero or $LVGIT_UNFOLDED
Text | Address of a string buffer that receives any additional text information If Flags is zero, this member will contain the existing item text In this case, you should append any additional text onto the end of this string
TextMax | Size, in characters, of the buffer pointed to by Text Although you should never assume that this buffer will be of any particular size, the $INFOTIPSIZE value can be used for design purposes
Item | Zero-based index of the item to which this structure refers.
SubItem | One-based index of the subitem to which this structure refers If this member is zero, the structure is referring to the item and not a subitem This member is not currently used and will always be zero
lParam | Application-defined value associated with the item This member is not currently used and will always be zero.

Remarks

None.

Related


Keyword $tagNMLVKEYDOWN

Keyword Reference

$tagNMLVKEYDOWN

Contains information used in processing the $LVN_KEYDOWN notification message

Global Const $tagNMLVKEYDOWN = $tagNMHDR & ";int VKey;int Flags"

Parameters

$tagNMHDR | Contains information about a notification message
VKey | Virtual key code
Flags | This member must always be zero

Remarks

None.

Related


Keyword $tagNMLVSCROLL

Keyword Reference

$tagNMLVSCROLL

Provides information about a scrolling operation

Global Const $tagNMLVSCROLL = $tagNMHDR & ";int DX;int DY"

Parameters

$tagNMHDR | Contains information about a notification message
DX | Specifies in pixels the horizontal position where a scrolling operation should begin or end
DY | Specifies in pixels the vertical position where a scrolling operation should begin or end

Remarks

None.

Related


Keyword $tagNMMOUSE

Keyword Reference

$tagNMMOUSE

Contains information used with mouse notification messages

Global Const $tagNMMOUSE = $tagNMHDR & ";dword ItemSpec;dword ItemData;int X;int Y;dword HitInfo"

Parameters

$tagNMHDR | Contains information about a notification message
ItemSpec | A control-specific item identifier
ItemData | A control-specific item data
X | Specifies the x-coordinate of the point
Y | Specifies the y-coordinate of the point
HitInfo | Carries information about where on the item or control the cursor is pointing

Remarks

None.

Related


Keyword $tagNMOBJECTNOTIFY

Keyword Reference

$tagNMOBJECTNOTIFY

Contains information used with the $TBN_GETOBJECT, $TCN_GETOBJECT, $RBN_GETOBJECT, and $PSN_GETOBJECT notification messages

Global Const $tagNMOBJECTNOTIFY = $tagNMHDR & ";int Item;ptr piid;ptr pObject;int Result"

Parameters

$tagNMHDR | Contains information about a notification message
Item | A control-specific item identifier
piid | A pointer to an interface identifier of the requested object
pObject | A pointer to an object provided by the window processing the notification message The application processing the notification message sets this member
Result | COM success or failure flags. The application processing the notification message sets this member

Remarks

None.

Related


Keyword $tagNMRBAUTOSIZE

Keyword Reference

$tagNMRBAUTOSIZE

Contains information used in handling the $RBN_AUTOSIZE notification messages

Global Const $tagNMRBAUTOSIZE = $tagNMHDR & ";int fChanged;int TargetLeft;int TargetTop;int TargetRight;int TargetBottom;" & _
"int ActualLeft;int ActualTop;int ActualRight;int ActualBottom"

Parameters

$tagNMHDR | Contains information about a notification message
fChanged | Member that indicates if the size or layout of the rebar control has changed (nonzero if a change occurred or zero otherwise)
TargetLeft | Specifies the x-coordinate of the upper-left corner of the rectangle to which the rebar control tried to size itself
TargetTop | Specifies the y-coordinate of the upper-left corner of the rectangle to which the rebar control tried to size itself
TargetRight | Specifies the x-coordinate of the lower-right corner of the rectangle to which the rebar control tried to size itself
TargetBottom | Specifies the y-coordinate of the lower-right corner of the rectangle to which the rebar control tried to size itself
ActualLeft | Specifies the x-coordinate of the upper-left corner of the rectangle to which the rebar control actually sized itself
ActualTop | Specifies the y-coordinate of the upper-left corner of the rectangle to which the rebar control actually sized itself
ActualRight | Specifies the x-coordinate of the lower-right corner of the rectangle to which the rebar control actually sized itself
ActualBottom | Specifies the y-coordinate of the lower-right corner of the rectangle to which the rebar control actually sized itself

Remarks

None.

Related


Keyword $tagNMREBAR

Keyword Reference

$tagNMREBAR

Contains information used in handling various rebar notification messages

Global Const $tagNMREBAR = $tagNMHDR & ";dword dwMask;uint uBand;uint fStyle;uint wID;int lParam"

Parameters

$tagNMHDR | Contains information about a notification message
dwMask | Set of flags that define which members of this structure contain valid information. This can be one or more of the following values: $RBNM_ID - The wID member contains valid information. $RBNM_LPARAM - The lParam member contains valid information. $RBNM_STYLE - The fStyle member contains valid information.
uBand | Zero-based index of the band affected by the notification. This will be -1 if no band is affected.
fStyle | The style of the band. This is one or more of the $RBBS_ styles detailed in the fStyle member of the $tagREBARBANDINFO structure. This member is only valid if dwMask contains $RBNM_STYLE.
wID | Application-defined identifier of the band. This member is only valid if dwMask contains $RBNM_ID.
lParam | Application-defined value associated with the band. This member is only valid if dwMask contains $RBNM_LPARAM

Remarks

None.

Related


Keyword $tagNMREBARAUTOBREAK

Keyword Reference

$tagNMREBARAUTOBREAK

Contains information used with the $RBN_AUTOBREAK notification

Global Const $tagNMREBARAUTOBREAK = $tagNMHDR & ";uint uBand;uint wID;int lParam;uint uMsg;uint fStyleCurrent;int fAutoBreak"

Parameters

$tagNMHDR | Contains information about a notification message
uBand | Zero-based index of the band affected by the notification. This is -1 if no band is affected.
wID | Application-defined ID of the band.
lParam | Application-defined value from the lParam member of the $tagREBARBANDINFO structure that defines the rebar band.
uMsg | ID of the message.
fStyleCurrent | Style of the specified band.
fAutoBreak | indicates whether a break should occur.

Remarks

None.

Related


Keyword $tagNMREBARCHEVRON

Keyword Reference

$tagNMREBARCHEVRON

Contains information used in handling the RBN_CHEVRONPUSHED notification message

Global Const $tagNMREBARCHEVRON = $tagNMHDR & ";uint uBand;uint wID;int lParam;int Left;int Top;int Right;int Bottom;int lParamNM"

Parameters

$tagNMHDR | Contains information about a notification message
uBand | Zero-based index of the band sending the notification
wID | Application-defined identifier for the band
lParam | Application-defined value associated with the band
Left | Specifies the x-coordinate of the upper-left corner of the rectangle
Top | Specifies the y-coordinate of the upper-left corner of the rectangle
Right | Specifies the x-coordinate of the lower-right corner of the rectangle
Bottom | Specifies the y-coordinate of the lower-right corner of the rectangle
lParamNM | An application-defined value If the $RBN_CHEVRONPUSHED notification was sent as a result of an $RB_PUSHCHEVRON message, this member contains the message's lAppValue value. Otherwise, it is set to zero.

Remarks

None.

Related


Keyword $tagNMREBARCHILDSIZE

Keyword Reference

$tagNMREBARCHILDSIZE

Contains information used in handling the RBN_CHILDSIZE notification message

Global Const $tagNMREBARCHILDSIZE = $tagNMHDR & ";uint uBand;uint wID;int CLeft;int CTop;int CRight;int CBottom;" & _
"int BLeft;int BTop;int BRight;int BBottom"

Parameters

$tagNMHDR | Contains information about a notification message
uBand | Zero-based index of the band sending the notification
wID | Application-defined identifier for the band
CLeft | Specifies the x-coordinate of the upper-left corner of the rectangle of the new size of the child window This member can be changed during the notification to modify the child window's position and size
CTop | Specifies the y-coordinate of the upper-left corner of the rectangle of the new size of the child window This member can be changed during the notification to modify the child window's position and size
CRight | Specifies the x-coordinate of the lower-right corner of the rectangle of the new size of the child window This member can be changed during the notification to modify the child window's position and size
CBottom | Specifies the y-coordinate of the lower-right corner of the rectangle of the new size of the child window This member can be changed during the notification to modify the child window's position and size
BLeft | Specifies the x-coordinate of the upper-left corner of the rectangle of the new size of the band
BTop | Specifies the y-coordinate of the upper-left corner of the rectangle of the new size of the band
BRight | Specifies the x-coordinate of the lower-right corner of the rectangle of the new size of the band
BBottom | Specifies the y-coordinate of the lower-right corner of the rectangle of the new size of the band

Remarks

None.

Related


Keyword $tagNMSELCHANGE

Keyword Reference

$tagNMSELCHANGE

Carries information required to process the $MCN_SELCHANGE notification message

Global Const $tagNMSELCHANGE = $tagNMHDR & ";short BegYear;short BegMonth;short BegDOW;short BegDay;" & _
"short BegHour;short BegMinute;short BegSecond;short BegMSeconds;short EndYear;short EndMonth;short EndDOW;" & _
"short EndDay;short EndHour;short EndMinute;short EndSecond;short EndMSeconds"

Parameters

$tagNMHDR | Contains information about a notification message
BegYear | Year
BegMonth | Month
BegDOW | DOW
BegDay | Day
BegHour | Hour
BegMinute | Minute
BegSecond | Seconds
BegMSeconds | Milliseconds
EndYear | Year
EndMonth | Month
EndDOW | DOW
EndDay | Day
EndHour | Hour
EndMinute | Minute
EndSecond | Seconds
EndMSeconds | Milliseconds

Remarks

None.

Related


Keyword $tagNMTBHOTITEM

Keyword Reference

$tagNMTBHOTITEM

Contains information used with the $TBN_HOTITEMCHANGE notification

Global Const $tagNMTBHOTITEM = $tagNMHDR & ";int idOld;int idNew;dword dwFlags"

Parameters

$tagNMHDR | Contains information about a notification message
idOld | Command identifier of the previously highlighted item
idNew | Command identifier of the item about to be highlighted
dwFlags Flags that indicate why the hot item has changed. This can be one or more of the following values:
$HICF_ACCELERATOR - The change in the hot item was caused by a shortcut key
$HICF_ARROWKEYS - The change in the hot item was caused by an arrow key
$HICF_DUPACCEL - Modifies $HICF_ACCELERATOR. If this flag is set, more than one item has the same shortcut key character
$HICF_ENTERING - Modifies the other reason flags. If this flag is set, there is no previous hot item and idOld does not contain valid information
$HICF_LEAVING - Modifies the other reason flags. If this flag is set, there is no new hot item and idNew does not contain valid information
$HICF_LMOUSE - The change in the hot item resulted from a left-click mouse event
$HICF_MOUSE - The change in the hot item resulted from a mouse event
$HICF_OTHER - The change in the hot item resulted from an event that could not be determined. This will most often be due to a change in focus or the $TB_SETHOTITEM message
$HICF_RESELECT - The change in the hot item resulted from the user entering the shortcut key for an item that was already hot
$HICF_TOGGLEDROPDOWN - Version 5.80. Causes the button to switch states

Remarks

Needs alignment for x64

Related


Keyword $tagNMTCKEYDOWN

Keyword Reference

$tagNMTCKEYDOWN

Contains information used in processing the $LVN_KEYDOWN notification message

Global Const $tagNMTCKEYDOWN = $tagNMHDR & ";int VKey;int Flags"

Parameters

$tagNMHDR | Contains information about a notification message
VKey | Virtual key code
Flags | Bits as shown in the following table: 0-15 - Specifies the repeat count for the current message. 16-23 - Specifies the scan code. The value depends on the OEM. 24 - Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0. 25-28 - Reserved; do not use. 29 - Specifies the context code. The value is always 0 for a $WM_KEYDOWN message. 30 - Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is zero if the key is up. 31 - Specifies the transition state. The value is always zero for a $WM_KEYDOWN message

Remarks

None.

Related


Keyword $tagNMTOOLBAR

Keyword Reference

$tagNMTOOLBAR

Contains information used to process toolbar notification messages

Global Const $tagNMTOOLBAR = $tagNMHDR & ";int iItem;int iBitmap;int idCommand;" & _
"byte fsState;byte fsStyle;byte bReserved1;byte bReserved2;dword dwData;int iString;int cchText;" & _
"ptr pszText;int Left;int Top;int Right;int Bottom"

Parameters

$tagNMHDR | Contains information about a notification message
iItem | Command identifier of the button associated with the notification
iBitmap | Zero-based index of the button image. If the button is a separator, that is, if fsStyle is set to $BTNS_SEP, iBitmap determines the width of the separator, in pixels
idCommand | Command identifier associated with the button. This identifier is used in a WM_COMMAND message when the button is chosen
fsState | Button state flags. This member can be a combination of the values listed in Toolbar Button States
fsStyle | Button style. This member can be a combination of the button style values listed in Toolbar Control and Button Styles
bReserved1 | Reserved. Do not use.
bReserved2 | Reserved. Do not use.
dwData | Application-defined value
iString | Zero-based index of the button string, or a pointer to a string buffer that contains text for the button
cchText | Count of characters in the button text
pszText | Address of a character buffer that contains the button text
Left | Specifies the x-coordinate of the upper-left corner of the rectangle
Top | Specifies the y-coordinate of the upper-left corner of the rectangle
Right | Specifies the x-coordinate of the lower-right corner of the rectangle
Bottom | Specifies the y-coordinate of the lower-right corner of the rectangle

Remarks

None.

Related


Keyword $tagNMTREEVIEW

Keyword Reference

$tagNMTREEVIEW

Contains information about a tree-view notification message

Global Const $tagNMTREEVIEW = $tagNMHDR & ";int Action;int OldMask;int OldhItem;int OldState;int OldStateMask;" & _
"ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;int OldParam;int NewMask;int NewhItem;" & _
"int NewState;int NewStateMask;ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;" & _
"int NewParam;int PointX; int PointY"

Parameters

$tagNMHDR | Contains information about a notification message
Action | Notification-specific action flag
OldMask | Flags that indicate which of the other structure members contain valid data.
OldhItem | Item to which this structure refers
OldState | Set of bit flags and image list indexes that indicate the item's state
OldStateMask | Bits of the state member that are valid
OldText | Pointer to a null-terminated string that contains the item text.
OldTextMax | Size of the buffer pointed to by the Text member, in characters
OldImage | Index in the image list of the icon image to use when the item is in the nonselected state
OldSelectedImage | Index in the image list of the icon image to use when the item is in the selected state
OldChildren | Flag that indicates whether the item has associated child items
OldParam | A value to associate with the item
NewMask | Flags that indicate which of the other structure members contain valid data.
NewhItem | Item to which this structure refers
NewState | Set of bit flags and image list indexes that indicate the item's state
NewStateMask | Bits of the state member that are valid
NewText | Pointer to a null-terminated string that contains the item text.
NewTextMax | Size of the buffer pointed to by the Text member, in characters
NewImage | Index in the image list of the icon image to use when the item is in the nonselected state
NewSelectedImage | Index in the image list of the icon image to use when the item is in the selected state
NewChildren | Flag that indicates whether the item has associated child items
NewParam | A value to associate with the item
PointX | X position that of the mouse at the time the event occurred
PointY | Y position that of the mouse at the time the event occurred

Remarks

None.

Related


Keyword $tagNMTVCUSTOMDRAW

Keyword Reference

$tagNMTVCUSTOMDRAW

Contains information specific to an NM_CUSTOMDRAW (tree view) notification message sent by a tree-view control

Global Const $tagNMTVCUSTOMDRAW = $tagNMHDR & ";uint DrawStage;hwnd HDC;int Left;int Top;int Right;int Bottom;" & _
"ptr ItemSpec;uint ItemState;int ItemParam;int ClrText;int ClrTextBk;int Level"

Parameters

$tagNMHDR | Contains information about a notification message
DrawStage | Current drawing stage. This value is one of the following: Global Values: $CDDS_POSTERASE - After the erasing cycle is complete $CDDS_POSTPAINT - After the painting cycle is complete $CDDS_PREERASE - Before the erasing cycle begins $CDDS_PREPAINT - Before the painting cycle begins Item-specific Values: $CDDS_ITEM - Indicates that the ItemSpec, ItemState, and ItemParam members are valid $CDDS_ITEMPOSTERASE - After an item has been erased $CDDS_ITEMPOSTPAINT - After an item has been drawn $CDDS_ITEMPREERASE - Before an item is erased $CDDS_ITEMPREPAINT - Before an item is drawn $CDDS_SUBITEM - Flag combined with $CDDS_ITEMPREPAINT or $CDDS_ITEMPOSTPAINT if a subitem is being drawn
HDC | Handle to the control's device context
Left | X coordinate of upper left corner of bounding rectangle being drawn
Top | Y coordinate of upper left corner of bounding rectangle being drawn
Right | X coordinate of lower right corner of bounding rectangle being drawn
Bottom | Y coordinate of lower right corner of bounding rectangle being drawn
ItemSpec | Item number
ItemState | Current item state. This value is a combination of the following: $CDIS_CHECKED - The item is checked $CDIS_DEFAULT - The item is in its default state $CDIS_DISABLED - The item is disabled $CDIS_FOCUS - The item is in focus $CDIS_GRAYED - The item is grayed $CDIS_HOT - The item is currently under the pointer $CDIS_INDETERMINATE - The item is in an indeterminate state $CDIS_MARKED - The item is marked $CDIS_SELECTED - The item is selected $CDIS_SHOWKEYBOARDCUES - The item is a keyboard cue
ItemParam | Application defined item data
ClrText | The color that will be used to display text foreground in the control
ClrTextBk | The color that will be used to display text background in the control
Level | Zero based level of the item being drawn

Remarks

$CDxx_ constants require WindowsConstants.au3

Related


Keyword $tagNMTVDISPINFO

Keyword Reference

$tagNMTVDISPINFO

Contains and receives display information for a tree-view item

Global Const $tagNMTVDISPINFO = $tagNMHDR & ";int Mask;int hItem;int State;int StateMask;" & _
"ptr Text;int TextMax;int Image;int SelectedImage;int Children;int Param"

Parameters

$tagNMHDR | Contains information about a notification message
Mask | Specifies which information is being set or retrieved. It can be one or more of the following values: $TVIF_CHILDREN - The Children member is valid $TVIF_IMAGE - The Image member is valid $TVIF_SELECTEDIMAGE - The SelectedImage member is valid $TVIF_TEXT - The Text and TextMax members are valid
hItem | Item to which this structure refers
State | Set of bit flags and image list indexes that indicate the item's state. When setting the state of an item, the StateMask member indicates the bits of this member that are valid. When retrieving the state of an item, this member returns the current state for the bits indicated in the StateMask member. Bits 0 through 7 of this member contain the item state flags. Bits 8 through 11 of this member specify the one based overlay image index.
StateMask | Bits of the state member that are valid. If you are retrieving an item's state, set the bits of the stateMask member to indicate the bits to be returned in the state member. If you are setting an item's state, set the bits of the stateMask member to indicate the bits of the state member that you want to set.
Text | Pointer to a null-terminated string that contains the item text.
TextMax | Size of the buffer pointed to by the Text member, in characters
Image | Index in the image list of the icon image to use when the item is in the nonselected state
SelectedImage | Index in the image list of the icon image to use when the item is in the selected state
Children | Flag that indicates whether the item has associated child items. This member can be one of the following values: 0 - The item has no child items 1 - The item has one or more child items
Param | A value to associate with the item

Remarks

None.

Related


Keyword $tagNMTVGETINFOTIP

Keyword Reference

$tagNMTVGETINFOTIP

Contains and receives tree-view item information needed to display a ToolTip for an item

Global Const $tagNMTVGETINFOTIP = $tagNMHDR & ";ptr Text;int TextMax;hwnd hItem;int lParam"

Parameters

$tagNMHDR | Contains information about a notification message
Text | Address of a character buffer that contains the text to be displayed
TextMax | Size of the buffer at Text, in characters. Although you should never assume that this buffer will be of any particular size, the $INFOTIPSIZE value can be used for design purposes
hItem | Tree handle to the item for which the ToolTip is being displayed
lParam | Application-defined data associated with the item for which the ToolTip is being displayed

Remarks

None.

Related


Keyword $tagNMTVKEYDOWN

Keyword Reference

$tagNMTVKEYDOWN

Contains information about a keyboard event in a tree-view control

Global Const $tagNMTVKEYDOWN = $tagNMHDR & ";int VKey;int Flags"

Parameters

$tagNMHDR | Contains information about a notification message
VKey | Virtual key code
Flags | Always zero

Remarks

None.

Related


Keyword $tagOPENFILENAME

Keyword Reference

$tagOPENFILENAME

Contains information information that the GetOpenFileName and GetSaveFileName functions use to initialize an Open or Save As dialog box

Global Const $tagOPENFILENAME = "dword StructSize;hwnd hwndOwner;hwnd hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & _
"dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;int nMaxFileTitle;" & _
"ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;short nFileOffset;short nFileExtension;ptr lpstrDefExt;ptr lCustData;" & _
"ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx"

Parameters

StructSize | Specifies the length, in bytes, of the structure.
hwndOwner | Handle to the window that owns the dialog box. This member can be any valid window handle, or it can be NULL if the dialog box has no owner.
hInstance If the $OFN_ENABLETEMPLATEHANDLE flag is set in the Flags member, hInstance is a handle to a memory object containing a dialog box template.
If the $OFN_ENABLETEMPLATE flag is set, hInstance is a handle to a module that contains a dialog box template named by the lpTemplateName member.
If neither flag is set, this member is ignored.
If the $OFN_EXPLORER flag is set, the system uses the specified template to create a dialog box that is a child of the default Explorer-style dialog box.
If the $OFN_EXPLORER flag is not set, the system uses the template to create an old-style dialog box that replaces the default dialog box.
lpstrFilter | Pointer to a buffer containing pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.
lpstrCustomFilter Pointer to a static buffer that contains a pair of null-terminated filter strings for preserving the filter pattern chosen by the user.
The first string is your display string that describes the custom filter, and the second string is the filter pattern selected by the user.
The first time your application creates the dialog box, you specify the first string, which can be any nonempty string.
When the user selects a file, the dialog box copies the current filter pattern to the second string.
The preserved filter pattern can be one of the patterns specified in the lpstrFilter buffer, or it can be a filter pattern typed by the user.
The system uses the strings to initialize the user-defined file filter the next time the dialog box is created.
If the nFilterIndex member is zero, the dialog box uses the custom filter.
If this member is NULL, the dialog box does not preserve user-defined filter patterns.
If this member is not NULL, the value of the nMaxCustFilter member must specify the size, in TCHARs, of the lpstrCustomFilter buffer.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters.
nMaxCustFilter Specifies the size, in TCHARs, of the buffer identified by lpstrCustomFilter.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters.
This buffer should be at least 40 characters long. This member is ignored if lpstrCustomFilter is NULL or points to a NULL string.
nFilterIndex Specifies the index of the currently selected filter in the File Types control.
The buffer pointed to by lpstrFilter contains pairs of strings that define the filters.
The first pair of strings has an index value of 1, the second pair 2, and so on.
An index of zero indicates the custom filter specified by lpstrCustomFilter.
You can specify an index on input to indicate the initial filter description and filter pattern for the dialog box.
When the user selects a file, nFilterIndex returns the index of the currently displayed filter.
If nFilterIndex is zero and lpstrCustomFilter is NULL, the system uses the first filter in the lpstrFilter buffer.
If all three members are zero or NULL, the system does not use any filters and does not show any files in the file list control of the dialog box.
lpstrFile Pointer to a buffer that contains a file name used to initialize the File Name edit control.
The first character of this buffer must be NULL if initialization is not necessary.
When the _WinAPI_GetOpenFileName or _WinAPI_GetSaveFileName function returns successfully, this buffer contains the drive designator, path, file name, and extension of the selected file.
If the $OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the file names of the selected files.
For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name.
For old-style dialog boxes, the strings are space separated and the function uses short file names for file names with spaces.
You can use the FindFirstFile function to convert between long and short file names.
If the user selects only one file, the lpstrFile string does not have a separator between the path and file name.
If the buffer is too small, the function returns FALSE and the _WinAPI_CommDlgExtendedError function returns $FNERR_BUFFERTOOSMALL.
In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.
nMaxFile Specifies the size, in TCHARs, of the buffer pointed to by lpstrFile.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters.
The buffer must be large enough to store the path and file name string or strings, including the terminating NULL character.
The _WinAPI_GetOpenFileName and _WinAPI_GetSaveFileName functions return FALSE if the buffer is too small to contain the file information.
The buffer should be at least 256 characters long.
lpstrFileTitle | Pointer to a buffer that receives the file name and extension (without path information) of the selected file. This member can be NULL.
nMaxFileTitle Specifies the size, in TCHARs, of the buffer pointed to by lpstrFileTitle.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters. This member is ignored if lpstrFileTitle is NULL.
lpstrInitialDir | Pointer to a NULL terminated string that can specify the initial directory.
lpstrTitle | Pointer to a string to be placed in the title bar of the dialog box. If this member is NULL, the system uses the default title (that is, Save As or Open).
Flags A set of bit flags you can use to initialize the dialog box. When the dialog box returns, it sets these flags to indicate the user's input. This member can be a combination of the following flags.
$OFN_ALLOWMULTISELECT - Specifies that the File Name list box allows multiple selections.
If you also set the $OFN_EXPLORER flag, the dialog box uses the Explorer-style user interface; otherwise, it uses the old-style user interface.
$OFN_CREATEPROMPT - If the user specifies a file that does not exist, this flag causes the dialog box to prompt the user for permission to create the file.
If the user chooses to create the file, the dialog box closes and the function returns the specified name; otherwise, the dialog box remains open.
If you use this flag with the $OFN_ALLOWMULTISELECT flag, the dialog box allows the user to specify only one nonexistent file.
$OFN_DONTADDTORECENT - Windows 2000/XP: Prevents the system from adding a link to the selected file in the file system directory that contains the user's most recently used documents.
$OFN_ENABLEHOOK - Enables the hook function specified in the lpfnHook member.
$OFN_ENABLEINCLUDENOTIFY - Windows 2000/XP: Causes the dialog box to send CDN_INCLUDEITEM notification messages to your OFNHookProc hook procedure when the user opens a folder.
The dialog box sends a notification for each item in the newly opened folder.
These messages enable you to control which items the dialog box displays in the folder's item list.
$OFN_ENABLESIZING - Windows 2000/XP, Windows 98/Me: Enables the Explorer-style dialog box to be resized using either the mouse or the keyboard.
By default, the Explorer-style Open and Save As dialog boxes allow the dialog box to be resized regardless of whether this flag is set.
This flag is necessary only if you provide a hook procedure or custom template. The old-style dialog box does not permit resizing.
$OFN_ENABLETEMPLATE - Indicates that the lpTemplateName member is a pointer to the name of a dialog template resource in the module identified by the hInstance member.
If the $OFN_EXPLORER flag is set, the system uses the specified template to create a dialog box that is a child of the default Explorer-style dialog box.
If the $OFN_EXPLORER flag is not set, the system uses the template to create an old-style dialog box that replaces the default dialog box.
$OFN_ENABLETEMPLATEHANDLE - Indicates that the hInstance member identifies a data block that contains a preloaded dialog box template.
The system ignores lpTemplateName if this flag is specified.
If the $OFN_EXPLORER flag is set, the system uses the specified template to create a dialog box that is a child of the default Explorer-style dialog box.
If the $OFN_EXPLORER flag is not set, the system uses the template to create an old-style dialog box that replaces the default dialog box.
$OFN_EXPLORER - Indicates that any customizations made to the Open or Save As dialog box use the new Explorer-style customization methods.
By default, the Open and Save As dialog boxes use the Explorer-style user interface regardless of whether this flag is set.
This flag is necessary only if you provide a hook procedure or custom template, or set the $OFN_ALLOWMULTISELECT flag.
If you want the old-style user interface, omit the $OFN_EXPLORER flag and provide a replacement old-style template or hook procedure.
If you want the old style but do not need a custom template or hook procedure, simply provide a hook procedure that always returns FALSE.
$OFN_EXTENSIONDIFFERENT - Specifies that the user typed a file name extension that differs from the extension specified by lpstrDefExt.
The function does not use this flag if lpstrDefExt is NULL.
$OFN_FILEMUSTEXIST - Specifies that the user can type only names of existing files in the File Name entry field.
If this flag is specified and the user enters an invalid name, the dialog box procedure displays a warning in a message box.
If this flag is specified, the $OFN_PATHMUSTEXIST flag is also used. This flag can be used in an Open dialog box. It cannot be used with a Save As dialog box.
$OFN_FORCESHOWHIDDEN - Windows 2000/XP: Forces the showing of system and hidden files, thus overriding the user setting to show or not show hidden files.
However, a file that is marked both system and hidden is not shown.
$OFN_HIDEREADONLY - Hides the Read Only check box.
$OFN_LONGNAMES - For old-style dialog boxes, this flag causes the dialog box to use long file names.
If this flag is not specified, or if the $OFN_ALLOWMULTISELECT flag is also set, old-style dialog boxes use short file names (8.3 format) for file names with spaces.
Explorer-style dialog boxes ignore this flag and always display long file names.
$OFN_NOCHANGEDIR - Restores the current directory to its original value if the user changed the directory while searching for files.
Windows NT 4.0/2000/XP: This flag is ineffective for GetOpenFileName.
$OFN_NODEREFERENCELINKS - Directs the dialog box to return the path and file name of the selected shortcut (.LNK) file.
If this value is not specified, the dialog box returns the path and file name of the file referenced by the shortcut.
$OFN_NOLONGNAMES - For old-style dialog boxes, this flag causes the dialog box to use short file names (8.3 format).
Explorer-style dialog boxes ignore this flag and always display long file names.
$OFN_NONETWORKBUTTON - Hides and disables the Network button.
$OFN_NOREADONLYRETURN - Specifies that the returned file does not have the Read Only check box selected and is not in a write-protected directory.
$OFN_NOTESTFILECREATE - Specifies that the file is not created before the dialog box is closed.
This flag should be specified if the application saves the file on a create-nonmodify network share.
When an application specifies this flag, the library does not check for write protection, a full disk, an open drive door, or network protection.
Applications using this flag must perform file operations carefully, because a file cannot be reopened once it is closed.
$OFN_NOVALIDATE - Specifies that the common dialog boxes allow invalid characters in the returned file name.
Typically, the calling application uses a hook procedure that checks the file name by using the FILEOKSTRING message.
If the text box in the edit control is empty or contains nothing but spaces, the lists of files and directories are updated.
If the text box in the edit control contains anything else, nFileOffset and nFileExtension are set to values generated by parsing the text.
No default extension is added to the text, nor is text copied to the buffer specified by lpstrFileTitle.
If the value specified by nFileOffset is less than zero, the file name is invalid.
Otherwise, the file name is valid, and nFileExtension and nFileOffset can be used as if the $OFN_NOVALIDATE flag had not been specified.
$OFN_OVERWRITEPROMPT - Causes the Save As dialog box to generate a message box if the selected file already exists.
The user must confirm whether to overwrite the file.
$OFN_PATHMUSTEXIST - Specifies that the user can type only valid paths and file names.
If this flag is used and the user types an invalid path and file name in the File Name entry field, the dialog box function displays a warning in a message box.
$OFN_READONLY - Causes the Read Only check box to be selected initially when the dialog box is created.
This flag indicates the state of the Read Only check box when the dialog box is closed.
$OFN_SHAREAWARE - Specifies that if a call to the OpenFile function fails because of a network sharing violation, the error is ignored and the dialog box returns the selected file name.
If this flag is not set, the dialog box notifies your hook procedure when a network sharing violation occurs for the file name specified by the user.
If you set the $OFN_EXPLORER flag, the dialog box sends the CDN_SHAREVIOLATION message to the hook procedure.
If you do not set $OFN_EXPLORER, the dialog box sends the SHAREVISTRING registered message to the hook procedure.
$OFN_SHOWHELP - Causes the dialog box to display the Help button.
The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button.
An Explorer-style dialog box sends a CDN_HELP notification message to your hook procedure when the user clicks the Help button.
$OFN_USESHELLITEM - Do not use.
nFileOffset Specifies the zero-based offset, in TCHARs, from the beginning of the path to the file name in the string pointed to by lpstrFile.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters.
nFileExtension Specifies the zero-based offset, in TCHARs, from the beginning of the path to the file name extension in the string pointed to by lpstrFile.
For the ANSI version, this is the number of bytes; for the Unicode version, this is the number of characters.
lpstrDefExt | Pointer to a buffer that contains the default extension.
lCustData | Specifies application-defined data that the system passes to the hook procedure identified by the lpfnHook member.
lpfnHook | Pointer to a hook procedure. This member is ignored unless the Flags member includes the $OFN_ENABLEHOOK flag.
lpTemplateName | Pointer to a null-terminated string that names a dialog template resource in the module identified by the hInstance member.
pvReserved | Reserved. Must be set to NULL.
dwReserved | Reserved. Must be set to 0.
FlagsEx Windows 2000/XP: A set of bit flags you can use to initialize the dialog box. Currently, this member can be zero or the following flag.
$OFN_EX_NOPLACESBAR - If this flag is set, the places bar is not displayed.
If this flag is not set, Explorer-style dialog boxes include a places bar containing icons for commonly-used folders, such as Favorites and Desktop.

Remarks

None.

Related


Keyword $tagOVERLAPPED

Keyword Reference

$tagOVERLAPPED

Contains information used in asynchronous (or overlapped) input and output (I/O).

Global Const $tagOVERLAPPED = "int Internal;int InternalHigh;int Offset;int OffsetHigh;int hEvent"

Parameters

Internal | Reserved for operating system use. This member, which specifies a system-dependent status, is valid when the GetOverlappedResult function returns without setting the extended error information to ERROR_IO_PENDING.
InternalHigh | Reserved for operating system use. This member, which specifies the length of the data transferred, is valid when the GetOverlappedResult function returns True.
Offset | File position at which to start the transfer. The file position is a byte offset from the start of the file. The calling process must set this member before calling the ReadFile or WriteFile function. This member is used only when the device is a file. Otherwise, this member must be zero.
OffsetHigh | High-order word of the file position at which to start the transfer. This member is used only when the device is a file. Otherwise, this member must be zero.
hEvent | Handle to an event that will be set to the signaled state when the operation has completed. The calling process must set this member either to zero or a valid event handle before calling any overlapped functions.

Remarks

None.

Related


Keyword $tagPOINT

Keyword Reference

$tagPOINT

Defines the x- and y- coordinates of a point

Global Const $tagPOINT = "int X;int Y"

Parameters

X | Specifies the x-coordinate of the point
Y | Specifies the y-coordinate of the point

Remarks

None.

Related


Keyword $tagPROCESS_INFORMATION

Keyword Reference

$tagPROCESS_INFORMATION

Contains information about a newly created process and its primary thread

Global Const $tagPROCESS_INFORMATION = "hwnd hProcess;hwnd hThread;int ProcessID;int ThreadID"

Parameters

hProcess | A handle to the newly created process
hThread | A handle to the primary thread of the newly created process
ProcessID | A value that can be used to identify a process
ThreadID | A value that can be used to identify a thread

Remarks

None.

Related


Keyword $tagREBARBANDINFO

Keyword Reference

$tagREBARBANDINFO

Contains information about an item in a ComboBoxEx control

Global Const $tagREBARBANDINFO = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & _
"int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;hwnd hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & _
"uint cyIntegral;uint cxIdeal;int lParam;uint cxHeader"

Parameters

cbSize | Size of this structure, in bytes. Your application must fill this member before sending any messages that use the address of this structure as a parameter.
fMask Flags that indicate which members of this structure are valid or must be filled. This value can be a combination of the following:;
$RBBIM_BACKGROUND - The hbmBack member is valid or must be set.
$RBBIM_CHILD - The hwndChild member is valid or must be set.
$RBBIM_CHILDSIZE - The cxMinChild, cyMinChild, cyChild, cyMaxChild, and cyIntegral members are valid or must be set.
$RBBIM_COLORS - The clrFore and clrBack members are valid or must be set.
$RBBIM_HEADERSIZE - Version 4.71. The cxHeader member is valid or must be set.
$RBBIM_IDEALSIZE - Version 4.71. The cxIdeal member is valid or must be set.
$RBBIM_ID - The wID member is valid or must be set.
$RBBIM_IMAGE - The iImage member is valid or must be set.
$RBBIM_LPARAM - Version 4.71. The lParam member is valid or must be set.
$RBBIM_SIZE - The cx member is valid or must be set.
$RBBIM_STYLE - The fStyle member is valid or must be set.
$RBBIM_TEXT - The lpText member is valid or must be set.
$RBBIM_CHEVRONLOCATION - The rcChevronLocation member is valid or must be set.
$RBBIM_CHEVRONSTATE - The uChevronState member is valid or must be set.
fStyle Flags that specify the band style. This value can be a combination of the following:
$RBBS_BREAK - The band is on a new line.
$RBBS_CHILDEDGE - The band has an edge at the top and bottom of the child window.
$RBBS_FIXEDBMP - The background bitmap does not move when the band is resized.
$RBBS_FIXEDSIZE - The band can't be sized. With this style, the sizing grip is not displayed on the band.
$RBBS_GRIPPERALWAYS - Version 4.71. The band will always have a sizing grip, even if it is the only band in the rebar.
$RBBS_HIDDEN - The band will not be visible.
$RBBS_NOGRIPPER - Version 4.71. The band will never have a sizing grip, even if there is more than one band in the rebar.
$RBBS_USECHEVRON - Version 5.80. Show a chevron button if the band is smaller than cxIdeal.
$RBBS_VARIABLEHEIGHT - Version 4.71. The band can be resized by the rebar control; cyIntegral and cyMaxChild affect how the rebar will resize the band.
$RBBS_NOVERT - Don't show when vertical.
$RBBS_USECHEVRON - Display drop-down button.
$RBBS_HIDETITLE - Keep band title hidden.
$RBBS_TOPALIGN - Keep band in top row.
clrFore | Band foreground colors.
clrBack Band background colors.
If hbmBack specifies a background bitmap, these members are ignored.
By default, the band will use the background color of the rebar control set with the $RB_SETBKCOLOR message.
If a background color is specified here, then this background color will be used instead.
lpText Pointer to a buffer that contains the display text for the band.
If band information is being requested from the control and $RBBIM_TEXT is specified in fMask,
this member must be initialized to the address of the buffer that will receive the text.
cch | Size of the buffer at lpText, in bytes. If information is not being requested from the control, this member is ignored.
iImage | Zero-based index of any image that should be displayed in the band. The image list is set using the $RB_SETBARINFO message.
hwndChild | Handle to the child window contained in the band, if any.
cxMinChild | Minimum width of the child window, in pixels. The band can't be sized smaller than this value.
cyMinChild | Minimum height of the child window, in pixels. The band can't be sized smaller than this value.
cx | Length of the band, in pixels.
hbmBack | Handle to a bitmap that is used as the background for this band.
wID | UINT value that the control uses to identify this band for custom draw notification messages.
cyChild | Version 4.71. Initial height of the band, in pixels. This member is ignored unless the $RBBS_VARIABLEHEIGHT style is specified.
cyMaxChild | Version 4.71. Maximum height of the band, in pixels. This member is ignored unless the $RBBS_VARIABLEHEIGHT style is specified.
cyIntegral Version 4.71. Step value by which the band can grow or shrink, in pixels.
If the band is resized, it will be resized in steps specified by this value.
This member is ignored unless the $RBBS_VARIABLEHEIGHT style is specified.
cxIdeal Version 4.71. Ideal width of the band, in pixels.
If the band is maximized to the ideal width (see $RB_MAXIMIZEBAND), the rebar control will attempt to make the band this width.
lParam | Version 4.71. Application-defined value.
cxHeader Version 4.71. Size of the band's header, in pixels.
The band header is the area between the edge of the band and the edge of the child window.
This is the area where band text and images are displayed, if they are specified.
If this value is specified, it will override the normal header dimensions that the control calculates for the band.

Remarks

None.

Related


Keyword $tagRECT

Keyword Reference

$tagRECT

Defines the coordinates of the upper-left and lower-right corners of a rectangle

Global Const $tagRECT = "int Left;int Top;int Right;int Bottom"

Parameters

Left | Specifies the x-coordinate of the upper-left corner of the rectangle
Top | Specifies the y-coordinate of the upper-left corner of the rectangle
Right | Specifies the x-coordinate of the lower-right corner of the rectangle
Bottom | Specifies the y-coordinate of the lower-right corner of the rectangle

Remarks

None.

Related


Keyword $tagSCROLLBARINFO

Keyword Reference

$tagSCROLLBARINFO

Contains scroll bar information

Global Const $tagSCROLLBARINFO = "dword cbSize;int Left;int Top;int Right;int Bottom;int dxyLineButton;int xyThumbTop;" & _
"int xyThumbBottom;int reserved;dword rgstate[6]"

Parameters

cbSize | Specifies the size, in bytes, of this structure. The caller must set this to DllStructGetSize($tagSCROLLBARINFO).
Left | Specifies the x-coordinate of the upper-left corner of the rectangle coordinates of the scroll bar
Top | Specifies the y-coordinate of the upper-left corner of the rectangle coordinates of the scroll bar
Right | Specifies the x-coordinate of the lower-right corner of the rectangle coordinates of the scroll bar
Bottom | Specifies the y-coordinate of the lower-right corner of the rectangle coordinates of the scroll bar
dxyLineButton | Height or width of the thumb.
xyThumbTop | Position of the top or left of the thumb.
xyThumbBottom | Position of the bottom or right of the thumb.
reserved | Reserved.
rgstate | An array of DWORD elements. Each element indicates the state of a scroll bar component. The following values show the scroll bar component that corresponds to each array index: 0 The scroll bar itself. 1 The top or right arrow button. 2 The page up or page right region. 3 The scroll box (thumb). 4 The page down or page left region. 5 The bottom or left arrow button.
 | The DWORD element for each scroll bar component can include a combination of the following bit flags. STATE_SYSTEM_INVISIBLE - For the scroll bar itself, indicates the specified vertical or horizontal scroll bar does not exist. For the page up or page down regions, indicates the thumb is positioned such that the region does not exist. STATE_SYSTEM_OFFSCREEN - For the scroll bar itself, indicates the window is sized such that the specified vertical or horizontal scroll bar is not currently displayed. STATE_SYSTEM_PRESSED - The arrow button or page region is pressed. STATE_SYSTEM_UNAVAILABLE - The component is disabled.

Remarks

$SIF_xxxxx and $SB_xxxxx for scrollbar require WindowsConstants.au3

Related


Keyword $tagSCROLLINFO

Keyword Reference

$tagSCROLLINFO

Contains scroll bar parameters to be set by the $SBM_SETSCROLLINFO message, or retrieved by the $SBM_GETSCROLLINFO message

Global Const $tagSCROLLINFO = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos"

Parameters

cbSize | Specifies the size, in bytes, of this structure. The caller must set this to DllStructGetSize($tagSCROLLINFO).
fMask | Specifies the scroll bar parameters to set or retrieve. This member can be a combination of the following values: $SIF_ALL - Combination of $SIF_PAGE, $SIF_POS, $SIF_RANGE, and $SIF_TRACKPOS. $SIF_DISABLENOSCROLL - This value is used only when setting a scroll bar's parameters. If the scroll bar's new parameters make the scroll bar unnecessary, disable the scroll bar instead of removing it. $SIF_PAGE - The nPage member contains the page size for a proportional scroll bar. $SIF_POS - The nPos member contains the scroll box position, which is not updated while the user drags the scroll box. $SIF_RANGE - The nMin and nMax members contain the minimum and maximum values for the scrolling range. $SIF_TRACKPOS - The nTrackPos member contains the current position of the scroll box while the user is dragging it.
nMin | Specifies the minimum scrolling position.
nMax | Specifies the maximum scrolling position.
nPage | Specifies the page size. A scroll bar uses this value to determine the appropriate size of the proportional scroll box.
nPos | Specifies the position of the scroll box.
nTrackPos | Specifies the immediate position of a scroll box that the user is dragging. An application can retrieve this value while processing the $SB_THUMBTRACK request code. An application cannot set the immediate scroll position, the SetScrollInfo function ignores this member.

Remarks

$SIF_xxxxx and $SB_xxxxx for scrollbar require WindowsConstants.au3

Related


Keyword $tagSECURITY_ATTRIBUTES

Keyword Reference

$tagSECURITY_ATTRIBUTES

Contains the security descriptor for an object and specifies whether the handle retrieved by specifying this structure is inheritable

Global Const $tagSECURITY_ATTRIBUTES = "int Length;ptr Descriptor;int InheritHandle"

Parameters

Length | The size, in bytes, of this structure
Descriptor | A pointer to a security descriptor for the object that controls the sharing of it
InheritHandle | If True, the new process inherits the handle.

Remarks

None.

Related


Keyword $tagSIZE

Keyword Reference

$tagSIZE

Stores an ordered pair of integers, typically the width and height of a rectangle

Global Const $tagSIZE = "int X;int Y"

Parameters

X | Width
Y | Height

Remarks

None.

Related


Keyword $tagSTARTUPINFO

Keyword Reference

$tagSTARTUPINFO

Specifies the window station, desktop, standard handles, and appearance of the main window for a process at creation time

Global Const $tagSTARTUPINFO = "int Size;ptr Reserved1;ptr Desktop;ptr Title;int X;int Y;int XSize;int YSize;int XCountChars;" & _
"int YCountChars;int FillAttribute;int Flags;short ShowWindow;short Reserved2;ptr Reserved3;int StdInput;" & _
"int StdOutput;int StdError"

Parameters

Size | The size of the structure, in bytes
Reserved1 | Reserved, must be zero
Desktop | The name of the desktop, or the name of both the desktop and window station for this process
Title | For console processes, the title displayed in the title bar if a new console is created
X If Flags specifies $STARTF_USEPOSITION, this member is the x offset of the upper left corner
of a window if a new window is created, in pixels.
Y If Flags specifies $STARTF_USEPOSITION, this member is the y offset of the upper left corner
of a window if a new window is created, in pixels.
XSize | If Flags specifies $STARTF_USESIZE, this member is the height of the window, in pixels
YSize | If Flags specifies $STARTF_USESIZE, this member is the width of the window, in pixels
XCountChars If Flags specifies $STARTF_USECOUNTCHARS, if a new console window is created in a console
process, this member specifies the screen buffer width, in character columns.
YCountChars If Flags specifies $STARTF_USECOUNTCHARS, if a new console window is created in a console
process, this member specifies the screen buffer height, in character rows.
FillAttribute If Flags specifies $STARTF_USEFILLATTRIBUTE, this member is the initial text and background
colors if a new console window is created in a console application.
Flags Determines which members are used when the process creates a window:
$STARTF_FORCEONFEEDBACK - The cursor is in feedback mode for two seconds after CreateProcess is called. The
Working in Background cursor is displayed. If during those two seconds the process makes the first GUI call,
the system gives five more seconds to the process. If during those five seconds the process shows a window,
the system gives five more seconds to the process to finish drawing the window. The system turns the feedback
cursor off after the first call to GetMessage, regardless of whether the process is drawing.
$STARTF_FORCEOFFFEEDBACK - Indicates that the feedback cursor is forced off while the process is starting.
The Normal Select cursor is displayed.
$STARTF_RUNFULLSCREEN - Indicates that the process should be run in full screen mode, rather than in
windowed mode. This flag is only valid for console applications running on an x86 computer.
$STARTF_USECOUNTCHARS - The XCountChars and YCountChars members are valid
$STARTF_USEFILLATTRIBUTE - The FillAttribute member is valid
$STARTF_USEPOSITION - The X and Y members are valid
$STARTF_USESHOWWINDOW - The ShowWindow member is valid
$STARTF_USESIZE - The XSize and YSize members are valid
$STARTF_USESTDHANDLES - The hStdInput, hStdOutput, and hStdError members are valid
ShowWindow | If Flags specifies $STARTF_USESHOWWINDOW, this member can be any of the SW_ constants
Reserved2 | Reserved, must be zero
Reserved3 | Reserved, must be zero
StdInput | If Flags specifies $STARTF_USESTDHANDLES, this member is the standard input handle
StdOutput | If Flags specifies $STARTF_USESTDHANDLES, this member is the standard output handle
StdError | If Flags specifies $STARTF_USESTDHANDLES, this member is the standard error handle

Remarks

None.

Related


Keyword $tagSYSTEMTIME

Keyword Reference

$tagSYSTEMTIME

Specifies a date and time, in coordinated universal time (UTC)

Global Const $tagSYSTEMTIME = "short Year;short Month;short Dow;short Day;short Hour;short Minute;short Second;short MSeconds"

Parameters

Year | Year
Month | Month
Dow | Day of week
Day | Day
Hour | Hour
Minute | Minute
Second | Second
MSeconds | MSeconds

Remarks

None.

Related


Keyword $tagTBBUTTON

Keyword Reference

$tagTBBUTTON

Contains information about a button in a toolbar

Global Const $tagTBBUTTON = "int Bitmap;int Command;byte State;byte Style;short Reserved;int Param;int String"

Parameters

Bitmap | Zero based index of the button image. Set this member to $I_IMAGECALLBACK, and the toolbar will send the $TBN_GETDISPINFO notification to retrieve the image index when it is needed. Set this member to $I_IMAGENONE to indicate that the button does not have an image. The button layout will not include any space for a bitmap, only text. If the button is a separator, Bitmap determines the width of the separator, in pixels.
Command | Command identifier associated with the button. This identifier is used in a $WM_COMMAND message when the button is chosen.
State | Button state flags
Style | Button style flags
Reserved | Reserved
Param | Application defined value
String | Zero based index of the button string, or a pointer to a string that contains text for the button

Remarks

None.

Related


Keyword $tagTBBUTTONINFO

Keyword Reference

$tagTBBUTTONINFO

Contains or receives information for a specific button in a toolbar

Global Const $tagTBBUTTONINFO = "int Size;int Mask;int Command;int Image;byte State;byte Style;short CX;int Param;ptr Text;int TextMax"

Parameters

Size | Size of this structure, in bytes
Mask | Set of flags that indicate which members contain valid information: $TBIF_BYINDEX - The Param sent with a $TB_GETBUTTONINFO or $TB_SETBUTTONINFO message is an index $TBIF_COMMAND - The Command member contains valid information or is being requested $TBIF_IMAGE - The Image member contains valid information or is being requested $TBIF_IMAGELABEL - Indicates that ImageLabel should be used $TBIF_LPARAM - The Param member contains valid information or is being requested $TBIF_SIZE - The CX member contains valid information or is being requested $TBIF_STATE - The State member contains valid information or is being requested $TBIF_STYLE - The Style member contains valid information or is being requested $TBIF_TEXT - The Text member contains valid information or is being requested
Command | Command identifier of the button
Image | Image index of the button. Set this member to $I_IMAGECALLBACK, and the toolbar will send the $TBN_GETDISPINFO notification to retrieve the image index when it is needed. Set this member to $I_IMAGENONE to indicate that the button does not have an image.
State | State flags of the button
Style | Style flags of the button
CX | Width of the button, in pixels
Param | Application defined value associated with the button
Text | Address of a character buffer that contains or receives the button text
TextMax | Size of the buffer at Text. If the button information is being set, this member is ignored
ImageLabel | Provides the ability to replace the text label of an item with an image

Remarks

None.

Related


Keyword $tagTIME_ZONE_INFORMATION

Keyword Reference

$tagTIME_ZONE_INFORMATION

Specifies information specific to the time zone

Global Const $tagTIME_ZONE_INFORMATION = "long Bias;byte StdName[64];ushort StdDate[8];long StdBias;byte DayName[64];ushort DayDate[8];long DayBias"

Parameters

Bias | The current bias for local time translation on this computer, in minutes
StdName | A description for standard time
StdDate | A SYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs on this operating system.
StdBias | The bias value to be used during local time translations that occur during standard time
DayName | A description for daylight saving time
DayDate | A SYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs on this operating system.
DayBias | The bias value to be used during local time translations that occur during daylight saving time

Remarks

None.

Related


Keyword $tagTOKEN_PRIVILEGES

Keyword Reference

$tagTOKEN_PRIVILEGES

Contains information about a set of privileges for an access token

Global Const $tagTOKEN_PRIVILEGES = "int Count;int64 LUID;int Attributes"

Parameters

Count | Specifies the number of entries
LUID | Specifies a LUID value
Attributes | Specifies attributes of the LUID

Remarks

None.

Related


Keyword $tagTVHITTESTINFO

Keyword Reference

$tagTVHITTESTINFO

Contains information used to determine the location of a point relative to a tree-view control

Global Const $tagTVHITTESTINFO = "int X;int Y;int Flags;int Item"

Parameters

X | X position, in client coordiantes, to be tested
Y | Y position, in client coordiantes, to be tested
Flags | Results of a hit test. This member can be one or more of the following values: $TVHT_ABOVE - Above the client area $TVHT_BELOW - Below the client area $TVHT_NOWHERE - In the client area, but below the last item $TVHT_ONITEM - On the bitmap or label associated with an item $TVHT_ONITEMBUTTON - On the button associated with an item $TVHT_ONITEMICON - On the bitmap associated with an item $TVHT_ONITEMINDENT - In the indentation associated with an item $TVHT_ONITEMLABEL - On the label (string) associated with an item $TVHT_ONITEMRIGHT - In the area to the right of an item DllStructGetData($TVHT_ONITEMSTATEICON - On the state icon for an item that is in a user-defined state, "") $TVHT_TOLEFT - To the left of the client area $TVHT_TORIGHT - To the right of the client area
Item | Handle to the item that occupies the position

Remarks

None.

Related


Keyword $tagTVITEMEX

Keyword Reference

$tagTVITEMEX

Specifies or receives attributes of a tree-view item

Global Const $tagTVITEMEX = "int Mask;int hItem;int State;int StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & _
"int Children;int Param;int Integral"

Parameters

Mask | Flags that indicate which of the other structure members contain valid data: $TVIF_CHILDREN - The Children member is valid $TVIF_DI_SETITEM - The will retain the supplied information and will not request it again $TVIF_HANDLE - The hItem member is valid $TVIF_IMAGE - The Image member is valid $TVIF_INTEGRAL - The Integral member is valid $TVIF_PARAM - The Param member is valid $TVIF_SELECTEDIMAGE - The SelectedImage member is valid $TVIF_STATE - The State and StateMask members are valid $TVIF_TEXT - The Text and TextMax members are valid
hItem | Item to which this structure refers
State | Set of bit flags and image list indexes that indicate the item's state. When setting the state of an item, the StateMask member indicates the bits of this member that are valid. When retrieving the state of an item, this member returns the current state for the bits indicated in the StateMask member. Bits 0 through 7 of this member contain the item state flags. Bits 8 through 11 of this member specify the one based overlay image index.
StateMask | Bits of the state member that are valid. If you are retrieving an item's state, set the bits of the stateMask member to indicate the bits to be returned in the state member. If you are setting an item's state, set the bits of the stateMask member to indicate the bits of the state member that you want to set.
Text | Pointer to a null-terminated string that contains the item text.
TextMax | Size of the buffer pointed to by the Text member, in characters
Image | Index in the image list of the icon image to use when the item is in the nonselected state
SelectedImage | Index in the image list of the icon image to use when the item is in the selected state
Children | Flag that indicates whether the item has associated child items. This member can be one of the following values: 0 - The item has no child items 1 - The item has one or more child items
Param | A value to associate with the item
Integral | Height of the item

Remarks

None.

Related


Keyword $tagWIN32_FIND_DATA

Keyword Reference

$tagWIN32_FIND_DATA

Contains the data found when finding a file

Global Const $tagWIN32_FIND_DATA = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]"

Parameters

dwFileAttributes | The file attributes of a file.
ftCreationTime | A FILETIME structure that specifies when a file or directory was created.
ftLastAccessTime | A FILETIME structure that specifies when the file was last read from, written to, or for executable files, run.
ftLastWriteTime | A FILETIME structure that specifies when when the file was last written to, truncated, or overwritten.
nFileSizeHigh | The high-order DWORD value of the file size, in bytes.
nFileSizeLow | The low-order DWORD value of the file size, in bytes.
dwReserved0 | If the dwFileAttributes member includes the $FILE_ATTRIBUTE_REPARSE_POINT attribute. This member specifies the reparse tag.
dwReserved1 | Reserved.
cFileName | The name of the file.
cAlternateFileName | An alternative name for the file, the classic 8.3 (filename.ext) file name format.

Remarks

Unicode version must be used.

Related

See Also

Search WIN32_FIND_DATA in MSDN Library


Keyword $tagWINDOWPLACEMENT

Keyword Reference

$tagWINDOWPLACEMENT

The WINDOWPLACEMENT structure contains information about the placement of a window on the screen

Global Const $tagWINDOWPLACEMENT = "UINT length; UINT flags; UINT showCmd; int ptMinPosition[2]; int ptMaxPosition[2]; int rcNormalPosition[4]"

Parameters

length | Specifies the length, in bytes, of the structure
flags Specifies flags that control the position of the minimized window and the method by which the window is restored. This member can be one or more of the following values
$WPF_ASYNCWINDOWPLACEMENT - Windows 2000/XP: If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window.
$WPF_RESTORETOMAXIMIZED - Specifies that the restored window will be maximized, regardless of whether it was maximized before it was minimized.
This setting is only valid the next time the window is restored. It does not change the default restoration behavior.
This flag is only valid when the @SW_SHOWMINIMIZED value is specified for the showCmd member.
$WPF_SETMINPOSITION - Specifies that the coordinates of the minimized window may be specified.
This flag must be specified if the coordinates are set in the ptMinPosition member.
showCmd Specifies the current show state of the window. This member can be one of the following values:
@SW_HIDE - Hides the window and activates another window.
@SW_MAXIMIZE - Maximizes the specified window.
@SW_MINIMIZE - Minimizes the specified window and activates the next top-level window in the z-order.
@SW_RESTORE - Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position.
An application should specify this flag when restoring a minimized window.
@SW_SHOW - Activates the window and displays it in its current size and position.
@SW_SHOWMAXIMIZED - Activates the window and displays it as a maximized window.
@SW_SHOWMINIMIZED - Activates the window and displays it as a minimized window.
@SW_SHOWMINNOACTIVE - Displays the window as a minimized window.
This value is similar to @SW_SHOWMINIMIZED, except the window is not activated.
@SW_SHOWNA - Displays the window in its current size and position.
This value is similar to @SW_SHOW, except the window is not activated.
@SW_SHOWNOACTIVATE - Displays a window in its most recent size and position.
This value is similar to @SW_SHOWNORMAL, except the window is not actived.
@SW_SHOWNORMAL - Activates and displays a window.
If the window is minimized or maximized, the system restores it to its original size and position.
An application should specify this flag when displaying the window for the first time.
ptMinPosition | Specifies the coordinates of the window's upper-left corner when the window is minimized.
ptMaxPosition | Specifies the coordinates of the window's upper-left corner when the window is maximized.
rcNormalPosition | Specifies the window's coordinates when the window is in the restored position.

Remarks

None.

Related


Keyword $tagWINDOWPOS

Keyword Reference

$tagWINDOWPOS

The WINDOWPOS structure contains information about the size and position of a window

Global Const $tagWINDOWPOS = "hwnd hWnd;int InsertAfter;int X;int Y;int CX;int CY;int Flags"

Parameters

hWnd | Handle to the window
InsertAfter | Specifies the position of the window in Z order
X | Specifies the position of the left edge of the window
Y | Specifies the position of the top edge of the window
CX | Specifies the window width, in pixels
CY | Specifies the window height, in pixels
Flags | Specifies the window position. This member can be one or more of the following values: $SWP_DRAWFRAME - Draws a frame around the window $SWP_FRAMECHANGED - Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed $SWP_HIDEWINDOW - Hides the window $SWP_NOACTIVATE - Does not activate the window $SWP_NOCOPYBITS - Discards the entire contents of the client area $SWP_NOMOVE - Retains the current position (ignores the x and y parameters) $SWP_ NOOWNERZORDER - Does not change the owner window's position in the Z order $SWP_NOREDRAW - Does not redraw changes $SWP_NOREPOSITION - Same as the SWP_NOOWNERZORDER flag $SWP_NOSENDCHANGING - Prevents the window from receiving the WM_WINDOWPOSCHANGING message $SWP_NOSIZE - Retains the current size (ignores the cx and cy parameters) $SWP_NOZORDER - Retains the current Z order (ignores the InsertAfter parameter) $SWP_SHOWWINDOW - Displays the window

Remarks

None.

Related


User Defined Functions

Timers user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Timers.au3>.

User Defined Function | Description
_Timer_Diff | Returns the difference in time from a previous call to _Timer_Init
_Timer_GetIdleTime | Returns the number of ticks since last user activity (i.e. KYBD/Mouse)
_Timer_GetTimerID | Returns the Timer ID from $iwParam
_Timer_Init | Returns a timestamp (in milliseconds).
_Timer_KillAllTimers | Destroys all the timers
_Timer_KillTimer | Destroys the specified timer
_Timer_SetTimer | Creates a timer with the specified time-out value


Function _Timer_Diff

Function Reference

_Timer_Diff

Returns the difference in time from a previous call to _Timer_Init

#Include <Timers.au3>
_Timer_Diff($iTimeStamp)

Parameters

$iTimeStamp Timestamp returned from a previous call to _Timer_Init().

Return Value

Returns the time difference (in milliseconds) from a previous call to _Timer_Init().

Remarks

None.

Related

_Timer_Init

Example

#include <Timers.au3>

_Main()

Func _Main()
HotKeySet("{ESC}", "_Quit")

Local $starttime = _Timer_Init()
While 1
ToolTip(_Timer_Diff($starttime))
WEnd
EndFunc ;==>_Main

Func _Quit()
Exit
EndFunc ;==>_Quit


Function _Timer_GetIdleTime

Function Reference

_Timer_GetIdleTime

Returns the number of ticks since last user activity (i.e. KYBD/Mouse)

#Include <Timers.au3>
_Timer_GetIdleTime()

Parameters

None.

Return Value

Success: | integer ticks since last (approx. milliseconds) since last activity
Failure: | Sets @extended = 1 if rollover occurs (see remarks)

Remarks

The current ticks since last system restart will roll over to 0 every 50 days or so,
which makes it possible for last user activity to be before the rollover, but run time
of this function to be after the rollover. If this happens, @extended = 1 and the
returned value is ticks since rollover occured.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <Timers.au3>

; Mouse/Keyboard action during this 10 sec delay will change reported idle time
Sleep(10 * 1000); 10sec

Global $iIdleTime = _Timer_GetIdleTime()

MsgBox(64, "_Timer_GetIdleTime", "Idle time = " & $iIdleTime & "ms")


Function _Timer_GetTimerID

Function Reference

_Timer_GetTimerID

Returns the Timer ID from $iwParam

#Include <Timers.au3>
_Timer_GetTimerID($iwParam)

Parameters

$iwParam Specifies the timer identifier event.

Return Value

Success: | The Timer ID
Failure: | 0

Remarks

None.

Related

_Timer_SetTimer

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1
Global $iTimer1, $iTimer2

_Example_Events()

Func _Example_Events()
Local $hGUI, $btn_change, $iWait = 10, $btn_state
Local $aParts[3] = [75, 330, -1]

$hGUI = GUICreate("Timers Using WM_TIMER Events", 400, 320)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
$btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
GUICtrlSetState($btn_change, $GUI_DISABLE)
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
_GUICtrlStatusBar_SetText($hStatusBar, "Timers")
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
GUICtrlSetColor($progress, 0xff0000)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
GUISetState()

GUIRegisterMsg($WM_TIMER, "WM_TIMER")

$iTimer1 = _Timer_SetTimer($hGUI, 1000)

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_state
If GUICtrlRead($btn_state) = "Start Progress Bar" Then
$iTimer2 = _Timer_SetTimer($hGUI, $iWait) ; create timer
If @error Or $iTimer2 = 0 Then ContinueLoop
GUICtrlSetData($btn_state, "Stop Progress Bar")
GUICtrlSetState($btn_change, $GUI_ENABLE)
Else
GUICtrlSetState($btn_change, $GUI_DISABLE)
_Timer_KillTimer($hGUI, $iTimer2)
GUICtrlSetData($btn_state, "Start Progress Bar")
EndIf

Case $btn_change
If $iWait = 10 Then
$iWait = 250
Else
$iWait = 10
EndIf
MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
$iTimer2 = _Timer_SetTimer($hGUI, $iWait, "", $iTimer2) ; reuse timer with different interval
EndSwitch
WEnd

ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
GUIDelete()
EndFunc ;==>_Example_Events

; Timer Events
Func WM_TIMER($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam

Switch _Timer_GetTimerID($iwParam)
Case $iTimer1
_UpdateStatusBarClock()
Case $iTimer2
_UpdateProgressBar()
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_TIMER

Func _UpdateStatusBarClock()
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc ;==>_UpdateStatusBarClock2

Func _UpdateProgressBar()
$percent += 5 * $direction
GUICtrlSetData($progress, $percent)
If $percent = 100 Or $percent = 0 Then $direction *= -1
If $percent = 100 Then
GUICtrlSetColor($progress, 0xff0000)
ElseIf $percent = 0 Then
GUICtrlSetColor($progress, 0x0000ff)
EndIf
EndFunc ;==>_UpdateProgressBar2

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Timer_Init

Function Reference

_Timer_Init

Returns a timestamp (in milliseconds).

#Include <Timers.au3>
_Timer_Init()

Parameters

None.

Return Value

Returns a timestamp number (in milliseconds).

Remarks

None.

Related

_Timer_Diff

Example

#include <Timers.au3>

_Main()

Func _Main()
HotKeySet("{ESC}", "_Quit")

Local $starttime = _Timer_Init()
While 1
ToolTip(_Timer_Diff($starttime))
WEnd
EndFunc ;==>_Main

Func _Quit()
Exit
EndFunc ;==>_Quit


Function _Timer_KillAllTimers

Function Reference

_Timer_KillAllTimers

Destroys all the timers

#Include <Timers.au3>
_Timer_KillAllTimers($hWnd)

Parameters

$hWnd Handle to the window associated with the timers.
This value must be the same as the hWnd value passed to the _Timer_SetTimer function that created the timer

Return Value

Success: | True
Failure: | False

Remarks

The _Timer_KillAllTimers function does not remove WM_TIMER messages already posted to the message queue

Related

_Timer_KillTimer, _Timer_SetTimer

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1

_Example_CallBack()

Func _Example_CallBack()
Local $hGUI, $iTimerProgress, $btn_change, $iWait = 10, $btn_state
Local $aParts[3] = [75, 330, -1]

$hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
$btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
GUICtrlSetState($btn_change, $GUI_DISABLE)
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
_GUICtrlStatusBar_SetText($hStatusBar, "Timers")
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
GUICtrlSetColor($progress, 0xff0000)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
GUISetState()

_Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_state
If GUICtrlRead($btn_state) = "Start Progress Bar" Then
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
If @error Or $iTimerProgress = 0 Then ContinueLoop
GUICtrlSetData($btn_state, "Stop Progress Bar")
GUICtrlSetState($btn_change, $GUI_ENABLE)
Else
GUICtrlSetState($btn_change, $GUI_DISABLE)
_Timer_KillTimer($hGUI, $iTimerProgress)
GUICtrlSetData($btn_state, "Start Progress Bar")
EndIf

Case $btn_change
If $iWait = 10 Then
$iWait = 250
Else
$iWait = 10
EndIf
MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
EndSwitch
WEnd
ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
GUIDelete()
EndFunc ;==>_Example_CallBack

Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc ;==>_UpdateStatusBarClock

Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
$percent += 5 * $direction
GUICtrlSetData($progress, $percent)
If $percent = 100 Or $percent = 0 Then $direction *= -1
If $percent = 100 Then
GUICtrlSetColor($progress, 0xff0000)
ElseIf $percent = 0 Then
GUICtrlSetColor($progress, 0x0000ff)
EndIf
EndFunc ;==>_UpdateProgressBar

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Timer_KillTimer

Function Reference

_Timer_KillTimer

Destroys the specified timer

#Include <Timers.au3>
_Timer_KillTimer($hWnd, $iTimerID)

Parameters

$hWnd | Handle to the window associated with the specified timer. This value must be the same as the hWnd value passed to the _Timer_SetTimer function that created the timer
$iTimerID | Specifies the timer to be destroyed

Return Value

Success: | True
Failure: | False

Remarks

The _Timer_KillTimer function does not remove WM_TIMER messages already posted to the message queue

Related

_Timer_KillAllTimers, _Timer_SetTimer

See Also

Search KillTimer in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1

_Example_CallBack()

Func _Example_CallBack()
Local $hGUI, $iTimerProgress, $btn_change, $iWait = 10, $btn_state
Local $aParts[3] = [75, 330, -1]

$hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
$btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
GUICtrlSetState($btn_change, $GUI_DISABLE)
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
_GUICtrlStatusBar_SetText($hStatusBar, "Timers")
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
GUICtrlSetColor($progress, 0xff0000)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
GUISetState()

_Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_state
If GUICtrlRead($btn_state) = "Start Progress Bar" Then
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
If @error Or $iTimerProgress = 0 Then ContinueLoop
GUICtrlSetData($btn_state, "Stop Progress Bar")
GUICtrlSetState($btn_change, $GUI_ENABLE)
Else
GUICtrlSetState($btn_change, $GUI_DISABLE)
_Timer_KillTimer($hGUI, $iTimerProgress)
GUICtrlSetData($btn_state, "Start Progress Bar")
EndIf

Case $btn_change
If $iWait = 10 Then
$iWait = 250
Else
$iWait = 10
EndIf
MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
EndSwitch
WEnd
ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
GUIDelete()
EndFunc ;==>_Example_CallBack

Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc ;==>_UpdateStatusBarClock

Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
$percent += 5 * $direction
GUICtrlSetData($progress, $percent)
If $percent = 100 Or $percent = 0 Then $direction *= -1
If $percent = 100 Then
GUICtrlSetColor($progress, 0xff0000)
ElseIf $percent = 0 Then
GUICtrlSetColor($progress, 0x0000ff)
EndIf
EndFunc ;==>_UpdateProgressBar

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _Timer_SetTimer

Function Reference

_Timer_SetTimer

Creates a timer with the specified time-out value

#Include <Timers.au3>
_Timer_SetTimer($hWnd [, $iElapse = 250 [, $sTimerFunc = "" [, $iTimerID = -1]]])

Parameters

$hWnd | Handle to the window to be associated with the timer. This window must be owned by the calling thread
$iElapse | [optional] Specifies the time-out value, in milliseconds
$sTimerFunc | [optional] Function name to be notified when the time-out value elapses
$iTimerID | [optional] Specifies a timer identifier. If $iTimerID = -1 then a new timer is created If $iTimerID matches an existing timer then the timer is replaced If $iTimerID = -1 and $sTimerFunc = "" then timer will use WM_TIMER events

Return Value

Success: | Integer identifying the new timer
Failure: | 0

Remarks

None.

Related

_Timer_KillTimer, _Timer_KillAllTimers, _Timer_GetTimerID

See Also

Search SetTimer in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Timers.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>

Opt("MustDeclareVars", 1)

Global $iMemo, $hStatusBar, $progress, $percent = 0, $direction = 1

_Example_CallBack()

Func _Example_CallBack()
Local $hGUI, $iTimerProgress, $btn_change, $iWait = 10, $btn_state
Local $aParts[3] = [75, 330, -1]

$hGUI = GUICreate("Timers Using CallBack Function(s)", 400, 320)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_state = GUICtrlCreateButton("Start Progress Bar", 70, 270, 100, 25)
$btn_change = GUICtrlCreateButton("Change", 215, 270, 90, 25)
GUICtrlSetState($btn_change, $GUI_DISABLE)
$hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aParts)
_GUICtrlStatusBar_SetText($hStatusBar, "Timers")
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
GUICtrlSetColor($progress, 0xff0000)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, GUICtrlGetHandle($progress))
GUISetState()

_Timer_SetTimer($hGUI, 1000, "_UpdateStatusBarClock") ; create timer

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $btn_state
If GUICtrlRead($btn_state) = "Start Progress Bar" Then
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "_UpdateProgressBar") ; create timer
If @error Or $iTimerProgress = 0 Then ContinueLoop
GUICtrlSetData($btn_state, "Stop Progress Bar")
GUICtrlSetState($btn_change, $GUI_ENABLE)
Else
GUICtrlSetState($btn_change, $GUI_DISABLE)
_Timer_KillTimer($hGUI, $iTimerProgress)
GUICtrlSetData($btn_state, "Start Progress Bar")
EndIf

Case $btn_change
If $iWait = 10 Then
$iWait = 250
Else
$iWait = 10
EndIf
MemoWrite("Timer for _UpdateProgressBar set at: " & $iWait & " milliseconds")
$iTimerProgress = _Timer_SetTimer($hGUI, $iWait, "", $iTimerProgress) ; reuse timer with different interval
EndSwitch
WEnd
ConsoleWrite("Killed All Timers? " & _Timer_KillAllTimers($hGUI) & @CRLF)
GUIDelete()
EndFunc ;==>_Example_CallBack

; call back function
Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
_GUICtrlStatusBar_SetText($hStatusBar, @TAB & @TAB & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC), 2)
EndFunc ;==>_UpdateStatusBarClock

; call back function
Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime)
#forceref $hWnd, $Msg, $iIDTimer, $dwTime
$percent += 5 * $direction
GUICtrlSetData($progress, $percent)
If $percent = 100 Or $percent = 0 Then $direction *= -1
If $percent = 100 Then
GUICtrlSetColor($progress, 0xff0000)
ElseIf $percent = 0 Then
GUICtrlSetColor($progress, 0x0000ff)
EndIf
EndFunc ;==>_UpdateProgressBar

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


User Defined Functions

Visa user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Visa.au3>.

User Defined Function | Description
_viClose | Closes a VISA connection to an Instrument/Device
_viExecCommand | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viFindGpib | Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)
_viGpibBusReset | GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function
_viGTL | Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"
_viInteractiveControl | Interactive VISA control to test your SCPI commands.
_viOpen | Opens a VISA connection to an Instrument/Device
_viSetAttribute | Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.
_viSetTimeout | Sets the VISA timeout in MILISECONDS


Function _viClose

Function Reference

_viClose

Closes a VISA connection to an Instrument/Device

#include <Visa.au3>
_viClose ( $h_session )

Parameters

$h_session A VISA session handle (as returned by _viOpen)

Return Value

Success: | Returns 0.
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

Related

_viExecCommand, _viFindGpib, _viGpibBusReset, _viGTL, _viOpen, _viSetAttribute, _viSetTimeout

Example

;- This assumes that you have instrument set to GPIB address 1
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen("GPIB::3::0")
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 3","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viExecCommand

Function Reference

_viExecCommand

Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)

#include <Visa.au3>
_viExecCommand ( $h_session, $s_command [, $i_timeout_ms = -1] )

Parameters

$h_session A VISA descriptor (STRING) OR a VISA session handle (INTEGER)
This it can be a string or an integer (a handle):
* STRING -&gr; A VISA DESCRIPTOR is a string which specifies the resource with
which to establish a communication session.
An example descriptor is "GPIB::20::0".
This function supports all valid VISA descriptors, including GPIB, TCP, VXI
and Serial Interface instruments (ASRL).
A detailed explanation of VISA descriptors is shown in the Remarks section
of this function.
As a SHORTCUT you can also use a STRING containing the address number
(e.g. "20") of a GPIB instrument instead of typing the full descriptor
(in that case, "GPIB::20::0")
* INTEGER -&gr; A VISA session handle is an integer value returned by _viOpen.
It is recommended that instead you use _viOpen and VISA session handles
instead of descriptors if you plan to communicate repeteadly with an
Instrument or Device, as otherwise each time that you contact the instrument
you would incur the overhead of opening and closing the communication link.
Once you are done using the instrument you must remember to close the link
with _viClose.
$s_command Command/Query to execute (e.g. "*IDN?" or "SOURCE:POWER -20 dBM")
A query MUST contain a QUESTION MARK (?)
When the command is a QUERY the function will automatically wait for the
instrument's answer (or until the operation times out)
$i_timeout_ms [optional] The operation timeout in MILISECONDS.
This is mostly important for QUERIES only.
If it is not specified the last set timeout will be used. If it was never set
before the default timeout (which depends on the VISA implementation) will be used.
Timeouts can also be set separatelly with the _viSetTimeout function.
Depending on the bus type (GPIB, TCP, etc) the timeout might not be set to the
exact value that you request. Instead the closest valid timeout bigger than
the one that you requested will be used.

Return Value

The return value depends on whether the command is a QUERY
or not and in whether the operation was successful or not.
* Command, NON QUERY:
Success: | Returns ZERO
Failure: | Returns -1 if the VISA DLL could not be open
 | or a NON ZERO value representing the VISA
 | error code (see the VISA programmer's guide)
* QUERY:
Success: | Returns the answer of the instrument to the QUERY
Failure: | Returns -1 if the VISA DLL could not be open
 | Returns -3 if the VISA DLL returned an unexpected number of results
 | or returns a NON ZERO value representing the VISA
 | error code (see the VISA programmer's guide)
This function always sets @error to 1 in case of error.

Remarks

* The VISA queries only return the 1st line of the device answer
This is not a problem in most cases, as most devices will always
answer with a single line.

* The following is a description of the MOST COMMON VISA DESCRIPTORS
Note that there are some more types. For more info please
refer to a VISA programmer's guide (available at www.ni.com)
Optional segments are shown in square brackets ([]).
Required segments that must be filled in are denoted by angle
brackets (<&gr;).

Interface Syntax
------------------------------------------------------------
GPIB INSTR GPIB[board]::primary address
[::secondary address] [::INSTR]
GPIB INTFC GPIB[board]::INTFC
TCPIP SOCKET TCPIP[board]::host address::port::SOCKET
Serial INSTR ASRL[board][::INSTR]
PXI INSTR PXI[board]::device[::function][::INSTR]
VXI INSTR VXI[board]::VXI logical address[::INSTR]
GPIB-VXI INSTR GPIB-VXI[board]::VXI logical address[::INSTR]
TCPIP INSTR TCPIP[board]::host address[::LAN device name]
[::INSTR]

The GPIB keyword is used for GPIB instruments.
The TCPIP keyword is used for TCP/IP communication.
The ASRL keyword is used for serial instruments.
The PXI keyword is used for PXI instruments.
The VXI keyword is used for VXI instruments via either embedded
or MXIbus controllers.
The GPIB-VXI keyword is used for VXI instruments via a GPIB-VXI
controller.

The default values for optional parameters are shown below.

Optional Segment Default Value
---------------------------------------
board 0
secondary address none
LAN device name inst0

Example Resource Strings:
--------------------------------------------------------------
GPIB::1::0::INSTR A GPIB device at primary address 1 and
secondary address 0 in GPIB interface 0.

GPIB2::INTFC Interface or raw resource for GPIB
interface 2.

TCPIP0::1.2.3.4::999::SOCKET Raw TCP/IP access to port 999
at the specified IP address.

ASRL1::INSTR A serial device attached to interface
ASRL1. VXI::MEMACC Board-level register
access to the VXI interface.

PXI::15::INSTR PXI device number 15 on bus 0.

VXI0::1::INSTR A VXI device at logical address 1 in VXI
interface VXI0.

GPIB-VXI::9::INSTR A VXI device at logical address 9 in a
GPIB-VXI controlled system.

Related

_viFindGpib, _viOpen, _viClose, _viSetTimeout, _viGTL, _viGpibBusReset, _viSetAttribute

Example

;- This assumes that you have instrument set to GPIB address 3
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query using a VISA Descriptor")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 2","Go to LOCAL using VISA Descriptor")
_viGTL("GPIB::1::0") ; Go to local (exit remote control mode)

MsgBox(0,"Step 3","Simple GPIB query using a VISA address shortcut")
$s_answer = _viExecCommand("1","*IDN?") ; The address MUST BE A STRING
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
MsgBox(0,"Info","Now let's use _viOpen and _viClose")

MsgBox(0,"Step 4","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 5","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 6","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 7","Go to LOCAL using VISA instrument handle")
_viGTL($h_instr); Go to local (this is optional)

MsgBox(0,"Step 8","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viFindGpib

Function Reference

_viFindGpib

Send a Command/Query to an Instrument/Device through the VISA interface (GPIB / TCP)

#include <Visa.au3>
_viFindGpib ( ByRef $a_descriptor_list, ByRef $a_idn_list [, $f_show_search_results = 0] )

Parameters

$a_descriptor_list (ByRef) | RETURNS an array of the VISA resource descriptors of the instruments that were found in the GPIB bus (see the Remarks of the _viExecCommand for more info)
$a_idn_list (ByRef) | RETURNS an array of the IDNs (i.e names) of the instruments that were found in the GPIB bus
$f_show_search_results | [optional] If 1 a message box showing the results of the search will be shown. The default is 0, which means that the results are not shown

Return Value

Success: | The number of instruments found (0 or more)
Failure: | Returns a NEGATIVE value and SETS @error to 1

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viExecCommand, _viOpen, _viClose, _viGTL, _viGpibBusReset

Example

; This example performs a search on the GPIB bus and shows the results in a MsgBox

#include <Visa.au3>

Dim $a_descriptor_list[1], $a_idn_list[1]
_viFindGpib($a_descriptor_list, $a_idn_list, 1)


Function _viGpibBusReset

Function Reference

_viGpibBusReset

GPIB BUS "reset": Use this function when the GPIB BUS gets stuck for some reason. You might be lucky and resolve the problem by calling this function

#include <Visa.au3>
_viGpibBusReset ( )

Parameters

None

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide)
This function always sets @error to 1 in case of error

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

Related

_viGTL, _viExecCommand, _viFindGpib, _viOpen, _viClose

Example

; This example tries to "reset" the GPIB bus after a BUS "lock". This is rare,
; but it might happen if one of the instruments connected to the BUS has crashed

#include <Visa.au3>

_viGpibBusReset()


Function _viGTL

Function Reference

_viGTL

Go To Local mode: Instruments that accept this command will exit the "Remote Control mode" and go to "Local mode". If the instrument is already in "Local mode" this is simply ignored. Normally, if an instrument does not support this command it will simply stay in the "Remote Control mode"

#include <Visa.au3>
_viGTL ( $h_session )

Parameters

$h_session A VISA descriptor (STRING) OR a VISA session handle (INTEGER).
See the Remarks of the _viExecCommand for more info.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viExecCommand, _viGpibBusReset, _viFindGpib, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viGTL function with a VISA descriptor and with a
; VISA device handler. We use _viExecCommand first to force the instrument to go
; into "Remote mode"

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query using a VISA Descriptor")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10)
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 2","Go to LOCAL using VISA Descriptor")
_viGTL("GPIB::1::0") ; Go to local (exit remote control mode)

MsgBox(0,"Step 4","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 5","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 6","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 7","Go to LOCAL using VISA instrument handle")
_viGTL($h_instr); Go to local (this is optional)

MsgBox(0,"Step 8","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viInteractiveControl

Function Reference

_viInteractiveControl

Interactive VISA control to test your SCPI commands.

#include <Visa.au3>
_viInteractiveControl ([$s_command_save_filename = ""])

Parameters

$s_command_save_filename [optional] The name of the file in which the SCPI commands issued
during the interactive session will be saved.
If no filename is passed the funcion asks the user if and
where does the user want to save the issued commands.

Return Value

The list of AutoIt3 VISA commands that were executed by the tool.
This is the same list that is saved into the file if the a filename is passed to the function.

Remarks

Type "FIND" in the Device Descriptor query to perform a GPIB search.

This function lets you easily test your SCPI commands interactively.
It also lets you save these commands into a file
Simply answer the questions (Device Descriptor, SCPI command and timeout).
* If you click Cancel on the 1st question the interactive control ends.
* If you click Cancel to the other queries, you will go back to the Device Descriptor question.

Related


Function _viOpen

Function Reference

_viOpen

Opens a VISA connection to an Instrument/Device

#include <Visa.au3>
_viOpen ( $s_visa_address [, $s_visa_secondary_address = 0] )

Parameters

$s_visa_address | A VISA resource descriptor STRING (see the NOTES of _viExecCommand above for more info) As as shortcut you can also directly pass a GPIB address as an integer
$s_visa_secondary_address | [optional] The "secondary GPIB address". Only used if the primary address is passed as an integer. Only some GPIB instruments have secondary addresses. In those cases this optional parameter can be used to specify it. This parameter is ZERO by default, which means NO SECONDARY ADDRESS

Return Value

Success: | Returns a (POSITIVE) VISA Instrument Handle
Failure: | Returns -1 and SETS @error to 1

Remarks

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viClose, _viExecCommand, _viFindGpib, _viGpibBusReset, _viGTL, _viSetAttribute, _viSetTimeout

Example

;- This assumes that you have instrument set to GPIB address 1
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function
#include <Visa.au3>
Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen("GPIB::3::0")
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 3","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection

MsgBox(0,"Step 5","Open the Instrument connection using only the address number")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; Show the Session Handle
; Query the instrument

MsgBox(0,"Step 6","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again

MsgBox(0,"Step 7","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 8","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viSetAttribute

Function Reference

_viSetAttribute

Set any VISA attribute This function, which is called by _viSetTimeout, can ALSO be used to set the other VISA specific attributes. Read the VISA documentation for more information and a list of VISA attributes and their corresponding values.

#include <Visa.au3>
_viSetAttribute ( $h_session, $i_attribute, $i_value )

Parameters

$h_session | A VISA descriptor (STRING) OR a VISA session handle (INTEGER). See the Remarks of the _viExecCommand for more info.
$i_attribute | The index of the attribute that must be changed. Attributes are defined in the VISA library. This AutoIt library only defines a CONSTANT for the TIMEOUT attribute ($VI_ATTR_TMO_VALUE) and for the Serial Interface attributes and values (see the remarks) but you can pass any other valid index (as an integer) if you want to.
$i_value | The value of the attribute. It must be an integer and the possible values depend on the attribute type and are defined in the VISA documentation.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

This is a list of the currently pre-defined attributes and values. Remember that you can use any other valid attribute/value by passing the corresponding integer index (as defined in the VISA programmer's guide) to this function.

* Attribute: $VI_ATTR_TMO_VALUE -> Set Timeout
* Values:
A timeout in MILLISECONDS or
$VI_TMO_IMMEDIATE (or 0) for "Return immediatly"
VI_TMO_INFINITE (or "INF") for "No timeout"

* Attribute: $VI_ATTR_ASRL_BAUD
* Values:
Any valid baudrate (9600, 115200, etc)

* Attribute: $VI_ATTR_ASRL_DATA_BITS
* Values:
From 5 to 8

* Attribute: $VI_ATTR_ASRL_PARITY
* Values:
$VI_ASRL_PAR_NONE
$VI_ASRL_PAR_ODD
$VI_ASRL_PAR_EVEN
$VI_ASRL_PAR_MARK
$VI_ASRL_PAR_SPACE

* Attribute: $VI_ATTR_ASRL_STOP_BITS
* Values:
$VI_ASRL_STOP_ONE
$VI_ASRL_STOP_ONE5
$VI_ASRL_STOP_TWO

* Attribute: $VI_ATTR_ASRL_FLOW_CNTRL
* Values:
$VI_ASRL_FLOW_NONE
$VI_ASRL_FLOW_XON_XOFF
$VI_ASRL_FLOW_RTS_CTS
$VI_ASRL_FLOW_DTR_DSR

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32).
You onlly need a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) if you use the GPIB related functions.

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viSetTimeout, _viExecCommand, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3.
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viSetAttribute. In this example we use _viSetAttribute
; instead of _viSetTimeout to set the GPIB timeout of a _viExecCommand operation.

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query with explicit TIMEOUT set")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

; This is the same as using the _viSetAttribute function first:
MsgBox(0,"Step 2","_vOpen + timeout using _viSetAttribute + GPIB query")
Dim $h_instr = _viOpen(3)
; NOTE - This is the same as: _viSetTimeout($h_instr, 10000)
_viSetAttribute($h_instr, $VI_ATTR_TMO_VALUE, 10000) ; 10000 ms = 10 secs

$s_answer = _viExecCommand($h_instr,"*IDN?") ; No need to set the timeout now
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 3","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


Function _viSetTimeout

Function Reference

_viSetTimeout

Sets the VISA timeout in MILISECONDS

#include <Visa.au3>
_viSetTimeout ( $h_session, $i_timeout_ms )

Parameters

$h_session | A VISA descriptor (STRING) OR a VISA session handle (INTEGER). See the Remarks of the _viExecCommand for more info.
$i_timeout_ms | The timeout IN MILISECONDS for VISA operations (mainly for GPIB queries) If you set it to 0 the tiemouts are DISABLED. If you set it to "INF" the VISA operations will NEVER timeout. Be careful with this as it could easly hung your program ifv your instrument does not respond to one of your queries. Depending on the bus type (GPIB, TCP, etc) the timeout might not be set to the exact value that you request. Instead the closest valid timeout bigger than the one that you requested will be used.

Return Value

Success: | Returns 0
Failure: | Returns -1 if the VISA DLL could not be open or a NON ZERO value representing the VISA error code (see the VISA programmer's guide).
This function always sets @error to 1 in case of error.

Remarks

Most of the time it is not necessary to call this function, as _viExecCommand has a third OPTIONAL parameter $i_timeout_ms which can also be used to set the VISA timeout.

As for all the VISA functions the VISA libraries must be installed (you can check whether visa32.dll is in {WINDOWS}\system32) and a GPIB card (such as a National Instruments NI PCI-GPIB card or an Agilent 82350B PCI High-Performance GPIB card) must be installed

* For a detailed description of the most common VISA DESCRIPTORS look at the Remarks of the help on the _viExecCommand function

Related

_viSetAttribute, _viExecCommand, _viOpen, _viClose

Example

;- This assumes that you have instrument set to GPIB address 3.
; If you have an instrument in a different address change "GPIB::3::0" to the
; corresponding descriptor. Do the same for the call to _viOpen
; It shows how to use the _viExecCommand function with a timeout or how to
; call _viSetTimeout instead.

#include <Visa.au3>

Dim $h_session = 0

; Query the ID of the instrument in GPIB address 3
MsgBox(0,"Step 1","Simple GPIB query with explicit TIMEOUT set")
Dim $s_answer = _viExecCommand("GPIB::3::0","*IDN?",10000) ; 10 secs timeout
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

; This is the same as using the _viSetTimeout function first:
MsgBox(0,"Step 2","_vOpen + timeout using _viSetTimeout + GPIB query")
Dim $h_instr = _viOpen(3)
_viSetTimeout($h_instr, 10000) ; 10000 ms = 10 secs
$s_answer = _viExecCommand($h_instr,"*IDN?") ; No need to set the timeout now
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer

MsgBox(0,"Step 3","Close the Instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection


User Defined Functions

WinAPI user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <WinAPI.au3>.

User Defined Function | Description
_WinAPI_AttachConsole | Attaches the calling process to the console of the specified process
_WinAPI_AttachThreadInput | Attaches the input processing mechanism of one thread to that of another thread
_WinAPI_Beep | Generates simple tones on the speaker
_WinAPI_BitBlt | Performs a bit-block transfer of color data
_WinAPI_CallNextHookEx | Passes the hook information to the next hook procedure in the current hook chain
_WinAPI_CallWindowProc | Passes the hook information to the next hook procedure in the current hook chain
_WinAPI_ClientToScreen | Converts the client coordinates of a specified point to screen coordinates
_WinAPI_CloseHandle | Closes an open object handle
_WinAPI_CombineRgn | Combines two regions and stores the result in a third region
_WinAPI_CommDlgExtendedError | Returns a common dialog box error string. This string indicates the most recent error to occur during the execution of one of the common dialog box functions.
_WinAPI_CopyIcon | Copies the specified icon from another module
_WinAPI_CreateBitmap | Creates a bitmap with the specified width, height, and color format
_WinAPI_CreateCompatibleBitmap | Creates a bitmap compatible with the specified device context
_WinAPI_CreateCompatibleDC | Creates a memory device context compatible with the specified device
_WinAPI_CreateEvent | Creates or opens a named or unnamed event object
_WinAPI_CreateFile | Creates or opens a file or other device
_WinAPI_CreateFont | Creates a logical font with the specified characteristics
_WinAPI_CreateFontIndirect | Creates a logical font that has specific characteristics
_WinAPI_CreatePen | Creates a logical pen that has the specified style, width, and color.
_WinAPI_CreateProcess | Creates a new process and its primary thread
_WinAPI_CreateRectRgn | Creates a rectangular region
_WinAPI_CreateRoundRectRgn | Creates a rectangular region with rounded corners
_WinAPI_CreateSolidBitmap | Creates a solid color bitmap
_WinAPI_CreateSolidBrush | Creates a logical brush that has the specified solid color
_WinAPI_CreateWindowEx | Creates an overlapped, pop-up, or child window
_WinAPI_DefWindowProc | Call the default window procedure to provide default processing
_WinAPI_DeleteDC | Deletes the specified device context
_WinAPI_DeleteObject | Deletes a logical pen, brush, font, bitmap, region, or palette
_WinAPI_DestroyIcon | Destroys an icon and frees any memory the icon occupied
_WinAPI_DestroyWindow | Destroys the specified window
_WinAPI_DrawEdge | Draws one or more edges of rectangle
_WinAPI_DrawFrameControl | Draws a frame control of the specified type and style
_WinAPI_DrawIcon | Draws an icon or cursor into the specified device context
_WinAPI_DrawIconEx | Draws an icon or cursor into the specified device context
_WinAPI_DrawLine | Draws a line
_WinAPI_DrawText | Draws formatted text in the specified rectangle
_WinAPI_EnableWindow | Enables or disables mouse and keyboard input to the specified window or control
_WinAPI_EnumDisplayDevices | Obtains information about the display devices in a system
_WinAPI_EnumWindows | Enumerates all windows
_WinAPI_EnumWindowsPopup | Enumerates popup windows
_WinAPI_EnumWindowsTop | Enumerates all top level windows
_WinAPI_ExpandEnvironmentStrings | Expands environment variable strings and replaces them with their defined values
_WinAPI_ExtractIconEx | Creates an array of handles to large or small icons extracted from a file
_WinAPI_FatalAppExit | Displays a message box and terminates the application
_WinAPI_FillRect | Fills a rectangle by using the specified brush
_WinAPI_FindExecutable | Retrieves the name of the executable file associated with the specified file name
_WinAPI_FindWindow | Retrieves the handle to the top-level window whose class name and window name match
_WinAPI_FlashWindow | Flashes the specified window one time
_WinAPI_FlashWindowEx | Flashes the specified window
_WinAPI_FloatToInt | Returns a 4 byte float as an integer value
_WinAPI_FlushFileBuffers | Flushes the buffers of a specified file and causes all buffered data to be written
_WinAPI_FormatMessage | Formats a message string
_WinAPI_FrameRect | Draws a border around the specified rectangle by using the specified brush
_WinAPI_FreeLibrary | Decrements the reference count of the loaded dynamic-link library (DLL) module
_WinAPI_GetAncestor | Retrieves the handle to the ancestor of the specified window
_WinAPI_GetAsyncKeyState | Determines whether a key is up or down at the time the function is called
_WinAPI_GetBkMode | Returns the current background mix mode for a specified device context
_WinAPI_GetClassName | Retrieves the name of the class to which the specified window belongs
_WinAPI_GetClientHeight | Retrieves the height of a window's client area
_WinAPI_GetClientRect | Retrieves the coordinates of a window's client area
_WinAPI_GetClientWidth | Retrieves the width of a window's client area
_WinAPI_GetCurrentProcess | Returns the process handle of the calling process
_WinAPI_GetCurrentProcessID | Returns the process identifier of the calling process
_WinAPI_GetCurrentThread | Retrieves a pseudo handle for the calling thread.
_WinAPI_GetCurrentThreadId | Returns the thread identifier of the calling thread
_WinAPI_GetCursorInfo | Retrieves information about the global cursor
_WinAPI_GetDC | Retrieves a handle of a display device context for the client area a window
_WinAPI_GetDesktopWindow | Returns the handle of the Windows desktop window
_WinAPI_GetDeviceCaps | Retrieves device specific information about a specified device
_WinAPI_GetDIBits | Retrieves the bits of the specified bitmap and copies them into a buffer as a DIB
_WinAPI_GetDlgCtrlID | Returns the identifier of the specified control
_WinAPI_GetDlgItem | Retrieves the handle of a control in the specified dialog box
_WinAPI_GetFileSizeEx | Retrieves the size of the specified file
_WinAPI_GetFocus | Retrieves the handle of the window that has the keyboard focus
_WinAPI_GetForegroundWindow | Returns the handle of the foreground window
_WinAPI_GetGuiResources | Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process
_WinAPI_GetIconInfo | Retrieves information about the specified icon or cursor
_WinAPI_GetLastError | Returns the calling thread's lasterror code value
_WinAPI_GetLastErrorMessage | Returns the calling threads last error message
_WinAPI_GetLayeredWindowAttributes | Gets Layered Window Attributes
_WinAPI_GetModuleHandle | Returns a module handle for the specified module
_WinAPI_GetMousePos | Returns the current mouse position
_WinAPI_GetMousePosX | Returns the current mouse X position
_WinAPI_GetMousePosY | Returns the current mouse Y position
_WinAPI_GetObject | Retrieves information for the specified graphics object
_WinAPI_GetOpenFileName | Creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open
_WinAPI_GetOverlappedResult | Retrieves the results of an overlapped operation
_WinAPI_GetParent | Retrieves the handle of the specified child window's parent window
_WinAPI_GetProcessAffinityMask | Obtains a affinity masks for the process and the system
_WinAPI_GetSaveFileName | Creates a Save dialog box that lets the user specify the drive, directory, and name of a file to save
_WinAPI_GetStdHandle | Retrieves a handle for the standard input, standard output, or standard error device
_WinAPI_GetStockObject | Retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes
_WinAPI_GetSysColor | Retrieves the current color of the specified display element
_WinAPI_GetSysColorBrush | retrieves a handle identifying a logical brush that corresponds to the specified color index
_WinAPI_GetSystemMetrics | Retrieves the specified system metric or system configuration setting
_WinAPI_GetTextExtentPoint32 | Computes the width and height of the specified string of text
_WinAPI_GetWindow | Retrieves the handle of a window that has a specified relationship to the specified window
_WinAPI_GetWindowDC | Retrieves the device context (DC) for the entire window
_WinAPI_GetWindowHeight | Returns the height of the window
_WinAPI_GetWindowLong | Retrieves information about the specified window
_WinAPI_GetWindowPlacement | Retrieves the placement of the window for Min, Max, and normal positions
_WinAPI_GetWindowRect | Retrieves the dimensions of the bounding rectangle of the specified window
_WinAPI_GetWindowRgn | Obtains a copy of the window region of a window
_WinAPI_GetWindowText | Retrieves the text of the specified window's title bar
_WinAPI_GetWindowThreadProcessId | Retrieves the identifier of the thread that created the specified window
_WinAPI_GetWindowWidth | Returns the width of the window
_WinAPI_GetXYFromPoint | Returns the X/Y values from a $tagPOINT structure
_WinAPI_GlobalMemoryStatus | Retrieves information about current available memory
_WinAPI_GUIDFromString | Converts a string GUID to binary form
_WinAPI_GUIDFromStringEx | Converts a string GUID to binary form
_WinAPI_HiWord | Returns the high word of a longword value
_WinAPI_InProcess | Determines whether a window belongs to the current process
_WinAPI_IntToFloat | Returns a 4 byte integer as a float value
_WinAPI_InvalidateRect | Adds a rectangle to the specified window's update region
_WinAPI_IsClassName | Wrapper to check ClassName of the control.
_WinAPI_IsWindow | Determines whether the specified window handle identifies an existing window
_WinAPI_IsWindowVisible | Retrieves the visibility state of the specified window
_WinAPI_LineTo | Draws a line from the current position up to, but not including, the specified point.
_WinAPI_LoadBitmap | Loads the specified bitmap resource from a module's executable file
_WinAPI_LoadImage | Loads an icon, cursor, or bitmap
_WinAPI_LoadLibrary | Maps a specified executable module into the address space of the calling process
_WinAPI_LoadLibraryEx | Maps a specified executable module into the address space of the calling process
_WinAPI_LoadShell32Icon | Extracts an icon from the Shell32.dll file
_WinAPI_LoadString | loads a string resource from the executable file associated with a specified module
_WinAPI_LocalFree | Frees the specified local memory object and invalidates its handle
_WinAPI_LoWord | Returns the low word of a longword
_WinAPI_MAKELANGID | Construct language id from a primary language id and a sublanguage id
_WinAPI_MAKELCID | Construct locale id from a language id and a sort id
_WinAPI_MakeLong | Returns a longint value from two int values
_WinAPI_MakeQWord | Returns a QWORD value from two int values
_WinAPI_MessageBeep | Plays a waveform sound
_WinAPI_Mouse_Event | Synthesizes mouse motion and button clicks
_WinAPI_MoveTo | Updates the current position to the specified point
_WinAPI_MoveWindow | Changes the position and dimensions of the specified window
_WinAPI_MsgBox | Displays a message box with wider margin than original
_WinAPI_MulDiv | Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value
_WinAPI_MultiByteToWideChar | Maps a character string to a wide-character (Unicode) string
_WinAPI_MultiByteToWideCharEx | Maps a character string to a wide-character (Unicode) string
_WinAPI_OpenProcess | Returns a handle of an existing process object
_WinAPI_PathFindOnPath | Searchs for a file in the default system paths
_WinAPI_PointFromRect | Returns the top/left coordinates of a $tagRECT as a $tagPOINT structure
_WinAPI_PostMessage | Places a message in the message queue and then returns
_WinAPI_PrimaryLangId | Extract primary language id from a language id
_WinAPI_PtInRect | Determines whether the specified point lies within the specified rectangle
_WinAPI_ReadFile | Reads data from a file
_WinAPI_ReadProcessMemory | Reads memory in a specified process
_WinAPI_RectIsEmpty | Determins whether a rectangle is empty
_WinAPI_RedrawWindow | Updates the specified rectangle or region in a window's client area
_WinAPI_RegisterWindowMessage | Defines a new window message that is guaranteed to be unique throughout the system
_WinAPI_ReleaseCapture | Releases the mouse capture from a window in the current thread and restores normal mouse input processing
_WinAPI_ReleaseDC | Releases a device context
_WinAPI_ScreenToClient | Converts screen coordinates of a specified point on the screen to client coordinates
_WinAPI_SelectObject | Selects an object into the specified device context
_WinAPI_SetBkColor | Sets the current background color to the specified color value
_WinAPI_SetBkMode | Sets the background mix mode of the specified device context
_WinAPI_SetCapture | Sets the mouse capture to the specified window belonging to the current thread
_WinAPI_SetCursor | Establishes the cursor shape
_WinAPI_SetDefaultPrinter | Sets the default printer for the current user on the local computer
_WinAPI_SetDIBits | Sets the pixels in a compatible bitmap using the color data found in a DIB
_WinAPI_SetEndOfFile | Sets the physical file size for the specified file to the current position of the file pointer.
_WinAPI_SetEvent | Sets the specified event object to the signaled state
_WinAPI_SetFilePointer | Moves the file pointer of the specified file
_WinAPI_SetFocus | Sets the keyboard focus to the specified window
_WinAPI_SetFont | Sets a window font
_WinAPI_SetHandleInformation | Sets certain properties of an object handle
_WinAPI_SetLastError | Sets the last-error code for the calling thread
_WinAPI_SetLayeredWindowAttributes | Sets Layered Window Attributes
_WinAPI_SetParent | Changes the parent window of the specified child window
_WinAPI_SetProcessAffinityMask | Sets a processor affinity mask for the threads of a specified process
_WinAPI_SetSysColors | Obtains information about the display devices in a system
_WinAPI_SetTextColor | Sets the current text color to the specified color value
_WinAPI_SetWindowLong | Sets information about the specified window
_WinAPI_SetWindowPlacement | Sets the placement of the window for Min, Max, and normal positions
_WinAPI_SetWindowPos | Changes the size, position, and Z order of a child, pop-up, or top-level window
_WinAPI_SetWindowRgn | Sets the window region of a window
_WinAPI_SetWindowsHookEx | Installs an application-defined hook procedure into a hook chain
_WinAPI_SetWindowText | Changes the text of the specified window's title bar
_WinAPI_ShowCursor | Displays or hides the cursor
_WinAPI_ShowError | Displays an error message box with an optional exit
_WinAPI_ShowMsg | Displays an "Information" message box
_WinAPI_ShowWindow | Sets the specified window's show state
_WinAPI_StringFromGUID | Converts a binary GUID to string form
_WinAPI_SubLangId | Extract sublanguage id from a language id
_WinAPI_SystemParametersInfo | Retrieves or sets the value of one of the system-wide parameters
_WinAPI_TwipsPerPixelX | Returns the width of a pixel, in twips.
_WinAPI_TwipsPerPixelY | Returns the height of a pixel, in twips.
_WinAPI_UnhookWindowsHookEx | Removes a hook procedure installed in a hook chain by the _WinAPI_SetWindowsHookEx function
_WinAPI_UpdateLayeredWindow | Updates the position, size, shape, content, and translucency of a layered window
_WinAPI_UpdateWindow | Updates the client area of a window by sending a WM_PAINT message to the window
_WinAPI_WaitForInputIdle | Waits until a process is waiting for user input with no input pending, or a time out
_WinAPI_WaitForMultipleObjects | Waits until one or all of the specified objects are in the signaled state
_WinAPI_WaitForSingleObject | Waits until the specified object is in the signaled state
_WinAPI_WideCharToMultiByte | Converts a Unicode string to a multibyte string
_WinAPI_WindowFromPoint | Retrieves the handle of the window that contains the specified point
_WinAPI_WriteConsole | Writes a character string to a console screen buffer
_WinAPI_WriteFile | Writes data to a file at the position specified by the file pointer
_WinAPI_WriteProcessMemory | Writes memory in a specified process


Function _WinAPI_AttachConsole

Function Reference

_WinAPI_AttachConsole

Attaches the calling process to the console of the specified process

#Include <WinAPI.au3>
_WinAPI_AttachConsole([$iProcessID = -1])

Parameters

$iProcessID [optional] Identifier of the process. Set to -1 to attach to the current process.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search AttachConsole in MSDN Library


Function _WinAPI_AttachThreadInput

Function Reference

_WinAPI_AttachThreadInput

Attaches the input processing mechanism of one thread to that of another thread

#Include <WinAPI.au3>
_WinAPI_AttachThreadInput($iAttach, $iAttachTo, $fAttach)

Parameters

$iAttach | Identifier of the thread to be attached to another thread
$iAttachTo | Identifier of the thread to be attached to
$fAttach | Attachment mode: True - The threads are attached False - The threads are detached

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search AttachThreadInput in MSDN Library


Function _WinAPI_Beep

Function Reference

_WinAPI_Beep

Generates simple tones on the speaker

#Include <WinAPI.au3>
_WinAPI_Beep($iFreq = 500, $iDuration = 1000)

Parameters

$iFreq | The frequency of the sound, in hertz. This parameter must be in the range 37 through 32,767. Windows Me/98/95: This parameter is ignored.
$iDuration | The duration of the sound, in milliseconds. Windows Me/98/95: This parameter is ignored.

Return Value

Success: | True
Failure: | False

Remarks

Muting and volume control have no effect on Beep. You will still hear the tone.

Related

See Also

Search Beep in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $iFreqStart = 100
Local $iFreqEnd = 250

MsgBox(0, "_WinAPI_Beep Example", "Ascending")

For $iFreq = $iFreqStart To $iFreqEnd
_WinAPI_Beep($iFreq, 100)
ToolTip("Frequency = " & $iFreq)
Next

MsgBox(0, "_WinAPI_Beep Example", "Descending")

For $iFreq = $iFreqEnd To $iFreqStart Step -1
_WinAPI_Beep($iFreq, 100)
ToolTip("Frequency = " & $iFreq)
Next
EndFunc ;==>_Main


Function _WinAPI_BitBlt

Function Reference

_WinAPI_BitBlt

Performs a bit-block transfer of color data

#Include <WinAPI.au3>
_WinAPI_BitBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iROP)

Parameters

$hDestDC | Handle to the destination device context
$iXDest | X value of the upper-left corner of the destination rectangle
$iYDest | Y value of the upper-left corner of the destination rectangle
$iWidth | Width of the source and destination rectangles
$iHeight | Height of the source and destination rectangles
$hSrcDC | Handle to the source device context
$iXSrc | X value of the upper-left corner of the source rectangle
$iYSrc | Y value of the upper-left corner of the source rectangle
$iROP Specifies a raster operation code. These codes define how the color data for the source
rectangle is to be combined with the color data for the destination rectangle to achieve the final color:
$BLACKNESS - Fills the destination rectangle using the color associated with palette index 0
$CAPTUREBLT - Includes any window that are layered on top of your window in the resulting image
$DSTINVERT - Inverts the destination rectangle
$MERGECOPY - Merges the color of the source rectangle with the brush currently selected in hDest, by
using the AND operator.
$MERGEPAINT - Merges the color of the inverted source rectangle with the colors of the destination
rectangle by using the OR operator.
$NOMIRRORBITMAP - Prevents the bitmap from being mirrored
$NOTSRCCOPY - Copies the inverted source rectangle to the destination
$NOTSRCERASE - Combines the colors of the source and destination rectangles by using the OR operator and
then inverts the resultant color.
$PATCOPY - Copies the brush selected in hdcDest, into the destination bitmap
$PATINVERT - Combines the colors of the brush currently selected in hDest, with the colors of the
destination rectangle by using the XOR operator.
$PATPAINT - Combines the colors of the brush currently selected in hDest, with the colors of the
inverted source rectangle by using the OR operator. The result of this operation is combined with the color
of the destination rectangle by using the OR operator.
$SRCAND - Combines the colors of the source and destination rectangles by using the AND operator
$SRCCOPY - Copies the source rectangle directly to the destination rectangle
$SRCERASE - Combines the inverted color of the destination rectangle with the colors of the source
rectangle by using the AND operator.
$SRCINVERT - Combines the colors of the source and destination rectangles by using the XOR operator
$SRCPAINT - Combines the colors of the source and destination rectangles by using the OR operator
$WHITENESS - Fills the destination rectangle using the color associated with index 1 in the physical
palette.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search BitBlt in MSDN Library


Function _WinAPI_CallNextHookEx

Function Reference

_WinAPI_CallNextHookEx

Passes the hook information to the next hook procedure in the current hook chain

#Include <WinAPI.au3>
_WinAPI_CallNextHookEx($hhk, $iCode, $wParam, $lParam)

Parameters

$hhk | Windows 95/98/ME: Handle to the current hook. An application receives this handle as a result of a previous call to the _WinAPI_SetWindowsHookEx function. Windows NT/XP/2003: Ignored
$iCode | Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information
$wParam | Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain
$lParam | Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain

Return Value

Success: | This value is returned by the next hook procedure in the chain
Failure: | -1 and @error is set

Remarks

None.

Related

_WinAPI_SetWindowsHookEx, $tagKBDLLHOOKSTRUCT

See Also

Search CallNextHookEx in MSDN Library


Function _WinAPI_CallWindowProc

Function Reference

_WinAPI_CallWindowProc

Passes the hook information to the next hook procedure in the current hook chain

#Include <WinAPI.au3>
_WinAPI_CallWindowProc($lpPrevWndFunc, $hWnd, $Msg, $wParam, $lParam)

Parameters

$lpPrevWndFunc | Pointer to the previous window procedure. If this value is obtained by calling the _WinAPI_GetWindowLong function with the $iIndex parameter set to $GWL_WNDPROC or $DWL_DLGPROC, it is actually either the address of a window or dialog box procedure, or a special internal value meaningful only to _WinAPI_CallWindowProc.
$hWnd | Handle to the window procedure to receive the message
$Msg | Specifies the message
$wParam | Specifies additional message-specific information. The contents of this parameter depend on the value of the Msg parameter
$lParam | Specifies additional message-specific information. The contents of this parameter depend on the value of the Msg parameter

Return Value

Returns the return value specifies the result of the message processing and depends on the message sent

Remarks

Use the _WinAPI_CallWindowProc function for window subclassing. Usually, all windows with the same class share one window procedure.
A subclass is a window or set of windows with the same class whose messages are intercepted and processed by another window procedure
or procedures) before being passed to the window procedure of the class.

he _WinAPI_SetWindowLong function creates the subclass by changing the window procedure associated with a particular window, causing
he system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the
ew window procedure to the previous window procedure by calling _WinAPI_CallWindowProc. This allows the application to create a chain
f window procedures

Related

DllCallbackRegister, _WinAPI_SetWindowLong

See Also

Search CallWindowProc in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $ContextMenu, $CommonMenuItem, $FileMenuItem, $ExitMenuItem
Global $hGui, $cInput, $wProcOld

_Main()

Func _Main()
Local $cInput2, $wProcNew, $DummyMenu

$hGui = GUICreate("Type or paste some stuff", 400, 200, -1, -1, $WS_THICKFRAME, -1)
$cInput = GUICtrlCreateInput("", 20, 20, 360, 20)
$cInput2 = GUICtrlCreateInput("", 20, 50, 360, 20)

GUICtrlCreateLabel("abcd", 1, 1, 30, 18)
GUICtrlSetCursor(-1, 9)

$wProcNew = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;long;ptr")
$wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($cInput), $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))
_WinAPI_SetWindowLong(GUICtrlGetHandle($cInput2), $GWL_WNDPROC, DllCallbackGetPtr($wProcNew))
;_WinAPI_SetWindowLong(GUICtrlGetHandle($cInput3), $GWL_WNDPROC, DllCallbackGetPtr($wProcNew)) and so on

$DummyMenu = GUICtrlCreateDummy()
$ContextMenu = GUICtrlCreateContextMenu($DummyMenu)
$CommonMenuItem = GUICtrlCreateMenuItem("Common", $ContextMenu)
$FileMenuItem = GUICtrlCreateMenuItem("File", $ContextMenu)
GUICtrlCreateMenuItem("", $ContextMenu)
$ExitMenuItem = GUICtrlCreateMenuItem("Exit", $ContextMenu)

GUISetState(@SW_SHOW)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
EndFunc ;==>_Main

Func do_clever_stuff_with_clipboard($hWnd)
Local $sData
$sData = ClipGet()
If @error Then Return 0;clip data is not text or clip empty
;do whatever
$sData = StringUpper($sData)
;set text
GUICtrlSetData(_WinAPI_GetDlgCtrlID($hWnd), $sData);or _GUICtrlEdit_SetText($hWnd, $sData)
Return 1
EndFunc ;==>do_clever_stuff_with_clipboard

; Show a menu in a given GUI window which belongs to a given GUI ctrl
Func ShowMenu($hWnd, $nContextID)
Local $iSelected = _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($nContextID), $hWnd, -1, -1, -1, -1, 2)
Switch $iSelected
Case $CommonMenuItem
ConsoleWrite("Common" & @CRLF)
Case $FileMenuItem
ConsoleWrite("File" & @CRLF)
Case $ExitMenuItem
ConsoleWrite("Exit" & @CRLF)
EndSwitch
EndFunc ;==>ShowMenu

Func _MyWindowProc($hWnd, $uiMsg, $wParam, $lParam)
Switch $uiMsg
Case $WM_PASTE
Return do_clever_stuff_with_clipboard($hWnd)
Case $WM_CONTEXTMENU
If $hWnd = GUICtrlGetHandle($cInput) Then
ShowMenu($hGui, $ContextMenu)
Return 0
EndIf
Case $WM_SETCURSOR
GUICtrlSetCursor(_WinAPI_GetDlgCtrlID($hWnd), 5);;set Ibeam cursor
Return 1;;and don't let default windowproc mess things up
EndSwitch

;pass the unhandled messages to default WindowProc
Return _WinAPI_CallWindowProc($wProcOld, $hWnd, $uiMsg, $wParam, $lParam)
EndFunc ;==>_MyWindowProc


Function _WinAPI_ClientToScreen

Function Reference

_WinAPI_ClientToScreen

Converts the client coordinates of a specified point to screen coordinates

#Include <WinAPI.au3>
_WinAPI_ClientToScreen($hWnd, ByRef $tPoint)

Parameters

$hWnd | Identifies the window that will be used for the conversion
$tPoint | $tagPOINT structure that contains the client coordinates to be converted

Return Value

Success: | $tagPOINT structure
Failure: | set @error

Remarks

The function replaces the client coordinates in the $tagPOINT structure with the screen coordinates. The
screen coordinates are relative to the upper-left corner of the screen.

Related

_WinAPI_ScreenToClient, $tagPOINT

See Also

Search ClientToScreen in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hwnd = GUICreate("Example", 200, 200)
Local $tpoint = DllStructCreate("int X;int Y")
DllStructSetData($tpoint, "X", 100)
DllStructSetData($tpoint, "Y", 160)
GUISetState(@SW_SHOW)
Sleep(1000)
_WinAPI_ClientToScreen($hwnd, $tpoint)
MsgBox(0, "_WINAPI_ClientToScreen Example", "Screen Cordinates of client's x,y position: 100,160 is: " & @LF & _
"X: " & DllStructGetData($tpoint, "X") & @LF & _
"Y: " & DllStructGetData($tpoint, "Y") & @LF)
EndFunc ;==>_Main


Function _WinAPI_CloseHandle

Function Reference

_WinAPI_CloseHandle

Closes an open object handle

#Include <WinAPI.au3>
_WinAPI_CloseHandle($hObject)

Parameters

$hObject Handle of object to close

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search CloseHandle in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @LF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)


Function _WinAPI_CombineRgn

Function Reference

_WinAPI_CombineRgn

Combines two regions and stores the result in a third region

#Include <WinAPI.au3>
_WinAPI_CombineRgn($hRgnDest, $hRgnSrc1, $hRgnSrc2, $iCombineMode)

Parameters

$hRgnDest | Handle to a new region with dimensions defined by combining two other regions. (This region must exist before CombineRgn is called.)
$hRgnSrc1 | Handle to the first of two regions to be combined.
$hRgnSrc2 | Handle to the second of two regions to be combined.
$iCombineMode | Specifies a mode indicating how the two regions will be combined. This parameter can be one of the following values. $RGN_AND - Creates the intersection of the two combined regions. $RGN_COPY - Creates a copy of the region identified by hrgnSrc1. $RGN_DIFF - Combines the parts of hrgnSrc1 that are not part of hrgnSrc2. $RGN_OR - Creates the union of two combined regions. $RGN_XOR - Creates the union of two combined regions except for any overlapping areas.

Return Value

Success: | Specifies the type of the resulting region. It can be one of the following values.
 | $NULLREGION - The region is empty.
 | $SIMPLEREGION - The region is a single rectangle.
 | $COMPLEXREGION - The region is more than a single rectangle.
Failure: | 0 - No region is created.

Remarks

The two regions are combined according to the specified mode.
The three regions need not be distinct. For example, the hrgnSrc1 parameter can equal the hrgnDest parameter.

Related

_WinAPI_CreateRectRgn, _WinAPI_CreateRoundRectRgn, _WinAPI_SetWindowRgn, _WinAPI_GetWindowRgn

See Also

Search CombineRgn in MSDN Library

Example

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

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)

$gui = GUICreate("Test Windows regions", 350, 210)
$btn_default = GUICtrlCreateButton("Default region", 100, 30, 150)
$btn_round = GUICtrlCreateButton("Round region", 100, 60, 150)
$btn_buble = GUICtrlCreateButton("Buble region ", 100, 90, 150)
$btn_transparent = GUICtrlCreateButton("Transparent region", 100, 120, 150)
$btn_exit = GUICtrlCreateButton("Exit", 100, 150, 150)
GUISetState(@SW_SHOW)

$pos = WinGetPos($gui) ; get whole window size (no client size defined in GUICreate)
Global $width = $pos[2]
Global $height = $pos[3]

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop

Case $msg = $btn_default
$rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_round
$rgn = _WinAPI_CreateRoundRectRgn(0, 0, $width, $height, $width / 3, $height / 3)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_buble
$rgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $width / 2, $height / 2, $width / 2, $height / 2) ; left-top
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, 0, $width, $height / 2, $width / 2, $height / 2) ; right-top
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(0, $height / 2, $width / 2, $height, $width / 2, $height / 2) ; left-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, $height / 2, $width, $height, $width / 2, $height / 2) ; right-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(10, 10, $width - 10, $height - 10, $width, $height) ; middle
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
_WinAPI_SetWindowRgn($gui, $rgn1)

Case $msg = $btn_transparent
_GuiHole($gui, 40, 40, 260, 170)

EndSelect
WEnd

; make inner transparent area but add controls
Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
Local $outer_rgn, $inner_rgn, $combined_rgn

$outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
$inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh)
$combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
_WinAPI_DeleteObject($outer_rgn)
_WinAPI_DeleteObject($inner_rgn)
_AddCtrlRegion($combined_rgn, $btn_default)
_AddCtrlRegion($combined_rgn, $btn_round)
_AddCtrlRegion($combined_rgn, $btn_buble)
_AddCtrlRegion($combined_rgn, $btn_transparent)
_AddCtrlRegion($combined_rgn, $btn_exit)
_WinAPI_SetWindowRgn($h_win, $combined_rgn)
EndFunc ;==>_GuiHole

; add control's area to given region
; respecting also window title/frame sizes
Func _AddCtrlRegion($full_rgn, $ctrl_id)
Local $ctrl_pos, $ctrl_rgn

$ctrl_pos = ControlGetPos($gui, "", $ctrl_id)
$ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0] + $frame, $ctrl_pos[1] + $htit + $frame, _
$ctrl_pos[0] + $ctrl_pos[2] + $frame, $ctrl_pos[1] + $ctrl_pos[3] + $htit + $frame)
_WinAPI_CombineRgn($full_rgn, $full_rgn, $ctrl_rgn, $RGN_OR)
_WinAPI_DeleteObject($ctrl_rgn)
EndFunc ;==>_AddCtrlRegion


Function _WinAPI_CommDlgExtendedError

Function Reference

_WinAPI_CommDlgExtendedError

Returns a common dialog box error string. This string indicates the most recent error to occur during the execution of one of the common dialog box functions.

#Include <WinAPI.au3>
_WinAPI_CommDlgExtendedError()

Parameters

None.

Return Value

Success: | error string
Failure: | an hexa string of the extended error

Remarks

Can return general error strings for any of the common dialog box functions.

Related

_WinAPI_GetOpenFileName, _WinAPI_GetSaveFileName

See Also

Search CommDlgExtendedError in MSDN Library


Function _WinAPI_CopyIcon

Function Reference

_WinAPI_CopyIcon

Copies the specified icon from another module

#Include <WinAPI.au3>
_WinAPI_CopyIcon($hIcon)

Parameters

$hIcon Handle to the icon to be copied

Return Value

Success: | The handle to the duplicate icon
Failure: | 0

Remarks

The CopyIcon function enables an application or DLL to get its own handle to an icon owned by another module.
If the other module is freed, the application icon will still be able to use the icon. Before closing, call
the _WinAPI_DestroyIcon function to free any system resources associated with the icon.

Related

_WinAPI_DestroyIcon

See Also

Search CopyIcon in MSDN Library


Function _WinAPI_CreateBitmap

Function Reference

_WinAPI_CreateBitmap

Creates a bitmap with the specified width, height, and color format

#Include <WinAPI.au3>
_WinAPI_CreateBitmap($iWidth, $iHeight [, $iPlanes = 1 [, $iBitsPerPel = 1 [, $pBits = 0]]])

Parameters

$iWidth | Specifies the bitmap width, in pixels
$iHeight | Specifies the bitmap height, in pixels
$iPlanes | [optional] Specifies the number of color planes used by the device
$iBitsPerPel | [optional] Specifies the number of bits required to identify the color of a single pixel
$pBits | [optional] Pointer to an array of color data used to set the colors in a rectangle of pixels. Each scan line in the rectangle must be word aligned (scan lines that are not word aligned must be padded with zeros). If this parameter is 0, the contents of the new bitmap is undefined.

Return Value

Success: | The handle to a bitmap
Failure: | 0

Remarks

None.

Related

See Also

Search CreateBitmap in MSDN Library


Function _WinAPI_CreateCompatibleBitmap

Function Reference

_WinAPI_CreateCompatibleBitmap

Creates a bitmap compatible with the specified device context

#Include <WinAPI.au3>
_WinAPI_CreateCompatibleBitmap($hDC, $iWidth, $iHeight)

Parameters

$hDC | Identifies a device context
$iWidth | Specifies the bitmap width, in pixels
$iHeight | Specifies the bitmap height, in pixels

Return Value

Success: | The handle to the bitmap
Failure: | 0

Remarks

When you no longer need the bitmap, call the _WinAPI_DeleteObject function to delete it

Related

_WinAPI_DeleteObject, _WinAPI_CreateSolidBitmap

See Also

Search CreateCompatibleBitmap in MSDN Library


Function _WinAPI_CreateCompatibleDC

Function Reference

_WinAPI_CreateCompatibleDC

Creates a memory device context compatible with the specified device

#Include <WinAPI.au3>
_WinAPI_CreateCompatibleDC($hDC)

Parameters

$hDC Handle to an existing DC. If this handle is 0, the function creates a memory DC compatible with
the application's current screen.

Return Value

Success: | Handle to a memory DC
Failure: | 0

Remarks

When you no longer need the memory DC, call the _WinAPI_DeleteDC function

Related

_WinAPI_DeleteDC

See Also

Search CreateCompatibleDC in MSDN Library


Function _WinAPI_CreateEvent

Function Reference

_WinAPI_CreateEvent

Creates or opens a named or unnamed event object

#Include <WinAPI.au3>
_WinAPI_CreateEvent([$pAttributes = 0 [, $fManualReset = True [, $fInitialState = True [, $sName = ""]]]])

Parameters

$pAttributes | [optional] Pointer to a $tagSECURITY_ATTRIBUTES structure. If 0, the handle cannot be inherited by child processes. The Descriptor member of the structure specifies a security descriptor for the new event. If pAttributes is 0, the event gets a default security descriptor. The ACLs in the default security descriptor for an event come from the primary or impersonation token of the creator.
$fManualReset | [optional] If True, the function creates a manual-reset event object, which requires the use of the ResetEvent function to set the event state to nonsignaled. If False, the function creates an auto-reset event object and system automatically resets the event state to nonsignaled after a single waiting thread has been released.
$fInitialState | [optional] If True, the initial state of the event object is signaled; otherwise, it is nonsignaled
$sName | [optional] The name of the event object. Name comparison is case sensitive. If sName matches the name of an existing named event object, this function requests the EVENT_ALL_ACCESS access right. In this case the fManualReset and fInitialState parameters are ignored because they have already been set by the creating process. If the pAttributes parameter is not 0, it determines whether the handle can be inherited, but its security-descriptor member is ignored. If Name is blank, the event object is created without a name.

Return Value

Success: | The handle to the event object.
 | If the named event object existed before the function call the function returns a handle to the existing object and GetLastError returns ERROR_ALREADY_EXISTS.
Failure: | 0

Remarks

None.

Related

$tagSECURITY_ATTRIBUTES

See Also

Search CreateEvent in MSDN Library


Function _WinAPI_CreateFile

Function Reference

_WinAPI_CreateFile

Creates or opens a file or other device

#Include <WinAPI.au3>
_WinAPI_CreateFile($sFileName, $iCreation [, $iAccess = 4 [, $iShare = 0 [, $iAttributes = 0 [, $pSecurity = 0]]]])

Parameters

$sFileName | Name of an object to create or open
$iCreation | Action to take on files that exist and do not exist: 0 - Creates a new file. The function fails if the file exists 1 - Creates a new file. If a file exists, it is overwritten 2 - Opens a file. The function fails if the file does not exist 3 - Opens a file. If the file does not exist, the function creates the file 4 - Opens a file and truncates it so that its size is 0 bytes. The function fails if the file does not exist.
$iAccess | [optional] Access to the object: 1 - Execute 2 - Read 4 - Write
$iShare | [optional] Sharing mode of an object: 1 - Delete 2 - Read 4 - Write
$iAttributes | [optional] The file attributes: 1 - File should be archived 2 - File is hidden 4 - File is read only 8 - File is part of or used exclusively by an operating system.
$pSecurity | [optional] Pointer to a $tagSECURITY_ATTRIBUTES structure that determines if the returned handle can be inherited by child processes. If pSecurity is 0, the handle cannot be inherited.

Return Value

Success: | The open handle to a specified file
Failure: | 0

Remarks

None.

Related

$tagSECURITY_ATTRIBUTES, _WinAPI_CloseHandle, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search CreateFile in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)

FileDelete($sfile)


Function _WinAPI_CreateFont

Function Reference

_WinAPI_CreateFont

Creates a logical font with the specified characteristics

#Include <WinAPI.au3>
_WinAPI_CreateFont($nHeight, $nWidth[, $nEscape = 0 [, $nOrientn = 0 [, $fnWeight = $FW_NORMAL [, $bItalic = False[, $bUnderline = False [, $bStrikeout = False [, $nCharset = $DEFAULT_CHARSET [, $nOutputPrec = $OUT_DEFAULT_PRECIS [, $nClipPrec = $CLIP_DEFAULT_PRECIS [, $nQuality = $DEFAULT_QUALITY [, $nPitch = 0 [, $szFace = 'Arial']]]]]]]]]]]])

Parameters

$nHeight | height of font
$nWidth | average character width
$nEscape | [optional] angle of escapement
$nOrientn | [optional] base-line orientation angle
$fnWeight [optional] font weight, The following values are defined for convenience:
$FW_DONTCARE - 0
$FW_THIN - 100
$FW_EXTRALIGHT - 200
$FW_LIGHT - 300
$FW_NORMAL - 400
$FW_MEDIUM - 500
$FW_SEMIBOLD - 600
$FW_BOLD - 700
$FW_EXTRABOLD - 800
$FW_HEAVY - 900
$bItalic | [optional] italic attribute option
$bUnderline | [optional] underline attribute option
$bStrikeout | [optional] strikeout attribute option
$nCharset [optional] Specifies the character set. The following values are predefined:
$ANSI_CHARSET - 0
$BALTIC_CHARSET - 186
$CHINESEBIG5_CHARSET - 136
$DEFAULT_CHARSET - 1
$EASTEUROPE_CHARSET - 238
$GB2312_CHARSET - 134
$GREEK_CHARSET - 161
$HANGEUL_CHARSET - 129
$MAC_CHARSET - 77
$OEM_CHARSET - 255
$RUSSIAN_CHARSET - 204
$SHIFTJIS_CHARSET - 128
$SYMBOL_CHARSET - 2
$TURKISH_CHARSET - 162
$VIETNAMESE_CHARSET - 163
$nOutputPrec [optional] Specifies the output precision, It can be one of the following values:
$OUT_CHARACTER_PRECIS - Not used
$OUT_DEFAULT_PRECIS - Specifies the default font mapper behavior
$OUT_DEVICE_PRECIS - Instructs the font mapper to choose a Device font when the system contains multiple fonts with the same name
$OUT_OUTLINE_PRECIS - Windows NT/2000/XP: This value instructs the font mapper to choose from TrueType and other outline-based fonts
$OUT_PS_ONLY_PRECIS - Windows 2000/XP: Instructs the font mapper to choose from only PostScript fonts.
If there are no PostScript fonts installed in the system, the font mapper returns to default behavior
$OUT_RASTER_PRECIS - Instructs the font mapper to choose a raster font when the system contains multiple fonts with the same name
$OUT_STRING_PRECIS - This value is not used by the font mapper, but it is returned when raster fonts are enumerated
$OUT_STROKE_PRECIS - Windows NT/2000/XP: This value is not used by the font mapper, but it is returned when TrueType,
other outline-based fonts, and vector fonts are enumerated
$OUT_TT_ONLY_PRECIS - Instructs the font mapper to choose from only TrueType fonts. If there are no TrueType fonts installed in the system,
the font mapper returns to default behavior
$OUT_TT_PRECIS - Instructs the font mapper to choose a TrueType font when the system contains multiple fonts with the same name
$nClipPrec [optional] Specifies the clipping precision, It can be one or more of the following values:
$CLIP_CHARACTER_PRECIS - Not used
$CLIP_DEFAULT_PRECIS - Specifies default clipping behavior
$CLIP_EMBEDDED - You must specify this flag to use an embedded read-only font
$CLIP_LH_ANGLES - When this value is used, the rotation for all fonts depends on whether the orientation of the coordinate system is left-handed or right-handed.
If not used, device fonts always rotate counterclockwise, but the rotation of other fonts is dependent on the orientation of the coordinate system.
$CLIP_MASK - Not used
$CLIP_STROKE_PRECIS - Not used by the font mapper, but is returned when raster, vector, or TrueType fonts are enumerated
Windows NT/2000/XP: For compatibility, this value is always returned when enumerating fonts
$CLIP_TT_ALWAYS - Not used
$nQuality [optional] Specifies the output quality, It can be one of the following values:
$ANTIALIASED_QUALITY - Windows NT 4.0 and later: Font is antialiased, or smoothed, if the font supports it and the size of the font is not too small or too large.
Windows 95 with Plus!, Windows 98/Me: The display must greater than 8-bit color, it must be a single plane device, it cannot be a palette display, and it cannot be in a multiple display monitor setup.
In addition, you must select a TrueType font into a screen DC prior to using it in a DIBSection, otherwise antialiasing does not happen
$DEFAULT_QUALITY - Appearance of the font does not matter
$DRAFT_QUALITY - Appearance of the font is less important than when the PROOF_QUALITY value is used.
For GDI raster fonts, scaling is enabled, which means that more font sizes are available, but the quality may be lower.
Bold, italic, underline, and strikeout fonts are synthesized, if necessary
$NONANTIALIASED_QUALITY - Windows 95 with Plus!, Windows 98/Me, Windows NT 4.0 and later: Font is never antialiased, that is, font smoothing is not done
$PROOF_QUALITY - Character quality of the font is more important than exact matching of the logical-font attributes.
For GDI raster fonts, scaling is disabled and the font closest in size is chosen.
Although the chosen font size may not be mapped exactly when PROOF_QUALITY is used, the quality of the font is high and there is no distortion of appearance.
Bold, italic, underline, and strikeout fonts are synthesized, if necessary
$nPitch [optional] Specifies the pitch and family of the font. The two low-order bits specify the pitch of the font and can be one of the following values:
$DEFAULT_PITCH, $FIXED_PITCH, $VARIABLE_PITCH
The four high-order bits specify the font family and can be one of the following values:
$FF_DECORATIVE - Novelty fonts. Old English is an example
$FF_DONTCARE - Use default font
$FF_MODERN - Fonts with constant stroke width, with or without serifs. Pica, Elite, and Courier New are examples
$FF_ROMAN - Fonts with variable stroke width and with serifs. MS Serif is an example
$FF_SCRIPT - Fonts designed to look like handwriting. Script and Cursive are examples
$FF_SWISS - Fonts with variable stroke width and without serifs. MS Sans Serif is an example
$szFace | [optional] typeface name

Return Value

Success: | The handle to a logical font
Failure: | 0

Remarks

When you no longer need the font, call the _WinAPI_DeleteObject function to delete it
Needs FontConstants.au3 for pre-defined constants.

Related

See Also

Search CreateFont in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)
; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_CreateFontIndirect

Function Reference

_WinAPI_CreateFontIndirect

Creates a logical font that has specific characteristics

#Include <WinAPI.au3>
_WinAPI_CreateFontIndirect($tLogFont)

Parameters

$tLogFont $tagLOGFONT structure that defines the characteristics of the logical font

Return Value

Success: | Handle to a logical font
Failure: | 0

Remarks

This function creates a logical font with the characteristics specified in the $tagLOGFONT structure. When this
font is selected by using the SelectObject function, GDI's font mapper attempts to match the logical font with
an existing physical font. If it fails to find an exact match it provides an alternative whose characteristics
match as many of the requested characteristics as possible.

Related

$tagLOGFONT

See Also

Search CreateFontIndirect in MSDN Library


Function _WinAPI_CreatePen

Function Reference

_WinAPI_CreatePen

Creates a logical pen that has the specified style, width, and color.

#Include <WinAPI.au3>
_WinAPI_CreatePen($iPenStyle, $iWidth, $nColor)

Parameters

$iPenStyle | Specifies the pen style. It can be any one of the following values. PS_SOLID - The pen is solid. PS_DASH - The pen is dashed. This style is valid only when the pen width is one or less in device units. PS_DOT - The pen is dotted. This style is valid only when the pen width is one or less in device units. PS_DASHDOT - The pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units. PS_DASHDOTDOT - The pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units. PS_NULL - The pen is invisible. PS_INSIDEFRAME - The pen is solid. When this pen is used in any GDI drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.
$iWidth | Specifies the width of the pen, in logical units.
$nColor | Specifies the color of the pen (BGR)

Return Value

Success: | HPEN Value that identifies a logical pen
Failure: | 0

Remarks

The pen can subsequently be selected into a device context and used to draw lines and curves.
After an application creates a logical pen, it can select that pen into a device context by calling the SelectObject function. After a pen is selected into a device context, it can be used to draw lines and curves.
If the value specified by the nWidth parameter is zero, a line drawn with the created pen always is a single pixel wide regardless of the current transformation.
If the value specified by nWidth is greater than 1, the fnPenStyle parameter must be PS_NULL, PS_SOLID, or PS_INSIDEFRAME.
When you no longer need the pen, call the DeleteObject function to delete it.

Related

_WinAPI_MoveTo, _WinAPI_LineTo, _WinAPI_SelectObject, _WinAPI_DeleteObject, _WinAPI_DrawLine, _WinAPI_GetBkMode, _WinAPI_SetBkMode

See Also

Search CreatePen in MSDN Library

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_CreateProcess

Function Reference

_WinAPI_CreateProcess

Creates a new process and its primary thread

#Include <WinAPI.au3>
_WinAPI_CreateProcess($sAppName, $sCommand, $pSecurity, $pThread, $fInherit, $iFlags, $pEnviron, $sDir, $pStartupInfo, $pProcess)

Parameters

$sAppName | The name of the module to be executed
$sCommand | The command line to be executed
$pSecurity | Pointer to $tagSECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes.
$pThread | Pointer to $tagSECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes.
$fInherit | If True, each inheritable handle in the calling process is inherited by the new process
$iFlags | Flags that control the priority class and creation of the process
$pEnviron | Pointer to the environment block for the new process
$sDir | The full path to the current directory for the process
$pStartupInfo | Pointer to a $tagSTARTUPINFO structure
$pProcess | Pointer to a $tagPROCESS_INFORMATION structure

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagSECURITY_ATTRIBUTES, $tagSTARTUPINFO, $tagPROCESS_INFORMATION

See Also

Search CreateProcess in MSDN Library


Function _WinAPI_CreateRectRgn

Function Reference

_WinAPI_CreateRectRgn

Creates a rectangular region

#Include <WinAPI.au3>
_WinAPI_CreateRectRgn($iLeftRect, $iTopRect, $iRightRect, $iBottomRect)

Parameters

$iLeftRect | X-coordinate of the upper-left corner of the region
$iTopRect | Y-coordinate of the upper-left corner of the region
$iRightRect | X-coordinate of the lower-right corner of the region
$iBottomRect | Y-coordinate of the lower-right corner of the region

Return Value

Success: | Returns the handle to the region
Failure: | 0

Remarks

When you no longer need the HRGN object call the _WinAPI_DeleteObject function to delete it.
Region coordinates are represented as 27-bit signed integers.
The region will be exclusive of the bottom and right edges.

Related

_WinAPI_CreateRoundRectRgn, _WinAPI_SetWindowRgn, _WinAPI_DeleteObject, _WinAPI_CombineRgn, _WinAPI_GetWindowRgn

See Also

Search CreateRectRgn in MSDN Library

Example

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

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)

$gui = GUICreate("Test Windows regions", 350, 210)
$btn_default = GUICtrlCreateButton("Default region", 100, 30, 150)
$btn_round = GUICtrlCreateButton("Round region", 100, 60, 150)
$btn_buble = GUICtrlCreateButton("Buble region ", 100, 90, 150)
$btn_transparent = GUICtrlCreateButton("Transparent region", 100, 120, 150)
$btn_exit = GUICtrlCreateButton("Exit", 100, 150, 150)
GUISetState(@SW_SHOW)

$pos = WinGetPos($gui) ; get whole window size (no client size defined in GUICreate)
Global $width = $pos[2]
Global $height = $pos[3]

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop

Case $msg = $btn_default
$rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_round
$rgn = _WinAPI_CreateRoundRectRgn(0, 0, $width, $height, $width / 3, $height / 3)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_buble
$rgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $width / 2, $height / 2, $width / 2, $height / 2) ; left-top
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, 0, $width, $height / 2, $width / 2, $height / 2) ; right-top
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(0, $height / 2, $width / 2, $height, $width / 2, $height / 2) ; left-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, $height / 2, $width, $height, $width / 2, $height / 2) ; right-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(10, 10, $width - 10, $height - 10, $width, $height) ; middle
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
_WinAPI_SetWindowRgn($gui, $rgn1)

Case $msg = $btn_transparent
_GuiHole($gui, 40, 40, 260, 170)

EndSelect
WEnd

; make inner transparent area but add controls
Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
Local $outer_rgn, $inner_rgn, $combined_rgn

$outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
$inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh)
$combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
_WinAPI_DeleteObject($outer_rgn)
_WinAPI_DeleteObject($inner_rgn)
_AddCtrlRegion($combined_rgn, $btn_default)
_AddCtrlRegion($combined_rgn, $btn_round)
_AddCtrlRegion($combined_rgn, $btn_buble)
_AddCtrlRegion($combined_rgn, $btn_transparent)
_AddCtrlRegion($combined_rgn, $btn_exit)
_WinAPI_SetWindowRgn($h_win, $combined_rgn)
EndFunc ;==>_GuiHole

; add control's area to given region
; respecting also window title/frame sizes
Func _AddCtrlRegion($full_rgn, $ctrl_id)
Local $ctrl_pos, $ctrl_rgn

$ctrl_pos = ControlGetPos($gui, "", $ctrl_id)
$ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0] + $frame, $ctrl_pos[1] + $htit + $frame, _
$ctrl_pos[0] + $ctrl_pos[2] + $frame, $ctrl_pos[1] + $ctrl_pos[3] + $htit + $frame)
_WinAPI_CombineRgn($full_rgn, $full_rgn, $ctrl_rgn, $RGN_OR)
_WinAPI_DeleteObject($ctrl_rgn)
EndFunc ;==>_AddCtrlRegion


Function _WinAPI_CreateRoundRectRgn

Function Reference

_WinAPI_CreateRoundRectRgn

Creates a rectangular region with rounded corners

#Include <WinAPI.au3>
_WinAPI_CreateRoundRectRgn($iLeftRect, $iTopRect, $iRightRect, $iBottomRect, $iWidthEllipse, $iHeightEllipse)

Parameters

$iLeftRect | X-coordinate of the upper-left corner of the region
$iTopRect | Y-coordinate of the upper-left corner of the region
$iRightRect | X-coordinate of the lower-right corner of the region
$iBottomRect | Y-coordinate of the lower-right corner of the region
$iWidthEllipse | Width of the ellipse used to create the rounded corners
$iHeightEllipse | Height of the ellipse used to create the rounded corners

Return Value

Success: | Returns the handle to the region
Failure: | 0

Remarks

When you no longer need the HRGN object call the _WinAPI_DeleteObject function to delete it.
Region coordinates are represented as 27-bit signed integers.

Related

_WinAPI_CreateRectRgn, _WinAPI_SetWindowRgn, _WinAPI_DeleteObject, _WinAPI_CombineRgn, _WinAPI_GetWindowRgn

See Also

Search CreateRoundRectRgn in MSDN Library

Example

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

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)

$gui = GUICreate("Test Windows regions", 350, 210)
$btn_default = GUICtrlCreateButton("Default region", 100, 30, 150)
$btn_round = GUICtrlCreateButton("Round region", 100, 60, 150)
$btn_buble = GUICtrlCreateButton("Buble region ", 100, 90, 150)
$btn_transparent = GUICtrlCreateButton("Transparent region", 100, 120, 150)
$btn_exit = GUICtrlCreateButton("Exit", 100, 150, 150)
GUISetState(@SW_SHOW)

$pos = WinGetPos($gui) ; get whole window size (no client size defined in GUICreate)
Global $width = $pos[2]
Global $height = $pos[3]

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop

Case $msg = $btn_default
$rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_round
$rgn = _WinAPI_CreateRoundRectRgn(0, 0, $width, $height, $width / 3, $height / 3)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_buble
$rgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $width / 2, $height / 2, $width / 2, $height / 2) ; left-top
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, 0, $width, $height / 2, $width / 2, $height / 2) ; right-top
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(0, $height / 2, $width / 2, $height, $width / 2, $height / 2) ; left-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, $height / 2, $width, $height, $width / 2, $height / 2) ; right-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(10, 10, $width - 10, $height - 10, $width, $height) ; middle
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
_WinAPI_SetWindowRgn($gui, $rgn1)

Case $msg = $btn_transparent
_GuiHole($gui, 40, 40, 260, 170)

EndSelect
WEnd

; make inner transparent area but add controls
Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
Local $outer_rgn, $inner_rgn, $combined_rgn

$outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
$inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh)
$combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
_WinAPI_DeleteObject($outer_rgn)
_WinAPI_DeleteObject($inner_rgn)
_AddCtrlRegion($combined_rgn, $btn_default)
_AddCtrlRegion($combined_rgn, $btn_round)
_AddCtrlRegion($combined_rgn, $btn_buble)
_AddCtrlRegion($combined_rgn, $btn_transparent)
_AddCtrlRegion($combined_rgn, $btn_exit)
_WinAPI_SetWindowRgn($h_win, $combined_rgn)
EndFunc ;==>_GuiHole

; add control's area to given region
; respecting also window title/frame sizes
Func _AddCtrlRegion($full_rgn, $ctrl_id)
Local $ctrl_pos, $ctrl_rgn

$ctrl_pos = ControlGetPos($gui, "", $ctrl_id)
$ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0] + $frame, $ctrl_pos[1] + $htit + $frame, _
$ctrl_pos[0] + $ctrl_pos[2] + $frame, $ctrl_pos[1] + $ctrl_pos[3] + $htit + $frame)
_WinAPI_CombineRgn($full_rgn, $full_rgn, $ctrl_rgn, $RGN_OR)
_WinAPI_DeleteObject($ctrl_rgn)
EndFunc ;==>_AddCtrlRegion


Function _WinAPI_CreateSolidBitmap

Function Reference

_WinAPI_CreateSolidBitmap

Creates a solid color bitmap

#Include <WinAPI.au3>
_WinAPI_CreateSolidBitmap($hWnd, $iColor, $iWidth, $iHeight [, $bRGB = 1])

Parameters

$hWnd | Handle to the window where the bitmap will be displayed
$iColor | The color of the bitmap, stated in RGB
$iWidth | The width of the bitmap
$iHeight | The height of the bitmap
$bRGB | [optional] If True converts to COLOREF (0x00bbggrr)

Return Value

Success: | Handle to the bitmap
Failure: | 0

Remarks

None.

Related

_WinAPI_CreateCompatibleBitmap


Function _WinAPI_CreateSolidBrush

Function Reference

_WinAPI_CreateSolidBrush

Creates a logical brush that has the specified solid color

#Include <WinAPI.au3>
_WinAPI_CreateSolidBrush($nColor)

Parameters

$nColor Specifies the color of the brush

Return Value

Success: | HBRUSH Value that identifies a logical brush
Failure: | 0

Remarks

When you no longer need the HBRUSH object call the _WinAPI_DeleteObject function to delete it

Related

See Also

Search CreateSolidBrush in MSDN Library


Function _WinAPI_CreateWindowEx

Function Reference

_WinAPI_CreateWindowEx

Creates an overlapped, pop-up, or child window

#Include <WinAPI.au3>
_WinAPI_CreateWindowEx($iExStyle, $sClass, $sName, $iStyle, $iX, $iY, $iWidth, $iHeight, $hParent [, $hMenu = 0 [, $hInstance = 0 [, $pParam = 0]]])

Parameters

$iExStyle | Extended window style
$sClass | Registered class name
$sName | Window name
$iStyle | Window style
$iX | Horizontal position of window
$iY | Vertical position of window
$iWidth | Window width
$iHeight | Window height
$hParent | Handle to parent or owner window
$hMenu | [optional] Handle to menu or child-window identifier
$hInstance | [optional] Handle to application instance
$pParam | [optional] Pointer to window-creation data

Return Value

Success: | The handle to the new window
Failure: | 0

Remarks

None.

Related

_WinAPI_DestroyWindow

See Also

Search CreateWindowEx in MSDN Library


Function _WinAPI_DefWindowProc

Function Reference

_WinAPI_DefWindowProc

Call the default window procedure to provide default processing

#Include <WinAPI.au3>
_WinAPI_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam)

Parameters

$hWnd | Handle to the window procedure that received the message
$iMsg | Specifies the message
$iwParam | Specifies additional message information
$ilParam | Specifies additional message information

Return Value

Returns the return value is the result of the message processing and depends on the message

Remarks

None.

Related

See Also

Search DefWindowProc in MSDN Library


Function _WinAPI_DeleteDC

Function Reference

_WinAPI_DeleteDC

Deletes the specified device context

#Include <WinAPI.au3>
_WinAPI_DeleteDC($hDC)

Parameters

$hDC Identifies the device context to be deleted

Return Value

Success: | True
Failure: | False

Remarks

An application must not delete a DC whose handle was obtained by calling the _WinAPI_GetDC function. Instead, it
must call the _WinAPI_ReleaseDC function to free the DC.

Related

_WinAPI_GetDC, _WinAPI_ReleaseDC, _WinAPI_CreateCompatibleDC

See Also

Search DeleteDC in MSDN Library


Function _WinAPI_DeleteObject

Function Reference

_WinAPI_DeleteObject

Deletes a logical pen, brush, font, bitmap, region, or palette

#Include <WinAPI.au3>
_WinAPI_DeleteObject($hObject)

Parameters

$hObject Identifies a logical pen, brush, font, bitmap, region, or palette

Return Value

Success: | True
Failure: | False

Remarks

Do not delete a drawing object while it is still selected into a device context. When a pattern brush
is deleted the bitmap associated with the brush is not deleted. The bitmap must be deleted independently.

Related

_GDIPlus_BitmapCloneArea, _GDIPlus_BitmapCreateFromFile, _GDIPlus_BitmapCreateFromGraphics, _GDIPlus_BitmapCreateFromHBITMAP, _GDIPlus_BitmapCreateHBITMAPFromBitmap, _GDIPlus_BitmapLockBits, _GDIPlus_BitmapUnlockBits, _ScreenCapture_Capture, _ScreenCapture_CaptureWnd, _WinAPI_CreateCompatibleBitmap, _WinAPI_CreatePen, _WinAPI_CreateRectRgn, _WinAPI_CreateRoundRectRgn

See Also

Search DeleteObject in MSDN Library

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_DestroyIcon

Function Reference

_WinAPI_DestroyIcon

Destroys an icon and frees any memory the icon occupied

#Include <WinAPI.au3>
_WinAPI_DestroyIcon($hIcon)

Parameters

$hIcon Handle to the icon to be destroyed. The icon must not be in use.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_CopyIcon, _WinAPI_LoadShell32Icon

See Also

Search DestroyIcon in MSDN Library


Function _WinAPI_DestroyWindow

Function Reference

_WinAPI_DestroyWindow

Destroys the specified window

#Include <WinAPI.au3>
_WinAPI_DestroyWindow($hWnd)

Parameters

$hWnd Handle to the window to be destroyed

Return Value

Success: | True
Failure: | False

Remarks

You cannot use _WinAPI_DestroyWindow to destroy a window created by a different thread

Related

_WinAPI_CreateWindowEx

See Also

Search DestroyWindow in MSDN Library


Function _WinAPI_DrawEdge

Function Reference

_WinAPI_DrawEdge

Draws one or more edges of rectangle

#Include <WinAPI.au3>
_WinAPI_DrawEdge($hDC, $ptrRect, $nEdgeType, $grfFlags)

Parameters

$hDC | Handle to the device context into which the icon or cursor is drawn
$ptrRect | Pointer to a $tagRECT structure that contains the logical coordinates of the rectangle
$nEdgeType Specifies the type of inner and outer edges to draw. This parameter must be a combination of one inner-border flag and one outer-border flag.
The inner-border flags are as follows:
$BDR_RAISEDINNER - Raised inner edge
$BDR_SUNKENINNER - Sunken inner edge
The outer-border flags are as follows:
$BDR_RAISEDOUTER - Raised outer edge
$BDR_SUNKENOUTER - Sunken outer edge
Alternatively, the edge parameter can specify one of the following flags:
$EDGE_BUMP - Combination of $BDR_RAISEDOUTER and $BDR_SUNKENINNER
$EDGE_ETCHED - Combination of $BDR_SUNKENOUTER and $BDR_RAISEDINNER
$EDGE_RAISED - Combination of $BDR_RAISEDOUTER and $BDR_RAISEDINNER
$EDGE_SUNKEN - Combination of $BDR_SUNKENOUTER and $BDR_SUNKENINNER
$grfFlags Specifies the type of border. This parameter can be a combination of the following values:
$BF_ADJUST - If this flag is passed, shrink the rectangle pointed to by the $ptrRect parameter to exclude the edges that were drawn.
If this flag is not passed, then do not change the rectangle pointed to by the $ptrRect parameter
$BF_BOTTOM - Bottom of border rectangle
$BF_BOTTOMLEFT - Bottom and left side of border rectangle
$BF_BOTTOMRIGHT - Bottom and right side of border rectangle
$BF_DIAGONAL - Diagonal border
$BF_DIAGONAL_ENDBOTTOMLEFT - Diagonal border. The end point is the bottom-left corner of the rectangle; the origin is top-right corner
$BF_DIAGONAL_ENDBOTTOMRIGHT - Diagonal border. The end point is the bottom-right corner of the rectangle; the origin is top-left corner
$BF_DIAGONAL_ENDTOPLEFT - Diagonal border. The end point is the top-left corner of the rectangle; the origin is bottom-right corner
$BF_DIAGONAL_ENDTOPRIGHT - Diagonal border. The end point is the top-right corner of the rectangle; the origin is bottom-left corner
$BF_FLAT - Flat border
$BF_LEFT - Left side of border rectangle
$BF_MIDDLE - Interior of rectangle to be filled
$BF_MONO - One-dimensional border
$BF_RECT - Entire border rectangle
$BF_RIGHT - Right side of border rectangle
$BF_SOFT - Soft buttons instead of tiles
$BF_TOP - Top of border rectangle
$BF_TOPLEFT - Top and left side of border rectangle
$BF_TOPRIGHT - Top and right side of border rectangle

Return Value

Success: | True
Failure: | False

Remarks

Needs BorderConstants.au3 for pre-defined constants

Related

$tagRECT

See Also

Search DrawEdge in MSDN Library


Function _WinAPI_DrawFrameControl

Function Reference

_WinAPI_DrawFrameControl

Draws a frame control of the specified type and style

#Include <WinAPI.au3>
_WinAPI_DrawFrameControl($hDC, $ptrRect, $nType, $nState)

Parameters

$hDC | Handle to the device context into which the icon or cursor is drawn
$ptrRect | Pointer to a $tagRECT structure that contains the logical coordinates of the rectangle
$nType Specifies the type of frame control to draw. This parameter can be one of the following values:
$DFC_BUTTON - Standard button
$DFC_CAPTION - Title bar
$DFC_MENU - Menu bar
$DFC_POPUPMENU - Windows 98/Me, Windows 2000/XP: Popup menu item
$DFC_SCROLL - Scroll bar
$nState Specifies the initial state of the frame control. If $nType is $DFC_BUTTON, $nState can be one of the following values:
$DFCS_BUTTON3STATE - Three-state button
$DFCS_BUTTONCHECK - Check box
$DFCS_BUTTONPUSH - Push button
$DFCS_BUTTONRADIO - Radio button
$DFCS_BUTTONRADIOIMAGE - Image for radio button (nonsquare needs image)
$DFCS_BUTTONRADIOMASK - Mask for radio button (nonsquare needs mask)
If $nType is $DFC_CAPTION, $nState can be one of the following values:
$DFCS_CAPTIONCLOSE - Close button
$DFCS_CAPTIONHELP - Help button
$DFCS_CAPTIONMAX - Maximize button
$DFCS_CAPTIONMIN - Minimize button
$DFCS_CAPTIONRESTORE - Restore button
If $nType is $DFC_MENU, $nState can be one of the following values:
$DFCS_MENUARROW - Submenu arrow
$DFCS_MENUARROWRIGHT - Submenu arrow pointing left. This is used for the right-to-left cascading menus used with right-to-left languages such as Arabic or Hebrew
$DFCS_MENUBULLET - Bullet
$DFCS_MENUCHECK - Check mark
If $nType is $DFC_SCROLL, $nState can be one of the following values:
$DFCS_SCROLLCOMBOBOX - Combo box scroll bar
$DFCS_SCROLLDOWN - Down arrow of scroll bar
$DFCS_SCROLLLEFT - Left arrow of scroll bar
$DFCS_SCROLLRIGHT - Right arrow of scroll bar
$DFCS_SCROLLSIZEGRIP - Size grip in bottom-right corner of window
$DFCS_SCROLLSIZEGRIPRIGHT - Size grip in bottom-left corner of window. This is used with right-to-left languages such as Arabic or Hebrew
$DFCS_SCROLLUP - Up arrow of scroll bar
The following style can be used to adjust the bounding rectangle of the push button:
$DFCS_ADJUSTRECT - Bounding rectangle is adjusted to exclude the surrounding edge of the push button
One or more of the following values can be used to set the state of the control to be drawn:
$DFCS_CHECKED - Button is checked
$DFCS_FLAT - Button has a flat border
$DFCS_HOT - Windows 98/Me, Windows 2000/XP: Button is hot-tracked
$DFCS_INACTIVE - Button is inactive (grayed)
$DFCS_PUSHED - Button is pushed
$DFCS_TRANSPARENT - Windows 98/Me, Windows 2000/XP: The background remains untouched. This flag can only be combined with $DFCS_MENUARROWUP or $DFCS_MENUARROWDOWN

Return Value

Success: | True
Failure: | False

Remarks

Needs FrameConstants.au3 for pre-defined constants

Related

$tagRECT

See Also

Search DrawFrameControl in MSDN Library


Function _WinAPI_DrawIcon

Function Reference

_WinAPI_DrawIcon

Draws an icon or cursor into the specified device context

#Include <WinAPI.au3>
_WinAPI_DrawIcon($hDC, $iX, $iY, $hIcon)

Parameters

$hDC | Handle to the device context into which the icon or cursor is drawn
$iX | X coordinate of the upper-left corner of the icon
$iY | Y coordinate of the upper-left corner of the icon
$hIcon | Handle to the icon to be drawn

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_DrawIconEx

See Also

Search DrawIcon in MSDN Library


Function _WinAPI_DrawIconEx

Function Reference

_WinAPI_DrawIconEx

Draws an icon or cursor into the specified device context

#Include <WinAPI.au3>
_WinAPI_DrawIconEx($hDC, $iX, $iY, $hIcon [, $iWidth = 0 [, $iHeight = 0 [, $iStep = 0 [, $hBrush = 0 [, $iFlags = 3]]]]])

Parameters

$hDC | Handle to the device context into which the icon or cursor is drawn
$iX | X coordinate of the upper-left corner of the icon
$iY | Y coordinate of the upper-left corner of the icon
$hIcon | Handle to the icon to be drawn
$iWidth | [optional] Specifies the logical width of the icon or cursor. If this parameter is zero and the iFlags parameter is "default size", the function uses the $SM_CXICON or $SM_CXCURSOR system metric value to set the width. If this is zero and "default size" is not used, the function uses the actual resource width.
$iHeight | [optional] Specifies the logical height of the icon or cursor. If this parameter is zero and the iFlags parameter is "default size", the function uses the $SM_CYICON or $SM_CYCURSOR system metric value to set the width. If this is zero and "default size" is not used, the function uses the actual resource height.
$iStep | [optional] Specifies the index of the frame to draw if hIcon identifies an animated cursor. This parameter is ignored if hIcon does not identify an animated cursor.
$hBrush | [optional] Handle to a brush that the system uses for flicker-free drawing. If hBrush is a valid brush handle, the system creates an offscreen bitmap using the specified brush for the background color, draws the icon or cursor into the bitmap, and then copies the bitmap into the device context identified by hDC. If hBrush is 0, the system draws the icon or cursor directly into the device context.
$iFlags | [optional] Specifies the drawing flags. This parameter can be one of the following values: 1 - Draws the icon or cursor using the mask 2 - Draws the icon or cursor using the image 3 - Draws the icon or cursor using the mask and image 4 - Draws the icon or cursor using the system default image rather than the user-specified image 5 - Draws the icon or cursor using the width and height specified by the system metric values for cursors or icons, if the iWidth and iWidth parameters are set to zero. If this flag is not specified and iWidth and iWidth are set to zero, the function uses the actual resource size. 6 - Draws the icon as an unmirrored icon

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_DrawIcon

See Also

Search DrawIconEx in MSDN Library


Function _WinAPI_DrawLine

Function Reference

_WinAPI_DrawLine

Draws a line

#Include <WinAPI.au3>
_WinAPI_DrawLine($hDC, $iX1, $iY1, $iX2, $iY2)

Parameters

$hDC | Handle to device context
$iX1 | X coordinate of the line's starting point.
$iY1 | Y coordinate of the line's starting point.
$iX2 | X coordinate of the line's ending point.
$iY2 | Y coordinate of the line's ending point.

Return Value

Success: | True
Failure: | False

Remarks

Internally calls _WinAPI_MoveTo() and _WinAPI_LineTo(), see _WinAPI_LineTo() for details

Related

_WinAPI_MoveTo, _WinAPI_LineTo, _WinAPI_SelectObject, _WinAPI_CreatePen

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_DrawText

Function Reference

_WinAPI_DrawText

Draws formatted text in the specified rectangle

#Include <WinAPI.au3>
_WinAPI_DrawText($hDC, $sText, ByRef $tRect, $iFlags)

Parameters

$hDC | Identifies the device context
$sText | The string to be drawn
$tRect | $tagRECT structure that contains the rectangle for the text
$iFlags Specifies the method of formatting the text:
$DT_BOTTOM - Justifies the text to the bottom of the rectangle
$DT_CALCRECT - Determines the width and height of the rectangle
$DT_CENTER - Centers text horizontally in the rectangle
$DT_EDITCONTROL - Duplicates the text-displaying characteristics of a multiline edit control
$DT_END_ELLIPSIS - Replaces part of the given string with ellipses if necessary
$DT_EXPANDTABS - Expands tab characters
$DT_EXTERNALLEADING - Includes the font external leading in line height
$DT_HIDEPREFIX - Ignores the ampersand (&) prefix character in the text.
The letter that follows will not be underlined, but other mnemonic-prefix characters are still processed.
$DT_INTERNAL - Uses the system font to calculate text metrics
$DT_LEFT - Aligns text to the left
$DT_MODIFYSTRING - Modifies the given string to match the displayed text
$DT_NOCLIP - Draws without clipping
$DT_NOFULLWIDTHCHARBREAK - Prevents a line break at a DBCS (double-wide character string), so that the line breaking rule is equivalent to SBCS strings.
For example, this can be used in Korean windows, for more readability of icon labels.
This value has no effect unless $DT_WORDBREAK is specified
$DT_NOPREFIX - Turns off processing of prefix characters
$DT_PATH_ELLIPSIS - For displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle.
If the string contains backslash (\) characters, $DT_PATH_ELLIPSIS preserves as much as possible of the text after the last backslash.
The string is not modified unless the $DT_MODIFYSTRING flag is specified
$DT_PREFIXONLY - Draws only an underline at the position of the character following the ampersand (&) prefix character.
Does not draw any other characters in the string
$DT_RIGHT - Aligns text to the right
$DT_RTLREADING - Layout in right to left reading order for bi-directional text
$DT_SINGLELINE - Displays text on a single line only
$DT_TABSTOP - Sets tab stops. Bits 15-8 of $iFlags specify the number of characters for each tab
$DT_TOP - Top-justifies text (single line only)
$DT_VCENTER - Centers text vertically (single line only)
$DT_WORDBREAK - Breaks words
$DT_WORD_ELLIPSIS - Truncates any word that does not fit in the rectangle and adds ellipses

Return Value

Success: | The height of the text
Failure: | 0

Remarks

The DrawText function uses the device context's selected font, text color, and background color to draw the
text. Unless the $DT_NOCLIP format is used, DrawText clips the text so that it does not appear outside the
specified rectangle. All formatting is assumed to have multiple lines unless the $DT_SINGLELINE format is
specified. If the selected font is too large, DrawText does not attempt to substitute a smaller font.

Needs WindowsConstants.au3 for pre-defined constants

Related

$tagRECT, _WinAPI_GetBkMode, _WinAPI_SetBkMode

See Also

Search DrawText in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)
; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_EnableWindow

Function Reference

_WinAPI_EnableWindow

Enables or disables mouse and keyboard input to the specified window or control

#Include <WinAPI.au3>
_WinAPI_EnableWindow($hWnd [, $fEnable = True])

Parameters

$hWnd | Handle to the window to be enabled or disabled
$fEnable | [optional] Specifies whether to enable or disable the window: True - The window or control is enabled False - The window or control is disabled

Return Value

True: | The window or control was previously disabled
False: | The window or control was previously enabled

Remarks

None.

Related

See Also

Search EnableWindow in MSDN Library


Function _WinAPI_EnumDisplayDevices

Function Reference

_WinAPI_EnumDisplayDevices

Obtains information about the display devices in a system

#Include <WinAPI.au3>
_WinAPI_EnumDisplayDevices($sDevice, $iDevNum)

Parameters

$sDevice | Device name. If blank, the function returns information for the display adapters on the machine based on iDevNum.
$iDevNum | Zero based index value that specifies the display device of interest

Return Value

Success: | Array with the following format:
 | $aDevice[0] - True
 | $aDevice[1] - Either the adapter device or the monitor device
 | $aDevice[2] - Either a description of the adapter or the monitor
 | $aDevice[3] - Device state flags:
 | 1 - The device is part of the desktop
 | 2 - The primary desktop is on the device
 | 4 - Represents a pseudo device used to mirror application drawing for remoting
 | 8 - The device is VGA compatible
 | 16 - The device is removable; it cannot be the primary display
 | 32 - The device has more display modes than its output devices support
 | $aDevice[4] - Plug and Play identifier string (Windows 98/ME)
Failure: | Set @error

Remarks

None.

Related

See Also

Search EnumDisplayDevices in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aDevice, $i = 0, $text
While 1
$aDevice = _WinAPI_EnumDisplayDevices("", $i)
If Not $aDevice[0] Then ExitLoop
$text = "Successful? " & $aDevice[0] & @LF
$text &= "Device (Adapter or Monitor): " & $aDevice[1] & @LF
$text &= "Description (Adapter or Monitor): " & $aDevice[2] & @LF
$text &= "Device State Flag: " & $aDevice[3] & @LF
if BitAND($aDevice[3], 32) then $text &= @TAB & "- The device has more display modes than its output devices support" & @LF

if BitAND($aDevice[3], 16) then $text &= @TAB & "- The device is removable; it cannot be the primary display" & @LF
if BitAND($aDevice[3], 8) then $text &= @TAB & "- The device is VGA compatible" & @LF
if BitAND($aDevice[3], 4) then $text &= @TAB & "- Represents a pseudo device used to mirror application drawing for remoting" & @LF
if BitAND($aDevice[3], 2) then $text &= @TAB & "- The primary desktop is on the device" & @LF
if BitAND($aDevice[3], 1) then $text &= @TAB & "- The device is part of the desktop" & @LF

$text &= "Plug and Play identifier string: " & $aDevice[4] & @LF
MsgBox(0, "", $text)
$i += 1
WEnd
EndFunc ;==>_Main


Function _WinAPI_EnumWindows

Function Reference

_WinAPI_EnumWindows

Enumerates all windows

#Include <WinAPI.au3>
_WinAPI_EnumWindows([$fVisible = True [, $hwnd = Default]])

Parameters

$fVisible | [optional] Window selection flag: True - Returns only visible windows False - Returns all windows
$hwnd | [optional] Handle of the starting windows (default Desktop windows)

Return Value

Returns an Array with the following format:
[0][0] - Number of rows in array (n)
[1][0] - Window handle
[1][1] - Window class name
[n][0] - Window handle
[n][1] - Window class name

Remarks

None.

Related

_WinAPI_EnumWindowsPopup, _WinAPI_EnumWindowsTop

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aWindows, $i, $text
$aWindows = _WinAPI_EnumWindows()
For $i = 1 To $aWindows[0][0]
$text = "Window Handle: " & $aWindows[$i][0] & @LF
$text &= "Window Class: " & $aWindows[$i][1] & @LF
$text &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @LF
$text &= "Window Text: " & WinGetText($aWindows[$i][0]) & @LF
$text &= "Window Process: " & WinGetProcess($aWindows[$i][0])
MsgBox(0, "Item " & $i & " of " & $aWindows[0][0], $text)
Next
EndFunc ;==>_Main


Function _WinAPI_EnumWindowsPopup

Function Reference

_WinAPI_EnumWindowsPopup

Enumerates popup windows

#Include <WinAPI.au3>
_WinAPI_EnumWindowsPopup()

Parameters

None.

Return Value

Returns an Array with the following format:
[0][0] - Number of rows in array (n)
[1][0] - Window handle
[1][1] - Window class name
[n][0] - Window handle
[n][1] - Window class name

Remarks

None.

Related

_WinAPI_EnumWindows, _WinAPI_EnumWindowsTop

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aWindows, $i, $text
$aWindows = _WinAPI_EnumWindowsPopup()
For $i = 1 To $aWindows[0][0]
$text = "Window Handle: " & $aWindows[$i][0] & @LF
$text &= "Window Class: " & $aWindows[$i][1] & @LF
$text &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @LF
$text &= "Window Text: " & WinGetText($aWindows[$i][0]) & @LF
$text &= "Window Process: " & WinGetProcess($aWindows[$i][0])
MsgBox(0, "Item " & $i & " of " & $aWindows[0][0], $text)
Next
EndFunc ;==>_Main


Function _WinAPI_EnumWindowsTop

Function Reference

_WinAPI_EnumWindowsTop

Enumerates all top level windows

#Include <WinAPI.au3>
_WinAPI_EnumWindowsTop()

Parameters

None.

Return Value

Returns an Array with the following format:
[0][0] - Number of rows in array (n)
[1][0] - Window handle
[1][1] - Window class name
[n][0] - Window handle
[n][1] - Window class name

Remarks

None.

Related

_WinAPI_EnumWindows, _WinAPI_EnumWindowsPopup

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aWindows, $i, $text
$aWindows = _WinAPI_EnumWindowsTop()
For $i = 1 To $aWindows[0][0]
$text = "Window Handle: " & $aWindows[$i][0] & @LF
$text &= "Window Class: " & $aWindows[$i][1] & @LF
$text &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @LF
$text &= "Window Text: " & WinGetText($aWindows[$i][0]) & @LF
$text &= "Window Process: " & WinGetProcess($aWindows[$i][0])
MsgBox(0, "Item " & $i & " of " & $aWindows[0][0], $text)
Next
EndFunc ;==>_Main


Function _WinAPI_ExpandEnvironmentStrings

Function Reference

_WinAPI_ExpandEnvironmentStrings

Expands environment variable strings and replaces them with their defined values

#Include <WinAPI.au3>
_WinAPI_ExpandEnvironmentStrings($sString)

Parameters

$sString String to convert for environment variables

Return Value

Success: | Converted string
Failure: | Set @error

Remarks

None.

Related

See Also

Search ExpandEnvironmentStrings in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
MsgBox(4096, "Environment string", "%windir% = " & _WinAPI_ExpandEnvironmentStrings("%windir%"))


Function _WinAPI_ExtractIconEx

Function Reference

_WinAPI_ExtractIconEx

Creates an array of handles to large or small icons extracted from a file

#Include <WinAPI.au3>
_WinAPI_ExtractIconEx($sFile, $iIndex, $pLarge, $pSmall, $iIcons)

Parameters

$sFile | Name of an executable file, DLL, or icon file from which icons will be extracted
$iIndex | Specifies the zero-based index of the first icon to extract
$pLarge | Pointer to an array of icon handles that receives handles to the large icons extracted from the file. If this parameter is 0, no large icons are extracted from the file.
$pSmall | Pointer to an array of icon handles that receives handles to the small icons extracted from the file. If this parameter is 0, no small icons are extracted from the file.
$iIcons | Specifies the number of icons to extract from the file

Return Value

Returns If iIndex is -1, pLarge parameter is 0, and pSmall is 0, then the return value is the number of
icons contained in the specified file. Otherwise, the return value is the number of icons successfully
extracted from the file.

Remarks

None.

Related

See Also

Search ExtractIconEx in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
MsgBox(4096, "ExtractIconEx", "# of Icons in file shell32.dll: " & _WinAPI_ExtractIconEx("shell32.dll", -1, 0, 0, 0))


Function _WinAPI_FatalAppExit

Function Reference

_WinAPI_FatalAppExit

Displays a message box and terminates the application

#Include <WinAPI.au3>
_WinAPI_FatalAppExit($sMessage)

Parameters

$sMessage The string that is displayed in the message box

Return Value

None.

Remarks

An application calls FatalAppExit only when it is not capable of terminating any other way. FatalAppExit may
not always free an application's memory or close its files, and it may cause a general failure of the system.
An application that encounters an unexpected error should terminate by freeing all its memory and returning
from its main message loop.

Related

See Also

Search FatalAppExit in MSDN Library


Function _WinAPI_FillRect

Function Reference

_WinAPI_FillRect

Fills a rectangle by using the specified brush

#Include <WinAPI.au3>
_WinAPI_FillRect($hDC, $ptrRect, $hBrush)

Parameters

$hDC | Handle to the device context
$ptrRect | Pointer to a $tagRECT structure that contains the logical coordinates of the rectangle to be filled
$hBrush | Handle to the brush used to fill the rectangle

Return Value

Success: | True
Failure: | False

Remarks

The brush identified by the $hBrush parameter may be either a handle to a logical brush or a color value.
If specifying a handle to a logical brush, call _WinAPI_CreateSolidBrush.
Additionally, you may retrieve a handle to one of the stock brushes by using the _WinAPI_GetStockObject function.
If specifying a color value for the $hBrush parameter, it must be one of the standard system colors (the value 1 must be added to the chosen color)

Related

See Also

Search FillRect in MSDN Library


Function _WinAPI_FindExecutable

Function Reference

_WinAPI_FindExecutable

Retrieves the name of the executable file associated with the specified file name

#Include <WinAPI.au3>
_WinAPI_FindExecutable($sFileName [, $sDirectory = ""])

Parameters

$sFileName | Fully qualified path to existing file
$sDirectory | [optional] Default directory

Return Value

Success: | the Full path to the executable file started when an "open" by association is run on the file specified
Failure: | empty string if no association was found. and set @error

Remarks

None.

Related

See Also

Search FindExecutable in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
MsgBox(4096, "Find Executable", "file " & @ScriptName & @LF & "Executable: " & _WinAPI_FindExecutable(@ScriptName))


Function _WinAPI_FindWindow

Function Reference

_WinAPI_FindWindow

Retrieves the handle to the top-level window whose class name and window name match

#Include <WinAPI.au3>
_WinAPI_FindWindow($sClassName, $sWindowName)

Parameters

$sClassName | A string that specifies the class name or is an atom that identifies the class-name string. If this parameter is an atom, it must be a global atom created by a call to the GlobalAddAtom function. The atom, a 16-bit value, must be placed in the low-order word of the $sClassName string and the high-order word must be zero.
$sWindowName | A string that specifies the window name. If this parameter is blank, all window names match.

Return Value

Success: | The handle to the window
Failure: | 0

Remarks

None.

Related

See Also

Search FindWindow in MSDN Library


Function _WinAPI_FlashWindow

Function Reference

_WinAPI_FlashWindow

Flashes the specified window one time

#Include <WinAPI.au3>
_WinAPI_FlashWindow($hWnd [, $fInvert = True])

Parameters

$hWnd | Handle to the window to be flashed. The window can be either open or minimized.
$fInvert | [optional] If True, the window is flashed from one state to the other. If False the window is returned to its original state. When an application is minimized and this parameter is True, the taskbar window button flashes active/inactive. If it is False, the taskbar window button flashes inactive, meaning that it does not change colors. It flashes as if it were being redrawn, but it does not provide the visual invert clue to the user.

Return Value

Success: | True
Failure: | False

Remarks

This function does not change the active state of the window. To flash the window a specified number of times,
use the FlashWindowEx function.

Related

_WinAPI_FlashWindowEx

See Also

Search FlashWindow in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hwnd, $msg, $btnFlash
$hwnd = GUICreate("__WinAPI_FlashWindow Example", 200, 200)
$btnFlash = GUICtrlCreateButton("Flash Window", 50, 85, 100, 30)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $btnFlash
GUISetState(@SW_MINIMIZE)
Sleep(1000)
_WinAPI_FlashWindow($hwnd)
Sleep(6000)
EndSelect
WEnd
EndFunc ;==>_Main


Function _WinAPI_FlashWindowEx

Function Reference

_WinAPI_FlashWindowEx

Flashes the specified window

#Include <WinAPI.au3>
_WinAPI_FlashWindowEx($hWnd [, $iFlags = 3 [, $iCount = 3 [, $iTimeout = 0]]])

Parameters

$hWnd | Handle to the window to be flashed. The window can be either open or minimized.
$iFlags | [optional] The flash status. Can be one or more of the following values: 0 - Stop flashing. The system restores the window to its original state. 1 - Flash the window caption 2 - Flash the taskbar button 4 - Flash continuously until stopped 8 - Flash continuously until the window comes to the foreground
$iCount | [optional] The number of times to flash the window
$iTimeout | [optional] The rate at which the window is to be flashed, in milliseconds. If 0, the function uses the default cursor blink rate.

Return Value

Success: | True
Failure: | False

Remarks

Typically, you flash a window to inform the user that the window requires attention but does not currently
have the keyboard focus. When a window flashes, it appears to change from inactive to active status. An
inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption
bar.

Related

_WinAPI_FlashWindow

See Also

Search FlashWindowEx in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hwnd, $Flash, $Timeout, $btnFlash, $msg, $flashrate, $timeoutrate, $flashing = False
$hwnd = GUICreate("Form1", 229, 170, 193, 125)
$Flash = GUICtrlCreateInput("20", 80, 72, 121, 21)
$Timeout = GUICtrlCreateInput("500", 80, 103, 121, 21)
GUICtrlCreateLabel("Please input the flash rate, and the time between flashes", 8, 24, 214, 41)
GUICtrlCreateLabel("Flash Rate:", 16, 72, 58, 17)
GUICtrlCreateLabel("Timeout (ms)", 16, 104, 64, 17)
$btnFlash = GUICtrlCreateButton("Flash Window", 80, 136, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion

While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $btnFlash
If $flashing Then
_WinAPI_FlashWindowEx($hwnd, 0)
$flashing = False
Else
$flashrate = GUICtrlRead($Flash)
$timeoutrate = GUICtrlRead($Timeout)
_WinAPI_FlashWindowEx($hwnd, 2, $flashrate, $timeoutrate)
GUICtrlSetData($btnFlash, "Stop Flashing")
$flashing = True
EndIf
EndSwitch
WEnd
EndFunc ;==>_Main


Function _WinAPI_FloatToInt

Function Reference

_WinAPI_FloatToInt

Returns a 4 byte float as an integer value

#Include <WinAPI.au3>
_WinAPI_FloatToInt($nFloat)

Parameters

$nFloat Float value

Return Value

Returns an 4 byte float value as an integer

Remarks

None.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $float, $text, $INT
$float = 10.55
$INT = _WinAPI_FloatToInt($float)
$text = "The float " & $float & " is converted to the Integer " & $INT & " (Hex = " & Hex($INT) & ")"
MsgBox(0, "_WinAPI_FloatToInt Example Results", $text)
EndFunc ;==>_Main


Function _WinAPI_FlushFileBuffers

Function Reference

_WinAPI_FlushFileBuffers

Flushes the buffers of a specified file and causes all buffered data to be written

#Include <WinAPI.au3>
_WinAPI_FlushFileBuffers($hFile)

Parameters

$hFile Handle to an open file. The file handle must have the $GENERIC_WRITE access right. If hFile is
a handle to a communications device, the function only flushes the transmit buffer. If hFile is a handle to
the server end of a named pipe the function does not return until the client has read all buffered data from
the pipe.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search FlushFileBuffers in MSDN Library


Function _WinAPI_FormatMessage

Function Reference

_WinAPI_FormatMessage

Formats a message string

#Include <WinAPI.au3>
_WinAPI_FormatMessage($iFlags, $pSource, $iMessageID, $iLanguageID, ByRef $pBuffer, $iSize, $vArguments)

Parameters

$iFlags | Contains a set of bit flags that specify aspects of the formatting process and how to interpret the pSource parameter. The low-order byte of $iFlags specifies how the function handles line breaks in the output buffer. The low-order byte can also specify the maximum width of a formatted output line.
$pSource | Pointer to message source
$iMessageID | Requested message identifier
$iLanguageID | Language identifier for requested message
$pBuffer | Pointer to message buffer or string variable that will contain the message
$iSize | Maximum size of message buffer
$vArguments | Address of array of message inserts

Return Value

Success: | Number of bytes stored in message buffer
Failure: | Set @error

Remarks

None.

Related

See Also

Search FormatMessage in MSDN Library


Function _WinAPI_FrameRect

Function Reference

_WinAPI_FrameRect

Draws a border around the specified rectangle by using the specified brush

#Include <WinAPI.au3>
_WinAPI_FrameRect($hDC, $ptrRect, $hBrush)

Parameters

$hDC | Handle to the device context in which the border is drawn
$ptrRect | Pointer to a $tagRECT structure that contains the logical coordinates of the upper-left and lower-right corners of the rectangle
$hBrush | Handle to the brush used to draw the border

Return Value

Success: | True
Failure: | False

Remarks

The brush identified by the $hBrush parameter must have been created by using the _WinAPI_CreateSolidBrush function,
or retrieved by using the _WinAPI_GetStockObject function

Related

$tagRECT

See Also

Search FrameRect in MSDN Library


Function _WinAPI_FreeLibrary

Function Reference

_WinAPI_FreeLibrary

Decrements the reference count of the loaded dynamic-link library (DLL) module

#Include <WinAPI.au3>
_WinAPI_FreeLibrary($hModule)

Parameters

$hModule Identifies the loaded library module

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_LoadLibrary, _WinAPI_LoadLibraryEx, _WinAPI_LoadString

See Also

Search FreeLibrary in MSDN Library

Example

#include <GuiReBar.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hInput, $btn_get, $hReBar, $hInstance, $sText
; Create GUI
$hGUI = GUICreate("WinAPI", 400, 396)

$hInput = GUICtrlCreateInput("4209", 0, 0, 100, 20)

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hGUI, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL))
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "String ID:")

$btn_get = GUICtrlCreateButton("Get String", 0, 0, 90, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($btn_get), 120, 200)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $btn_get
GUICtrlSetData($iMemo, "")
$hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE)
If $hInstance Then
$sText = _WinAPI_LoadString($hInstance, GUICtrlRead($hInput))
If Not @error Then
MemoWrite('Got the String (chars: ' & @extended & '): ' & @CRLF & $sText)
Else
MemoWrite("Last Error Message: " & @CRLF & _WinAPI_GetLastErrorMessage())
EndIf
MemoWrite(@CRLF & "Success Freeing? " & _WinAPI_FreeLibrary($hInstance))
EndIf
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _WinAPI_GetAncestor

Function Reference

_WinAPI_GetAncestor

Retrieves the handle to the ancestor of the specified window

#Include <WinAPI.au3>
_WinAPI_GetAncestor($hWnd [, $iFlags = 1])

Parameters

$hWnd | Handle to the window whose ancestor is to be retrieved. If this is the desktop window, the function returns 0.
$iFlags | [optional] Specifies the ancestor to be retrieved. This parameter can be one of the following values: $GA_PARENT - Retrieves the parent window $GA_ROOT - Retrieves the root window by walking the chain of parent windows $GA_ROOTOWNER - Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.

Return Value

Success: | The handle of the ancestor window
Failure: | 0

Remarks

Needs WindowsConstants.au3 for pre-definded constants

Related

See Also

Search GetAncestor in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
Local $hwnd, $hparent
$hwnd = GUICreate("test")
$hparent = _WinAPI_GetAncestor($hwnd, $GA_PARENT)
MsgBox(4096, "Parent", "Get Ancestor of " & $hwnd & ": " & $hparent)
MsgBox(4096, "Root", "Get Ancestor of " & $hparent & ": " & _WinAPI_GetAncestor($hwnd, $GA_ROOT))
MsgBox(4096, "Root Owner", "Get Ancestor of " & $hparent & ": " & _WinAPI_GetAncestor($hwnd, $GA_ROOTOWNER))
EndFunc ;==>_Main


Function _WinAPI_GetAsyncKeyState

Function Reference

_WinAPI_GetAsyncKeyState

Determines whether a key is up or down at the time the function is called

#Include <WinAPI.au3>
_WinAPI_GetAsyncKeyState($iKey)

Parameters

$iKey Key to test for

Return Value

Success: | If the most significant bit is set the key is down, and if the least significant bit is set,
 | the key was pressed after the previous call to GetAsyncKeyState.
Failure: | 0, if a window in another thread or process currently has the keyboard focus.

Remarks

None.

Related

See Also

Search GetAsyncKeyState in MSDN Library


Function _WinAPI_GetBkMode

Function Reference

_WinAPI_GetBkMode

Returns the current background mix mode for a specified device context

#Include <WinAPI.au3>
_WinAPI_GetBkMode($hDC)

Parameters

$hDC Handle to the device context whose background mode is to be returned

Return Value

Success: | Value specifies the current background mix mode, either OPAQUE or TRANSPARENT
Failure: | 0

Remarks

The background mix mode of a device context affects text, hatched brushes, and pen styles that are not solid lines.

Related

_WinAPI_SetBkMode, _WinAPI_DrawText, _WinAPI_CreatePen, _WinAPI_SelectObject

See Also

Search GetBkMode in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)

MsgBox(4096, "Information", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

MsgBox(4096, "Information", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_GetClassName

Function Reference

_WinAPI_GetClassName

Retrieves the name of the class to which the specified window belongs

#Include <WinAPI.au3>
_WinAPI_GetClassName($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | The window class name
Failure: | Set @error

Remarks

None.

Related

See Also

Search GetClassName in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd
$hwnd = GUICreate("test")
MsgBox(4096, "Get ClassName", "ClassName of " & $hwnd & ": " & _WinAPI_GetClassName($hwnd))
EndFunc ;==>_Main


Function _WinAPI_GetClientHeight

Function Reference

_WinAPI_GetClientHeight

Retrieves the height of a window's client area

#Include <WinAPI.au3>
_WinAPI_GetClientHeight($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | Client area height
Failure: | set @error

Remarks

None.

Related

_WinAPI_GetClientWidth

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd
$hwnd = GUICreate("test")
MsgBox(4096, "Client", "Client Height: " & _WinAPI_GetClientHeight($hwnd))
EndFunc ;==>_Main


Function _WinAPI_GetClientRect

Function Reference

_WinAPI_GetClientRect

Retrieves the coordinates of a window's client area

#Include <WinAPI.au3>
_WinAPI_GetClientRect($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | $tagRECT structure that receives the client coordinates
Failure: | set @error

Remarks

None.

Related

$tagRECT

See Also

Search GetClientRect in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd, $tRect
$hwnd = GUICreate("test")
$tRect = _WinAPI_GetClientRect($hwnd)
MsgBox(4096, "Rect", _
"Left..: " & DllStructGetData($tRect, "Left") & @LF & _
"Right.: " & DllStructGetData($tRect, "Right") & @LF & _
"Top...: " & DllStructGetData($tRect, "Top") & @LF & _
"Bottom: " & DllStructGetData($tRect, "Bottom"))
EndFunc ;==>_Main


Function _WinAPI_GetClientWidth

Function Reference

_WinAPI_GetClientWidth

Retrieves the width of a window's client area

#Include <WinAPI.au3>
_WinAPI_GetClientWidth($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | Client area width
Failure: | set @error

Remarks

None.

Related

_WinAPI_GetClientHeight

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd
$hwnd = GUICreate("test")
MsgBox(4096, "Client", "Client Width: " & _WinAPI_GetClientWidth($hwnd))
EndFunc ;==>_Main


Function _WinAPI_GetCurrentProcess

Function Reference

_WinAPI_GetCurrentProcess

Returns the process handle of the calling process

#Include <WinAPI.au3>
_WinAPI_GetCurrentProcess()

Parameters

None.

Return Value

Returns the Process handle of the calling process

Remarks

None.

Related

_WinAPI_GetCurrentProcessID

See Also

Search GetCurrentProcess in MSDN Library


Function _WinAPI_GetCurrentProcessID

Function Reference

_WinAPI_GetCurrentProcessID

Returns the process identifier of the calling process

#Include <WinAPI.au3>
_WinAPI_GetCurrentProcessID()

Parameters

None.

Return Value

Returns the Process identifier of the calling process

Remarks

None.

Related

_WinAPI_GetWindowThreadProcessID, _WinAPI_GetCurrentProcess

See Also

Search GetCurrentProcessId in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

MsgBox(4096, "ID", "Get Current Process: " & _WinAPI_GetCurrentProcessID())


Function _WinAPI_GetCurrentThread

Function Reference

_WinAPI_GetCurrentThread

Retrieves a pseudo handle for the calling thread.

#Include <WinAPI.au3>
_WinAPI_GetCurrentThread()

Parameters

None.

Return Value

Returns the Pseudo handle for the current thread

Remarks

A pseudo handle is a special constant that is interpreted as the current thread handle. The calling thread can
use this handle to specify itself whenever a thread handle is required.

Related

See Also

Search GetCurrentThread in MSDN Library


Function _WinAPI_GetCurrentThreadId

Function Reference

_WinAPI_GetCurrentThreadId

Returns the thread identifier of the calling thread

#Include <WinAPI.au3>
_WinAPI_GetCurrentThreadId()

Parameters

None.

Return Value

Returns the Thread identifier of the calling thread

Remarks

None.

Related

See Also

Search GetCurrentThreadId in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

MsgBox(4096, "ID", "Get Current Thread: " & _WinAPI_GetCurrentThreadId())


Function _WinAPI_GetCursorInfo

Function Reference

_WinAPI_GetCursorInfo

Retrieves information about the global cursor

#Include <WinAPI.au3>
_WinAPI_GetCursorInfo()

Parameters

None.

Return Value

Success: | Array with the following format:
 | $aCursor[0] - True
 | $aCursor[1] - True if cursor is showing, otherwise False
 | $aCursor[2] - Handle to the cursor
 | $aCursor[3] - X coordinate of the cursor
 | $aCursor[4] - Y coordinate of the cursor
Failure: | set @error

Remarks

None.

Related

See Also

Search GetCursorInfo in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $cursor, $text
$cursor = _WinAPI_GetCursorInfo()
$text = "Was the operation sucessful? " & $cursor[0] & @LF
$text &= "Is the cursor showing? " & $cursor[1] & @LF & @LF
$text &= "Cursor Handle: " & $cursor[2] & @LF
$text &= "X Coordinate: " & $cursor[3] & @LF
$text &= "Y Coordinate: " & $cursor[4]
MsgBox(0, "_WinApi_GetCursorInfo Example", $text)
EndFunc ;==>_Main


Function _WinAPI_GetDC

Function Reference

_WinAPI_GetDC

Retrieves a handle of a display device context for the client area a window

#Include <WinAPI.au3>
_WinAPI_GetDC($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | The device context for the given window's client area
Failure: | 0

Remarks

After painting with a common device context, the _WinAPI_ReleaseDC function must be called to release the DC

Related

_WinAPI_DeleteDC, _WinAPI_ReleaseDC

See Also

Search GetDC in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
Local $hwnd, $hDC
$hwnd = GUICreate("test")
$hDC = _WinAPI_GetDC($hwnd)
MsgBox(4096, "Handle", "Display Device: " & $hDC)
_WinAPI_ReleaseDC($hwnd, $hDC)
EndFunc ;==>_Main


Function _WinAPI_GetDesktopWindow

Function Reference

_WinAPI_GetDesktopWindow

Returns the handle of the Windows desktop window

#Include <WinAPI.au3>
_WinAPI_GetDesktopWindow()

Parameters

None.

Return Value

Returns the Handle of the desktop window

Remarks

None.

Related

See Also

Search GetDesktopWindow in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $win = _WinAPI_GetDesktopWindow()
MsgBox(0, "", WinGetTitle($win))
MsgBox(0, "", $win)
EndFunc ;==>_Main


Function _WinAPI_GetDeviceCaps

Function Reference

_WinAPI_GetDeviceCaps

Retrieves device specific information about a specified device

#Include <WinAPI.au3>
_WinAPI_GetDeviceCaps($hDC, $iIndex)

Parameters

$hDC | Identifies the device context
$iIndex | Specifies the item to return

Return Value

Returns the value of the desired item

Remarks

None.

Related

See Also

Search GetDeviceCaps in MSDN Library


Function _WinAPI_GetDIBits

Function Reference

_WinAPI_GetDIBits

Retrieves the bits of the specified bitmap and copies them into a buffer as a DIB

#Include <WinAPI.au3>
_WinAPI_GetDIBits($hDC, $hBmp, $iStartScan, $iScanLines, $pBits, $pBI, $iUsage)

Parameters

$hDC | Handle to the device context
$hBmp | Handle to the bitmap. This must be a compatible bitmap (DDB).
$iStartScan | Specifies the first scan line to retrieve
$iScanLines | Specifies the number of scan lines to retrieve
$pBits | Pointer to a buffer to receive the bitmap data. If this parameter is 0, the function passes the dimensions and format of the bitmap to the $tagBITMAPINFO structure pointed to by the pBI parameter.
$pBI | Pointer to a $tagBITMAPINFO structure that specifies the desired format for the DIB data
$iUsage | Specifies the format of the bmiColors member of the $tagBITMAPINFO structure. It must be one of the following values: $DIB_PAL_COLORS - The color table should consist of an array of 16-bit indexes into the current palette $DIB_RGB_COLORS - The color table should consist of literal red, green, blue values

Return Value

Success: | If pBits is not 0 and the function succeeds, the return value is the number of scan lines copied from the bitmap.
 | If pBits is 0 and GetDIBits successfully fills the structure, the return value is True.
Failure: | False

Remarks

None.

Related

$tagBITMAPINFO

See Also

Search GetDIBits in MSDN Library


Function _WinAPI_GetDlgCtrlID

Function Reference

_WinAPI_GetDlgCtrlID

Returns the identifier of the specified control

#Include <WinAPI.au3>
_WinAPI_GetDlgCtrlID($hWnd)

Parameters

$hWnd Handle to control

Return Value

Success: | Identifier of the control
Failure: | 0

Remarks

GetDlgCtrlID accepts child window handles as well as handles of controls in dialog boxes. An application sets
the identifier for a child window when it creates the window by assigning the identifier value to the hmenu
parameter when calling the CreateWindow or CreateWindowEx function. Although GetDlgCtrlID may return a value
if $hWnd identifies a top-level window, top-level windows cannot have identifiers and such a return value is
never valid.

Related

See Also

Search GetDlgCtrlID in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $button
GUICreate("test")
$button = GUICtrlCreateButton("testing", 0, 0)
MsgBox(4096, "ID", "Dialog Control ID: " & _WinAPI_GetDlgCtrlID(GUICtrlGetHandle($button)))
EndFunc ;==>_Main


Function _WinAPI_GetDlgItem

Function Reference

_WinAPI_GetDlgItem

Retrieves the handle of a control in the specified dialog box

#Include <WinAPI.au3>
_WinAPI_GetDlgItem($hWnd, $iItemID)

Parameters

$hWnd | Handle to the dialog box
$iItemID | Specifies the identifier of the control to be retrieved

Return Value

Success: | The window handle of the given control
Failure: | 0

Remarks

You can use the GetDlgItem function with any parent-child window pair, not just with dialog boxes. As long as
the $hWnd parameter specifies a parent window and the child window has a unique identifier, GetDlgItem returns
a valid handle to the child window.

Related

See Also

Search GetDlgItem in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd, $button
$hwnd = GUICreate("test")
$button = GUICtrlCreateButton("button", 0, 0)
MsgBox(4096, "Handle", "Get Dialog Item: " & _WinAPI_GetDlgItem($hwnd, $button))
EndFunc ;==>_Main


Function _WinAPI_GetFileSizeEx

Function Reference

_WinAPI_GetFileSizeEx

Retrieves the size of the specified file

#Include <WinAPI.au3>
_WinAPI_GetFileSizeEx($hFile)

Parameters

$hFile Handle to the file whose size is to be returned

Return Value

Success: | File size
Failure: | set @error

Remarks

None.

Related

_WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search GetFileSizeEx in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer, $size

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
$size = _WinAPI_GetFileSizeEx($hFile)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1):' & $size & ' ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
$size = _WinAPI_GetFileSizeEx($hFile)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2):' & $size & ' ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
$size = _WinAPI_GetFileSizeEx($hFile)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3):' & $size & ' ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
$size = _WinAPI_GetFileSizeEx($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4):' & $size & ' ' & FileRead($sFile) & @CRLF)

FileDelete($sfile)


Function _WinAPI_GetFocus

Function Reference

_WinAPI_GetFocus

Retrieves the handle of the window that has the keyboard focus

#Include <WinAPI.au3>
_WinAPI_GetFocus()

Parameters

None.

Return Value

Success: | The handle of the window with the keyboard focus
Failure: | 0

Remarks

None.

Related

See Also

Search GetFocus in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $gui, $msg, $btnFocus, $win, $text
$gui = GUICreate("__WinAPI_GetFocus Example", 200, 200)
$btnFocus = GUICtrlCreateButton("Get Focus", 50, 85, 100, 30)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $btnFocus
$win = _WinAPI_GetFocus()
$text = "Full Title: " & WinGetTitle($win) & @LF
$text &= "Full Text: " & WinGetText($win) & @LF
$text &= "Handle: " & WinGetHandle($win) & @LF
$text &= "Process: " & WinGetProcess($win) & @LF
MsgBox(0, "", $text)
EndSelect
WEnd
EndFunc ;==>_Main


Function _WinAPI_GetForegroundWindow

Function Reference

_WinAPI_GetForegroundWindow

Returns the handle of the foreground window

#Include <WinAPI.au3>
_WinAPI_GetForegroundWindow()

Parameters

None.

Return Value

Success: | Handle of the foreground window
Failure: | The foreground window can be NULL in certain circumstances, such as when a window is losing activation

Remarks

None.

Related

See Also

Search GetForegroundWindow in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

MsgBox(4096, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow())


Function _WinAPI_GetGuiResources

Function Reference

_WinAPI_GetGuiResources

Retrieves the count of handles to graphical user interface (GUI) objects in use by the specified process

#Include <WinAPI.au3>
_WinAPI_GetGuiResources([$iflag = 1 [, $hProcess = -1}})

Parameters

$iflag | [optional] 0 (Default) Return the count of GDI objects. 1 Return the count of USER objects.
$hProcess | [optional] A handle to the process. By default the current process.

Return Value

Success: | Returns the count of handles to GUI objects in use by the process, according to $iFlag
Failure: | Set @error

Remarks

None.

Related

See Also

Search GetGuiResources in MSDN Library


Function _WinAPI_GetIconInfo

Function Reference

_WinAPI_GetIconInfo

Retrieves information about the specified icon or cursor

#Include <WinAPI.au3>
_WinAPI_GetIconInfo($hIcon)

Parameters

$hIcon Handle to the icon or cursor. To retrieve information on a standard icon or cursor, specify one
of the following values:
$IDC_APPSTARTING - Standard arrow and small hourglass cursor
$IDC_ARROW - Standard arrow cursor
$IDC_CROSS - Crosshair cursor
$IDC_HAND - Hand cursor
$IDC_HELP - Arrow and question mark cursor
$IDC_IBEAM - I-beam cursor
$IDC_NO - Slashed circle cursor
$IDC_SIZEALL - Four-pointed arrow cursor
$IDC_SIZENESW - Double-pointed arrow cursor pointing NE and SW
$IDC_SIZENS - Double-pointed arrow cursor pointing N and S
$IDC_SIZENWSE - Double-pointed arrow cursor pointing NW and SE
$IDC_SIZEWE - Double-pointed arrow cursor pointing W and E
$IDC_UPARROW - Vertical arrow cursor
$IDC_WAIT - Hourglass cursor
$IDI_APPLICATION - Application icon
$IDI_ASTERISK - Asterisk icon
$IDI_EXCLAMATION - Exclamation point icon
$IDI_HAND - Stop sign icon
$IDI_QUESTION - Question-mark icon
$IDI_WINLOGO - Windows logo icon

Return Value

Success: | Array with the following format:
 | $aIcon[0] - True
 | $aIcon[1] - True specifies an icon, False specifies a cursor
 | $aIcon[2] - Specifies the X coordinate of a cursor's hot spot
 | $aIcon[3] - Specifies the Y coordinate of a cursor's hot spot
 | $aIcon[4] - Specifies the icon bitmask bitmap
 | $aIcon[5] - Handle to the icon color bitmap
Failure: | Set @error

Remarks

This function creates bitmaps for the bitmask and color members. You must manage these bitmaps and delete
them when they are no longer necessary.

Related

See Also

Search GetIconInfo in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>
#include <Constants.au3>

_Main()

Func _Main()
Local $aInfo, $sInfo = ""
$aInfo = _WinAPI_GetIconInfo($IDC_WAIT)
For $x = 0 To UBound($aInfo) - 1
$sInfo &= $aInfo[$x] & @LF
Next
MsgBox(4096, "Icon", "Get Icon Info: " & @LF & $sInfo)
EndFunc ;==>_Main


Function _WinAPI_GetLastError

Function Reference

_WinAPI_GetLastError

Returns the calling thread's lasterror code value

#Include <WinAPI.au3>
_WinAPI_GetLastError()

Parameters

None.

Return Value

Returns the Last error code

Remarks

None.

Related

_WinAPI_GetLastErrorMessage

See Also

Search GetLastError in MSDN Library


Function _WinAPI_GetLastErrorMessage

Function Reference

_WinAPI_GetLastErrorMessage

Returns the calling threads last error message

#Include <WinAPI.au3>
_WinAPI_GetLastErrorMessage()

Parameters

None.

Return Value

Success: | Last error message
Failure: | set @error

Remarks

None.

Related

_WinAPI_GetLastError


Function _WinAPI_GetLayeredWindowAttributes

Function Reference

_WinAPI_GetLayeredWindowAttributes

Gets Layered Window Attributes

#Include <WinAPI.au3>
_WinAPI_GetLayeredWindowAttributes($hWnd, ByRef $i_transcolor, ByRef $Transparency [, $asColorRef = False])

Parameters

$hwnd | Handle of GUI to work on
$i_transcolor | Returns Transparent color ( dword as 0x00bbggrr or string "0xRRGGBB")
$Transparency | Returns Transparancy of GUI
$asColorRef | [optional] If True, $i_transcolor will be a COLORREF( 0x00bbggrr ), else an RGB-Color

Return Value

Success: | Usage of LWA_ALPHA and LWA_COLORKEY (use BitAnd)
Failure: | 0
@error: | 1 to 3 - Error from DllCall
 | 4 - Function did not succeed
@extended: | contains _WinAPI_GetLastError()

Remarks

Minimum OS - Windows XP.

Related

_WinAPI_SetLayeredWindowAttributes, _WinAPI_GetLastError

See Also

Search GetLayeredWindowAttributes in MSDN Library

Example

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

$gui = GUICreate("trans", 300, 400, -1, -1, -1, $WS_EX_LAYERED)
GUICtrlCreateLabel("This is text on a transparent Layered GUI", 10, 10, 200, 20, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetTip(-1, "Click label to drag layered window")
$layButt = GUICtrlCreateButton("Button", 10, 40, 40)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($gui, 0x010101)
GUISetState()

$guicontrol = GUICreate("ControlGUI", 300, 400, 100, 100)
$checkTrans = GUICtrlCreateCheckbox("Transparent color 0xABCDEF (Checked) Or 0x010101", 10, 10)
$checkBorder = GUICtrlCreateCheckbox("POPUP-Style", 10, 30)
GUICtrlCreateLabel("Transparency for Layered GUI", 10, 50)
$slidTrans = GUICtrlCreateSlider(10, 70, 200, 30)
GUICtrlSetLimit($slidTrans, 255, 0)
GUICtrlSetData(-1, 255)
GUISetState()

While 1
$extMsg = GUIGetMsg(1)
$msg = $extMsg[0]
Switch $extMsg[1]
Case $guicontrol
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $checkTrans Or $msg = $slidTrans

; Change Attributes of Trans-Color and Window Transparency

If BitAND(GUICtrlRead($checkTrans), $GUI_CHECKED) = $GUI_CHECKED Then
_WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF, GUICtrlRead($slidTrans))
Else
_WinAPI_SetLayeredWindowAttributes($gui, 0x010101, GUICtrlRead($slidTrans))
EndIf

Case $msg = $checkBorder
If BitAND(GUICtrlRead($checkBorder), $GUI_CHECKED) = $GUI_CHECKED Then
GUISetStyle($WS_POPUP, -1, $gui)
Else
GUISetStyle($GUI_SS_DEFAULT_GUI, -1, $gui)
EndIf
EndSelect
Case $gui
Select
Case $msg = $layButt
Dim $transcolor, $alpha
$info = _WinAPI_GetLayeredWindowAttributes($gui,$transcolor, $alpha)
MsgBox(0, 'Layered GUI', "Button on layered Window Clicked" & @CRLF & "Information about this window: " & @CRLF & _
"Transparent Color: " & $transcolor & @CRLF & _
"Alpha Value: " & $alpha & @CRLF & _
"LWA_COLORKEY: " & (BitAND($info,$LWA_COLORKEY)=$LWA_COLORKEY) & @CRLF & _
"LWA_ALPHA: " & (BitAND($info,$LWA_ALPHA)=$LWA_ALPHA) )
Case $msg = $GUI_EVENT_CLOSE
Exit MsgBox(0, '', "Close from Layered GUI")
EndSelect
EndSwitch
WEnd


Function _WinAPI_GetModuleHandle

Function Reference

_WinAPI_GetModuleHandle

Returns a module handle for the specified module

#Include <WinAPI.au3>
_WinAPI_GetModuleHandle($sModuleName)

Parameters

$sModuleName Names a Win32 module (either a .DLL or .EXE file). If the filename extension is omitted, the
default library extension .DLL is appended. The filename string can include a trailing point character (.) to
indicate that the module name has no extension. The string does not have to specify a path. The name is
compared (case independently) to the names of modules currently mapped into the address space of the calling
process. If this parameter is 0 the function returns a handle of the file used to create the calling process.

Return Value

Success: | The handle to the specified module
Failure: | 0

Remarks

None.

Related

See Also

Search GetModuleHandle in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Opt('MustDeclareVars', 1)

Global $hHook, $hStub_KeyProc, $buffer = ""

_Main()

Func _Main()
OnAutoItExitRegister("Cleanup")

Local $hmod

$hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
$hmod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)

MsgBox(4096, "", "Click OK, then in notepad type..." & _
@LF & @LF & "Jon" & @LF & "AutoIt" & @LF & @LF & "Press Esc to exit script")

Run("Notepad")
WinWait("Untitled -")
WinActivate("Untitled -")

While 1
Sleep(10)
WEnd
EndFunc ;==>_Main

Func EvaluateKey($keycode)
If (($keycode > 64) And ($keycode < 91)) _ ; a - z
Or (($keycode > 96) And ($keycode < 123)) _ ; A - Z
Or (($keycode > 47) And ($keycode < 58)) Then ; 0 - 9
$buffer &= Chr($keycode)
Switch $buffer
Case "Jon"
ToolTip("What can you say?")
Case "AutoIt"
ToolTip("AutoIt Rocks")
EndSwitch
ElseIf ($keycode > 159) And ($keycode < 164) Then
Return
ElseIf ($keycode = 27) Then ; esc key
Exit
Else
$buffer = ""
EndIf
EndFunc ;==>EvaluateKey

;===========================================================
; callback function
;===========================================================
Func _KeyProc($nCode, $wParam, $lParam)
Local $tKEYHOOKS
$tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
If $nCode < 0 Then
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndIf
If $wParam = $WM_KEYDOWN Then
EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
Else
Local $flags = DllStructGetData($tKEYHOOKS, "flags")
Switch $flags
Case $LLKHF_ALTDOWN
ConsoleWrite("$LLKHF_ALTDOWN" & @CRLF)
Case $LLKHF_EXTENDED
ConsoleWrite("$LLKHF_EXTENDED" & @CRLF)
Case $LLKHF_INJECTED
ConsoleWrite("$LLKHF_INJECTED" & @CRLF)
Case $LLKHF_UP
ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @CRLF)
EndSwitch
EndIf
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc ;==>_KeyProc

Func Cleanup()
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallbackFree($hStub_KeyProc)
EndFunc ;==>Cleanup


Function _WinAPI_GetMousePos

Function Reference

_WinAPI_GetMousePos

Returns the current mouse position

#Include <WinAPI.au3>
_WinAPI_GetMousePos([$fToClient = False [, $hWnd = 0]])

Parameters

$fToClient | [optional] If True, the coordinates will be converted to client coordinates
$hWnd | [optional] Window handle used to convert coordinates if $fToClient is True

Return Value

Success: | $tagPOINT structure with current mouse position
Failure: | set @error

Remarks

This function takes into account the current MouseCoordMode setting when obtaining the mouse position. It
will also convert screen to client coordinates based on the parameters passed.

Related

$tagPOINT, _WinAPI_GetMousePosX, _WinAPI_GetMousePosY

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd = GUICreate("test")
Local $tPoint = _WinAPI_GetMousePos()
Local $tPoint2 = _WinAPI_GetMousePos(True, $hwnd)

MsgBox(4096, "Mouse Pos", _
"X = " & DllStructGetData($tPoint, "X") & @LF & "Y = " & DllStructGetData($tPoint, "Y") & @LF & @LF & _
"Client" & @LF & "X = " & DllStructGetData($tPoint2, "X") & @LF & "Y = " & DllStructGetData($tPoint2, "Y"))
EndFunc ;==>_Main


Function _WinAPI_GetMousePosX

Function Reference

_WinAPI_GetMousePosX

Returns the current mouse X position

#Include <WinAPI.au3>
_WinAPI_GetMousePosX([$fToClient = False [, $hWnd = 0]])

Parameters

$fToClient | [optional] If True, the coordinates will be converted to client coordinates
$hWnd | [optional] Window handle used to convert coordinates if $fToClient is True

Return Value

Success: | Mouse X position
Failure: | set @error

Remarks

This function takes into account the current MouseCoordMode setting when obtaining the mouse position. It
will also convert screen to client coordinates based on the parameters passed.

Related

_WinAPI_GetMousePos

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd = GUICreate("test")
Local $iX = _WinAPI_GetMousePosX()
Local $iX2 = _WinAPI_GetMousePosX(True, $hwnd)
Local $iY = _WinAPI_GetMousePosY()
Local $iY2 = _WinAPI_GetMousePosY(True, $hwnd)

MsgBox(4096, "Mouse Pos", "X = " & $iX & @LF & "Y = " & $iY & @LF & @LF & _
"Client" & @LF & "X = " & $iX2 & @LF & "Y = " & $iY2)
EndFunc ;==>_Main


Function _WinAPI_GetMousePosY

Function Reference

_WinAPI_GetMousePosY

Returns the current mouse Y position

#Include <WinAPI.au3>
_WinAPI_GetMousePosY([$fToClient = False [, $hWnd = 0]])

Parameters

$fToClient | [optional] If True, the coordinates will be converted to client coordinates
$hWnd | [optional] Window handle used to convert coordinates if $fToClient is True

Return Value

Success: | Mouse Y position
Failure: | set @error

Remarks

This function takes into account the current MouseCoordMode setting when obtaining the mouse position. It
will also convert screen to client coordinates based on the parameters passed.

Related

_WinAPI_GetMousePos

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd = GUICreate("test")
Local $iX = _WinAPI_GetMousePosX()
Local $iX2 = _WinAPI_GetMousePosX(True, $hwnd)
Local $iY = _WinAPI_GetMousePosY()
Local $iY2 = _WinAPI_GetMousePosY(True, $hwnd)

MsgBox(4096, "Mouse Pos", "X = " & $iX & @LF & "Y = " & $iY & @LF & @LF & _
"Client" & @LF & "X = " & $iX2 & @LF & "Y = " & $iY2)
EndFunc ;==>_Main


Function _WinAPI_GetObject

Function Reference

_WinAPI_GetObject

Retrieves information for the specified graphics object

#Include <WinAPI.au3>
_WinAPI_GetObject($hObject, $iSize, $pObject)

Parameters

$hObject | Identifies a logical pen, brush, font, bitmap, region, or palette
$iSize | Specifies the number of bytes to be written to the buffer
$pObject | Pointer to a buffer that receives the information. The following shows the type of information the buffer receives for each type of graphics object you can specify: HBITMAP - BITMAP or DIBSECTION HPALETTE - A count of the number of entries in the logical palette HPEN - EXTLOGPEN or LOGPEN HBRUSH - LOGBRUSH HFONT - LOGFONT
 | If $pObject is 0 the function return value is the number of bytes required to store the information it writes to the buffer for the specified graphics object.

Return Value

Success: | If $pObject is a valid pointer, the return value is the number of bytes stored into the buffer.
 | If the function succeeds, and $pObject is 0, the return value is the number of bytes required to hold the information the function would store into the buffer.
Failure: | 0

Remarks

None.

Related

See Also

Search GetObject in MSDN Library


Function _WinAPI_GetOpenFileName

Function Reference

_WinAPI_GetOpenFileName

Creates an Open dialog box that lets the user specify the drive, directory, and the name of a file or set of files to open

#Include <WinAPI.au3>
_WinAPI_GetOpenFileName([$sTitle = "" [, $sFilter = "All files (*.*)" [, $sInitalDir = "." [, $sDefaultFile = "" [, $sDefaultExt = "" [, $iFilterIndex = 1 [, $iFlags = 0 [, $iFlagsEx = 0 [, $hwndOwner = 0]]]]]]]]])

Parameters

$sTitle | [optional] string to be placed in the title bar of the dialog box
$sFilter | [optional] Pairs of filter strings (for example "Text Files (*.txt)|All Files (*.*)") The first string in each pair is a display string that describes the filter (for example, "Text Files") The second string specifies the filter pattern (for example, "*.TXT") To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK") A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character Do not include spaces in the pattern string.
$sInitalDir | [optional] String that can specify the initial directory
$sDefaultFile | [optional] A file name used to initialize the File Name edit control
$sDefaultExt | [optional] String that contains the default extension
$iFilterIndex | [optional] Specifies the index of the currently selected filter in the File Types control
$iFlags | [optional] See Flags in $tagOPENFILENAME information
$iFlagsEx | [optional] See FlagEx in $tagOPENFILENAME information
$hwndOwner | [optional] Handle to the window that owns the dialog box. This member can be any valid window handle, or it can be 0 if the dialog box has no owner

Return Value

Success: | Array in the following format:
 | [0] - Contains the number of strings
 | [1] - Contains the path selected
 | [2] - Contains file selected
 | [n] - Contains file selected
Failure: | Array of 1 item set to 0

Remarks

None.

Related

$tagOPENFILENAME, _WinAPI_GetSaveFileName, _WinAPI_CommDlgExtendedError

See Also

Search GetOpenFileName in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <StructureConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Example_Defaults()
_Example_ExplorerStyleMultiSelect()
_Example_OldStyle()
_Example_ExplorerStyleSinglSelect()
_Example_ExplorerStyle_NoPlaceBar()

Func _Example_Defaults()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetOpenFileName use defaults", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Open Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetOpenFileName() ; use defaults
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_Defaults

Func _Example_ExplorerStyleMultiSelect()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetOpenFileName use Explorer Style (Multi Select)", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Open Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetOpenFileName("My Open File Dialog", _
"Text File (*.txt;*.au3)", ".", @ScriptName, "", 1, _
BitOR($OFN_ALLOWMULTISELECT, $OFN_EXPLORER), 0, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_ExplorerStyleMultiSelect

Func _Example_OldStyle()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetOpenFileName use Old Style (Multi Select)", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Open Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetOpenFileName("My Open File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", @ScriptName, _
"", 2, $OFN_ALLOWMULTISELECT, 0, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_OldStyle

Func _Example_ExplorerStyleSinglSelect()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetOpenFileName use Explorer Style (Single Select)", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Open Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetOpenFileName("My Open File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", @ScriptName, _
"", 2, 0, 0, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_ExplorerStyleSinglSelect

Func _Example_ExplorerStyle_NoPlaceBar()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetOpenFileName use Explorer Style (Single Select)", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Open Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetOpenFileName("My Open File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", @ScriptName, _
"", 2, BitOR($OFN_ALLOWMULTISELECT, $OFN_EXPLORER), $OFN_EX_NOPLACESBAR, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_ExplorerStyle_NoPlaceBar

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _WinAPI_GetOverlappedResult

Function Reference

_WinAPI_GetOverlappedResult

Retrieves the results of an overlapped operation

#Include <WinAPI.au3>
_WinAPI_GetOverlappedResult($hFile, $pOverlapped, ByRef $iBytes [, $fWait = False])

Parameters

$hFile | Handle to the file, named pipe, or communications device. This is the same handle that was specified when the overlapped operation was started by a call to ReadFile, WriteFile, ConnectNamedPipe, TransactNamedPipe, DeviceIoControl, or WaitCommEvent.
$pOverlapped | Pointer to the $tagOVERLAPPED structure that was specified when the overlapped operation was started.
$iBytes | The number of bytes that were actually transferred by a read or write operation. For a TransactNamedPipe operation, this is the number of bytes that were read from the pipe. For a DeviceIoControl operation this is the number of bytes of output data returned by the device driver. For a ConnectNamedPipe or WaitCommEvent operation, this value is undefined.
$fWait | [optional] If True, the function does not return until the operation has been completed. If False and the operation is still pending, the function returns False and the GetLastError function will return ERROR_IO_INCOMPLETE.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagOVERLAPPED

See Also

Search GetOverlappedResult in MSDN Library


Function _WinAPI_GetParent

Function Reference

_WinAPI_GetParent

Retrieves the handle of the specified child window's parent window

#Include <WinAPI.au3>
_WinAPI_GetParent($hWnd)

Parameters

$hWnd Window handle of child window

Return Value

Success: | The handle of the parent window
Failure: | 0

Remarks

None.

Related

See Also

Search GetParent in MSDN Library


Function _WinAPI_GetProcessAffinityMask

Function Reference

_WinAPI_GetProcessAffinityMask

Obtains a affinity masks for the process and the system

#Include <WinAPI.au3>
_WinAPI_GetProcessAffinityMask($hProcess)

Parameters

$hProcess An open handle to the process whose affinity mask is desired.

Return Value

Success: | Array with the following format:
 | $aMask[0] - True on success, otherwise False
 | $aMask[1] - Process affinity mask
 | $aMask[2] - System affinity mask
Failure: | set @error

Remarks

An affinity mask is a bit mask in which each bit represents a processor on which the threads of the process
are allowed to run. For example, if you pass a mask of 0x05, processors 1 and 3 are allowed to run.

Related

See Also

Search GetProcessAffinityMask in MSDN Library


Function _WinAPI_GetSaveFileName

Function Reference

_WinAPI_GetSaveFileName

Creates a Save dialog box that lets the user specify the drive, directory, and name of a file to save

#Include <WinAPI.au3>
_WinAPI_GetSaveFileName([$sTitle = "" [, $sFilter = "All files (*.*)" [, $sInitalDir = "." [, $sDefaultFile = "" [, $sDefaultExt = "" [, $iFilterIndex = 1 [, $iFlags = 0 [, $iFlagsEx = 0 [, $hwndOwner = 0]]]]]]]]])

Parameters

$sTitle | [optional] string to be placed in the title bar of the dialog box
$sFilter | [optional] Pairs of filter strings (for example "Text Files (*.txt)|All Files (*.*)") The first string in each pair is a display string that describes the filter (for example, "Text Files") The second string specifies the filter pattern (for example, "*.TXT") To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK") A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character Do not include spaces in the pattern string.
$sInitalDir | [optional] String that can specify the initial directory
$sDefaultFile | [optional] A file name used to initialize the File Name edit control
$sDefaultExt | [optional] String that contains the default extension
$iFilterIndex | [optional] Specifies the index of the currently selected filter in the File Types control
$iFlags | [optional] See Flags in $tagOPENFILENAME information
$iFlagsEx | [optional] See FlagEx in $tagOPENFILENAME information
$hwndOwner | [optional] Handle to the window that owns the dialog box. This member can be any valid window handle, or it can be 0 if the dialog box has no owner

Return Value

Success: | Array in the following format:
 | [0] - Contains the number of strings (2)
 | [1] - Contains the path selected
 | [2] - Contains file selected
Failure: | Array of 1 item set to 0

Remarks

None.

Related

$tagOPENFILENAME, _WinAPI_GetOpenFileName, _WinAPI_CommDlgExtendedError

See Also

Search GetSaveFileName in MSDN Library

Example

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <StructureConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Example_Defaults()
_Example_ExplorerStyle()
_Example_OldStyle()
_Example_ExplorerStyle_NoPlaceBar()

Func _Example_Defaults()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetSaveFileName use defaults", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Save Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetSaveFileName() ; use defaults
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_Defaults

Func _Example_ExplorerStyle()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetSaveFileName use Explorer Style", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Save Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetSaveFileName("My Save File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", _
"", "au3", 2, 0, 0, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_ExplorerStyle

Func _Example_OldStyle()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetSaveFileName use Old Style", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Save Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetSaveFileName("My Save File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", "", _
"", 2, $OFN_ALLOWMULTISELECT, 0, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_OldStyle

Func _Example_ExplorerStyle_NoPlaceBar()
Local $hGui, $btn_dialog, $aFile, $sError

; Create GUI
$hGui = GUICreate("GetSaveFileName use Explorer Style No Place Bar", 400, 296)
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, $WS_HSCROLL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
$btn_dialog = GUICtrlCreateButton("Save Dialog", 155, 270, 90, 20)
GUISetState()

While 1
Switch GUIGetMsg()
Case $btn_dialog
$aFile = _WinAPI_GetSaveFileName("My Save File Dialog", _
"Text File (*.txt)|AutoIt File (*.au3)", ".", "", _
"", 2, 0, $OFN_EX_NOPLACESBAR, $hGui)
If $aFile[0] = 0 Then
$sError = _WinAPI_CommDlgExtendedError()
MemoWrite("CommDlgExtendedError (" & @error & "): " & $sError)
Else
For $x = 1 To $aFile[0]
MemoWrite($aFile[$x])
Next
EndIf
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
GUIDelete($hGui)
EndFunc ;==>_Example_ExplorerStyle_NoPlaceBar

; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _WinAPI_GetStdHandle

Function Reference

_WinAPI_GetStdHandle

Retrieves a handle for the standard input, standard output, or standard error device

#Include <WinAPI.au3>
_WinAPI_GetStdHandle($iStdHandle)

Parameters

$iStdHandle Standard device for which a handle is to be returned. This can be one of the following values:
0 - Handle to the standard input device
1 - Handle to the standard output device
2 - Handle to the standard error device

Return Value

Success: | Handle to the specified device
Failure: | -1

Remarks

The handle has GENERIC_READ and GENERIC_WRITE access rights, unless the application has used SetStdHandle to
set a standard handle with lesser access. If an application does not have associated standard handles, the
return value is 0.

Related

See Also

Search GetStdHandle in MSDN Library


Function _WinAPI_GetStockObject

Function Reference

_WinAPI_GetStockObject

Retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes

#Include <WinAPI.au3>
_WinAPI_GetStockObject($iObject)

Parameters

$iObject Specifies the type of stock object. This parameter can be any one of the following values:
$BLACK_BRUSH - Black brush
$DKGRAY_BRUSH - Dark gray brush
$GRAY_BRUSH - Gray brush
$HOLLOW_BRUSH - Hollow brush (equivalent to NULL_BRUSH)
$LTGRAY_BRUSH - Light gray brush
$NULL_BRUSH - Null brush (equivalent to HOLLOW_BRUSH)
$WHITE_BRUSH - White brush
$BLACK_PEN - Black pen
$NULL_PEN - Null pen
$WHITE_PEN - White pen
$ANSI_FIXED_FONT - Windows fixed-pitch (monospace) system font
$ANSI_VAR_FONT - Windows variable-pitch (proportional space) system font
$DEVICE_DEFAULT_FONT - Device-dependent font
$DEFAULT_GUI_FONT - Default font for user interface objects
$OEM_FIXED_FONT - OEM dependent fixed-pitch (monospace) font
$SYSTEM_FONT - System font
$SYSTEM_FIXED_FONT - Fixed-pitch (monospace) system font used in Windows versions earlier than 3.0
$DEFAULT_PALETTE - Default palette. This palette consists of the static colors in the system palette.

Return Value

Success: | The logical object requested
Failure: | 0

Remarks

None.

Related

See Also

Search GetStockObject in MSDN Library


Function _WinAPI_GetSysColor

Function Reference

_WinAPI_GetSysColor

Retrieves the current color of the specified display element

#Include <WinAPI.au3>
_WinAPI_GetSysColor($iIndex)

Parameters

$iIndex The display element whose color is to be retrieved. Can be one of the following:
$COLOR_3DDKSHADOW - Dark shadow for three-dimensional display elements.
$COLOR_3DFACE - Face color for three-dimensional display elements and for dialog box backgrounds.
$COLOR_3DHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.)
$COLOR_3DHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.)
$COLOR_3DLIGHT - Light color for three-dimensional display elements (for edges facing the light source.)
$COLOR_3DSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source).
$COLOR_ACTIVEBORDER - Active window border.
$COLOR_ACTIVECAPTION - Active window title bar.
Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.
$COLOR_APPWORKSPACE - Background color of multiple document interface (MDI) applications.
$COLOR_BACKGROUND - Desktop.
$COLOR_BTNFACE - Face color for three-dimensional display elements and for dialog box backgrounds.
$COLOR_BTNHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.)
$COLOR_BTNHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.)
$COLOR_BTNSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source).
$COLOR_BTNTEXT - Text on push buttons.
$COLOR_CAPTIONTEXT - Text in caption, size box, and scroll bar arrow box.
$COLOR_DESKTOP - Desktop.
$COLOR_GRADIENTACTIVECAPTION - Right side color in the color gradient of an active window's title bar.
$COLOR_ACTIVECAPTION specifies the left side color.
Use SPI_GETGRADIENTCAPTIONS with the SystemParametersInfo function to determine whether the gradient effect is enabled.
$COLOR_GRADIENTINACTIVECAPTION - Right side color in the color gradient of an inactive window's title bar.
$COLOR_INACTIVECAPTION specifies the left side color.
$COLOR_GRAYTEXT - Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color.
$COLOR_HIGHLIGHT - Item(s) selected in a control.
$COLOR_HIGHLIGHTTEXT - Text of item(s) selected in a control.
$COLOR_HOTLIGHT - Color for a hyperlink or hot-tracked item.
$COLOR_INACTIVEBORDER - Inactive window border.
$COLOR_INACTIVECAPTION - Inactive window caption.
Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.
$COLOR_INACTIVECAPTIONTEXT - Color of text in an inactive caption.
$COLOR_INFOBK - Background color for tooltip controls.
$COLOR_INFOTEXT - Text color for tooltip controls.
$COLOR_MENU - Menu background.
$COLOR_MENUHILIGHT - The color used to highlight menu items when the menu appears as a flat menu.
The highlighted menu item is outlined with $COLOR_HIGHLIGHT.
Windows 2000: This value is not supported.
$COLOR_MENUBAR - The background color for the menu bar when menus appear as flat menus.
However, $COLOR_MENU continues to specify the background color of the menu popup.
Windows 2000: This value is not supported.
$COLOR_MENUTEXT - Text in menus.
$COLOR_SCROLLBAR - Scroll bar gray area.
$COLOR_WINDOW - Window background.
$COLOR_WINDOWFRAME - Window frame.
$COLOR_WINDOWTEXT - Text in windows.

Return Value

Returns The red, green, blue (RGB) color value of the given element

Remarks

Requires WindowsConstants.au3 for above constants.

If the $iIndex parameter is out of range, the return value is zero. Because zero is also a valid RGB value, you cannot use GetSysColor to determine whether a system color is supported by the current platform. Instead, use the GetSysColorBrush function, which returns NULL if the color is not supported.

Related

_WinAPI_SetSysColors

See Also

Search GetSysColor in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aElements[2] = [$COLOR_ACTIVECAPTION, $COLOR_GRADIENTACTIVECAPTION]
; Red and Yellow
Local $aColors[2] = [255, 65535], $aSaveColors[2]

GUICreate("My GUI", 300, 200)

$aSaveColors[0] = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION)
$aSaveColors[1] = _WinAPI_GetSysColor($COLOR_GRADIENTACTIVECAPTION)

_WinAPI_SetSysColors($aElements, $aColors)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop

EndSwitch
WEnd

GUIDelete()

_WinAPI_SetSysColors($aElements, $aSaveColors)

Exit

EndFunc ;==>_Main


Function _WinAPI_GetSysColorBrush

Function Reference

_WinAPI_GetSysColorBrush

retrieves a handle identifying a logical brush that corresponds to the specified color index

#Include <WinAPI.au3>
_WinAPI_GetSysColorBrush($iIndex)

Parameters

$iIndex The display element whose color is to be retrieved

Return Value

Success: | A logical brush if $iIndex is supported by the current platform
Failure: | 0

Remarks

None.

Related

See Also

Search GetSysColorBrush in MSDN Library


Function _WinAPI_GetSystemMetrics

Function Reference

_WinAPI_GetSystemMetrics

Retrieves the specified system metric or system configuration setting

#Include <WinAPI.au3>
_WinAPI_GetSystemMetrics($iIndex)

Parameters

$iIndex The system metric or configuration setting to be retrieved

Return Value

Success: | The requested system metric
Failure: | 0

Remarks

None.

Related

See Also

Search GetSystemMetrics in MSDN Library


Function _WinAPI_GetTextExtentPoint32

Function Reference

_WinAPI_GetTextExtentPoint32

Computes the width and height of the specified string of text

#Include <WinAPI.au3>
_WinAPI_GetTextExtentPoint32($hDC, $sText)

Parameters

$hDC | Identifies the device contex
$sText | String of text

Return Value

Success: | $tagSIZE structure in which the dimensions of the string are to be returned
Failure: | set @error

Remarks

None.

Related

$tagSIZE

See Also

Search GetTextExtentPoint32 in MSDN Library


Function _WinAPI_GetWindow

Function Reference

_WinAPI_GetWindow

Retrieves the handle of a window that has a specified relationship to the specified window

#Include <WinAPI.au3>
_WinAPI_GetWindow($hWnd, $iCmd)

Parameters

$hWnd Handle of the window
$iCmd Specifies the relationship between the specified window and the window whose handle is to be
retrieved. This parameter can be one of the following values:
$GW_CHILD - The retrieved handle identifies the child window at the top of the Z order, if the specified
window is a parent window; otherwise, the retrieved handle is 0. The function examines only child windows of
the specified window. It does not examine descendant windows.
$GW_HWNDFIRST - The retrieved handle identifies the window of the same type that is highest in the Z order.
If the specified window is a topmost window, the handle identifies the topmost window that is highest in the
Z order. If the specified window is a top-level window, the handle identifies the top level window that is
highest in the Z order. If the specified window is a child window, the handle identifies the sibling window
that is highest in the Z order.
$GW_HWNDLAST - The retrieved handle identifies the window of the same type that is lowest in the Z order. If
the specified window is a topmost window, the handle identifies the topmost window that is lowest in the Z
order. If the specified window is a top-level window the handle identifies the top-level window that's lowest
in the Z order. If the specified window is a child window, the handle identifies the sibling window that is
lowest in the Z order.
$GW_HWNDNEXT - The retrieved handle identifies the window below the specified window in the Z order. If the
specified window is a topmost window, the handle identifies the topmost window below the specified window. If
the specified window is a top-level window, the handle identifies the top-level window below the specified
window. If the specified window is a child window the handle identifies the sibling window below the
specified window.
$GW_HWNDPREV - The retrieved handle identifies the window above the specified window in the Z order. If the
specified window is a topmost window, the handle identifies the topmost window above the specified window. If
the specified window is a top-level window, the handle identifies the top-level window above the specified
window. If the specified window is a child window, the handle identifies the sibling window above the
specified window.
$GW_OWNER - The retrieved handle identifies the specified window's owner window if any

Return Value

Success: | The window handle
Failure: | 0

Remarks

Needs Constants.au3 for pre-defined constants

Related

See Also

Search GetWindow in MSDN Library


Function _WinAPI_GetWindowDC

Function Reference

_WinAPI_GetWindowDC

Retrieves the device context (DC) for the entire window

#Include <WinAPI.au3>
_WinAPI_GetWindowDC($hWnd)

Parameters

$hWnd Handle of window

Return Value

Success: | The handle of a device context for the specified window
Failure: | 0

Remarks

GetWindowDC is intended for special painting effects within a window's nonclient area. Painting in nonclient
areas of any window is normally not recommended. The GetSystemMetrics function can be used to retrieve the
dimensions of various parts of the nonclient area, such as the title bar, menu, and scroll bars. After
painting is complete, the _WinAPI_ReleaseDC function must be called to release the device context. Not releasing
the window device context has serious effects on painting requested by applications.

Related

_WinAPI_ReleaseDC

See Also

Search GetWindowDC in MSDN Library


Function _WinAPI_GetWindowHeight

Function Reference

_WinAPI_GetWindowHeight

Returns the height of the window

#Include <WinAPI.au3>
_WinAPI_GetWindowHeight($hWnd)

Parameters

$hWnd Handle to a window

Return Value

Success: | Height of window
Failure: | set @error

Remarks

None.

Related

_WinAPI_GetWindowWidth


Function _WinAPI_GetWindowLong

Function Reference

_WinAPI_GetWindowLong

Retrieves information about the specified window

#Include <WinAPI.au3>
_WinAPI_GetWindowLong($hWnd, $iIndex)

Parameters

$hWnd | Handle of the window
$iIndex | Specifies the zero based offset to the value to be retrieved. Valid values are in the range zero through the number of bytes of extra window memory, minus four; for example, if you specified 12 or more bytes of extra memory, a value of 8 would be an index to the third 32 bit integer. To retrieve any other value, specify one of the following values: $GWL_EXSTYLE - Retrieves the extended window styles $GWL_STYLE - Retrieves the window styles $GWL_WNDPROC - Retrieves the address of the window procedure $GWL_HINSTANCE - Retrieves the handle of the application instance $GWL_HWNDPARENT - Retrieves the handle of the parent window, if any $GWL_ID - Retrieves the identifier of the window $GWL_USERDATA - Retrieves the 32-bit value associated with the window

Return Value

Success: | The requested value
Failure: | set @error

Remarks

Needs Constants.au3 for pre-defined constants

Related

_WinAPI_SetWindowLong

See Also

Search GetWindowLongPtr in MSDN Library


Function _WinAPI_GetWindowPlacement

Function Reference

_WinAPI_GetWindowPlacement

Retrieves the placement of the window for Min, Max, and normal positions

#Include <WinAPI.au3>
_WinAPI_GetWindowPlacement($hWnd)

Parameters

$hWnd Handle of the window

Return Value

Success: | $tagWINDOWPLACEMENT structure with the placement coordinates
Failure: | 0, @error = 1, @extended = _WinAPI_GetLastError()

Remarks

None.

Related

_WinAPI_SetWindowPlacement, $tagWINDOWPLACEMENT

See Also

Search GetWindowPlacement in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $hWindow, $stRET, $sMsg, $pStruct, $iRET

; Create an instance of notepad to play with
Run("notepad.exe")
WinWait("[CLASS:Notepad]")
$hWindow = WinGetHandle("[CLASS:Notepad]")
WinMove($hWindow, "", 256, 256, 400, 400)
Sleep(1000)

; Minimize and then check the placement values returned by _WinAPI_GetWindowPlacement()
WinSetState($hWindow, "", @SW_MINIMIZE)
$stRET = _WinAPI_GetWindowPlacement($hWindow)
If @error = 0 Then
$sMsg = "$stWindowPlacement:" & @CRLF & @CRLF
$sMsg &= @TAB & "length = " & DllStructGetData($stRET, "length") & @CRLF
$sMsg &= @TAB & "flags = " & DllStructGetData($stRET, "flags") & @CRLF
$sMsg &= @TAB & "showCmd = " & DllStructGetData($stRET, "showCmd") & @CRLF & @CRLF
$sMsg &= "ptMinPosition:" & @CRLF
$sMsg &= @TAB & "MinX = " & DllStructGetData($stRET, "ptMinPosition", 1) & @CRLF
$sMsg &= @TAB & "MinY = " & DllStructGetData($stRET, "ptMinPosition", 2) & @CRLF & @CRLF
$sMsg &= "ptMaxPosition:" & @CRLF
$sMsg &= @TAB & "MaxX = " & DllStructGetData($stRET, "ptMaxPosition", 1) & @CRLF
$sMsg &= @TAB & "MaxY = " & DllStructGetData($stRET, "ptMaxPosition", 2) & @CRLF & @CRLF
$sMsg &= "rcNormalPosition:" & @CRLF
$sMsg &= @TAB & "left = " & DllStructGetData($stRET, "rcNormalPosition", 1) & @CRLF
$sMsg &= @TAB & "top = " & DllStructGetData($stRET, "rcNormalPosition", 2) & @CRLF
$sMsg &= @TAB & "right = " & DllStructGetData($stRET, "rcNormalPosition", 3) & @CRLF
$sMsg &= @TAB & "bottom = " & DllStructGetData($stRET, "rcNormalPosition", 4)
MsgBox(64, "Success", $sMsg)

; Change the normalized rectangle with _WinAPI_SetWindowPlacement() and then restore
DllStructSetData($stRET, "rcNormalPosition", 128, 1); left
DllStructSetData($stRET, "rcNormalPosition", 128, 2); top
DllStructSetData($stRET, "rcNormalPosition", @DesktopWidth - 128, 3); right
DllStructSetData($stRET, "rcNormalPosition", @DesktopHeight - 128, 4); bottom
$pStruct = DllStructGetPtr($stRET); Get pointer to the modified struct
$iRET = _WinAPI_SetWindowPlacement($hWindow, $pStruct)
If @error = 0 Then
WinSetState($hWindow, "", @SW_RESTORE)
ControlSetText($hWindow, "", "Edit1", "_WinAPI_SetWindowPlacement() succeeded!")
Else
MsgBox(16, "Error", "_WinAPI_SetWindowPlacement() failed!" & @CRLF & _
"$iRET = " & $iRET & @CRLF & _
"@error = " & @error & @CRLF & _
"@extended = " & @extended)
EndIf
Else
MsgBox(16, "Error", "_WinAPI_GetWindowPlacement() failed!" & @CRLF & _
"$stRET = " & $stRET & @CRLF & _
"@error = " & @error & @CRLF & _
"@extended = " & @extended)
EndIf


Function _WinAPI_GetWindowRect

Function Reference

_WinAPI_GetWindowRect

Retrieves the dimensions of the bounding rectangle of the specified window

#Include <WinAPI.au3>
_WinAPI_GetWindowRect($hWnd)

Parameters

$hWnd Handle of the window

Return Value

Success: | $tagRECT structure that receives the screen coordinates
Failure: | set @error

Remarks

None.

Related

$tagRECT

See Also

Search GetWindowRect in MSDN Library


Function _WinAPI_GetWindowRgn

Function Reference

_WinAPI_GetWindowRgn

Obtains a copy of the window region of a window

#Include <WinAPI.au3>
_WinAPI_GetWindowRgn($hWnd, $hRgn)

Parameters

$hWnd | Handle to the window whose window region is to be obtained.
$hRgn | Handle to the region which will be modified to represent the window region.

Return Value

Success: | Specifies the type of the region that the function obtains. It can be one of the following values
 | $NULLREGION - The region is empty.
 | $SIMPLEREGION - The region is a single rectangle.
 | $COMPLEXREGION - The region is more than one rectangle.
Failure: | 0 The specified window does not have a region, or an error occurred while attempting to return the region.

Remarks

The window region of a window is set by calling the SetWindowRgn function.
The window region determines the area within the window where the system permits drawing.
The system does not display any portion of a window that lies outside of the window region
The coordinates of a window's window region are relative to the upper-left corner of the window, not the client area of the window.
To set the window region of a window, call the SetWindowRgn function.

Related

_WinAPI_CreateRectRgn, _WinAPI_CreateRoundRectRgn, _WinAPI_CombineRgn, _WinAPI_SetWindowRgn

See Also

Search GetWindowRgn in MSDN Library


Function _WinAPI_GetWindowText

Function Reference

_WinAPI_GetWindowText

Retrieves the text of the specified window's title bar

#Include <WinAPI.au3>
_WinAPI_GetWindowText($hWnd)

Parameters

$hWnd Handle of the window

Return Value

Success: | Windows title bar
Failure: | set @error

Remarks

None.

Related

See Also

Search GetWindowText in MSDN Library


Function _WinAPI_GetWindowThreadProcessId

Function Reference

_WinAPI_GetWindowThreadProcessId

Retrieves the identifier of the thread that created the specified window

#Include <WinAPI.au3>
_WinAPI_GetWindowThreadProcessId($hWnd, ByRef $iPID)

Parameters

$hWnd | Window handle
$iPID | Returns the Process ID of the specified window

Return Value

Returns the Thread ID of the specified window

Remarks

None.

Related

_WinAPI_GetCurrentProcessID

See Also

Search GetWindowThreadProcessId in MSDN Library


Function _WinAPI_GetWindowWidth

Function Reference

_WinAPI_GetWindowWidth

Returns the width of the window

#Include <WinAPI.au3>
_WinAPI_GetWindowWidth($hWnd)

Parameters

$hWnd Handle to a window

Return Value

Success: | Width of window
Failure: | set @error

Remarks

None.

Related

_WinAPI_GetWindowHeight


Function _WinAPI_GetXYFromPoint

Function Reference

_WinAPI_GetXYFromPoint

Returns the X/Y values from a $tagPOINT structure

#Include <WinAPI.au3>
_WinAPI_GetXYFromPoint(ByRef $tPoint, ByRef $iX, ByRef $iY)

Parameters

$tPoint | $tagPOINT structure
$iX | Returns X value
$iY | Returns Y value

Return Value

None.

Remarks

This function extracts the X/Y values from a $tagPOINT structure

Related


Function _WinAPI_GlobalMemoryStatus

Function Reference

_WinAPI_GlobalMemoryStatus

Retrieves information about current available memory

#Include <WinAPI.au3>
_WinAPI_GlobalMemoryStatus()

Parameters

None.

Return Value

Returns an Array with the following format:
$aMem[0] - Percent of Mem in use
$aMem[1] - Physical Mem: Total
$aMem[2] - Physical Mem: Free
$aMem[3] - Paging file: Total
$aMem[4] - Paging file: Free
$aMem[5] - User Mem: Total
$aMem[6] - User Mem: Free

Remarks

Unlike the AutoIt MemGetStats() function, this function returns the values in bytes

Related

See Also

Search GlobalMemoryStatusEx in MSDN Library


Function _WinAPI_GUIDFromString

Function Reference

_WinAPI_GUIDFromString

Converts a string GUID to binary form

#Include <WinAPI.au3>
_WinAPI_GUIDFromString($sGUID)

Parameters

$sGUID GUID in string form

Return Value

Success: | $tagGUID structure
Failure: | set @error

Remarks

None.

Related

_WinAPI_StringFromGUID, $tagGUID


Function _WinAPI_GUIDFromStringEx

Function Reference

_WinAPI_GUIDFromStringEx

Converts a string GUID to binary form

#Include <WinAPI.au3>
_WinAPI_GUIDFromStringEx($sGUID, $pGUID)

Parameters

$sGUID | GUID in string form
$pGUID | Pointer to a $tagGUID structure where the GUID will be stored

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_StringFromGUID, $tagGUID

See Also

Search CLSIDFromString in MSDN Library


Function _WinAPI_HiWord

Function Reference

_WinAPI_HiWord

Returns the high word of a longword value

#Include <WinAPI.au3>
_WinAPI_HiWord($iLong)

Parameters

$iLong Longword value

Return Value

Returns an High order word of the longword value

Remarks

None.

Related

_WinAPI_LoWord, _WinAPI_MakeLong

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

_Main()

Func _Main()
Local $iWord = 11 * 65535
MsgBox(0, $iWord, "HiWord: " & _WinAPI_HiWord($iWord) & @LF & "LoWord: " & _WinAPI_LoWord($iWord))
EndFunc ;==>_Main


Function _WinAPI_InProcess

Function Reference

_WinAPI_InProcess

Determines whether a window belongs to the current process

#Include <WinAPI.au3>
_WinAPI_InProcess($hWnd, ByRef $hLastWnd)

Parameters

$hWnd | Window handle to be tested
$hLastWnd | Last window tested. If $hWnd = $hLastWnd, this process will immediately return True. Otherwise, _WinAPI_InProcess will be called. If $hWnd is in process, $hLastWnd will be set to $hWnd on return.

Return Value

True: | Window handle belongs to the current process
False: | Window handle does not belong to the current process

Remarks

This is one of the key functions to the control memory mapping technique. It checks the process ID of the
window to determine if it belongs to the current process, which means it can be accessed without mapping the control memory.

Related


Function _WinAPI_IntToFloat

Function Reference

_WinAPI_IntToFloat

Returns a 4 byte integer as a float value

#Include <WinAPI.au3>
_WinAPI_IntToFloat($iInt)

Parameters

$iInt Integer value

Return Value

Returns a 4 byte integer value as a float

Remarks

None.

Related

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

MsgBox(0, "", _WinAPI_IntToFloat(12389654))


Function _WinAPI_InvalidateRect

Function Reference

_WinAPI_InvalidateRect

Adds a rectangle to the specified window's update region

#Include <WinAPI.au3>
_WinAPI_InvalidateRect($hWnd [, $tRect = 0 [, $fErase = True]])

Parameters

$hWnd | Handle to windows
$tRect | [optional] $tagRECT structure that contains the client coordinates of the rectangle to be added to the update region. If this parameter is 0 the entire client area is added to the update region.
$fErase | [optional] Specifies whether the background within the update region is to be erased when the update region is processed. If this parameter is True the background is erased when the BeginPaint function is called. If this parameter is False, the background remains unchanged.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagRECT

See Also

Search InvalidateRect in MSDN Library


Function _WinAPI_IsClassName

Function Reference

_WinAPI_IsClassName

Wrapper to check ClassName of the control.

#Include <WinAPI.au3>
_WinAPI_IsClassName($hWnd, $sClassName)

Parameters

$hWnd | Handle to a control
$sClassName | Class name to check

Return Value

True: | $sClassName matches ClassName retrieved from $hWnd
False: | $sClassName does not match ClassName retrieved from $hWnd

Remarks

Used for checking correct $hWnd is passed into function

Related


Function _WinAPI_IsWindow

Function Reference

_WinAPI_IsWindow

Determines whether the specified window handle identifies an existing window

#Include <WinAPI.au3>
_WinAPI_IsWindow($hWnd)

Parameters

$hWnd Handle to be tested

Return Value

Success: | Handle is a window
Failure: | Handle is not a window

Remarks

None.

Related

See Also

Search IsWindow in MSDN Library


Function _WinAPI_IsWindowVisible

Function Reference

_WinAPI_IsWindowVisible

Retrieves the visibility state of the specified window

#Include <WinAPI.au3>
_WinAPI_IsWindowVisible($hWnd)

Parameters

$hWnd Handle of window

Return Value

True: | Window is visible
Failse: | Window is not visible

Remarks

The visibility state of a window is indicated by the $WS_VISIBLE style bit. When $WS_VISIBLE is set, the window
is displayed and subsequent drawing into it is displayed as long as the window has the $WS_VISIBLE style.

Related

See Also

Search IsWindowVisible in MSDN Library


Function _WinAPI_LineTo

Function Reference

_WinAPI_LineTo

Draws a line from the current position up to, but not including, the specified point.

#Include <WinAPI.au3>
_WinAPI_LineTo($hDC, $iX, $iY)

Parameters

$hDC | Handle to device context
$iX | X coordinate of the line's ending point.
$iY | Y coordinate of the line's ending point.

Return Value

Success: | True
Failure: | False

Remarks

The line is drawn by using the current pen and, if the pen is a geometric pen, the current brush.
If LineTo succeeds, the current position is set to the specified ending point.

Related

_WinAPI_MoveTo, _WinAPI_DrawLine, _WinAPI_SelectObject, _WinAPI_CreatePen

See Also

Search LineTo in MSDN Library

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_LoadBitmap

Function Reference

_WinAPI_LoadBitmap

Loads the specified bitmap resource from a module's executable file

#Include <WinAPI.au3>
_WinAPI_LoadBitmap($hInstance, $sBitmap)

Parameters

$hInstance | Handle to the instance of the module whose executable file contains the bitmap to be loaded
$sBitmap | The name of the bitmap resource to be loaded. Alternatively this can consist of the resource identifier in the low order word and 0 in the high order word.

Return Value

Success: | The handle to the specified bitmap
Failure: | 0

Remarks

None.

Related

See Also

Search LoadBitmap in MSDN Library


Function _WinAPI_LoadImage

Function Reference

_WinAPI_LoadImage

Loads an icon, cursor, or bitmap

#Include <WinAPI.au3>
_WinAPI_LoadImage($hInstance, $sImage, $iType, $iXDesired, $iYDesired, $iLoad)

Parameters

$hInstance Identifies an instance of the module that contains the image to be loaded. To load an OEM
image, set this parameter to zero.
$sImage Identifies the image to load. If the $hInstance parameter is not 0 and the $iLoad parameter
does not include $LR_LOADFROMFILE $sImage is a string that contains the name of the image resource in the
$hInstance module. If $hInstance is 0 and $LR_LOADFROMFILE is not specified, the low-order word of this
parameter must be the identifier of the OEM image to load.
$iType Specifies the type of image to be loaded. This parameter can be one of the following values:
$IMAGE_BITMAP - Loads a bitmap
$IMAGE_CURSOR - Loads a cursor
$IMAGE_ICON - Loads an icon
$iXDesired Specifies the width, in pixels, of the icon or cursor. If this is 0
and $iLoad is LR_DEFAULTSIZE the function uses the SM_CXICON or SM_CXCURSOR system
metric value to set the width. If this parameter is 0 and LR_DEFAULTSIZE is not
used, the function uses the actual resource width.
$iYDesired Specifies the height, in pixels, of the icon or cursor. If this is 0
and $iLoad is LR_DEFAULTSIZE the function uses the SM_CYICON or SM_CYCURSOR system
metric value to set the height. If this parameter is 0 and LR_DEFAULTSIZE is not
used, the function uses the actual resource height.
$iLoad Specifies a combination of the following values:
$LR_DEFAULTCOLOR - The default flag
$LR_CREATEDIBSECTION - When the $iType parameter specifies $IMAGE_BITMAP, causes the function to return a DIB
section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping it
to the colors of the display device.
$LR_DEFAULTSIZE - Uses the width or height specified by the system metric values for cursors or icons if
the $iXDesired or $iYDesired values are set to 0. If this flag is not specified and $iXDesired and $iYDesired
are set to zero, the function uses the actual resource size. If the resource contains multiple images the
function uses the size of the first image.
$LR_LOADFROMFILE - Loads the image from the file specified by the $sImage parameter. If this flag is not
specified, $sImage is the name of the resource.
$LR_LOADMAP3DCOLORS - Searches the color table for the image and replaces the following shades of gray with
the corresponding 3D color:
Dk Gray: RGB(128,128,128) COLOR_3DSHADOW
Gray : RGB(192,192,192) COLOR_3DFACE
Lt Gray: RGB(223,223,223) COLOR_3DLIGHT
$LR_LOADTRANSPARENT - Gets the color value of the first pixel in the image and replaces the corresponding
entry in the color table with the default window color. All pixels in the image that use that entry become
the default window color. This value applies only to images that have corresponding color tables. If $iLoad
includes both the $LR_LOADTRANSPARENT and $LR_LOADMAP3DCOLORS values, $LRLOADTRANSPARENT takes precedence.
However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.
$LR_MONOCHROME - Loads the image in black and white
$LR_SHARED - Shares the image handle if the image is loaded multiple times. If LR_SHARED is not set,
a second call to LoadImage for the same resource will load the image again and return a different handle. Do
not use $LR_SHARED for images that have non-standard sizes, that may change after loading, or that are loaded
from a file.

Return Value

Success: | The handle of the newly loaded image
Failure: | 0

Remarks

Needs Constants.au3 for pre-definded constants

Related

See Also

Search LoadImage in MSDN Library


Function _WinAPI_LoadLibrary

Function Reference

_WinAPI_LoadLibrary

Maps a specified executable module into the address space of the calling process

#Include <WinAPI.au3>
_WinAPI_LoadLibrary($sFileName)

Parameters

$sFileName Names a Win32 executable module (either a .DLL or an .EXE file). The name specified is the
filename of the executable module.

Return Value

Success: | A handle to the executable module
Failure: | 0

Remarks

None.

Related

_WinAPI_LoadLibraryEx, _WinAPI_FreeLibrary

See Also

Search LoadLibrary in MSDN Library


Function _WinAPI_LoadLibraryEx

Function Reference

_WinAPI_LoadLibraryEx

Maps a specified executable module into the address space of the calling process

#Include <WinAPI.au3>
_WinAPI_LoadLibraryEx($sFileName [, $iFlags = 0])

Parameters

$sFileName | Names a Win32 executable module (either a .DLL or an .EXE file). The name specified is the filename of the executable module.
$iFlags | [optional] Specifies the action to take when loading the module. This parameter can be one of the following values: $DONT_RESOLVE_DLL_REFERENCES - If this value is used and the executable module is a DLL the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module. $LOAD_LIBRARY_AS_DATAFILE - If this value is used, the system maps the file into the calling process's address space as if it were a data file. Nothing is done to execute or prepare to execute the mapped file. $LOAD_WITH_ALTERED_SEARCH_PATH - If this value is used, and $FileName specifies a path, the system uses the alternate file search strategy to find the associated executable modules that the specified module causes to be loaded.

Return Value

Success: | A handle to the executable module
Failure: | 0

Remarks

Needs Constants.au3 for pre-defined constants

Related

_WinAPI_LoadLibrary, _WinAPI_FreeLibrary, _WinAPI_LoadString

See Also

Search LoadLibraryEx in MSDN Library

Example

#include <GuiReBar.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hInput, $btn_get, $hReBar, $hInstance, $sText
; Create GUI
$hGUI = GUICreate("WinAPI", 400, 396)

$hInput = GUICtrlCreateInput("4209", 0, 0, 100, 20)

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hGUI, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL))
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "String ID:")

$btn_get = GUICtrlCreateButton("Get String", 0, 0, 90, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($btn_get), 120, 200)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $btn_get
GUICtrlSetData($iMemo, "")
$hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE)
If $hInstance Then
$sText = _WinAPI_LoadString($hInstance, GUICtrlRead($hInput))
If Not @error Then
MemoWrite('Got the String (chars: ' & @extended & '): ' & @CRLF & $sText)
Else
MemoWrite("Last Error Message: " & @CRLF & _WinAPI_GetLastErrorMessage())
EndIf
MemoWrite(@CRLF & "Success Freeing? " & _WinAPI_FreeLibrary($hInstance))
EndIf
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _WinAPI_LoadShell32Icon

Function Reference

_WinAPI_LoadShell32Icon

Extracts an icon from the Shell32.dll file

#Include <WinAPI.au3>
_WinAPI_LoadShell32Icon($iIconID)

Parameters

$iIconID ID of the icon to extract

Return Value

Success: | Handle to the specified icon
Failure: | 0

Remarks

When you are done with the icon, call _WinAPI_DestroyIcon to release the icon handle

Related

_WinAPI_DestroyIcon


Function _WinAPI_LoadString

Function Reference

_WinAPI_LoadString

loads a string resource from the executable file associated with a specified module

#Include <WinAPI.au3>
_WinAPI_LoadString($hInstance, $iStringId)

Parameters

$hInstance | Handle to an instance of the module whose executable file contains the string resource
$iStringId | Specifies the integer identifier of the string to be loaded

Return Value

Success: | The string requested, @extended is the number of TCHARS copied
Failure: | Empty string and @error is set

Remarks

None.

Related

_WinAPI_LoadLibraryEx, _WinAPI_FreeLibrary

See Also

Search LoadString in MSDN Library

Example

#include <GuiReBar.au3>
#include <WinAPI.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Opt('MustDeclareVars', 1)

Global $iMemo

_Main()

Func _Main()
Local $hGUI, $hInput, $btn_get, $hReBar, $hInstance, $sText
; Create GUI
$hGUI = GUICreate("WinAPI", 400, 396)

$hInput = GUICtrlCreateInput("4209", 0, 0, 100, 20)

; create the rebar control
$hReBar = _GUICtrlReBar_Create($hGUI, BitOR($CCS_TOP, $WS_BORDER, $RBS_VARHEIGHT, $RBS_AUTOSIZE, $RBS_BANDBORDERS))

$iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL))
GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New")

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($hInput), 120, 200, "String ID:")

$btn_get = GUICtrlCreateButton("Get String", 0, 0, 90, 20)

;add band containing the control
_GUICtrlReBar_AddBand($hReBar, GUICtrlGetHandle($btn_get), 120, 200)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $btn_get
GUICtrlSetData($iMemo, "")
$hInstance = _WinAPI_LoadLibraryEx("shell32.dll", $LOAD_LIBRARY_AS_DATAFILE)
If $hInstance Then
$sText = _WinAPI_LoadString($hInstance, GUICtrlRead($hInput))
If Not @error Then
MemoWrite('Got the String (chars: ' & @extended & '): ' & @CRLF & $sText)
Else
MemoWrite("Last Error Message: " & @CRLF & _WinAPI_GetLastErrorMessage())
EndIf
MemoWrite(@CRLF & "Success Freeing? " & _WinAPI_FreeLibrary($hInstance))
EndIf
EndSwitch
WEnd
EndFunc ;==>_Main

; Write message to memo
Func MemoWrite($sMessage = "")
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite


Function _WinAPI_LocalFree

Function Reference

_WinAPI_LocalFree

Frees the specified local memory object and invalidates its handle

#Include <WinAPI.au3>
_WinAPI_LocalFree($hMem)

Parameters

$hMem A handle to the local memory object

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search LocalFree in MSDN Library


Function _WinAPI_LoWord

Function Reference

_WinAPI_LoWord

Returns the low word of a longword

#Include <WinAPI.au3>
_WinAPI_LoWord($iLong)

Parameters

$iLong Longword value

Return Value

Returns an low order word of the longword value

Remarks

None.

Related

_WinAPI_HiWord, _WinAPI_MakeLong

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>

_Main()

Func _Main()
Local $iWord = 11 * 65535
MsgBox(0, $iWord, "HiWord: " & _WinAPI_HiWord($iWord) & @LF & "LoWord: " & _WinAPI_LoWord($iWord))
EndFunc ;==>_Main


Function _WinAPI_MAKELANGID

Function Reference

_WinAPI_MAKELANGID

Construct language id from a primary language id and a sublanguage id

#Include <WinAPI.au3>
_WinAPI_MAKELANGID($lgidPrimary, $lgidSub)

Parameters

$lgidPrimary | Primary Language id
$lgidSub | Sub-Language id

Return Value

Returns the Language identifier

Remarks

None.

Related


Function _WinAPI_MAKELCID

Function Reference

_WinAPI_MAKELCID

Construct locale id from a language id and a sort id

#Include <WinAPI.au3>
_WinAPI_MAKELCID($lgid, $srtid)

Parameters

$lgid | Language id
$srtid | Sort id

Return Value

Returns a Locale identifier

Remarks

None.

Related


Function _WinAPI_MakeLong

Function Reference

_WinAPI_MakeLong

Returns a longint value from two int values

#Include <WinAPI.au3>
_WinAPI_MakeLong($iLo, $iHi)

Parameters

$iLo | Low word
$iHi | Hi word

Return Value

Returns a Longint value

Remarks

None.

Related

_WinAPI_HiWord, _WinAPI_LoWord


Function _WinAPI_MakeQWord

Function Reference

_WinAPI_MakeQWord

Returns a QWORD value from two int values

#Include <WinAPI.au3>
_WinAPI_MakeQWord($LoDWORD, $HiDWORD)

Parameters

$LoDWORD | Low DWORD (int)
$HiDWORD | Hi DWORD (int)

Return Value

Returns a QWORD (int64) value

Remarks

None.

Related


Function _WinAPI_MessageBeep

Function Reference

_WinAPI_MessageBeep

Plays a waveform sound

#Include <WinAPI.au3>
_WinAPI_MessageBeep([$iType = 1])

Parameters

$iType [optional] The sound type, as identified by an entry in the registry. This can be one of the following
values:
0 - Simple beep. If a sound card is not available, the speaker is used.
1 - OK
2 - Hand
3 - Question
4 - Exclamation
5 - Asterisk

Return Value

Success: | True
Failure: | False

Remarks

After queuing the sound, the MessageBeep function returns control to the calling function and plays the sound
asynchronously. If it cannot play the specified alert sound, MessageBeep attempts to play the system default
sound. If it cannot play the system default sound, the function produces a standard beep sound through the
computer speaker.

Related

See Also

Search MessageBeep in MSDN Library


Function _WinAPI_Mouse_Event

Function Reference

_WinAPI_Mouse_Event

Synthesizes mouse motion and button clicks

#Include <WinAPI.au3>
_WinAPI_Mouse_Event($iFlags [, $iX = 0 [, $iY = 0 [, $iData = 0 [, $iExtraInfo = 0]]]])

Parameters

$iFlags A set of flag bits that specify various aspects of mouse motion and button clicking. The bits
in this parameter can be any reasonable combination of the following values:
$MOUSEEVENTF_ABSOLUTE - Specifies that the $iX and $iY parameters contain normal absolute coordinates. If
not set, those parameters contain relative data. The change in position since the last reported position.
This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected
to the system.
$MOUSEEVENTF_ABSOLUTE - Specifies that the dx and dy parameters contain normalized absolute coordinates.
If not set, those parameters contain relative data: the change in position since the last reported position.
This flag can be set, or not set, regardless of what kind of mouse or mouse-like device, if any, is connected to the system.
$MOUSEEVENTF_MOVE - Specifies that movement occurred
$MOUSEEVENTF_LEFTDOWN - Specifies that the left button changed to down
$MOUSEEVENTF_LEFTUP - Specifies that the left button changed to up
$MOUSEEVENTF_RIGHTDOWN - Specifies that the right button changed to down
$MOUSEEVENTF_RIGHTUP - Specifies that the right button changed to up
$MOUSEEVENTF_MIDDLEDOWN - Specifies that the middle button changed to down
$MOUSEEVENTF_MIDDLEUP - Specifies that the middle button changed to up
$MOUSEEVENTF_WHEEL - Specifies that the wheel has been moved, if the mouse has a wheel
$MOUSEEVENTF_XDOWN - Specifies that an X button was pressed
$MOUSEEVENTF_XUP - Specifies that an X button was released
$iX [optional] Specifies the mouse's absolute position along the X axis or its amount of motion since the
last mouse event was generated depending on the setting of $MOUSEEVENTF_ABSOLUTE. Absolute data is given as
the mouse's actual X coordinate relative data is given as the number of mickeys moved.
$iY [optional] Specifies the mouse's absolute position along the Y axis or its amount of motion since the
last mouse event was generated depending on the setting of $MOUSEEVENTF_ABSOLUTE. Absolute data is given as
the mouse's actual Y coordinate relative data is given as the number of mickeys moved.
$iData [optional] If iFlags is $MOUSEEVENTF_WHEEL, then iData specifies the amount of wheel movement. A positive
value indicates that the wheel was rotated forward away from the user. A negative value indicates that the
wheel was rotated backward, toward the user. One wheel click is defined as $WHEEL_DELTA, which is 120. If
iFlags is not $MOUSEEVENTF_WHEEL, then $iData should be zero.
$iExtraInfo [optional] Specifies a 32 bit value associated with the mouse event

Return Value

None.

Remarks

Needs Constants.au3 for pre-defined constants

Related

See Also

Search mouse_event in MSDN Library


Function _WinAPI_MoveTo

Function Reference

_WinAPI_MoveTo

Updates the current position to the specified point

#Include <WinAPI.au3>
_WinAPI_MoveTo($hDC, $iX, $iY)

Parameters

$hDC | Handle to device context
$iX | X coordinate of the new position.
$iY | Y coordinate of the new position.

Return Value

Success: | True
Failure: | False

Remarks

The MoveTo function affects all drawing functions.

Related

_WinAPI_LineTo, _WinAPI_DrawLine, _WinAPI_SelectObject, _WinAPI_CreatePen

See Also

Search MoveToEx in MSDN Library

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_MoveWindow

Function Reference

_WinAPI_MoveWindow

Changes the position and dimensions of the specified window

#Include <WinAPI.au3>
_WinAPI_MoveWindow($hWnd, $iX, $iY, $iWidth, $iHeight [, $fRepaint = True])

Parameters

$hWnd | Handle of window
$iX | New position of the left side of the window
$iY | New position of the top of the window
$iWidth | New width of the window
$iHeight | New height of the window
$fRepaint | [optional] Specifies whether the window is to be repainted. If True, the window receives a $WM_PAINT message. If False, no repainting of any kind occurs. This applies to the client area, the nonclient area, and any part of the parent window uncovered as a result of moving a child window. If False, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search MoveWindow in MSDN Library


Function _WinAPI_MsgBox

Function Reference

_WinAPI_MsgBox

Displays a message box with wider margin than original

#Include <WinAPI.au3>
_WinAPI_MsgBox($iFlags, $sTitle, $sText)

Parameters

$iFlags | Flags to use during window creation
$sTitle | Window title
$sText | Window text

Return Value

None.

Remarks

This function produces (IMO) a better looking message box. It also makes sure that BlockInput is turned off
so the user can move the mouse.

Related

_WinAPI_ShowMsg, _WinAPI_ShowError


Function _WinAPI_MulDiv

Function Reference

_WinAPI_MulDiv

Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value

#Include <WinAPI.au3>
_WinAPI_MulDiv($iNumber, $iNumerator, $iDenominator)

Parameters

$iNumber | Specifies the multiplicand
$iNumerator | Specifies the multiplier
$iDenominator | Specifies the number by which the result of the multiplication is to be divided

Return Value

Success: | The result of the multiplication and division
Failure: | -1

Remarks

None.

Related

See Also

Search MulDiv in MSDN Library


Function _WinAPI_MultiByteToWideChar

Function Reference

_WinAPI_MultiByteToWideChar

Maps a character string to a wide-character (Unicode) string

#Include <WinAPI.au3>
_WinAPI_MultiByteToWideChar($sText [, $iCodePage = 0 [, $iFlags = 0 [, $bRetString = False]]])

Parameters

$sText | Text or DllStruct containing multibyte text to be converted
$iCodePage | [optional] Specifies the code page to be used to perform the conversion: 0 - ANSI code page 1 - OEM code page 2 - Macintosh code page 3 - The Windows ANSI code page for the current thread 42 - Symbol code page 65000 - UTF-7 65001 - UTF-8
$iFlags | [optional] Flags that indicate whether to translate to precomposed or composite wide characters: $MB_PRECOMPOSED - Always use precomposed characters $MB_COMPOSITE - Always use composite characters $MB_USEGLYPHCHARS - Use glyph characters instead of control characters
$bRetString | [optional] Flags that indicate whether to return a String or a DllStruct (default False : Structure)

Return Value

Success: | String or DllStruct that contains the Unicode character string
Failure: | set @error

Remarks

None.

Related

_WinAPI_WideCharToMultiByte, _WinAPI_MultiByteToWideCharEx

See Also

Search MultiByteToWideChar in MSDN Library


Function _WinAPI_MultiByteToWideCharEx

Function Reference

_WinAPI_MultiByteToWideCharEx

Maps a character string to a wide-character (Unicode) string

#Include <WinAPI.au3>
_WinAPI_MultiByteToWideCharEx($sText, $pText [, $iCodePage = 0 [, $iFlags = 0]])

Parameters

$sText | Text to be converted
$pText | Pointer to a byte structure where the converted string will be stored
$iCodePage | [optional] Specifies the code page to be used to perform the conversion: 0 - ANSI code page 1 - OEM code page 2 - Macintosh code page
$iFlags | [optional] Flags that indicate whether to translate to precomposed or composite wide characters: $MB_PRECOMPOSED - Always use precomposed characters $MB_COMPOSITE - Always use composite characters $MB_USEGLYPHCHARS - Use glyph characters instead of control characters

Return Value

Success: | True
Failure: | False

Remarks

The byte structure must be at least twice the length of $sText

Related

_WinAPI_MultiByteToWideChar


Function _WinAPI_OpenProcess

Function Reference

_WinAPI_OpenProcess

Returns a handle of an existing process object

#Include <WinAPI.au3>
_WinAPI_OpenProcess($iAccess, $fInherit, $iProcessID [, $fDebugPriv = False])

Parameters

$iAccess | Specifies the access to the process object
$fInherit | Specifies whether the returned handle can be inherited
$iProcessID | Specifies the process identifier of the process to open
$fDebugPriv | [optional] Certain system processes can not be opened unless you have the debug security privilege. If True, this function will attempt to open the process with debug priviliges if the process can not be opened with standard access privileges.

Return Value

Success: | Process handle to the object
Failure: | set @error

Remarks

None.

Related

See Also

Search OpenProcess in MSDN Library


Function _WinAPI_PathFindOnPath

Function Reference

_WinAPI_PathFindOnPath

Searchs for a file in the default system paths

#Include <WinAPI.au3>
_WinAPI_PathFindOnPath ( $szFile, $aExtraPaths="", $szPathDelimiter=@LF)

Parameters

$szFile | Filename to search for
$aExtraPaths | Extra paths to check before any others.
$szPathDelimiter | Delimiter used to split $aExtraPaths if it's an non-empty string (StringSplit with flag 2).

Return Value

Success: | Full path of found file
Failure: | Unchanged filename, @error=1

Remarks

$aExtraPaths can contain a list of paths to be checked before any system defaults.
It can be an array or a string. If the former, it shall not have a count in it's first element.
If the latter, it will be split using $szPathDelimiter as the delimiter, that defaults to @LF.

Related

See Also

Search PathFindOnpath in MSDN Library

Example

#include <WinAPI.au3>

MsgBox(0, "PathFindOnPath Example", _
StringFormat( "Full path of notepad.exe:\n%s\n\n" & _
"Find ntuser.dat in profile folder, using custom paths:\n%s", _
_WinAPI_PathFindOnPath("notepad.exe"), _WinAPI_PathFindOnPath("ntuser.dat", @UserProfileDir) _
))


Function _WinAPI_PointFromRect

Function Reference

_WinAPI_PointFromRect

Returns the top/left coordinates of a $tagRECT as a $tagPOINT structure

#Include <WinAPI.au3>
_WinAPI_PointFromRect(ByRef $tRect [, $fCenter = True])

Parameters

$tRect | $tagRECT structure
$fCenter | [optional] If True, the return will be a point at the center of the rectangle, otherwise the left/top coordinates are returned.

Return Value

Returns a $tagPOINT structure

Remarks

This function is used to get the click position for many of the click functions

Related


Function _WinAPI_PostMessage

Function Reference

_WinAPI_PostMessage

Places a message in the message queue and then returns

#Include <WinAPI.au3>
_WinAPI_PostMessage($hWnd, $iMsg, $iwParam, $ilParam)

Parameters

$hWnd | Identifies the window whose window procedure will receive the message. If this parameter is 0xFFFF (HWND_BROADCAST), the message is sent to all top-level windows in the system, including disabled or invisible unknowned windows, overlapped windows, and pop-up windows; but the message is not sent to child windows.
$iMsg | Specifies the message to be sent
$iwParam | First message parameter
$ilParam | Second message parameter

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search PostMessage in MSDN Library


Function _WinAPI_PrimaryLangId

Function Reference

_WinAPI_PrimaryLangId

Extract primary language id from a language id

#Include <WinAPI.au3>
_WinAPI_PrimaryLangId($lgid)

Parameters

$lgid Language id

Return Value

Returns an Primary language id

Remarks

None.

Related


Function _WinAPI_PtInRect

Function Reference

_WinAPI_PtInRect

Determines whether the specified point lies within the specified rectangle

#Include <WinAPI.au3>
_WinAPI_PtInRect(ByRef $tRect, ByRef $tPoint)

Parameters

$tRect | $tagRECT structure that contains the specified rectangle
$tPoint | $tagPOINT structure that contains the specified point

Return Value

True: | Point lies within the rectangle
False: | Point does not lie within the rectangle

Remarks

None.

Related

$tagRECT, $tagPOINT

See Also

Search PtInRect in MSDN Library


Function _WinAPI_ReadFile

Function Reference

_WinAPI_ReadFile

Reads data from a file

#Include <WinAPI.au3>
_WinAPI_ReadFile($hFile, $pBuffer, $iToRead, ByRef $iRead [, $pOverlapped = 0])

Parameters

$hFile | Handle to the file to be read
$pBuffer | Pointer to the buffer that receives the data read from a file
$iToRead | Maximum number of bytes to read
$iRead | Number of bytes read
$pOverlapped | [optional] Pointer to a $tagOVERLAPPED structure

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagOVERLAPPED, _WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search ReadFile in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)

FileDelete($sfile)


Function _WinAPI_ReadProcessMemory

Function Reference

_WinAPI_ReadProcessMemory

Reads memory in a specified process

#Include <WinAPI.au3>
_WinAPI_ReadProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iRead)

Parameters

$hProcess | Identifies an open handle of a process whose memory is read
$pBaseAddress | Points to the base address in the specified process to be read
$pBuffer | Points to a buffer that receives the contents from the address space
$iSize | Specifies the requested number of bytes to read from the specified process
$iRead | The actual number of bytes transferred into the specified buffer

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_WriteProcessMemory

See Also

Search ReadProcessMemory in MSDN Library


Function _WinAPI_RectIsEmpty

Function Reference

_WinAPI_RectIsEmpty

Determins whether a rectangle is empty

#Include <WinAPI.au3>
_WinAPI_RectIsEmpty(ByRef $tRect)

Parameters

$tRect $tagRect structure

Return Value

True: | Rectangle is empty (all values are zero)
False: | Rectangle is not empty

Remarks

None.

Related

$tagRect


Function _WinAPI_RedrawWindow

Function Reference

_WinAPI_RedrawWindow

Updates the specified rectangle or region in a window's client area

#Include <WinAPI.au3>
_WinAPI_RedrawWindow($hWnd [, $tRect = 0 [, $hRegion = 0 [, $iFlags = 5]]])

Parameters

$hWnd Handle to a Window
$tRect [optional] $tagRECT structure containing the coordinates of the update rectangle. This parameter is
ignored if the $hRegion parameter identifies a region.
$hRegion [optional] Identifies the update region. If the $hRegion and $tRect parameters are 0, the entire client
area is added to the update region.
$iFlags [optional] Specifies the redraw flags. This parameter can be a combination of flags that invalidate or
validate a window, control repainting, and control which windows are affected:
$RDW_ERASE - Causes the window to receive a WM_ERASEBKGND message when the window is repainted
$RDW_FRAME - Causes any part of the nonclient area of the window that intersects the update region
to receive a WM_NCPAINT message.
$RDW_INTERNALPAINT - Causes a WM_PAINT message to be posted to the window regardless of whether any portion
of the window is invalid.
$RDW_INVALIDATE - Invalidates DllStructGetData($tRect or $hRegion, "") If both are 0, the entire window is invalidated.
$RDW_NOERASE - Suppresses any pending $WM_ERASEBKGND messages
$RDW_NOFRAME - Suppresses any pending $WM_NCPAINT messages
$RDW_NOINTERNALPAINT - Suppresses any pending internal $WM_PAINT messages
$RDW_VALIDATE - Validates $tRect or $hRegion
$RDW_ERASENOW - Causes the affected windows to receive $WM_NCPAINT and $WM_ERASEBKGND messages, if
necessary, before the function returns
$RDW_UPDATENOW - Causes the affected windows to receive $WM_NCPAINT, $WM_ERASEBKGND, and $WM_PAINT
messages, if necessary, before the function returns.
$RDW_ALLCHILDREN - Includes child windows in the repainting operation
$RDW_NOCHILDREN - Excludes child windows from the repainting operation

Return Value

Success: | True
Failure: | False

Remarks

When RedrawWindow is used to invalidate part of the desktop window, the desktop window does not receive a
$WM_PAINT message. To repaint the desktop an application uses the $RDW_ERASE flag to generate a $WM_ERASEBKGND
message.

Needs WindowsConstants.au3 for pre-defined constants

Related

$tagRECT

See Also

Search RedrawWindow in MSDN Library


Function _WinAPI_RegisterWindowMessage

Function Reference

_WinAPI_RegisterWindowMessage

Defines a new window message that is guaranteed to be unique throughout the system

#Include <WinAPI.au3>
_WinAPI_RegisterWindowMessage($sMessage)

Parameters

$sMessage String that specifies the message to be registered

Return Value

Success: | A message identifier in the range 0xC000 through 0xFFFF
Failure: | 0

Remarks

The RegisterWindowMessage function is used to register messages for communicating between two cooperating
applications. If two different applications register the same message string, the applications return the same
message value. The message remains registered until the session ends.

Related

See Also

Search RegisterWindowMessage in MSDN Library


Function _WinAPI_ReleaseCapture

Function Reference

_WinAPI_ReleaseCapture

Releases the mouse capture from a window in the current thread and restores normal mouse input processing

#Include <WinAPI.au3>
_WinAPI_ReleaseCapture()

Parameters

None.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search ReleaseCapture in MSDN Library


Function _WinAPI_ReleaseDC

Function Reference

_WinAPI_ReleaseDC

Releases a device context

#Include <WinAPI.au3>
_WinAPI_ReleaseDC($hWnd, $hDC)

Parameters

$hWnd | Handle of window
$hDC | Identifies the device context to be released

Return Value

Success: | True
Failure: | False

Remarks

The application must call the _WinAPI_ReleaseDC function for each call to the _WinAPI_GetWindowDC function and for
each call to the _WinAPI_GetDC function that retrieves a common device context.

Related

_WinAPI_GetDC, _WinAPI_GetWindowDC, _WinAPI_DeleteDC

See Also

Search ReleaseDC in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)

#include <WinAPI.au3>

_Main()

Func _Main()
Local $hwnd, $hDC
$hwnd = GUICreate("test")
$hDC = _WinAPI_GetDC($hwnd)
MsgBox(4096, "Handle", "Display Device: " & $hDC)
_WinAPI_ReleaseDC($hwnd, $hDC)
EndFunc ;==>_Main


Function _WinAPI_ScreenToClient

Function Reference

_WinAPI_ScreenToClient

Converts screen coordinates of a specified point on the screen to client coordinates

#Include <WinAPI.au3>
_WinAPI_ScreenToClient($hWnd, ByRef $tPoint)

Parameters

$hWnd | Identifies the window that be used for the conversion
$tPoint | $tagPOINT structure that contains the screen coordinates to be converted

Return Value

Success: | True
Failure: | False

Remarks

The function uses the window identified by the $hWnd parameter and the screen coordinates given in the
$tagPOINT structure to compute client coordinates. It then replaces the screen coordinates with the client
coordinates. The new coordinates are relative to the upper-left corner of the specified window's client area.

Related

_WinAPI_ClientToScreen, $tagPOINT

See Also

Search ScreenToClient in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <WinAPI.au3>
Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $hwnd = GUICreate("Example", 200, 200)
Local $tpoint = DllStructCreate("int X;int Y")
DllStructSetData($tpoint, "X", 641)
DllStructSetData($tpoint, "Y", 459)
GUISetState(@SW_SHOW)
Sleep(1000)
_WinAPI_ScreenToClient($hwnd, $tpoint)
MsgBox(0, "_WINAPI_ClientToScreen Example", "Screen Cordinates of 641,459 is x,y position of client: " & @LF & _
"X: " & DllStructGetData($tpoint, "X") & @LF & _
"Y: " & DllStructGetData($tpoint, "Y") & @LF)
EndFunc ;==>_Main


Function _WinAPI_SelectObject

Function Reference

_WinAPI_SelectObject

Selects an object into the specified device context

#Include <WinAPI.au3>
_WinAPI_SelectObject($hDC, $hGDIObj)

Parameters

$hDC | Identifies the device context
$hGDIObj | Identifies the object to be selected

Return Value

Success: | The handle of the object being replaced
Failure: | <= 0

Remarks

None.

Related

_WinAPI_CreatePen, _WinAPI_DrawLine, _WinAPI_GetBkMode, _WinAPI_LineTo, _WinAPI_MoveTo, _WinAPI_SetBkMode

See Also

Search SelectObject in MSDN Library

Example

#include <WindowsConstants.au3>
#include <WinAPI.au3>

ShowCross(@DesktopWidth / 2, @DesktopHeight / 2, 20, 2, 0xFF, 3000)

Func ShowCross($start_x, $start_y, $length, $width, $color, $time)
Local $hDC, $hPen, $obj_orig

$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, $width, $color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)

_WinAPI_DrawLine($hDC, $start_x - $length, $start_y, $start_x - 5, $start_y) ; horizontal left
_WinAPI_DrawLine($hDC, $start_x + $length, $start_y, $start_x + 5, $start_y) ; horizontal right
_WinAPI_DrawLine($hDC, $start_x, $start_y - $length, $start_x, $start_y - 5) ; vertical up
; _WinAPI_DrawLine($hDC, $start_x, $start_y + $length, $start_x, $start_y + 5) ; vertical down
_WinAPI_MoveTo($hDC, $start_x, $start_y + $length)
_WinAPI_LineTo($hDC, $start_x, $start_y + 5)

Sleep($time) ; show cross over screen for defined seconds

; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)

; clear resources
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc ;==>ShowCross


Function _WinAPI_SetBkColor

Function Reference

_WinAPI_SetBkColor

Sets the current background color to the specified color value

#Include <WinAPI.au3>
_WinAPI_SetBkColor($hDC, $iColor)

Parameters

$hDC | Handle to the device context
$iColor | Specifies the new background color

Return Value

Success: | The previous background color
Failure: | -1

Remarks

None.

Related

See Also

Search SetBkColor in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)
; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_SetBkMode

Function Reference

_WinAPI_SetBkMode

Sets the background mix mode of the specified device context

#Include <WinAPI.au3>
_WinAPI_SetBkMode($hDC, $iBkMode)

Parameters

$hDC | Handle to device context
$iBkMode | Specifies the background mix mode. This parameter can be one of the following values. OPAQUE - Background is filled with the current background color before the text, hatched brush, or pen is drawn. TRANSPARENT - Background remains untouched.

Return Value

Success: | Value specifies the previous background mix mode.
Failure: | 0

Remarks

The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.
The SetBkMode function affects the line styles for lines drawn using a pen created by the CreatePen function.
SetBkMode does not affect lines drawn using a pen created by the ExtCreatePen function.
The $iBkMode parameter can also be set to driver-specific values. GDI passes such values to the device driver and otherwise ignores them.

Related

_WinAPI_GetBkMode, _WinAPI_DrawText, _WinAPI_CreatePen, _WinAPI_SelectObject

See Also

Search SetBkMode in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)

MsgBox(4096, "Information", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

MsgBox(4096, "Information", "GetBkMode: " & _WinAPI_GetBkMode($hDC))

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_SetCapture

Function Reference

_WinAPI_SetCapture

Sets the mouse capture to the specified window belonging to the current thread

#Include <WinAPI.au3>
_WinAPI_SetCapture($hWnd)

Parameters

$hWnd Handle to the window in the current thread that is to capture the mouse

Return Value

Success: | handle to the window that had previously captured the mouse
Failure: | 0

Remarks

None.

Related

See Also

Search SetCapture in MSDN Library


Function _WinAPI_SetCursor

Function Reference

_WinAPI_SetCursor

Establishes the cursor shape

#Include <WinAPI.au3>
_WinAPI_SetCursor($hCursor)

Parameters

$hCursor Identifies the cursor

Return Value

Success: | The handle of the previous cursor, if there was one.
Failure: | 0, if there was no previous cursor.

Remarks

None.

Related

See Also

Search SetCursor in MSDN Library


Function _WinAPI_SetDefaultPrinter

Function Reference

_WinAPI_SetDefaultPrinter

Sets the default printer for the current user on the local computer

#Include <WinAPI.au3>
_WinAPI_SetDefaultPrinter($sPrinter)

Parameters

$sPrinter The default printer name. For a remote printer, the name format is \\server\printername. For a
local printer, the name format is printername. If this parameter is "", this function does nothing if there
is already a default printer. However, if there is no default printer, this function sets the default printer
to the first printer, if any, in an enumeration of printers installed on the local computer.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search SetDefaultPrinter in MSDN Library


Function _WinAPI_SetDIBits

Function Reference

_WinAPI_SetDIBits

Sets the pixels in a compatible bitmap using the color data found in a DIB

#Include <WinAPI.au3>
_WinAPI_SetDIBits($hDC, $hBmp, $iStartScan, $iScanLines, $pBits, $pBMI [, $iColorUse = 0])

Parameters

$hDC | Handle to a device context
$hBmp | Handle to the compatible bitmap (DDB) that is to be altered using the color data from the DIB
$iStartScan | Specifies the starting scan line for the device-independent color data in the array pointed to by the pBits parameter.
$iScanLines | Specifies the number of scan lines found in the array containing device-independent color data
$pBits | Pointer to the DIB color data, stored as an array of bytes. The format of the bitmap values depends on the biBitCount member of the $tagBITMAPINFO structure pointed to by the pBMI parameter.
$pBMI | Pointer to a $tagBITMAPINFO structure that contains information about the DIB
$iColorUse | [optional] Specifies whether the iColors member of the $tagBITMAPINFO structure was provided and, if so, whether iColors contains explicit red, green, blue (RGB) values or palette indexes. The iColorUse parameter must be one of the following values: 0 - The color table is provided and contains literal RGB values 1 - The color table consists of an array of 16-bit indexes into the logical palette of hDC

Return Value

Success: | True
Failure: | False

Remarks

The device context identified by the hDC parameter is used only if the iColorUse is set to 1, otherwise it is
ignored. The bitmap identified by the hBmp parameter must not be selected into a device context when this
function is called. The scan lines must be aligned on a DWORD except for RLE compressed bitmaps. The origin
for bottom up DIBs is the lower left corner of the bitmap; the origin for top down DIBs is the upper left
corner of the bitmap.

Related

$tagBITMAPINFO

See Also

Search SetDIBits in MSDN Library


Function _WinAPI_SetEndOfFile

Function Reference

_WinAPI_SetEndOfFile

Sets the physical file size for the specified file to the current position of the file pointer.

#Include <WinAPI.au3>
_WinAPI_SetEndOfFile($hFile)

Parameters

$hFile Handle to the file to be extended or truncated.
The file handle must have the $GENERIC_WRITE access right.

Return Value

Success: | True
Failure: | False, @extend is set to GetLastError() to get details

Remarks

This function can be used to truncate or extend a file.
If the file is extended, the contents of the file between the old end of the file and the new end of the file are not defined.
This function sets the file size.

Related

_WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetFilePointer, _WinAPI_WriteFile

See Also

Search SetEndOfFile in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from posision 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from posision 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)


Function _WinAPI_SetEvent

Function Reference

_WinAPI_SetEvent

Sets the specified event object to the signaled state

#Include <WinAPI.au3>
_WinAPI_SetEvent($hEvent)

Parameters

$hEvent Handle to the event objec

Return Value

Success: | True
Failure: | False

Remarks

The state of a manual-reset event object remains signaled until it is set explicitly to the nonsignaled state
by the ResetEvent function. Any number of waiting threads, or threads that subsequently begin wait operations
for the specified event object by calling one of the wait functions, can be released when the object's state
is signaled.

Related

See Also

Search SetEvent in MSDN Library


Function _WinAPI_SetFilePointer

Function Reference

_WinAPI_SetFilePointer

Moves the file pointer of the specified file

#Include <WinAPI.au3>
_WinAPI_SetFilePointer($hFile, $iPos [, $iMethod = 0])

Parameters

$hFile | Handle to the file to be processed
$iPos | Number of bytes to move the file pointer. Maximum value is 2^32 A positive value moves the file pointer forward in the file, and a negative value moves the file pointer back.
$iMethod | [optional] The starting point for the file pointer move. Can be one of the predefined values: $FILE_BEGIN = 0 - The starting point is zero (0) or the beginning of the file $FILE_CURRENT = 1 - The starting point is the current value of the file pointer. $FILE_END = 2 - The starting point is the current end-of-file position. Implicit value is $FILE_BEGIN = 0

Return Value

Success: | New file pointer.
Failure: | Returns INVALID_SET_FILE_POINTER (-1) and Set @error
@error: | 0 - No error
 | 2 - API returned INVALID_SET_FILE_POINTER

Remarks

This function can also be used to query the current file pointer position by specifying a move method of FILE_CURRENT and a distance of zero.
This function stores the file pointer in LONG value. To work with file pointers that are larger than a single LONG value, it must be used the SetFilePointerEx function.
File pointer is the position in the file to read/write to/from by _WinAPI_ReadFile/_WinAPI_WriteFile

Related

_WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_WriteFile

See Also

Search SetFilePointer in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)


Function _WinAPI_SetFocus

Function Reference

_WinAPI_SetFocus

Sets the keyboard focus to the specified window

#Include <WinAPI.au3>
_WinAPI_SetFocus($hWnd)

Parameters

$hWnd Identifies the window that will receive the keyboard input. If this parameter is 0, keystrokes
are ignored.

Return Value

Success: | The handle of the window that had the keyboard focus
Failure: | 0

Remarks

None.

Related

See Also

Search SetFocus in MSDN Library


Function _WinAPI_SetFont

Function Reference

_WinAPI_SetFont

Sets a window font

#Include <WinAPI.au3>
_WinAPI_SetFont($hWnd, $hFont [, $fRedraw = True])

Parameters

$hWnd | Window handle
$hFont | Font handle
$fRedraw | [optional] True to redraw the control

Return Value

None.

Remarks

None.

Related


Function _WinAPI_SetHandleInformation

Function Reference

_WinAPI_SetHandleInformation

Sets certain properties of an object handle

#Include <WinAPI.au3>
_WinAPI_SetHandleInformation($hObject, $iMask, $iFlags)

Parameters

$hObject | Handle to an object
$iMask | Specifies the bit flags to be changed
$iFlags | Specifies properties of the object handle

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search SetHandleInformation in MSDN Library


Function _WinAPI_SetLastError

Function Reference

_WinAPI_SetLastError

Sets the last-error code for the calling thread

#Include <WinAPI.au3>
_WinAPI_SetLastError($iErrCode)

Parameters

$iErrCode The last error code for the thread

Return Value

None.

Remarks

The last error code is kept in thread local storage so that multiple threads do not overwrite each other's
values.

Related

See Also

Search SetLastError in MSDN Library


Function _WinAPI_SetLayeredWindowAttributes

Function Reference

_WinAPI_SetLayeredWindowAttributes

Sets Layered Window Attributes

#Include <WinAPI.au3>
_WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor [, $Transparency = 255 [, $dwFlags = 0x03 [, $isColorRef = False]]])

Parameters

$hwnd | Handle of GUI to work on
$i_transcolor | Transparent color
$Transparency | [optional] Set Transparancy of GUI
$dwFlags | [optional] Flags.
$isColorRef | [optional] If True, $i_transcolor is a COLORREF( 0x00bbggrr ), else an RGB-Color

Return Value

Success: | 1
Failure: | 0
@error: | 4 - Function did not succeed - @extended is set to _WinAPI_GetLastErrorMessage to get more information

Remarks

None.

Related

_WinAPI_GetLayeredWindowAttributes, _WinAPI_GetLastError

See Also

Search SetLayeredWindowAttributes in MSDN Library

Example

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

$gui = GUICreate("trans", 300, 400, -1, -1, -1, $WS_EX_LAYERED)
GUICtrlCreateLabel("This is text on a transparent Layered GUI", 10, 10, 200, 20, -1, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetTip(-1, "Click label to drag layered window")
$layButt = GUICtrlCreateButton("Button", 10, 40, 40)
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($gui, 0x010101)
GUISetState()

$guicontrol = GUICreate("ControlGUI", 300, 400, 100, 100)
$checkTrans = GUICtrlCreateCheckbox("Transparent color 0xABCDEF (Checked) Or 0x010101", 10, 10)
$checkBorder = GUICtrlCreateCheckbox("POPUP-Style", 10, 30)
GUICtrlCreateLabel("Transparency for Layered GUI", 10, 50)
$slidTrans = GUICtrlCreateSlider(10, 70, 200, 30)
GUICtrlSetLimit($slidTrans, 255, 0)
GUICtrlSetData(-1, 255)
GUISetState()

While 1
$extMsg = GUIGetMsg(1)
$msg = $extMsg[0]
Switch $extMsg[1]
Case $guicontrol
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $checkTrans Or $msg = $slidTrans

; Change Attributes of Trans-Color and Window Transparency

If BitAND(GUICtrlRead($checkTrans), $GUI_CHECKED) = $GUI_CHECKED Then
_WinAPI_SetLayeredWindowAttributes($gui, 0xABCDEF, GUICtrlRead($slidTrans))
Else
_WinAPI_SetLayeredWindowAttributes($gui, 0x010101, GUICtrlRead($slidTrans))
EndIf

Case $msg = $checkBorder
If BitAND(GUICtrlRead($checkBorder), $GUI_CHECKED) = $GUI_CHECKED Then
GUISetStyle($WS_POPUP, -1, $gui)
Else
GUISetStyle($GUI_SS_DEFAULT_GUI, -1, $gui)
EndIf
EndSelect
Case $gui
Select
Case $msg = $layButt
Dim $transcolor, $alpha
$info = _WinAPI_GetLayeredWindowAttributes($gui,$transcolor, $alpha)
MsgBox(0, 'Layered GUI', "Button on layered Window Clicked" & @CRLF & "Information about this window: " & @CRLF & _
"Transparent Color: " & $transcolor & @CRLF & _
"Alpha Value: " & $alpha & @CRLF & _
"LWA_COLORKEY: " & (BitAND($info,$LWA_COLORKEY)=$LWA_COLORKEY) & @CRLF & _
"LWA_ALPHA: " & (BitAND($info,$LWA_ALPHA)=$LWA_ALPHA) )
Case $msg = $GUI_EVENT_CLOSE
Exit MsgBox(0, '', "Close from Layered GUI")
EndSelect
EndSwitch
WEnd


Function _WinAPI_SetParent

Function Reference

_WinAPI_SetParent

Changes the parent window of the specified child window

#Include <WinAPI.au3>
_WinAPI_SetParent($hWndChild, $hWndParent)

Parameters

$hWndChild | Window handle of child window
$hWndParent | Handle to the new parent window. If 0, the desktop window becomes the new parent window.

Return Value

Success: | A handle to the previous parent window
Failure: | 0

Remarks

An application can use the SetParent function to set the parent window of a pop-up, overlapped, or child
window. The new parent window and the child window must belong to the same application.

Related

See Also

Search SetParent in MSDN Library


Function _WinAPI_SetProcessAffinityMask

Function Reference

_WinAPI_SetProcessAffinityMask

Sets a processor affinity mask for the threads of a specified process

#Include <WinAPI.au3>
_WinAPI_SetProcessAffinityMask($hProcess, $iMask)

Parameters

$hProcess | A handle to the process whose affinity mask the function sets
$iMask | Affinity mask

Return Value

Success: | True
Failure: | False

Remarks

An affinity mask is a bit mask in which each bit represents a processor on which the threads of the process
are allowed to run. For example, if you pass a mask of 0x05, processors 1 and 3 are allowed to run.

Related

See Also

Search SetProcessAffinityMask in MSDN Library


Function _WinAPI_SetSysColors

Function Reference

_WinAPI_SetSysColors

Obtains information about the display devices in a system

#Include <WinAPI.au3>
_WinAPI_SetSysColors($vElements, $vColors)

Parameters

$vElements | Single element or Array of elements
$vColors | Single Color or Array of colors

Return Value

Success: | True
Failure: | False

Remarks

See _WinAPI_GetSysColor for list of Element indexes and requirements.

Related

_WinAPI_GetSysColor

See Also

Search SetSysColors in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
Local $aElements[2] = [$COLOR_ACTIVECAPTION, $COLOR_GRADIENTACTIVECAPTION]
; Red and Yellow
Local $aColors[2] = [255, 65535], $aSaveColors[2]

GUICreate("My GUI", 300, 200)

$aSaveColors[0] = _WinAPI_GetSysColor($COLOR_ACTIVECAPTION)
$aSaveColors[1] = _WinAPI_GetSysColor($COLOR_GRADIENTACTIVECAPTION)

_WinAPI_SetSysColors($aElements, $aColors)

GUISetState()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop

EndSwitch
WEnd

GUIDelete()

_WinAPI_SetSysColors($aElements, $aSaveColors)

Exit

EndFunc ;==>_Main


Function _WinAPI_SetTextColor

Function Reference

_WinAPI_SetTextColor

Sets the current text color to the specified color value

#Include <WinAPI.au3>
_WinAPI_SetTextColor($hDC, $iColor)

Parameters

$hDC | Handle to the device context
$iColor | Specifies the new text color

Return Value

Success: | The previous text color
Failure: | -1

Remarks

None.

Related

See Also

Search SetTextColor in MSDN Library

Example

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <FontConstants.au3>

Global $tRECT, $hFont, $hOldFont, $hDC

HotKeySet("{ESC}", "_Exit")

$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)

$hDC = _WinAPI_GetDC(0)
$hFont = _WinAPI_CreateFont(50, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _
$OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
$hOldFont = _WinAPI_SelectObject($hDC, $hFont)

_WinAPI_SetTextColor($hDC, 0x0000FF)
_WinAPI_SetBkColor($hDC, 0x000000)
; comment next line to get black background instead of transparent one
_WinAPI_SetBkMode($hDC, $TRANSPARENT)

While 1
_WinAPI_DrawText($hDC, "Hello world!", $tRECT, $DT_CENTER)
Sleep(100)
WEnd

Func _Exit()
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)
_WinAPI_ReleaseDC(0, $hDC)
_WinAPI_InvalidateRect(0, 0)
$tRECT = 0
Exit
EndFunc ;==>_Exit


Function _WinAPI_SetWindowLong

Function Reference

_WinAPI_SetWindowLong

Sets information about the specified window

#Include <WinAPI.au3>
_WinAPI_SetWindowLong($hWnd, $iIndex, $iValue)

Parameters

$hWnd | Handle of the window
$iIndex | Specifies the zero based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus four; for example, if you specified 12 or more bytes of extra memory, a value of 8 would be an index to the third 32-bit integer. To retrieve any other value specify one of the following values: $GWL_EXSTYLE - Sets the extended window styles $GWL_STYLE - Sets the window styles $GWL_WNDPROC - Sets the address of the window procedure $GWL_HINSTANCE - Sets the handle of the application instance $GWL_HWNDPARENT - Sets the handle of the parent window, if any $GWL_ID - Sets the identifier of the window $GWL_USERDATA - Sets the 32-bit value associated with the window
$iValue | Specifies the replacement value

Return Value

Success: | The previous value
Failure: | 0

Remarks

Needs Constants.au3 for pre-defined constants

Related

_WinAPI_GetWindowLong, _WinAPI_CallWindowProc

See Also

Search SetWindowLongPtr in MSDN Library


Function _WinAPI_SetWindowPlacement

Function Reference

_WinAPI_SetWindowPlacement

Sets the placement of the window for Min, Max, and normal positions

#Include <WinAPI.au3>
_WinAPI_SetWindowPlacement($hWnd, $pWindowPlacement)

Parameters

$hWnd | Handle of the window
$pWindowPlacement | pointer to $tagWINDOWPLACEMENT structure

Return Value

Success: | True
Failure: | False, @error = 1, @extended = _WinAPI_GetLastError()

Remarks

None.

Related

_WinAPI_GetWindowPlacement, $tagWINDOWPLACEMENT

See Also

Search SetWindowPlacement in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $hWindow, $stRET, $sMsg, $pStruct, $iRET

; Create an instance of notepad to play with
Run("notepad.exe")
WinWait("[CLASS:Notepad]")
$hWindow = WinGetHandle("[CLASS:Notepad]")
WinMove($hWindow, "", 256, 256, 400, 400)
Sleep(1000)

; Minimize and then check the placement values returned by _WinAPI_GetWindowPlacement()
WinSetState($hWindow, "", @SW_MINIMIZE)
$stRET = _WinAPI_GetWindowPlacement($hWindow)
If @error = 0 Then
$sMsg = "$stWindowPlacement:" & @CRLF & @CRLF
$sMsg &= @TAB & "length = " & DllStructGetData($stRET, "length") & @CRLF
$sMsg &= @TAB & "flags = " & DllStructGetData($stRET, "flags") & @CRLF
$sMsg &= @TAB & "showCmd = " & DllStructGetData($stRET, "showCmd") & @CRLF & @CRLF
$sMsg &= "ptMinPosition:" & @CRLF
$sMsg &= @TAB & "MinX = " & DllStructGetData($stRET, "ptMinPosition", 1) & @CRLF
$sMsg &= @TAB & "MinY = " & DllStructGetData($stRET, "ptMinPosition", 2) & @CRLF & @CRLF
$sMsg &= "ptMaxPosition:" & @CRLF
$sMsg &= @TAB & "MaxX = " & DllStructGetData($stRET, "ptMaxPosition", 1) & @CRLF
$sMsg &= @TAB & "MaxY = " & DllStructGetData($stRET, "ptMaxPosition", 2) & @CRLF & @CRLF
$sMsg &= "rcNormalPosition:" & @CRLF
$sMsg &= @TAB & "left = " & DllStructGetData($stRET, "rcNormalPosition", 1) & @CRLF
$sMsg &= @TAB & "top = " & DllStructGetData($stRET, "rcNormalPosition", 2) & @CRLF
$sMsg &= @TAB & "right = " & DllStructGetData($stRET, "rcNormalPosition", 3) & @CRLF
$sMsg &= @TAB & "bottom = " & DllStructGetData($stRET, "rcNormalPosition", 4)
MsgBox(64, "Success", $sMsg)

; Change the normalized rectangle with _WinAPI_SetWindowPlacement() and then restore
DllStructSetData($stRET, "rcNormalPosition", 128, 1); left
DllStructSetData($stRET, "rcNormalPosition", 128, 2); top
DllStructSetData($stRET, "rcNormalPosition", @DesktopWidth - 128, 3); right
DllStructSetData($stRET, "rcNormalPosition", @DesktopHeight - 128, 4); bottom
$pStruct = DllStructGetPtr($stRET); Get pointer to the modified struct
$iRET = _WinAPI_SetWindowPlacement($hWindow, $pStruct)
If @error = 0 Then
WinSetState($hWindow, "", @SW_RESTORE)
ControlSetText($hWindow, "", "Edit1", "_WinAPI_SetWindowPlacement() succeeded!")
Else
MsgBox(16, "Error", "_WinAPI_SetWindowPlacement() failed!" & @CRLF & _
"$iRET = " & $iRET & @CRLF & _
"@error = " & @error & @CRLF & _
"@extended = " & @extended)
EndIf
Else
MsgBox(16, "Error", "_WinAPI_GetWindowPlacement() failed!" & @CRLF & _
"$stRET = " & $stRET & @CRLF & _
"@error = " & @error & @CRLF & _
"@extended = " & @extended)
EndIf


Function _WinAPI_SetWindowPos

Function Reference

_WinAPI_SetWindowPos

Changes the size, position, and Z order of a child, pop-up, or top-level window

#Include <WinAPI.au3>
_WinAPI_SetWindowPos($hWnd, $hAfter, $iX, $iY, $iCX, $iCY, $iFlags)

Parameters

$hWnd | Handle of window
$hAfter | Identifies the window to precede the positioned window in the Z order. This parameter must be a window handle or one of the following values: $HWND_BOTTOM - Places the window at the bottom of the Z order $HWND_NOTOPMOST - Places the window above all non-topmost windows $HWND_TOP - Places the window at the top of the Z order $HWND_TOPMOST - Places the window above all non-topmost windows
$iX | Specifies the new position of the left side of the window
$iY | Specifies the new position of the top of the window
$iCX | Specifies the new width of the window, in pixels
$iCY | Specifies the new height of the window, in pixels
$iFlags | Specifies the window sizing and positioning flags: $SWP_DRAWFRAME - Draws a frame around the window $SWP_FRAMECHANGED - Sends a $WM_NCCALCSIZE message to the window, even if the window's size is not changed $SWP_HIDEWINDOW - Hides the window $SWP_NOACTIVATE - Does not activate the window $SWP_NOCOPYBITS - Discards the entire contents of the client area $SWP_NOMOVE - Retains the current position $SWP_NOOWNERZORDER - Does not change the owner window's position in the Z order $SWP_NOREDRAW - Does not redraw changes $SWP_NOREPOSITION - Same as the $SWP_NOOWNERZORDER flag $SWP_NOSENDCHANGING - Prevents the window from receiving $WM_WINDOWPOSCHANGING $SWP_NOSIZE - Retains the current size $SWP_NOZORDER - Retains the current Z order $SWP_SHOWWINDOW - Displays the window

Return Value

Success: | True
Failure: | False

Remarks

Needs Constants.au3 for pre-defined constants

Related

See Also

Search SetWindowPos in MSDN Library


Function _WinAPI_SetWindowRgn

Function Reference

_WinAPI_SetWindowRgn

Sets the window region of a window

#Include <WinAPI.au3>
_WinAPI_SetWindowRgn($hWnd, $hRgn [, $bRedraw])

Parameters

$hWnd | Handle to the window whose window region is to be set.
$hRgn | Handle to a region. The function sets the window region of the window to this region.
$bRedraw | [optional] Specifies whether the system redraws the window after setting the window region.

Return Value

Success: | Nonzero
Failure: | 0

Remarks

The window region determines the area within the window where the system permits drawing.
The system does not display any portion of a window that lies outside of the window region
When this function is called, the system sends the WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED messages to the window.
The coordinates of a window's window region are relative to the upper-left corner of the window, not the client area of the window.
After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn.
The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle.
In particular, do not delete this region handle. The system deletes the region handle when it no longer needed.

Related

_WinAPI_CreateRectRgn, _WinAPI_CreateRoundRectRgn, _WinAPI_CombineRgn, _WinAPI_GetWindowRgn

See Also

Search SetWindowRgn in MSDN Library

Example

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

; get height of window title and width of window frame - may be different when XP theme is ON/OFF
Global $htit = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $frame = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME)

$gui = GUICreate("Test Windows regions", 350, 210)
$btn_default = GUICtrlCreateButton("Default region", 100, 30, 150)
$btn_round = GUICtrlCreateButton("Round region", 100, 60, 150)
$btn_buble = GUICtrlCreateButton("Buble region ", 100, 90, 150)
$btn_transparent = GUICtrlCreateButton("Transparent region", 100, 120, 150)
$btn_exit = GUICtrlCreateButton("Exit", 100, 150, 150)
GUISetState(@SW_SHOW)

$pos = WinGetPos($gui) ; get whole window size (no client size defined in GUICreate)
Global $width = $pos[2]
Global $height = $pos[3]

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $btn_exit
ExitLoop

Case $msg = $btn_default
$rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_round
$rgn = _WinAPI_CreateRoundRectRgn(0, 0, $width, $height, $width / 3, $height / 3)
_WinAPI_SetWindowRgn($gui, $rgn)

Case $msg = $btn_buble
$rgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $width / 2, $height / 2, $width / 2, $height / 2) ; left-top
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, 0, $width, $height / 2, $width / 2, $height / 2) ; right-top
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(0, $height / 2, $width / 2, $height, $width / 2, $height / 2) ; left-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn($width / 2, $height / 2, $width, $height, $width / 2, $height / 2) ; right-bottom
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
$rgn2 = _WinAPI_CreateRoundRectRgn(10, 10, $width - 10, $height - 10, $width, $height) ; middle
_WinAPI_CombineRgn($rgn1, $rgn1, $rgn2, $RGN_OR)
_WinAPI_DeleteObject($rgn2)
_WinAPI_SetWindowRgn($gui, $rgn1)

Case $msg = $btn_transparent
_GuiHole($gui, 40, 40, 260, 170)

EndSelect
WEnd

; make inner transparent area but add controls
Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
Local $outer_rgn, $inner_rgn, $combined_rgn

$outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height)
$inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh)
$combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0)
_WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF)
_WinAPI_DeleteObject($outer_rgn)
_WinAPI_DeleteObject($inner_rgn)
_AddCtrlRegion($combined_rgn, $btn_default)
_AddCtrlRegion($combined_rgn, $btn_round)
_AddCtrlRegion($combined_rgn, $btn_buble)
_AddCtrlRegion($combined_rgn, $btn_transparent)
_AddCtrlRegion($combined_rgn, $btn_exit)
_WinAPI_SetWindowRgn($h_win, $combined_rgn)
EndFunc ;==>_GuiHole

; add control's area to given region
; respecting also window title/frame sizes
Func _AddCtrlRegion($full_rgn, $ctrl_id)
Local $ctrl_pos, $ctrl_rgn

$ctrl_pos = ControlGetPos($gui, "", $ctrl_id)
$ctrl_rgn = _WinAPI_CreateRectRgn($ctrl_pos[0] + $frame, $ctrl_pos[1] + $htit + $frame, _
$ctrl_pos[0] + $ctrl_pos[2] + $frame, $ctrl_pos[1] + $ctrl_pos[3] + $htit + $frame)
_WinAPI_CombineRgn($full_rgn, $full_rgn, $ctrl_rgn, $RGN_OR)
_WinAPI_DeleteObject($ctrl_rgn)
EndFunc ;==>_AddCtrlRegion


Function _WinAPI_SetWindowsHookEx

Function Reference

_WinAPI_SetWindowsHookEx

Installs an application-defined hook procedure into a hook chain

#Include <WinAPI.au3>
_WinAPI_SetWindowsHookEx($idHook, $lpfn, $hmod [, $dwThreadId = 0])

Parameters

$idHook Specifies the type of hook procedure to be installed. This parameter can be one of the following values:
$WH_CALLWNDPROC - Installs a hook procedure that monitors messages before the system sends them to the destination window procedure
$WH_CALLWNDPROCRET - Installs a hook procedure that monitors messages after they have been processed by the destination window procedure
$WH_CBT - Installs a hook procedure that receives notifications useful to a computer-based training (CBT) application
$WH_DEBUG - Installs a hook procedure useful for debugging other hook procedures
$WH_FOREGROUNDIDLE - Installs a hook procedure that will be called when the application's foreground thread is about to become idle
$WH_GETMESSAGE - Installs a hook procedure that monitors messages posted to a message queue
$WH_JOURNALPLAYBACK - Installs a hook procedure that posts messages previously recorded by a $WH_JOURNALRECORD hook procedure
$WH_JOURNALRECORD - Installs a hook procedure that records input messages posted to the system message queue
$WH_KEYBOARD - Installs a hook procedure that monitors keystroke messages
$WH_KEYBOARD_LL - Windows NT/2000/XP: Installs a hook procedure that monitors low-level keyboard input events
$WH_MOUSE - Installs a hook procedure that monitors mouse messages
$WH_MOUSE_LL - Windows NT/2000/XP: Installs a hook procedure that monitors low-level mouse input events
$WH_MSGFILTER - Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar
$WH_SHELL - Installs a hook procedure that receives notifications useful to shell applications
$WH_SYSMSGFILTER - Installs a hook procedure that monitors messages generated as a result of an input event in a dialog box, message box, menu, or scroll bar
$lpfn Pointer to the hook procedure. If the $dwThreadId parameter is zero or specifies the identifier of a thread created by a different process,
the $lpfn parameter must point to a hook procedure in a DLL.
Otherwise, $lpfn can point to a hook procedure in the code associated with the current process
$hmod Handle to the DLL containing the hook procedure pointed to by the $lpfn parameter.
The $hMod parameter must be set to NULL if the $dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the
code associated with the current process
$dwThreadId [optional] Specifies the identifier of the thread with which the hook procedure is to be associated.
If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread

Return Value

Success: | Handle to the hook procedure
Failure: | 0 and @error is set

Remarks

None.

Related

_WinAPI_UnhookWindowsHookEx, _WinAPI_CallNextHookEx, DllCallbackRegister, DllCallbackGetPtr, DllCallbackFree

See Also

Search SetWindowsHookEx in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Opt('MustDeclareVars', 1)

Global $hHook, $hStub_KeyProc, $buffer = ""

_Main()

Func _Main()
OnAutoItExitRegister("Cleanup")

Local $hmod

$hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
$hmod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)

MsgBox(4096, "", "Click OK, then in notepad type..." & _
@LF & @LF & "Jon" & @LF & "AutoIt" & @LF & @LF & "Press Esc to exit script")

Run("Notepad")
WinWait("Untitled -")
WinActivate("Untitled -")

While 1
Sleep(10)
WEnd
EndFunc ;==>_Main

Func EvaluateKey($keycode)
If (($keycode > 64) And ($keycode < 91)) _ ; a - z
Or (($keycode > 96) And ($keycode < 123)) _ ; A - Z
Or (($keycode > 47) And ($keycode < 58)) Then ; 0 - 9
$buffer &= Chr($keycode)
Switch $buffer
Case "Jon"
ToolTip("What can you say?")
Case "AutoIt"
ToolTip("AutoIt Rocks")
EndSwitch
ElseIf ($keycode > 159) And ($keycode < 164) Then
Return
ElseIf ($keycode = 27) Then ; esc key
Exit
Else
$buffer = ""
EndIf
EndFunc ;==>EvaluateKey

;===========================================================
; callback function
;===========================================================
Func _KeyProc($nCode, $wParam, $lParam)
Local $tKEYHOOKS
$tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
If $nCode < 0 Then
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndIf
If $wParam = $WM_KEYDOWN Then
EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
Else
Local $flags = DllStructGetData($tKEYHOOKS, "flags")
Switch $flags
Case $LLKHF_ALTDOWN
ConsoleWrite("$LLKHF_ALTDOWN" & @CRLF)
Case $LLKHF_EXTENDED
ConsoleWrite("$LLKHF_EXTENDED" & @CRLF)
Case $LLKHF_INJECTED
ConsoleWrite("$LLKHF_INJECTED" & @CRLF)
Case $LLKHF_UP
ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @CRLF)
EndSwitch
EndIf
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc ;==>_KeyProc

Func Cleanup()
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallbackFree($hStub_KeyProc)
EndFunc ;==>Cleanup


Function _WinAPI_SetWindowText

Function Reference

_WinAPI_SetWindowText

Changes the text of the specified window's title bar

#Include <WinAPI.au3>
_WinAPI_SetWindowText($hWnd, $sText)

Parameters

$hWnd | Handle to the window or control whose text is to be changed
$sText | String to be used as the new title or control te

Return Value

Success | True
Failure | False

Remarks

If the target window is owned by the current process, SetWindowText causes a $WM_SETTEXT message to be sent to
the specified window or control. If the control is a list box control created with the $WS_CAPTION style,
however, SetWindowText sets the text for the control, not for the list box entries. To set the text of a
control in another process, send the $WM_SETTEXT message directly instead of calling SetWindowText.

Related

See Also

Search SetWindowText in MSDN Library


Function _WinAPI_ShowCursor

Function Reference

_WinAPI_ShowCursor

Displays or hides the cursor

#Include <WinAPI.au3>
_WinAPI_ShowCursor($fShow)

Parameters

$fShow If True, the cursor is shown, otherwise it is hidden

Return Value

Success: | The new display counter
Failed: | 0

Remarks

This function sets an internal display counter that determines whether the cursor should be displayed. The
cursor is displayed only if the display count is greater than or equal to 0. If a mouse is installed, the
initial display count is 0. If no mouse is installed, the display count is -1.

Related

See Also

Search ShowCursor in MSDN Library


Function _WinAPI_ShowError

Function Reference

_WinAPI_ShowError

Displays an error message box with an optional exit

#Include <WinAPI.au3>
_WinAPI_ShowError($sText [, $fExit = True])

Parameters

$sText | Error text to display
$fExit | [optional] Specifies whether to exit after the display: True - Exit program after display False - Return normally after display

Return Value

None.

Remarks

None.

Related

_WinAPI_ShowMsg, _WinAPI_MsgBox


Function _WinAPI_ShowMsg

Function Reference

_WinAPI_ShowMsg

Displays an "Information" message box

#Include <WinAPI.au3>
_WinAPI_ShowMsg($sText)

Parameters

$sText "Information" text to display

Return Value

None.

Remarks

None.

Related

_WinAPI_ShowError, _WinAPI_MsgBox


Function _WinAPI_ShowWindow

Function Reference

_WinAPI_ShowWindow

Sets the specified window's show state

#Include <WinAPI.au3>
_WinAPI_ShowWindow($hWnd [, $iCmdShow = 5])

Parameters

$hWnd | Handle of window
$iCmdShow | [optional] Specifies how the window is to be shown: @SW_HIDE - Hides the window and activates another window @SW_MAXIMIZE - Maximizes the specified window @SW_MINIMIZE - Minimizes the specified window and activates the next top-level window in the Z order @SW_RESTORE - Activates and displays the window @SW_SHOW - Activates the window and displays it in its current size and position @SW_SHOWDEFAULT - Sets the show state based on the SW_ flag specified in the STARTUPINFO structure @SW_SHOWMAXIMIZED - Activates the window and displays it as a maximized window @SW_SHOWMINIMIZED - Activates the window and displays it as a minimized window @SW_SHOWMINNOACTIVE - Displays the window as a minimized window @SW_SHOWNA - Displays the window in its current state @SW_SHOWNOACTIVATE - Displays a window in its most recent size and position @SW_SHOWNORMAL - Activates and displays a window

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search ShowWindow in MSDN Library


Function _WinAPI_StringFromGUID

Function Reference

_WinAPI_StringFromGUID

Converts a binary GUID to string form

#Include <WinAPI.au3>
_WinAPI_StringFromGUID($pGUID)

Parameters

$pGUID Pointer to a $tagGUID structure

Return Value

Success: | GUID in string form
Failure: | empty string

Remarks

None.

Related

_WinAPI_GUIDFromString, _WinAPI_GUIDFromStringEx, $tagGUID

See Also

Search StringFromGUID2 in MSDN Library


Function _WinAPI_SubLangId

Function Reference

_WinAPI_SubLangId

Extract sublanguage id from a language id

#Include <WinAPI.au3>
_WinAPI_SubLangId($lgid)

Parameters

$lgid Language id

Return Value

Returns a Sub-Language id

Remarks

None.

Related


Function _WinAPI_SystemParametersInfo

Function Reference

_WinAPI_SystemParametersInfo

Retrieves or sets the value of one of the system-wide parameters

#Include <WinAPI.au3>
_WinAPI_SystemParametersInfo($iAction [, $iParam = 0 [, $vParam = 0 [, $iWinIni = 0]]])

Parameters

$iAction | The system-wide parameter to be retrieved or set
$iParam | [optional] A parameter whose usage and format depends on the parameter being queried or set
$vParam | [optional] A parameter whose usage and format depends on the parameter being queried or set
$iWinIni | [optional] If a system parameter is being set, specifies whether the user profile is to be updated, and if so, whether the $WM_SETTINGCHANGE message is to be broadcast. This parameter can be zero if you don't want to update the user profile or it can be one or more of the following values: $SPIF_UPDATEINIFILE - Writes the new setting to the user profile $SPIF_SENDCHANGE - Broadcasts the $WM_SETTINGCHANGE message after updating the user profile

Return Value

Success: | True
Failure: | False

Remarks

This function always call the Unicode version so $vParam must be inaccordance when using strings.

Related

See Also

Search SystemParametersInfo in MSDN Library


Function _WinAPI_TwipsPerPixelX

Function Reference

_WinAPI_TwipsPerPixelX

Returns the width of a pixel, in twips.

#Include <WinAPI.au3>
_WinAPI_TwipsPerPixelX()

Parameters

None.

Return Value

Returns the width of a pixel, in twips

Remarks

None.

Related


Function _WinAPI_TwipsPerPixelY

Function Reference

_WinAPI_TwipsPerPixelY

Returns the height of a pixel, in twips.

#Include <WinAPI.au3>
_WinAPI_TwipsPerPixelY()

Parameters

None.

Return Value

Returns the height of a pixel, in twips

Remarks

None.

Related


Function _WinAPI_UnhookWindowsHookEx

Function Reference

_WinAPI_UnhookWindowsHookEx

Removes a hook procedure installed in a hook chain by the _WinAPI_SetWindowsHookEx function

#Include <WinAPI.au3>
_WinAPI_UnhookWindowsHookEx($hhk)

Parameters

$hhk Handle to the hook to be removed

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_SetWindowsHookEx, DllCallbackFree

See Also

Search UnhookWindowsHookEx in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StructureConstants.au3>

Opt('MustDeclareVars', 1)

Global $hHook, $hStub_KeyProc, $buffer = ""

_Main()

Func _Main()
OnAutoItExitRegister("Cleanup")

Local $hmod

$hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam")
$hmod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod)

MsgBox(4096, "", "Click OK, then in notepad type..." & _
@LF & @LF & "Jon" & @LF & "AutoIt" & @LF & @LF & "Press Esc to exit script")

Run("Notepad")
WinWait("Untitled -")
WinActivate("Untitled -")

While 1
Sleep(10)
WEnd
EndFunc ;==>_Main

Func EvaluateKey($keycode)
If (($keycode > 64) And ($keycode < 91)) _ ; a - z
Or (($keycode > 96) And ($keycode < 123)) _ ; A - Z
Or (($keycode > 47) And ($keycode < 58)) Then ; 0 - 9
$buffer &= Chr($keycode)
Switch $buffer
Case "Jon"
ToolTip("What can you say?")
Case "AutoIt"
ToolTip("AutoIt Rocks")
EndSwitch
ElseIf ($keycode > 159) And ($keycode < 164) Then
Return
ElseIf ($keycode = 27) Then ; esc key
Exit
Else
$buffer = ""
EndIf
EndFunc ;==>EvaluateKey

;===========================================================
; callback function
;===========================================================
Func _KeyProc($nCode, $wParam, $lParam)
Local $tKEYHOOKS
$tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam)
If $nCode < 0 Then
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndIf
If $wParam = $WM_KEYDOWN Then
EvaluateKey(DllStructGetData($tKEYHOOKS, "vkCode"))
Else
Local $flags = DllStructGetData($tKEYHOOKS, "flags")
Switch $flags
Case $LLKHF_ALTDOWN
ConsoleWrite("$LLKHF_ALTDOWN" & @CRLF)
Case $LLKHF_EXTENDED
ConsoleWrite("$LLKHF_EXTENDED" & @CRLF)
Case $LLKHF_INJECTED
ConsoleWrite("$LLKHF_INJECTED" & @CRLF)
Case $LLKHF_UP
ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @CRLF)
EndSwitch
EndIf
Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndFunc ;==>_KeyProc

Func Cleanup()
_WinAPI_UnhookWindowsHookEx($hHook)
DllCallbackFree($hStub_KeyProc)
EndFunc ;==>Cleanup


Function _WinAPI_UpdateLayeredWindow

Function Reference

_WinAPI_UpdateLayeredWindow

Updates the position, size, shape, content, and translucency of a layered window

#Include <WinAPI.au3>
_WinAPI_UpdateLayeredWindow($hWnd, $hDCDest, $pPTDest, $pSize, $hDCSrce, $pPTSrce, $iRGB, $pBlend, $iFlags)

Parameters

$hWnd | Handle to a layered window. A layered window is created by specifying $WS_EX_LAYERED when creating the window.
$hDCDest | Handle to a device context for the screen
$pPTDest | Pointer to a $tagPOINT structure that specifies the new screen position of the layered window. If the current position is not changing, this can be zero.
$pSize | Pointer to a $tagSIZE structure that specifies the new size of the layered window. If the size of the window is not changing, this can be 0.
$hDCSrce | Handle to a device context for the surface that defines the layered window. This handle can be obtained by calling the _WinAPI_CreateCompatibleDC function.
$pPTSrce | Pointer to a $tagPOINT structure that specifies the location of the layer in the device context
$iRGB | The color key to be used when composing the layered window
$pBlend | Pointer to a $tagBLENDFUNCTION structure that specifies the transparency value to be used when composing the layered window.
$iFlags | This parameter can be one of the following values. $ULW_ALPHA - Use $tblend as the blend function $ULW_COLORKEY - Use $iRGB as the transparency color $ULW_OPAQUE - Draw an opaque layered window

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagBLENDFUNCTION, $tagPOINT, $tagSIZE

See Also

Search UpdateLayeredWindow in MSDN Library


Function _WinAPI_UpdateWindow

Function Reference

_WinAPI_UpdateWindow

Updates the client area of a window by sending a WM_PAINT message to the window

#Include <WinAPI.au3>
_WinAPI_UpdateWindow($hWnd)

Parameters

$hWnd Handle of window to update

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search UpdateWindow in MSDN Library


Function _WinAPI_WaitForInputIdle

Function Reference

_WinAPI_WaitForInputIdle

Waits until a process is waiting for user input with no input pending, or a time out

#Include <WinAPI.au3>
_WinAPI_WaitForInputIdle($hProcess [, $iTimeout = -1])

Parameters

$hProcess | A handle to the process. If this process is a console application or does not have a message queue, this function returns immediately.
$iTimeOut | [optional] The time out interval, in milliseconds. If set to -1, the function does not return until the process is idle.

Return Value

Success: | True
Failure: | False

Remarks

This function causes a thread to suspend execution until the specified process has finished its initialization
and is waiting for user input with no input pending. This can be useful for synchronizing a parent process and
a newly created child process. When a parent process creates a child process, the CreateProcess function
returns without waiting for the child process to finish its initialization. Before trying to communicate with
the child process, the parent process can use this function to determine when the child's initialization has
been completed. This function can be used at any time, not just during application startup.

Related

See Also

Search WaitForInputIdle in MSDN Library


Function _WinAPI_WaitForMultipleObjects

Function Reference

_WinAPI_WaitForMultipleObjects

Waits until one or all of the specified objects are in the signaled state

#Include <WinAPI.au3>
_WinAPI_WaitForMultipleObjects($iCount, $pHandles [, $fWaitAll = False [, $iTimeout = -1]])

Parameters

$iCount | The number of object handles in the array pointed to by pHandles
$pHandles | Pointer to an array of object handles
$fWaitAll | [optional] If True, the function returns when the state of all objects in the pHandles array is signaled. If False, the function returns when the state of any one of the objects is set to signaled. In the latter case, the return value indicates the object whose state caused the function to return.
$iTimeout | [optional] The time-out interval, in milliseconds. The function returns if the interval elapses, even if the conditions specified by the fWaitAll parameter are not met. If 0, the function tests the states of the specified objects and returns immediately. If -1, the function's time-out interval never elapses.

Return Value

Success: | Indicates the event that caused the function to return
Failure: | -1

Remarks

None.

Related

_WinAPI_WaitForSingleObject

See Also

Search WaitForMultipleObjects in MSDN Library


Function _WinAPI_WaitForSingleObject

Function Reference

_WinAPI_WaitForSingleObject

Waits until the specified object is in the signaled state

#Include <WinAPI.au3>
_WinAPI_WaitForSingleObject($hHandle [, $iTimeout = -1])

Parameters

$hHandle | A handle to the object
$iTimeout | [optional] The time-out interval, in milliseconds. The function returns if the interval elapses, even if the conditions specified by the fWaitAll parameter are not met. If 0, the function tests the states of the specified objects and returns immediately. If -1, the function's time-out interval never elapses.

Return Value

Success: | Indicates the event that caused the function to return
Failure: | -1

Remarks

None.

Related

_WinAPI_WaitForMultipleObjects

See Also

Search WaitForSingleObject in MSDN Library


Function _WinAPI_WideCharToMultiByte

Function Reference

_WinAPI_WideCharToMultiByte

Converts a Unicode string to a multibyte string

#Include <WinAPI.au3>
_WinAPI_WideCharToMultiByte($pUnicode [, $iCodePage = 0 [, $iFlags = 0 [, $bRetString = True]]])

Parameters

$pUnicode | String, DllStruct or Pointer to a byte array structure containing Unicode text to be converted
$iCodePage | [optional] Code page to use in performing the conversion: 0 - The current system Windows ANSI code page 1 - The current system OEM code page 2 - The current system Macintosh code page 3 - The Windows ANSI code page for the current thread 42 - Symbol code page 65000 - UTF-7 65001 - UTF-8
$iFlags | [optional] Flags indicating the conversion type, see MSDN (default 0)
$bRetString | [optional] Flags that indicate whether to return a String or a DllStruct (default True : String)

Return Value

Returns a string or a DllStruct containing a multibyte string

Remarks

None.

Related

_WinAPI_MultiByteToWideChar

See Also

Search WideCharToMultiByte in MSDN Library


Function _WinAPI_WindowFromPoint

Function Reference

_WinAPI_WindowFromPoint

Retrieves the handle of the window that contains the specified point

#Include <WinAPI.au3>
_WinAPI_WindowFromPoint(ByRef $tPoint)

Parameters

$tPoint $tagPOINT structure that defines the point to be checked

Return Value

Success: | The handle of the window that contains the point
Failure: | 0

Remarks

The WindowFromPoint function does not retrieve the handle of a hidden or disabled window, even if the point is
within the window.

Related

$tagPOINT

See Also

Search WindowFromPoint in MSDN Library

Example

#include <WinAPI.au3>

Global $Struct = DllStructCreate($tagPoint)

_Main()

Func _Main()
HotKeySet("{ESC}", "_Quit")

While 1
Sleep(100)
ToolTip("")
Pos()
$hwnd = _WinAPI_WindowFromPoint($Struct)
ToolTip($hwnd)
WEnd
EndFunc ;==>_Main

Func Pos()
DllStructSetData($Struct, "x", MouseGetPos(0))
DllStructSetData($Struct, "y", MouseGetPos(1))
EndFunc ;==>Pos

Func _Quit()
Exit
EndFunc ;==>_Quit


Function _WinAPI_WriteConsole

Function Reference

_WinAPI_WriteConsole

Writes a character string to a console screen buffer

#Include <WinAPI.au3>
_WinAPI_WriteConsole($hConsole, $sText)

Parameters

$hConsole | Handle to the console screen buffer
$sText | Text to be written to the console screen buffer

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search WriteConsole in MSDN Library


Function _WinAPI_WriteFile

Function Reference

_WinAPI_WriteFile

Writes data to a file at the position specified by the file pointer

#Include <WinAPI.au3>
_WinAPI_WriteFile($hFile, $pBuffer, $iToWrite, ByRef $iWritten [, $pOverlapped = 0])

Parameters

$hFile | Handle to the file to be written
$pBuffer | Pointer to the buffer containing the data to be written
$iToWrite | Number of bytes to be written to the file
$iWritten | The number of bytes written
$pOverlapped | [optional] Pointer to a $tagOVERLAPPED structure

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

$tagOVERLAPPED, _WinAPI_CloseHandle, _WinAPI_CreateFile, _WinAPI_FlushFileBuffers, _WinAPI_GetFileSizeEx, _WinAPI_ReadFile, _WinAPI_SetEndOfFile, _WinAPI_SetFilePointer

See Also

Search WriteFile in MSDN Library

Example

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

#include <WinAPI.au3>

Global $sFile, $hFile, $sText, $nBytes, $tBuffer

; 1) create file and write data to it
$sFile = @ScriptDir & '\test.txt'
$sText = 'abcdefghijklmnopqrstuvwxyz'
$tBuffer = DllStructCreate("byte[" & StringLen($sText) & "]")
DllStructSetData($tBuffer, 1, $sText)
$hFile = _WinAPI_CreateFile($sFile, 1)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), StringLen($sText), $nBytes)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('1) ' & FileRead($sFile) & @CRLF)

; 2) read 6 bytes from position 3
$tBuffer = DllStructCreate("byte[6]")
$hFile = _WinAPI_CreateFile($sFile, 2, 2)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$sText = BinaryToString(DllStructGetData($tBuffer, 1))
ConsoleWrite('2) ' & $sText & @CRLF)

; 3) write previously read 6 bytes from position 3 to the same position but in UpperCase
DllStructSetData($tBuffer, 1, StringUpper($sText))
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 3)
_WinAPI_WriteFile($hFile, DllStructGetPtr($tBuffer), 6, $nBytes)
_WinAPI_CloseHandle($hFile)
$tBuffer = 0
ConsoleWrite('3) ' & FileRead($sFile) & @CRLF)

; 4) truncate file size to 12 bytes
$hFile = _WinAPI_CreateFile($sFile, 2, 4)
_WinAPI_SetFilePointer($hFile, 12)
_WinAPI_SetEndOfFile($hFile)
_WinAPI_CloseHandle($hFile)
ConsoleWrite('4) ' & FileRead($sFile) & @CRLF)

FileDelete($sfile)


Function _WinAPI_WriteProcessMemory

Function Reference

_WinAPI_WriteProcessMemory

Writes memory in a specified process

#Include <WinAPI.au3>
_WinAPI_WriteProcessMemory($hProcess, $pBaseAddress, $pBuffer, $iSize, ByRef $iWritten [, $sBuffer = "ptr"])

Parameters

$hProcess | Identifies an open handle to a process whose memory is to be written to
$pBaseAddress | Points to the base address in the specified process to be written to
$pBuffer | Points to the buffer that supplies data to be written into the address space
$iSize | Specifies the number of bytes to write into the specified process
$iWritten | The actual number of bytes transferred into the specified process
$sBuffer | [optional] Contains the data type that $pBuffer represents

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinAPI_ReadProcessMemory

See Also

Search WriteProcessMemory in MSDN Library


User Defined Functions

WinNet user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <WinNet.au3>.

User Defined Function | Description
_WinNet_AddConnection | Connects a local device to a network resource
_WinNet_AddConnection2 | Connects a local device to a network resource
_WinNet_AddConnection3 | Connects a local device to a network resource
_WinNet_CancelConnection | Cancels an existing network connection
_WinNet_CancelConnection2 | Cancels an existing network connection
_WinNet_CloseEnum | Ends a network resource enumeration started by a call to WNetOpenEnum
_WinNet_ConnectionDialog | Starts a general browsing dialog box for connecting to network resources
_WinNet_ConnectionDialog1 | Starts a general browsing dialog box for connecting to network resources
_WinNet_DisconnectDialog | Starts a general browsing dialog box for disconnecting from network resources
_WinNet_DisconnectDialog1 | Starts a general browsing dialog box for disconnecting from network resources
_WinNet_EnumResource | Continues an enumeration of network resources
_WinNet_GetConnection | Retrieves the name of the network resource associated with a local device
_WinNet_GetConnectionPerformance | Returns information about the performance of a network connection resource
_WinNet_GetLastError | Retrieves the most recent extended error
_WinNet_GetNetworkInformation | Returns extended information about a specific network provider
_WinNet_GetProviderName | Obtains the provider name for a specific type of network
_WinNet_GetResourceInformation | Identifies the network provider that owns the resource
_WinNet_GetResourceParent | Returns the parent of a network resource in the network browse hierarchy
_WinNet_GetUniversalName | Converts drived based path to universal form
_WinNet_GetUser | Retrieves the default user name, or the user name used to establish a connection
_WinNet_OpenEnum | Starts an enumeration of network resources or existing connections
_WinNet_RestoreConnection | Restores the connection to a network resource
_WinNet_UseConnection | Connects a local device to a network resource


Function _WinNet_AddConnection

Function Reference

_WinNet_AddConnection

Connects a local device to a network resource

#Include <WinNet.au3>
_WinNet_AddConnection($sLocalName, $sRemoteName [, $sPassword = 0])

Parameters

$sLocalName | Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a case-insensitive manner. If 0, a connection to the network resource is made without redirecting the local device.
$sRemoteName | Name of the network resource to connect to
$sPassword | [optional] Password to be used to make a connection. This parameter is usually the password associated with the current user. If 0, the default password is used. If the string is empty, no password is used.

Return Value

Success: | True
Failure: | False

Remarks

This function is provided only for compatibility with 16-bit versions of Windows. Applications should call the
WNet_AddConnection2 or the WNet_AddConnection3 function. A successful connection is persistent meaning that
the system automatically restores the connection during subsequent logon operations.

Related

_WinNet_AddConnection2, _WinNet_AddConnection3

See Also

Search WNetAddConnection in MSDN Library


Function _WinNet_AddConnection2

Function Reference

_WinNet_AddConnection2

Connects a local device to a network resource

#Include <WinNet.au3>
_WinNet_AddConnection2($sLocalName, $sRemoteName [, $sUserName = 0 [, $sPassword = 0 [, $iType = 1 [, $iOptions = 1]]]])

Parameters

$sLocalName Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a
case-insensitive manner. If 0, a connection to the network resource is made without redirecting the local
device.
$sRemoteName | Name of the network resource to connect to
$sUsername | [optional] User name for making the connection. If 0, the function uses the default user name.
$sPassword [optional] Password to be used to make a connection. If 0, the default password is used. If the string is
empty, no password is used.
$iType [optional] Specifies the type of network resource to connect to:
0 - Any (only if $sLocalName is 0)
1 - Disk
2 - Print
$iOptions [optional] Connection options. Can be one or more of the following:
1 - The network resource connection should be remembered
2 - The operating system may interact with the user for authentication purposes
4 - The system not to use any default setting for user names or passwords without offering the user the
opportunity to supply an alternative. This flag is ignored unless bit 2 (interactive) is also set.
8 - Forces the redirection of a local device when making the connection
16 - The operating system prompts the user for authentication using the command line instead of a GUI. This
flag is ignored unless bit 2 (interactive) is also set.
32 - If this bit is set, and the operating system prompts for a credential, the credential is saved by the
credential manager. If the credential manager is disabled for the caller's logon session, or if the network
provider does not support saving credentials, this flag is ignored. This flag is also ignored unless you set
bit 5 (command line instead of GUI).

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_AddConnection, _WinNet_AddConnection3

See Also

Search WNetAddConnection2 in MSDN Library


Function _WinNet_AddConnection3

Function Reference

_WinNet_AddConnection3

Connects a local device to a network resource

#Include <WinNet.au3>
_WinNet_AddConnection3($hWnd, $sLocalName, $sRemoteName [, $sUserName = 0 [, $sPassword = 0 [, $iType = 1 [, $iOptions = 1]]]])

Parameters

$hWnd Handle to a window that the provider of network resources can use as an owner window for
dialogs. Use this parameter if you set bit 2 (interactive) in the Options parameter. This parameter can be 0.
$sLocalName Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a
case-insensitive manner. If 0, a connection to the network resource is made without redirecting the local
device.
$sRemoteName | Name of the network resource to connect to
$sUsername | [optional] User name for making the connection. If 0, the function uses the default user name.
$sPassword [optional] Password to be used to make a connection. If 0, the default password is used. If the string is
empty, no password is used.
$iType [optional] Specifies the type of network resource to connect to:
0 - Any (only if $sLocalName is 0)
1 - Disk
2 - Print
$iOptions [optional] Connection options. Can be one or more of the following:
1 - The network resource connection should be remembered
2 - The operating system may interact with the user for authentication purposes
4 - The system not to use any default setting for user names or passwords without offering the user the
opportunity to supply an alternative. This flag is ignored unless bit 2 (interactive) is also set.
8 - Forces the redirection of a local device when making the connection
16 - The operating system prompts the user for authentication using the command line instead of a GUI. This
flag is ignored unless bit 2 (interactive) is also set.
32 - If this bit is set, and the operating system prompts for a credential, the credential is saved by the
credential manager. If the credential manager is disabled for the caller's logon session, or if the network
provider does not support saving credentials, this flag is ignored. This flag is also ignored unless you set
bit 5 (command line instead of GUI).

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_AddConnection, _WinNet_AddConnection2

See Also

Search WNetAddConnection3 in MSDN Library


Function _WinNet_CancelConnection

Function Reference

_WinNet_CancelConnection

Cancels an existing network connection

#Include <WinNet.au3>
_WinNet_CancelConnection($sName [, $fForce = True])

Parameters

$sName | Name of either the redirected local device or the remote network resource to disconnect from. When this parameter specifies a redirected local device, the function cancels only the specified device redirection. If the parameter specifies a remote network resource, only the connections to remote networks without devices are canceled.
$fForce | [optional] Specifies whether or not the disconnection should occur if there are open files or jobs on the connection. If this parameter is False, the function fails if there are open files or jobs.

Return Value

Success: | True
Failure: | False

Remarks

This function is provided for compatibility with 16-bit versions of Windows. Other Windows-based applications
should call the WNet_CancelConnection2 function.

Related

_WinNet_CancelConnection2

See Also

Search WNetCancelConnection in MSDN Library


Function _WinNet_CancelConnection2

Function Reference

_WinNet_CancelConnection2

Cancels an existing network connection

#Include <WinNet.au3>
_WinNet_CancelConnection2($sName [, $fUpdate = True [, $fForce = True]])

Parameters

$sName | Name of either the redirected local device or the remote network resource to disconnect from. When this parameter specifies a redirected local device, the function cancels only the specified device redirection. If the parameter specifies a remote network resource, only the connections to remote networks without devices are canceled.
$fUpdate | [optional] If True, the users profile is updated with the information that the connection is no longer a persistent one.
$fForce | [optional] Specifies whether or not the disconnection should occur if there are open files or jobs on the connection. If this parameter is False, the function fails if there are open files or jobs.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_CancelConnection

See Also

Search WNetCancelConnection2 in MSDN Library


Function _WinNet_CloseEnum

Function Reference

_WinNet_CloseEnum

Ends a network resource enumeration started by a call to WNetOpenEnum

#Include <WinNet.au3>
_WinNet_CloseEnum($hEnum)

Parameters

$hEnum Handle that identifies an enumeration instance. The handle is returned by the WNet_OpenEnum
function

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_OpenEnum

See Also

Search WNetCloseEnum in MSDN Library


Function _WinNet_ConnectionDialog

Function Reference

_WinNet_ConnectionDialog

Starts a general browsing dialog box for connecting to network resources

#Include <WinNet.au3>
_WinNet_ConnectionDialog($hWnd)

Parameters

$hWnd Handle to the owner window for the dialog box

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_ConnectionDialog1

See Also

Search WNetConnectionDialog in MSDN Library


Function _WinNet_ConnectionDialog1

Function Reference

_WinNet_ConnectionDialog1

Starts a general browsing dialog box for connecting to network resources

#Include <WinNet.au3>
_WinNet_ConnectionDialog1($hWnd [, $sRemoteName = "" [, $iFlags = 2]])

Parameters

$hWnd | Handle to the owner window for the dialog box
$sRemoteName | [optional] Name of the network resource to connect to
$iFlags | [optional] Dialog box options. Can be one or more of the following: 1 - Display a read-only path instead of allowing the user to type in a path 2 - Enter the most recently used paths into the combination box 4 - Do not show the restore the connection at logon checkbox 8 - Restore the connection at logon 16 - Do not restore the connection at logon

Return Value

Success: | Returns the number of the connected device. The value is 1 for A:, 2 for B:, 3 for C: and so on. If the user made a deviceless connection, the value is –1.
Failure: | Set @error

Remarks

None.

Related

_WinNet_ConnectionDialog

See Also

Search WNetConnectionDialog1 in MSDN Library


Function _WinNet_DisconnectDialog

Function Reference

_WinNet_DisconnectDialog

Starts a general browsing dialog box for disconnecting from network resources

#Include <WinNet.au3>
_WinNet_DisconnectDialog($hWnd)

Parameters

$hWnd Handle to the owner window for the dialog box

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_DisconnectDialog1

See Also

Search WNetDisconnectDialog in MSDN Library


Function _WinNet_DisconnectDialog1

Function Reference

_WinNet_DisconnectDialog1

Starts a general browsing dialog box for disconnecting from network resources

#Include <WinNet.au3>
_WinNet_DisconnectDialog1($hWnd, $sLocalName [, $sRemoteName = "" [, $iFlags = 1]])

Parameters

$hWnd | Handle to the owner window for the dialog box
$sLocalName | Name of a local device, such as "F:" or "LPT1"
$sRemoteName | [optional] Name of the network resource to disconnect. This member can be 0 if $LocalName is specified. When sLocalName is specified, the connection to the network resource redirected from sLocalName is disconnected.
$iFlags | [optional] Flags describing the connection. Can be a combination of: 1 - If this value is set, the specified connection is no longer a persistent one. This flag is valid only if sLocalName specifies a local device. 2 - If this value is NOT set, the system applies force when disconnecting

Return Value

Success: | Returns 1. If the user cancels the dialog box, the return value is –1.
Failure: | Returns 0 and set @error.

Remarks

None.

Related

_WinNet_DisconnectDialog

See Also

Search WNetDisconnectDialog1 in MSDN Library


Function _WinNet_EnumResource

Function Reference

_WinNet_EnumResource

Continues an enumeration of network resources

#Include <WinNet.au3>
_WinNet_EnumResource($hEnum, ByRef $iCount, $pBuffer, ByRef $iBufSize)

Parameters

$hEnum | Handle that identifies an enumeration instance. The handle is returned by the _WinNet_OpenEnum function.
$iCount | Number of entries requested. If the number requested is –1, the function returns as many entries as possible. If the function succeeds, on return the variable contains the number of entries actually read
$pBuffer | Pointer to the buffer that receives the enumeration results. The results are returned as an array of $tagNETRESOURCE structures. The buffer must be large enough to hold the structures plus the strings to which their members point. The buffer is valid until the next call using the handle specified by hEnum. The order of $tagNETRESOURCE structures in the array is not predictable.
$iBufSize | The size of the buffer, in bytes. If the buffer is too small to receive even one entry, this parameter receives the required size of the buffer.

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_OpenEnum, $tagNETRESOURCE

See Also

Search WNetEnumResource in MSDN Library


Function _WinNet_GetConnection

Function Reference

_WinNet_GetConnection

Retrieves the name of the network resource associated with a local device

#Include <WinNet.au3>
_WinNet_GetConnection($sLocalName)

Parameters

$sLocalName The name of the local device to get the network name for

Return Value

Success: | The remote name used to make the connection
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetConnection in MSDN Library


Function _WinNet_GetConnectionPerformance

Function Reference

_WinNet_GetConnectionPerformance

Returns information about the performance of a network connection resource

#Include <WinNet.au3>
_WinNet_GetConnectionPerformance($sLocalName, $sRemoteName)

Parameters

$sLocalName | Name of a local device, such as "F:" or "LPT1", that is redirected to a network resource to be queried. If blank, the network resource is specified in sRemoteName. If this parameter specifies a local device sRemoteName is ignored.
$sRemoteName | Name of the network resource to query. The resource must currently have an established connection. For example, if the resource is a file on a file server, then having the file open will ensure the connection.

Return Value

Success: | Array with the following format:
 | $aInfo[0] - Connection description. Can be one of more of the following:
 | 1 - The information returned applies to the performance of the network card
 | 2 - The connection is not being routed
 | 4 - The connection is over a medium that is typically slow
 | 8 - Some of the information returned is calculated dynamically
 | $aInfo[1] - Speed of the media to the network resource, in 100 bps
 | $aInfo[2] - One-way delay time introduced when sending information
 | $aInfo[3] - Size of data that an application should use when making a single request to the resource
Failure: | Set @error

Remarks

None.

Related

See Also

Search MultinetGetConnectionPerformance in MSDN Library


Function _WinNet_GetLastError

Function Reference

_WinNet_GetLastError

Retrieves the most recent extended error

#Include <WinNet.au3>
_WinNet_GetLastError(ByRef $iError, ByRef $sError, ByRef $sName)

Parameters

$iError | On return, contains the most recent extended error code
$sError | On return, contains the most recent extended error code message
$sName | On return, the network provider that raised the error

Return Value

Success: | The most recent error messages
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetLastError in MSDN Library


Function _WinNet_GetNetworkInformation

Function Reference

_WinNet_GetNetworkInformation

Returns extended information about a specific network provider

#Include <WinNet.au3>
_WinNet_GetNetworkInformation($sName)

Parameters

$sName The network provider for which information is required

Return Value

Success: | Array with the following format:
 | $aInfo[0] - Version number of the network provider software
 | $aInfo[1] - Current status of the network provider software:
 | 0 - The network is running
 | 1 - The network is unavailable
 | 2 - The network is not currently able to service requests
 | $aInfo[2] - Instance handle for the network provider
 | $aInfo[3] - High word of the network type unique to the running network
 | $aInfo[4] - Set of bit flags indicating the valid print numbers for redirecting local printer devices, with
 | the low-order bit corresponding to LPT1. | $aInfo[5] - Set of bit flags indicating the valid local disk devices that can be used for redirecting disk
 | drives, with the low-order bit corresponding to A:.
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetNetworkInformation in MSDN Library


Function _WinNet_GetProviderName

Function Reference

_WinNet_GetProviderName

Obtains the provider name for a specific type of network

#Include <WinNet.au3>
_WinNet_GetProviderName($iType)

Parameters

$iType Network type that is unique to the network

Return Value

Success: | Network provider name
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetProviderName in MSDN Library


Function _WinNet_GetResourceInformation

Function Reference

_WinNet_GetResourceInformation

Identifies the network provider that owns the resource

#Include <WinNet.au3>
_WinNet_GetResourceInformation($sRemoteName [, $sProvider = "" [, $iType = 0]])

Parameters

$sRemoteName | The remote path name of the resource
$sProvider | [optional] The name of the provider that owns the resource. This member can be blank if the provider name is unknown.
$iType | [optional] Type of resource. This member can be 0 if it is not known.

Return Value

Success: | Array with the following format:
 | $aResource[0] - Scope of enumeration:
 | 0 - Connected
 | 1 - All resources
 | 2 - Remembered
 | $aResource[1] - Type of resource:
 | 0 - Disk
 | 1 - Print
 | 2 - Unknown
 | $aResource[2] - Display option:
 | 0 - Generic
 | 1 - Domain
 | 2 - Server
 | 3 - Share
 | 4 - File
 | 5 - Group
 | 6 - Network
 | 7 - Root
 | 8 - Admin Share
 | 9 - Directory
 | 10 - Tree
 | 11 - NDS Container
 | $aResource[3] - Resource usage. Can be one or more of the following:
 | 1 - The resource is a connectable resource
 | 2 - The resource is a container resource
 | 4 - The resource is attached
 | 8 - Thre resource is reserved
 | $aResource[4] - Local name
 | $aResource[5] - Remote name
 | $aResource[6] - Comment supplied by the network provider
 | $aResource[7] - The name of the provider that owns the resource
 | $aResource[8] - The part of the resource that is accessed through system functions
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetResourceInformation in MSDN Library


Function _WinNet_GetResourceParent

Function Reference

_WinNet_GetResourceParent

Returns the parent of a network resource in the network browse hierarchy

#Include <WinNet.au3>
_WinNet_GetResourceParent($sRemoteName, $sProvider [, $iType = 0])

Parameters

$sRemoteName | The remote path name of the resource
$sProvider | The name of the provider that owns the resource
$iType | [optional] Type of resource. This member can be 0 if it is not known.

Return Value

Success: | Array with the following format:
 | $aResource[0] - Scope of enumeration:
 | 0 - Connected
 | 1 - All resources
 | 2 - Remembered
 | $aResource[1] - Type of resource:
 | 0 - Disk
 | 1 - Print
 | 2 - Unknown
 | $aResource[2] - Display option:
 | 0 - Generic
 | 1 - Domain
 | 2 - Server
 | 3 - Share
 | 4 - File
 | 5 - Group
 | 6 - Network
 | 7 - Root
 | 8 - Admin Share
 | 9 - Directory
 | 10 - Tree
 | 11 - NDS Container
 | $aResource[3] - Resource usage. Can be one or more of the following:
 | 1 - The resource is a connectable resource
 | 2 - The resource is a container resource
 | 4 - The resource is attached
 | 8 - Thre resource is reserved
 | $aResource[4] - Local name
 | $aResource[5] - Remote name
 | $aResource[6] - Comment supplied by the network provider
 | $aResource[7] - The name of the provider that owns the resource
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetResourceParent in MSDN Library


Function _WinNet_GetUniversalName

Function Reference

_WinNet_GetUniversalName

Converts drived based path to universal form

#Include <WinNet.au3>
_WinNet_GetUniversalName($sLocalPath)

Parameters

$sLocalPath Drive based path for a network resource

Return Value

Success: | Array with the following format:
 | $aPath[0] - UNC name string that identifies a network resource
 | $aPath[1] - Name of the network connection
 | $aPath[2] - Remaining path string
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetUniversalName in MSDN Library


Function _WinNet_GetUser

Function Reference

_WinNet_GetUser

Retrieves the default user name, or the user name used to establish a connection

#Include <WinNet.au3>
_WinNet_GetUser($sName)

Parameters

$sName Either the name of a local device that has been redirected to a network resource, or the remote
name of a network resource to which a connection has been made without redirecting a local device. If blank,
the system returns the name of the current user for the process.

Return Value

Success: | User name
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetGetUser in MSDN Library


Function _WinNet_OpenEnum

Function Reference

_WinNet_OpenEnum

Starts an enumeration of network resources or existing connections

#Include <WinNet.au3>
_WinNet_OpenEnum($iScope, $iType, $iUsage, $pResource, ByRef $hEnum)

Parameters

$iScope | Scope of the enumeration: 0 - Enumerate all currently connected resources 1 - Enumerate all resources on the network 2 - Enumerate all remembered (persistent) connections 3 - Enumerate only resources in the network context of the caller
$iType | Resource types: 0 - All resources 1 - Disk resources 2 - Print resources
$iUsage | Resource usage types: 0 - All resources 1 - All connectable resources 2 - All container resources 4 - Forces the function to fail if the user is not authenticated
$pResource | Pointer to a $tagNETRESOURCE structure that specifies the container to enumerate. If iScope is not 1, this must be 0. If 0, the root of the network is assumed.
$hEnum | On return, a handle that can be used in calls to WNet_EnumResource

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

_WinNet_EnumResource, _WinNet_CloseEnum, $tagNETRESOURCE

See Also

Search WNetOpenEnum in MSDN Library


Function _WinNet_RestoreConnection

Function Reference

_WinNet_RestoreConnection

Restores the connection to a network resource

#Include <WinNet.au3>
_WinNet_RestoreConnection([$sDevice = "" [, $hWnd = 0 [, $fUseUI = True]]])

Parameters

$sDevice | [optional] The local name of the drive to connect to, such as "Z:". If blank, the function reconnects all persistent drives stored in the registry for the current user.
$hWnd | [optional] Handle to the parent window that the function uses to display the user interface that prompts the user for a name and password when making the network connection. If 0, there is no owner window.
$fUseUI | [optional] If True, display a username/password prompt to the caller

Return Value

Success: | True
Failure: | False

Remarks

None.

Related

See Also

Search WNetRestoreConnection in MSDN Library


Function _WinNet_UseConnection

Function Reference

_WinNet_UseConnection

Connects a local device to a network resource

#Include <WinNet.au3>
_WinNet_UseConnection($hWnd, $sLocalName, $sRemoteName [, $sUserName = 0 [, $sPassword = 0 [, $iType = 1 [, $iOptions = 1]]]])

Parameters

$hWnd Handle to a window that the provider of network resources can use as an owner window for
dialogs. Use this parameter if you set bit 2 (interactive) in the Options parameter. This parameter can be 0.
$sLocalName Name of a local device to be redirected, such as "F:" or "LPT1". The string is treated in a
case-insensitive manner. If 0, a connection to the network resource is made without redirecting the local
device.
$sRemoteName | Name of the network resource to connect to
$sUsername | [optional] User name for making the connection. If 0, the function uses the default user name.
$sPassword [optional] Password to be used to make a connection. If 0, the default password is used. If the string is
empty, no password is used.
$iType [optional] Specifies the type of network resource to connect to:
0 - Any (only if $sLocalName is blank)
1 - Disk
2 - Print
$iOptions [optional] Connection options. Can be one or more of the following:
1 - The network resource connection should be remembered
2 - The operating system may interact with the user for authentication purposes
4 - The system does not use any default setting for user names or passwords without offering the user the
opportunity to supply an alternative. This flag is ignored unless bit 2 (interactive) is also set.
8 - Forces the redirection of a local device when making the connection
16 - The operating system prompts the user for authentication using the command line instead of a GUI. This
flag is ignored unless bit 2 (interactive) is also set.
32 - If this bit is set, and the operating system prompts for a credential, the credential is saved by the
credential manager. If the credential manager is disabled for the caller's logon session, or if the network
provider does not support saving credentials, this flag is ignored. This flag is also ignored unless you set
bit 5 (command line instead of GUI).

Return Value

Success: | Array with the following format:
 | $aInfo[0] - If True, the connection was made using a local device redirection
 | $aInfo[1] - If sLocalName specifies a local device, this is the local device name. If sLocalName does not
 | specify a device and the network requires a local device redirection, or if bit 4 (force redirection) is set, | this buffer receives the name of the redirected local device. Otherwise, the name copied into the buffer is | that of a remote resource.
Failure: | Set @error

Remarks

None.

Related

See Also

Search WNetUseConnection in MSDN Library


User Defined Functions

Word user defined functions Reference

Below is a complete list of the user defined functions available in AutoIt. Click on a user defined function name for a detailed description.

When using them you need to add a #include <Word.au3>.

User Defined Function | Description
_Word_VersionInfo | Returns an array of information about the Word.au3 version
_WordAttach | Attach to the first existing instance of Microsoft Word where the search string matches based on the selected mode.
_WordCreate | Create a Microsoft Office Word Object
_WordDocAdd | Returns an object variable representing a new empty document
_WordDocAddLink | Add a hyperlink to the document
_WordDocAddPicture | Add a picture to the document
_WordDocClose | Closes a previously opened word document
_WordDocFindReplace | Runs the specified find and replace operation.
_WordDocGetCollection | Returns a collection object containing all documents
_WordDocLinkGetCollection | Returns a collection object containing all links in the document
_WordDocOpen | Opens an existing Microsoft Word Document
_WordDocPrint | Prints all or part of the specified document.
_WordDocPropertyGet | Returns a select property of the Word Document.
_WordDocPropertySet | Set a select property of the Word Document
_WordDocSave | Saves a previously opened document
_WordDocSaveAs | Saves the specified document with a new name or format.
_WordErrorHandlerDeRegister | Disable a registered user COM error handler
_WordErrorHandlerRegister | Register and enable a user COM error handler
_WordErrorNotify | Specifies whether Word.au3 automatically notifies of Warnings and Errors (to the console)
_WordMacroRun | Runs a Visual Basic macro
_WordPropertyGet | Returns a select property of the Word Application.
_WordPropertySet | Set a select property of the Word Application.
_WordQuit | Close the window and remove the object reference to it


Function _Word_VersionInfo

Function Reference

_Word_VersionInfo

Returns an array of information about the Word.au3 version

#include <Word.au3>
_Word_VersionInfo ( )

Parameters

None.

Return Value

Success: | Returns an array ($WordAU3VersionInfo)
 | $WordAU3VersionInfo[0] = Release Type (T=Test or V=Production)
 | $WordAU3VersionInfo[1] = Major Version
 | $WordAU3VersionInfo[2] = Minor Version
 | $WordAU3VersionInfo[3] = Sub Version
 | $WordAU3VersionInfo[4] = Release Date (YYYYMMDD)
 | $WordAU3VersionInfo[5] = Display Version (e.g. V1.0-1)
Failure: | None

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Retrieve and display Word.au3 version information
; *******************************************************
;
#include <Word.au3>
$aVersion = _Word_VersionInfo ()
MsgBox(0, "Word.au3 Version", $aVersion[5] & " released " & $aVersion[4])


Function _WordAttach

Function Reference

_WordAttach

Attach to the first existing instance of Microsoft Word where the search string matches based on the selected mode.

#include <Word.au3>
_WordAttach ( $s_string [, $s_mode = "FilePath"] )

Parameters

$s_string | String to search for
$s_mode | [optional] specifies search mode FileName = Name of the open document FilePath = (Default) Full path to the open document HWND = hwnd of the word window Text = Text from the body of the document Title = Title of the word window

Return Value

Success: | Returns an object variable pointing to the Word.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidValue = Invalid Value
 | $_WordStatus_NoMatch = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_WordCreate, _WordQuit

Example

; *******************************************************
; Example 1 - Attach to a word window with an open file named "Test.doc",
; then display the documents full file path.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordAttach ("Test.doc", "FileName")
If Not @error Then
$oDoc = _WordDocGetCollection ($oWordApp, 0)
MsgBox(64, "Document FileName", $oDoc.FullName)
EndIf

; *******************************************************
; Example 2 - Attach to a word window with "The quick brown fox"
; in the text of the document
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordAttach ("The quick brown fox", "Text")


Function _WordCreate

Function Reference

_WordCreate

Create a Microsoft Office Word Object

#include <Word.au3>
_WordCreate ( [ $s_FilePath = "" [, $b_tryAttach = 0 [, $b_visible = 1 [, $b_takeFocus = 1]]]] )

Parameters

$s_FilePath | [optional] specifies the file to open upon creation (See Remarks)
$b_tryAttach | [optional] specifies whether to try to attach to an existing window 0 = (Default) do not try to attach 1 = Try to attach to an existing window
$b_visible | [optional] specifies whether the window will be visible 0 = Window is hidden 1 = (Default) Window is visible
$b_takeFocus | [optional] specifies whether to bring the attached window to focus 0 = Do Not Bring window into focus 1 = (Default) bring window into focus

Return Value

Success: | Returns an object variable pointing to a Word.Application object
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Set to true (1) or false (0) depending on the success of $f_tryAttach

Remarks

File will be created if it does not exist.

Related

_WordAttach, _WordQuit

Example

; *******************************************************
; Example 1 - Create a Microsoft Word window and open a document file
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")

; *******************************************************
; Example 2 - Attempt to attach to an existing word window with the specified document open.
; Create a new word window and open that document if one does not already exist.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 1)
; Check @extended return value to see if attach was successful
If @extended Then
MsgBox(0, "", "Attached to Existing Window")
Else
MsgBox(0, "", "Created New Window")
EndIf

; *******************************************************
; Example 3 - Create a word window with a new blank document
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ()

; *******************************************************
; Example 4 - Create an invisible word window, open a document,
; append some text, and quit saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 0, 0)
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.insertAfter ("This is some text to insert.")
_WordQuit ($oWordApp, -1)


Function _WordDocAdd

Function Reference

_WordDocAdd

Returns an object variable representing a new empty document

#include <Word.au3>
_WordDocAdd ( ByRef $o_object [, $i_DocumentType = 0 [, $s_Template = "" [, $b_NewTemplate = 0]]] )

Parameters

$o_object | Object variable of a Word.Application object
$i_DocumentType | [optional] specifies the new document type 0 = (Default) blank document 1 = Web page 2 = Email Message (Currently this is non functional) 3 = Frameset 4 = XML Document
$s_Template | [optional] specifies name of the template to be used for the new document "" = (Default) normal template is used
$b_NewTemplate | [optional] specifies whether to open the document as a template 0 = (Default) do not open as template 1 = open as template

Return Value

Success: | Returns an object variable pointing to a Word.Application, document object
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_WordDocClose, _WordDocOpen, _WordDocSave, _WordDocSaveAs

Example

; *******************************************************
; Example 1 - Create an empty word window and add a new blank document
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ("")
$oDoc = _WordDocAdd ($oWordApp)


Function _WordDocAddLink

Function Reference

_WordDocAddLink

Add a hyperlink to the document

#include <Word.au3>
_WordDocAddLink ( ByRef $o_object [, $o_Anchor = "" [, $s_Address = "" [, $s_SubAddress = "" [, $s_ScreenTip = "" [, $s_TextToDisplay = "" [, $s_Target = ""]]]]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$o_Anchor | [optional] The text or graphic that you want turned into a hyperlink. "" = (Default) Uses entire document as range
$s_Address | [optional] The address for the specified link. The address can be an e-mail address, an Internet address, or a file name. "" = (Default) Link to the specified document is used
$s_SubAddress | [optional] The name of a location within the destination file, such as a bookmark, named range, or slide number.
$s_ScreenTip | [optional] The text that appears as a ScreenTip when the mouse pointer is positioned over the specified hyperlink. "" = (Default) Uses value of $s_Address
$s_TextToDisplay | [optional] The display text of the specified hyperlink. The value of this argument replaces the text or graphic specified by Anchor. "" = (Default) Uses value of $s_Address
$s_Target | [optional] The name of the frame or window in which you want to load the specified hyperlink.

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window with a new blank document,
; add a link, then get a collection of links.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ()
$oDoc = _WordDocGetCollection ($oWordApp, 0)
_WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt")
$oLinks = _WordDocLinkGetCollection ($oDoc)
MsgBox(0, "Link Count", @extended)


Function _WordDocAddPicture

Function Reference

_WordDocAddPicture

Add a picture to the document

#include <Word.au3>
_WordDocAddPicture ( ByRef $o_object, $s_FilePath [, $b_LinkToFile = 0 [, $b_SaveWithDocument = 0 [, $o_Range = ""]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$s_FilePath | The path and file name of the picture.
$b_LinkToFile | [optional] Specifies whether to link the picture to the file from which it was created. 0 = (Default) Make the picture an independent copy of the file 1 = Link the picture to the file from which it was created
$b_SaveWithDocument | [optional] Specifies whether to save the linked picture with the document. 0 = (Default) Do not save the linked picture with the document 1 = Save the linked picture with the document
$o_Range | [optional] The location where the picture will be placed in the text. "" = (Default) The picture is placed automatically Any range object

Return Value

Success: | Returns an object variable pointing to a Word.Application, shape object
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_ComError = Com Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window with a new blank document,
; then add some pictures to the document.
; *******************************************************
;
#include <Word.au3>

$sPath = @WindowsDir & "\"
$search = FileFindFirstFile($sPath & "*.bmp")

; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No images found")
Exit
EndIf

$oWordApp = _WordCreate ()
$oDoc = _WordDocGetCollection ($oWordApp, 0)

While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
$oShape = _WordDocAddPicture ($oDoc, $sPath & $file, 0, 1)
If Not @error Then $oShape.Range.InsertAfter (@CRLF)
WEnd

; Close the search handle
FileClose($search)


Function _WordDocClose

Function Reference

_WordDocClose

Closes a previously opened word document

#include <Word.au3>
_WordDocClose ( ByRef $o_object [, $i_SaveChanges = -2 [, $i_OriginalFormat = 2 [, $b_RouteDocument = 0]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$i_SaveChanges | [optional] specifies the save action for the document 0 = Do not save changes -1 = Save changes -2 = (Default) Prompt to save changes
$i_OriginalFormat | [optional] specifies the save format for the document 0 = Word Document 1 = Original Document Format 2 = (Default) Prompt User
$b_RouteDocument | [optional] specifies whether to route the document to the next recipient 0 = (Default) do not route 1 = route to next recipient

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_WordDocAdd, _WordDocOpen, _WordDocSave, _WordDocSaveAs

Example

; *******************************************************
; Example 1 - Create an empty word window, open an existing document,
; close the document and quit.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ("")
$oDoc = _WordDocOpen ($oWordApp, @ScriptDir & "\Test.doc")
_WordDocClose ($oDoc)
_WordQuit ($oWordApp)


Function _WordDocFindReplace

Function Reference

_WordDocFindReplace

Runs the specified find and replace operation.

#include <Word.au3>
_WordDocFindReplace ( ByRef $o_object [, $s_FindText = "" [, $s_ReplaceWith = "" [, $i_Replace = 2 [, $v_SearchRange = 0 [, $b_MatchCase = 0 [, $b_MatchWholeWord = 0 [, $b_MatchWildcards = 0 [, $b_MatchSoundsLike = 0 [, $b_MatchAllWordForms = 0 [, $b_Forward = 1 [, $i_Wrap = 1 [, $b_Format = 0]]]]]]]]]]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$s_FindText | [optional] The text to be searched for. (See Remarks) "" = (Default) Used to search for formatting only.
$s_ReplaceWith | [optional] The replacement text. (See Remarks) "" = (Default) Delete the text specified by $s_FindText
$i_Replace | [optional] Specifies how many replacements are to be made. 0 = Replace no occurrences 1 = Replace the first occurrence encountered 2 = (Default) Replace all occurrences
$v_SearchRange | [optional] Specifies the Selection or Range to search. -1 = Specifies the current selection 0 = (Default) Specifies the entire document Any range object
$b_MatchCase | [optional] Specifies whether the find text will be case-sensitive. 0 = (Default) Not case-sensitive 1 = Case-sensitive
$b_MatchWholeWord | [optional] Specifies whether to have the find operation locate only entire words, not text that's part of a larger word. 0 = (Default) Match partial words 1 = Only match entire words
$b_MatchWildcards | [optional] Specifies whether to have $s_FindText be a special search operator. 0 = (Default) Not a special search operator 1 = Special search operator
$b_MatchSoundsLike | [optional] Specifies whether to have the find operation locate words that sound similar to $s_FindText. 0 = (Default) Do not find similar sounding words 1 = Find similar sounding words
$b_MatchAllWordForms | [optional] Specifies whether to have the find operation locate all forms of the find text (for example, "sit" locates "sitting" and "sat"). 0 = (Default) Do not match other word forms 1 = Match all word forms
$b_Forward | [optional] Specifies which direction to search. 0 = Search backward (toward the start of the document) 1 = (Default) Search forward (toward the end of the document)
$i_Wrap | [optional] Controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if $b_Forward is set to 0). 0 = The find operation ends if the beginning or end of the search range is reached 1 = (Default) The find operation continues if the beginning or end of the search range is reached
$b_Format | [optional] Specifies whether to have the find operation locate formatting in addition to or instead of the find text. 0 = (Default) Do not locate formatting 1 = Locate formatting

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
 | $_WordStatus_NoMatch = No Match
@Extended: | Contains invalid parameter number

Remarks

You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.

You specify special characters and advanced search criteria just as you do for the Find argument. To specify a graphic object or other non-text item as the replacement, move the item to the Clipboard and specify "^c" for $s_ReplaceWith.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window, open a document, find "this",
; replace all occurrences with "THIS", quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection($oWordApp, 0)
$oFind = _WordDocFindReplace($oDoc, "this", "THIS")
If $oFind Then
MsgBox(0, "FindReplace", "Found and replaced.")
Else
MsgBox(0, "FindReplace", "Not Found")
EndIf
_WordQuit ($oWordApp, 0)


Function _WordDocGetCollection

Function Reference

_WordDocGetCollection

Returns a collection object containing all documents

#include <Word.au3>
_WordDocGetCollection ( ByRef $o_object [, $v_index = -1] )

Parameters

$o_object | Object variable of a Word.Application object
$v_index | [optional] Specifies whether to return a collection or indexed instance. -1 = (Default) Returns a collection 0 = Returns the Active Document The document name or index number to return (1 based)

Return Value

Success: | Returns an object collection of all documents, @EXTENDED = document count
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
 | $_WordStatus_NoMatch = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window with a new blank document,
; add a second blank document, and get a collection of the documents.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ()
_WordDocAdd ($oWordApp)
$oDocuments = _WordDocGetCollection ($oWordApp)
MsgBox(0, "Document Count", @extended)
_WordQuit ($oWordApp)


Function _WordDocLinkGetCollection

Function Reference

_WordDocLinkGetCollection

Returns a collection object containing all links in the document

#include <Word.au3>
_WordDocLinkGetCollection ( ByRef $o_object [, $i_index = -1] )

Parameters

$o_object | Object variable of an Word.Application, document object
$i_index | [optional] specifies whether to return a collection or indexed instance Positive integer returns an indexed instance (1 based) -1 = (Default) returns a collection

Return Value

Success: | Returns an object collection of all links in the document, @EXTENDED = link count
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidValue = Invalid Value
 | $_WordStatus_NoMatch = No Match
@Extended: | Contains invalid parameter number

Remarks

None.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window with a new blank document,
; add a link, then get a collection of links.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ()
$oDoc = _WordDocGetCollection ($oWordApp, 0)
_WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt")
$oLinks = _WordDocLinkGetCollection ($oDoc)
MsgBox(0, "Link Count", @extended)


Function _WordDocOpen

Function Reference

_WordDocOpen

Opens an existing Microsoft Word Document

#include <Word.au3>
_WordDocOpen ( ByRef $o_object , $s_FilePath [, $b_ConfirmConversions = 0 [, $i_Format = 0 [, $b_ReadOnly = 0 [, $b_Revert = 0 [, $b_AddToRecentFiles = 0 [, $s_PasswordDocument = "" [, $s_WritePasswordDocument = ""]]]]]]] )

Parameters

$o_object | Object variable of a Word.Application object
$s_FilePath | Full path of the document to open (See Remarks)
$b_ConfirmConversions | [optional] Specifies whether to display the Convert File dialog box if the file isn't in Microsoft Word format. 0 = (Default) Do not display 1 = Display
$i_Format | [optional] The file converter to be used to open the document. 0 = (Default) The existing format 1 = Microsoft Word Document format 2 = Microsoft Word Template format 3 = Rich text format (RTF) 4 = Unencoded text format 5 = Unicode text format or Encoded text format 6 = Microsoft Word format that is backward compatible with earlier versions of Microsoft Word 7 = HTML format 8 = XML format
$b_ReadOnly | [optional] Specifies whether to open the document as read-only. Note: This argument doesn't override the read-only recommended setting on a saved document. 0 = (Default) Open as Read/Write 1 = Open as Read Only
$b_Revert | [optional] Controls what happens if $s_FilePath is an open document. 0 = (Default) Activate the open document 1 = Discard any unsaved changes to the open document and reopen the file
$b_AddToRecentFiles | [optional] Specifies whether to add the file name to the list of recently used files at the bottom of the File menu. 0 = (Default) Do not add 1 = Add
$s_PasswordDocument | [optional] The password for opening the document.
$s_WritePasswordDocument | [optional] The password for saving changes to the document.

Return Value

Success: | Returns an object variable pointing to a Word.Application, document object
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

File will be created if it does not exist.

Related

_WordDocAdd, _WordDocClose, _WordDocSave, _WordDocSaveAs

Example

; *******************************************************
; Example 1 - Create an empty word window and open an existing document
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ("")
$oDoc = _WordDocOpen ($oWordApp, @ScriptDir & "\Test.doc")


Function _WordDocPrint

Function Reference

_WordDocPrint

Prints all or part of the specified document.

#include <Word.au3>
_WordDocPrint ( ByRef $o_object [, $b_Background = 0 [, $i_Copies = 1 [, $i_Orientation = -1 [, $b_Collate = 1 [, $s_Printer = "" [, $i_Range = 0 [, $i_From = "" [, $i_To = "" [, $s_Pages = "" [, $i_PageType = 0 [, $i_Item = 0]]]]]]]]]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$b_Background | [optional] Specifies whether to have the script continue while Microsoft Word prints the document. (See Remarks) 0 = (Default) Wait for document to print 1 = Continue script without waiting
$i_Copies | [optional] The number of copies to be printed.
$i_Orientation | [optional] Sets the orientation of the page. -1 = (Default) Current document orientation 0 = Portrait 1 = Landscape
$b_Collate | [optional] Specifies whether to print all pages of the document before printing the next copy. 0 = Do not collate 1 = (Default) Collate
$s_Printer | [optional] Sets the name of the printer. (See Remarks)
$i_Range | [optional] Specifies the page range. 0 = (Default) The entire document 1 = The current selection 2 = The current page 3 = A specified range (must specify $i_From and $i_To) 4 = A specified range of pages (must specify $s_Pages)
$i_From | [optional] The starting page number when $i_Range is set to 3.
$i_To | [optional] The ending page number when $i_Range is set to 3.
$s_Pages | [optional] The page numbers and page ranges to be printed, separated by commas, when $i_Range is set to 4. For example, "2, 6-10" prints page 2 and pages 6 through 10.
$i_PageType | [optional] The type of pages to be printed. 0 = (Default) All pages 1 = Odd-numbered pages only 2 = Even-numbered pages only
$i_Item | [optional] The item to be printed. 0 = (Default) Current document content 1 = Properties in the current document 2 = Comments and Markup in the current document 3 = Styles in the current document 4 = Autotext entries in the current document 5 = Key assignments in the current document 6 = An envelope 7 = Current document content including markup

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR = 1
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_ComError = Com Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Specifying $b_Background does NOT pause the script until the document is finished printing, it only pauses until Microsoft Word finishes sending the document to the printer. If you execute a background print then immediately execute a _WordQuit() the document will not have time to print.

To specify a network printer it needs to be in this format "\\Server\Printer".

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window, open a document, set the text,
; print with defaults, and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc)
_WordQuit ($oWordApp, 0)

; *******************************************************
; Example 2 - Create a word window, open a document, set the text,
; print using landscape, and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc, 0, 1, 1)
_WordQuit ($oWordApp, 0)

; *******************************************************
; Example 3 - Create a word window, open a document, set the text,
; print to a printer named "My Printer", and quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to print."
_WordDocPrint ($oDoc, 0, 1, 0, 1, "My Printer")
_WordQuit ($oWordApp, 0)


Function _WordDocPropertyGet

Function Reference

_WordDocPropertyGet

Returns a select property of the Word Document.

#include <Word.au3>
_WordDocPropertyGet ( ByRef $o_object, $v_property )

Parameters

$o_object | Object variable of a Word.Application, document object
$v_property | Property selection (see remarks)

Return Value

Success: | Value of selected Property
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_ComError = Com Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

You may use either the index or name as the property selection.

The following tables provide a description of each property available for use.

Word Document Properties

Property Index/Name | Description
(1) "title" | Title.
(2) "subject" | Subject.
(3) "author" | Author.
(4) "keywords" | Keywords.
(5) "comments" | Comments.
(6) "template" | Template name.
(7) "last author" | Last Author.
(8) "revision number" | Revision number.
(9) "application name" | Name of application.
(10) "last print date" | Time last printed.
(11) "creation date" | Time created.
(12) "last save time" | Time last saved.
(13) "total editing time" | Number of edits to VBA project.
(14) "pages" | Page count.
(15) "words" | Word count.
(16) "characters" | Character count.
(17) "security" | Security setting.
(18) "category" | Category.
(19) "" | Not supported.
(20) "manager" | Manager.
(21) "company" | Company.
(22) "bytes" | Byte count.
(23) "lines" | Line count.
(24) "paragraphs" | Paragraph count.
(25-28) "" | Not Supported.
(29) "hyperlink base" | When a relative link is based on a path you specify (the first part of the path that is shared by the file containing the hyperlink and the destination file), that path is the hyperlink base.
(30) "characters (with spaces)" | Character count with spaces.

Related

_WordDocPropertySet

Example

; *******************************************************
; Example 1 - Create a word window, open a document,
; then read all available document properties by index
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
For $i = 1 To 30
ConsoleWrite("Property Index " & $i & " - " & _WordDocPropertyGet ($oDoc, $i) & @CR)
Next

; *******************************************************
; Example 2 - Create a word window, open a document,
; then read the title, subject, and author properties by name.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
ConsoleWrite("Title - " & _WordDocPropertyGet ($oDoc, "Title") & @CRLF)
ConsoleWrite("Subject - " & _WordDocPropertyGet ($oDoc, "Subject") & @CRLF)
ConsoleWrite("Author - " & _WordDocPropertyGet ($oDoc, "Author") & @CRLF)


Function _WordDocPropertySet

Function Reference

_WordDocPropertySet

Set a select property of the Word Document

#include <Word.au3>
_WordDocPropertySet ( ByRef $o_object, $v_property, $v_newvalue )

Parameters

$o_object | Object variable of a Word.Application, document object
$v_property | Property selection (see remarks)
$v_newvalue | The new value to be set into the Word Document Property

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_ComError = Com Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

You may use either the index or name as the property selection.

The following tables provide a description of each property available for use.

Word Document Properties

Property Index/Name | Description
(1) "title" | Title.
(2) "subject" | Subject.
(3) "author" | Author.
(4) "keywords" | Keywords.
(5) "comments" | Comments.
(6) "template" | Template name.
(9) "application name" | Name of application.
(18) "category" | Category.
(20) "manager" | Manager.
(21) "company" | Company.
(29) "hyperlink base" | When a relative link is based on a path you specify (the first part of the path that is shared by the file containing the hyperlink and the destination file), that path is the hyperlink base.

Related

_WordDocPropertyGet

Example

; *******************************************************
; Example 1 - Create a word window, open a document,
; then set the title, subject, and author properties.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
_WordDocPropertySet ($oDoc, "Title", "Test Title")
_WordDocPropertySet ($oDoc, "Subject", "Test Subject")
_WordDocPropertySet ($oDoc, "Author", "Test Author")


Function _WordDocSave

Function Reference

_WordDocSave

Saves a previously opened document

#include <Word.au3>
_WordDocSave ( $o_object )

Parameters

$o_object Object variable of a Word.Application, document object

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

If a document hasn't been saved before, the Save As dialog box prompts the user for a file name.

Related

_WordDocAdd, _WordDocClose, _WordDocOpen, _WordDocSaveAs

Example

; *******************************************************
; Example 1 - Open an existing word document, append some text,
; save and quit.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.insertAfter ("This is some text to insert.")
_WordDocSave ($oDoc)
_WordQuit ($oWordApp)


Function _WordDocSaveAs

Function Reference

_WordDocSaveAs

Saves the specified document with a new name or format.

#include <Word.au3>
_WordDocSaveAs ( ByRef $o_object [, $s_FilePath = "" [, $i_Format = 0 [, $b_ReadOnlyRecommended = 0 [, $b_AddToRecentFiles = 0 [, $b_LockComments = 0 [, $s_Password = "" [, $s_WritePassword = ""]]]]]]] )

Parameters

$o_object | Object variable of a Word.Application, document object
$s_FilePath | [optional] The full file path for saving the document. (See Remarks) "" = (Default) If the document has never been saved, the default name is used (for example, Document1.doc)
$i_Format | [optional] The format in which the document is saved. 0 = (Default) Microsoft Word format 1 = Microsoft Word template format 2 = Microsoft Windows text format 3 = Microsoft Windows text format with line breaks preserved 4 = Microsoft DOS text format 5 = Microsoft DOS text with line breaks preserved 6 = Rich text format (RTF) 7 = Unicode text format or Encoded text format 8 = Standard HTML format 9 = Web archive format 10 = Filtered HTML format 11 = Extensible Markup Language (XML) format
$b_ReadOnlyRecommended | [optional] Specifies whether to have Microsoft Word suggest read-only status whenever the document is opened. 0 = (Default) Do not suggest read only 1 = Suggest read only
$b_AddToRecentFiles | [optional] Specifies whether to add the file name to the list of recently used files at the bottom of the File menu. 0 = (Default) Do not add 1 = Add
$b_LockComments | [optional] Specifies whether to lock the document for comments. 0 = (Default) Do not lock for comments 1 = Lock for comments
$s_Password | [optional] A password string for opening the document. (See Remarks)
$s_WritePassword | [optional] A password string for saving changes to the document. (See Remarks)

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

If a document with the specified file name already exists, the document is overwritten without the user being prompted first.
If the file cannot be saved the script will be stop unless WordErrorHandler has been registered.

Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Related

_WordDocAdd, _WordDocClose, _WordDocOpen, _WordDocSave

Example

; *******************************************************
; Example 1 - Create a word window with a new blank document, add some text,
; execute a saveas operation, then quit.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate ()
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$oDoc.Range.Text = "This is some text to insert."
_WordDocSaveAs ($oDoc, @ScriptDir & "\Test.doc")
_WordQuit ($oWordApp)


Function _WordErrorHandlerDeRegister

Function Reference

_WordErrorHandlerDeRegister

Disable a registered user COM error handler

#include <Word.au3>
_WordErrorHandlerDeRegister ( )

Parameters

None.

Return Value

Success: | Returns 1
Failure: | None

Remarks

See remarks for _WordErrorHandlerRegister.

Related

_WordErrorHandlerRegister

Example

; *******************************************************
; Example 1 - Register and later deregister a custom error handler
; *******************************************************
;
#include <Word.au3>
; Register a customer error handler
_WordErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_WordErrorHandlerDeregister ()
; Do something else

Exit

Func MyErrFunc()
$HexNumber = Hex($oWordErrorHandler.number, 8)
MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _
"Number is: " & $HexNumber & @CRLF & _
"Windescription is: " & $oWordErrorHandler.windescription)
SetError(1) ; something to check for when this function returns
EndFunc ;==>MyErrFunc


Function _WordErrorHandlerRegister

Function Reference

_WordErrorHandlerRegister

Register and enable a user COM error handler

#include <Word.au3>
_WordErrorHandlerRegister ( [$s_functionName = "__WordInternalErrorHandler"] )

Parameters

$s_functionName [optional] String variable with the name of a user-defined COM error handler, defaults to the internal COM error handler in this UDF

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
@Extended: | Contains invalid parameter number

Remarks

Important: When using your own error handler, the Error Object variable used MUST be named $oWordErrorHandler (see example).

AutoIt has the ability to trap COM errors and pass then through a custom error handler using the ObjEvent function. There is a problem with this for UDF writers however because only a single COM error handler can be in use at a time. For the UDF to use a COM error handler it must first deregister the user error handler, install its own and then put the user handler back in place. Unfortunately, by default, the UDF has no way to access the handle of the user error handler.

Using this routine you can register your COM error handler in a way that Word.au3 can gracefully remove and reinstate it when it needs to. You may either point to your own custom error handler or you may use the one developed for Word.au3 (the default). Using the default Word.au3 error handler you will also get some nice diagnostic information written to the console and some global variables that contain information about the trapped errors.

If you instantiate your own COM error handler without using this routine Word.au3 will not be able to trap some COM errors and you may experience some abrupt script terminations as a result.

Related

_WordErrorHandlerDeRegister

Example

; *******************************************************
; Example 1 - Register and later deregister a custom and the default Word.au3 error handler
; *******************************************************
;
#include <Word.au3>
; Register a customer error handler
_WordErrorHandlerRegister ("MyErrFunc")
; Do something
; Deregister the customer error handler
_WordErrorHandlerDeregister ()
; Do something else
; Register the default IE.au3 COM Error Handler
_WordErrorHandlerRegister ()
; Do more work

Exit

Func MyErrFunc()
; Important: the error object variable MUST be named $oWordErrorHandler
$ErrorScriptline = $oWordErrorHandler.scriptline
$ErrorNumber = $oWordErrorHandler.number
$ErrorNumberHex = Hex($oWordErrorHandler.number, 8)
$ErrorDescription = StringStripWS($oWordErrorHandler.description, 2)
$ErrorWinDescription = StringStripWS($oWordErrorHandler.WinDescription, 2)
$ErrorSource = $oWordErrorHandler.Source
$ErrorHelpFile = $oWordErrorHandler.HelpFile
$ErrorHelpContext = $oWordErrorHandler.HelpContext
$ErrorLastDllError = $oWordErrorHandler.LastDllError
$ErrorOutput = ""
$ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
$ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
$ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
$ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
$ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
$ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
$ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
$ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
$ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
$ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
MsgBox(0, "COM Error", $ErrorOutput)
SetError(1)
Return
EndFunc ;==>MyErrFunc


Function _WordErrorNotify

Function Reference

_WordErrorNotify

Specifies whether Word.au3 automatically notifies of Warnings and Errors (to the console)

#include <Word.au3>
_WordErrorNotify ( [$f_notify = -1] )

Parameters

$f_notify [optional] specifies whether notification should be on or off
-1 = (Default) return current setting
True = Turn On
False = Turn Off

Return Value

Success: | If $f_notify = -1, returns the current notification setting, else returns 1
Failure: | Returns 0

Remarks

Word.au3 writes diagnostic information, warnings and errors to the console by default. This information can readily be seen when using the SciTe editor to run your scripts.

This function allows you to turn this functionality on or off.

Related

None.

Example

; *******************************************************
; Example 1 - Check the current status of _WordErrorNotify, turn it off if on, on if off
; *******************************************************
;
#include <Word.au3>
If _WordErrorNotify () Then
MsgBox(0, "_WordErrorNotify Status", "Notification is ON, turning it OFF")
_WordErrorNotify (1)
Else
MsgBox(0, "_WordErrorNotify Status", "Notification is OFF, turning it ON")
_WordErrorNotify (0)
EndIf


Function _WordMacroRun

Function Reference

_WordMacroRun

Runs a Visual Basic macro

#include <Word.au3>
_WordMacroRun ( $o_object, $s_MacroName [, $v_Arg1 [, $v_Argn [, $v_Arg30]]] )

Parameters

$o_object | Object variable of a Word.Application object
$s_MacroName | The name of the macro. Can be any combination of template, module, and macro name. (See Remarks)
$v_Arg1 | [optional] The first parameter to pass to the macro
$v_Argn | [optional] ...
$v_Arg30 | [optional] The thirtieth parameter to pass to the macro

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_ComError = Com Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

If you specify the document name, your code can only run macros in documents related to the current context — not just any macro in any document.

Related

None.

Example

; *******************************************************
; Example 1 - Create a word window, open a document,
; run a macro named "My Macro" with one
; argument "Test", quit without saving changes.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
_WordMacroRun ($oWordApp, "My Macro", "Test")
_WordQuit ($oWordApp, 0)


Function _WordPropertyGet

Function Reference

_WordPropertyGet

Returns a select property of the Word Application.

#include <Word.au3>
_WordPropertyGet ( ByRef $o_object, $s_property )

Parameters

$o_object | Object variable of a Word.Application
$s_property | Property selection (see remarks)

Return Value

Success: | Value of selected Property
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following tables provide a description of each property available for use.

Word Application Properties

Property | Description
"activeprinter" | Returns the name of the active printer.
"capslock" | Returns a Boolean value indicating whether the CAPS LOCK key is turned on.
"screentips" | Returns a Boolean value indicating whether comments, footnotes, endnotes, and hyperlinks are displayed as tips.
"scrollbars" | Returns a Boolean value indicating whether Word displays a scroll bar in at least one document window.
"statusbar" | Returns a Boolean value indicating whether the status bar is displayed.
"height" | Returns the height of the active document window.
"language" | Returns an MsoLanguageID constant that represents the language selected for the Microsoft Word user interface.
"left" | Returns an Integer that represents the horizontal position of the active document.
"numlock" | Returns the state of the NUM LOCK key. Returns True if the keys on the numeric keypad insert numbers, and False if the keys move the insertion point.
"path" | Returns the disk or Web path to the specified object.
"screenupdating" | Returns a Boolean value indicating whether screen updating is turned on.
"startuppath" | Returns the complete path of the startup folder, excluding the final separator.
"top" | Returns the vertical position of the active document, in points.
"version" | Returns the Microsoft Word version number.
"visible" | Returns a Boolean value indicating whether the specified object is visible.
"width" | Returns the width of the specified object, in points.
"windowstate" | Returns the state of the specified document window or task window.

Related

_WordPropertySet

Example

; *******************************************************
; Example 1 - Create a word window, open a document, check to see if the
; statusbar is visible, if it is turn it off, if it isn't turn it on.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
If _WordPropertyGet ($oWordApp, "statusbar") Then
MsgBox(0, "StatusBar Status", "StatusBar Visible, turning it off.")
_WordPropertySet ($oWordApp, "statusbar", False)
Else
MsgBox(0, "StatusBar Status", "StatusBar Invisible, turning it on.")
_WordPropertySet ($oWordApp, "statusbar", True)
EndIf


Function _WordPropertySet

Function Reference

_WordPropertySet

Set a select property of the Word Application.

#include <Word.au3>
_WordPropertySet ( ByRef $o_object, $s_property, $v_newvalue )

Parameters

$o_object | Object variable of a Word.Application
$s_property | Property selection (see remarks)
$v_newvalue | The new value to be set into the Word Application Property

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
 | $_WordStatus_InvalidValue = Invalid Value
@Extended: | Contains invalid parameter number

Remarks

Further information can be found at MSDN.

The following tables provide a description of each property available for use.

Word Application Properties

Property | Description
"activeprinter" | Specifies the name of the active printer.
"screentips" | Specifies a Boolean value indicating whether comments, footnotes, endnotes, and hyperlinks are displayed as tips.
"scrollbars" | Specifies a Boolean value indicating whether Word displays a scroll bar in at least one document window.
"statusbar" | Specifies a Boolean value indicating whether the status bar is displayed.
"height" | Specifies the height of the active document window.
"left" | Specifies an Integer that represents the horizontal position of the active document.
"screenupdating" | Specifies a Boolean value indicating whether screen updating is turned on.
"startuppath" | Specifies the complete path of the startup folder.
"top" | Specifies the vertical position of the active document, in points.
"visible" | Specifies a Boolean value indicating whether the specified object is visible.
"width" | Specifies the width of the specified object, in points.
"windowstate" | Specifies the state of the specified document window or task window.

Related

_WordPropertyGet

Example

; *******************************************************
; Example 1 - Create a word window, open a document,
; hide the window, then make it visible again.
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc")
Sleep(2000)
_WordPropertySet ($oWordApp, "visible", False)
Sleep(2000)
_WordPropertySet ($oWordApp, "visible", True)


Function _WordQuit

Function Reference

_WordQuit

Close the window and remove the object reference to it

#include <Word.au3>
_WordQuit( ByRef $o_object [, $i_SaveChanges = -2 [, $i_OriginalFormat = 1 [, $b_RouteDocument = 0]]] )

Parameters

$o_object | Object variable of a Word.Application
$i_SaveChanges | [optional] specifies the save action for the document 0 = Do not save changes -1 = Save changes -2 = (Default) Prompt to save changes
$i_OriginalFormat | [optional] specifies the save format for the document 0 = Word Document 1 = (Default) Original Document Format 2 = Prompt User
$b_RouteDocument | [optional] specifies whether to route the document to the next recipient 0 = (Default) do not route 1 = route to next recipient

Return Value

Success: | Returns 1
Failure: | Returns 0 and sets @ERROR
@Error: | $_WordStatus_Success = No Error
 | $_WordStatus_GeneralError = General Error
 | $_WordStatus_InvalidDataType = Invalid Data Type
 | $_WordStatus_InvalidObjectType = Invalid Object Type
@Extended: | Contains invalid parameter number

Remarks

None.

Related

_WordCreate, _WordAttach

Example

; *******************************************************
; Example 1 - Create an invisible word window, open a
; document, retrieve some information and Quit
; *******************************************************
;
#include <Word.au3>
$oWordApp = _WordCreate (@ScriptDir & "\Test.doc", 0, 0)
; Display the text within the document
$sText = $oWordApp.ActiveDocument.Range.Text
MsgBox(0, "Document Text", $sText)
_WordQuit ($oWordApp)


UDFs renaming

Starting with v3.2.9.3 _GUICtrlXXXYYY() have been renamed _GUICtrlXXX_YYY() without any functional changes except stated in the below table.

For XXX equal to "Combo" and "List" these have been changed to "ComboBox" and "ListBox". They can be found in GuiComboBox.au3 and GuiListBox.au3. So the #include file will have to be changed too.

Old | New | Comments
_GUICtrlComboAddDir | _GUICtrlComboBox_AddDir | parameters inversion and $vAttrib->$iAttrib.
_GUICtrlComboAutoComplete | _GUICtrlComboBox_AutoComplete | $sText, $s_WTitle, $s_WText parameters ignored.
_GUICtrlComboFindString | _GUICtrlComboBox_FindString | or _GUICtrlComboBox_FindStringExact if $fexact was used.
_GUICtrlComboGetList | _GUICtrlComboBox_GetList | $sDelimiter suppress use Opt("GUIDataSeparatorChar").
_GUICtrlComboInsertString | _GUICtrlComboBox_InsertString | parameters inversion.
_GUICtrlComboSelectString | _GUICtrlComboBox_SelectString | parameters inversion.
_GUICtrlComboSetItemHeight | _GUICtrlComboBox_SetItemHeight | parameters inversion.

Old | New | Comments
_GUICtrlEditFind | _GUICtrlEdit_Find | $hGui parameter removed
_GUICtrlEditFindText |  | OBSOLETE
_GUICtrlEditGetRECT | _GUICtrlEdit_GetRECT | return modified.
_GUICtrlEditGetSel | _GUICtrlEdit_GetSel | return modified.
_GUICtrlEditSetRECT | _GUICtrlEdit_SetRECT | return modified.

Old | New | Comments
_GUICtrlIpAddressClear | _GUICtrlIpAddress_ClearAddress | renamed.
_GUICtrlIpAddressDelete | _GUICtrlIpAddress_Destroy | renamed.

Old | New | Comments
_GUICtrlListAddDir | _GUICtrlListBox_Dir | parameters inversion and $vAttrib->$iAttrib.
_GUICtrlListAddItem | _GUICtrlListBox_AddString | renamed.
_GUICtrlListClear | _GUICtrlListBox_ResetContent | renamed.
_GUICtrlListCount | _GUICtrlListBox_GetCount | renamed.
_GUICtrlListDeleteItem | _GUICtrlListBox_DeleteString | renamed.
_GUICtrlListGetInfo | _GUICtrlListBox_GetListBoxInfo | renamed.
_GUICtrlListGetItemRect | _GUICtrlListBox_GetItemRect | return modified.
_GUICtrlListGetLocale | _GUICtrlListBox_GetLocale | $fDec ignored.
_GUICtrlListGetSelState | _GUICtrlListBox_GetSel | renamed.
_GUICtrlListInsertItem | _GUICtrlListBox_InsertString | renamed.
_GUICtrlListSelectedIndex | _GUICtrlListBox_GetCurSel | renamed.
_GUICtrlListSelectIndex | _GUICtrlListBox_SetCurSel | renamed.
_GUICtrlListSelItemRange | _GUICtrlListBox_SelItemRange | parameters inversion.
_GUICtrlListSetSel | _GUICtrlListBox_SetSel | parameters inversion.

Old | New | Comments
_GUICtrlListViewFindItem | _GUICtrlListView_FindInText | _GUICtrlListView_FindItem, _GUICtrlListView_FindNearest, _GUICtrlListView_FindParam, _GUICtrlListView_FindText
_GUICtrlListViewGetBackColor | _GUICtrlListView_GetBkColor | renamed.
_GUICtrlListViewGetCheckedState | _GUICtrlListView_GetItemChecked | renamed.
_GUICtrlListViewGetCurSel | _GUICtrlListView_GetNextItem | renamed.
_GUICtrlListViewGetItemText | _GUICtrlListView_GetItemText | item is mandatory or _GUICtrlListView_GetItemTextString
_GUICtrlListViewGetNextItem | _GUICtrlListView_GetNextItem | $i_direction parameter changed.
_GUICtrlListViewGetSubItemsCount | _GUICtrlListView_GetColumnCount | renamed.
_GUICtrlListViewInsertColumn | _GUICtrlListView_InsertColumn | optional parameters inversion.
_GUICtrlListViewInsertItem | _GUICtrlListView_InsertItem | _GUICtrlListView_SetItemText for column >1
_GUICtrlListViewSetColumnHeaderText | _GUICtrlListView_SetColumn | parameters inversion.
_GUICtrlListViewSetColumnOrder | _GUICtrlListView_SetColumnOrder | $order must be split.
_GUICtrlListViewSetCheckState | _GUICtrlListView_SetItemChecked | renamed.
_GUICtrlListViewSetItemSelState | _GUICtrlListView_SetItemSelected | or _GUICtrlListView_SetItemFocused.
_GUICtrlListViewSetItemText | _GUICtrlListView_SetItemText | parameters inversion.
_GUICtrlListViewSort | _GUICtrlListView_SimpleSort | renamed.

Old | New | Comments
_GUICtrlMonthCalGet1stDOW | _GUICtrlMonthCal_GetFirstDOWStr | renamed.
_GUICtrlMonthCalGetColor | _GUICtrlMonthCal_GetColorArray | renamed.
_GUICtrlMonthCalGetMinReqRECT | _GUICtrlMonthCalGetMinReqRECT | renamed.
_GUICtrlMonthCalSetColor | _GUICtrlMonthCal_SetColor | return modified.
_GUICtrlMonthCalSet1stDOW | _GUICtrlMonthCal_SetFirstDOW | renamed.
_GUICtrlMonthCalSetDelta | _GUICtrlMonthCal_SetMonthDelta | renamed.

Old | New | Comments
_GUICtrlStatusBarCreateProgress |  | OBSOLETE
_GUICtrlStatusBarDelete | _GUICtrlStatusBar_Destroy | renamed.
_GUICtrlStatusBarGetParts | _GUICtrlStatusBar_GetCount | renamed.
_GUICtrlStatusBarGetTip | _GUICtrlStatusBar_GetTipText | renamed.
_GUICtrlStatusBarGetUnicode | _GUICtrlStatusBar_GetUnicodeFormat | renamed.
_GUICtrlStatusBarSetIcon | _GUICtrlStatusBar_SetIcon | optional parameters inversion.
_GUICtrlStatusBarSetParts | _GUICtrlStatusBar_SetParts | $hGUI parameter suppression.
_GUICtrlStatusBarSetUnicode | _GUICtrlStatusBar_SetUnicodeFormat | renamed.

Old | New | Comments
_GUICtrlTabGetItemRECT | _GUICtrlTab_GetItemRect | return modified.

Old | New | Comments
_GUICtrlTreeViewDeleteAllItems | _GUICtrlTreeView_DeleteAll | renamed.
_GUICtrlTreeViewDeleteItem | _GUICtrlTreeView_Delete | $hGUI parameter removed.
_GUICtrlTreeViewExpand | _GUICtrlTreeView_Expand | optional parameter inversion.
_GUICtrlTreeViewGetParentID | _GUICtrlTreeView_GetParentParam | renamed.
_GUICtrlTreeViewGetTree | _GUICtrlTreeView_GetTree | $sSeparator suppress use Opt("GUIDataSeparatorChar").