Jump to content

Marquee UDF - New release 13 Jan 2019


Melba23
 Share

Recommended Posts

I got the topic notification as RSS feed, and i had difficulties to click the topic link, guess why?

That's right, the text constantly moving in the feed :D

Nice UDF.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • Moderators

Andreik,

You are quite correct - as acknowledged in the UDF: ;)

Name...........: _GUICtrlMarquee_Create

; Author ........: james3mg, trancexx and jscript "FROM BRAZIL"
; Modified.......: Melba23

czardas,

Glad it made you smile! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

supersonic,

Oops! :>

Thanks for the report. :thumbsup:

M23

Edit: Modified version now in first post. :)

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 months later...

Melba23,

I tried the updated UDF and found it more interesting.

But It doesn't work when I called _GUICtrlMarquee_SetDisplay function passing parameter $iBorder = 0.

To make it work, I just simply changed line 205 to:

Case 0 To 3

Besides, if the text color and/or the background color are read from an INI file, I have to convert it to a Number before calling _GUICtrlMarquee_SetDisplay function to avoid the error when setting html document properties in _GUICtrlMarquee_Create function. The _GUICtrlMarquee_SetDisplay function just can't work as GUICtrlSetColor() or GUISetBkColor() which accepts a color string like "0xFF0000".

Thanks if you can check my concerns above.

Auttry

Edited by AUTTRY
Link to comment
Share on other sites

  • Moderators

AUTTRY,

Thanks for the report - I can see both problems (expecially as you showed me the first! ;)) and I am working on it. Expect a new version later today. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

BugFix version - 6 Nov 12

Fixed:

- The "no border" setting was ignored.

- Colour values recovered from an ini file (and so passed as strings) were not honoured.

Thanks to AUTTRY for pointing them out. :thumbsup:

New UDF and zip in first post. :)

M23

Note: As a numeric value recovered from an ini file is always in string format, it is normally the coder's responsibility to make sure that the value is recast as a number (with the Number function) before using it. Doing so would have prevented the second "bug" from appearing. ;)

However, as the UDF will also accept literal string values (i.e. "red", "green") for the colour value, I felt that is was a good idea to amend the UDF to handle the conversion internally on this occasion. :)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Good work! So far so good with the latest BugFix version.

I noted that a Marquee occupied much more memory resources (about 10MB) than a Label control. It's not a good thing.

Try this to compare:

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include "Marquee.au3"

Const $str = "For Marquee memory test."

$hGUI = GUICreate("", 285, 45, -1, -1, -1, $WS_EX_TOPMOST)
GUISetBkColor(0x19619C)

; Marquee
$aMarquee = _GUICtrlMarquee_Init()
_GUICtrlMarquee_SetScroll($aMarquee, Default, "slide", "left", 1, 1)
_GUICtrlMarquee_SetDisplay($aMarquee, 0, 0xF0FC29, 0x19619C, 8.5, "Courier New")
_GUICtrlMarquee_Create($aMarquee, $str, 80, 16, 180, 20)

;Label
;~ $Label = GUICtrlCreateLabel($str, 100, 16, 150, 20, -1)
;~ GUICtrlSetFont(-1, 8.5)
;~ GUICtrlSetColor(-1, 0xF0FC29)

GUISetState()

Do
Until GUIGetMsg() = -3

The memory usage won't go down even after _GUICtrlMarquee_Delete is called.

Edited by AUTTRY
Link to comment
Share on other sites

  • Moderators

AUTTRY,

It is hardly suprising that a marquee uses more memory than a simple label - after all you are creating a Shell.Explorer.2 object each time which is basically a mini browser. Although I get nothing like 10Mb extra usage when I run the 2 versions of your posted script - it is only about 2.4Mb more on my machine. ;)

But you are correct about the retained memory - I was not deleting the object itself when I deleted the entry in the internal array. Try using this amended function in the UDF and see if you get a better result - I drop about 600kb when I delete the marquee now - which reduces the overhead to 1.8Mb on my machine

Func _GUICtrlMarquee_Delete($iIndex)

    ; Errorcheck index
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    ; Delete the object
    $aMarquee_Params[$iIndex][1] = 0 ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    ; Remove that entry from the array
    GUICtrlDelete($aMarquee_Params[$iIndex][0])
    For $i = $iIndex To $aMarquee_Params[0][0] - 1
        For $j = 0 To UBound($aMarquee_Params, 2) - 1
            $aMarquee_Params[$i][$j] = $aMarquee_Params[$i + 1][$j]
        Next
    Next
    ReDim $aMarquee_Params[$aMarquee_Params[0][0]][13]
    $aMarquee_Params[0][0] -= 1

    ; Redraw the other marquees
    For $i = 1 To $aMarquee_Params[0][0]
        _GUICtrlMarquee_Reset($i)
    Next

EndFunc   ;==>_GUICtrlMarquee_Delete

The additional 1.8Mb memory used seems to remain constant regardless of how many marquees are created and deleted - I amended the script to use several marquees and each added another 600kb to the overall memory usage which was returned when the relevant object was deleted. I imagine that this memory is only released when the script ends and I am afraid I have no idea of how to do anything about that - but I will keep looking. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Link to comment
Share on other sites

  • Moderators

AUTTRY,,

Try this version of the UDF - I get very similar memory usage between the 2 versions now: :)

#include-once

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w- 7

; #INDEX# =======================================================================================================================
; Title .........: Marquee
; Description ...: This module contains functions to create and manage marquee controls
; ===============================================================================================================================

; #CURRENT# =====================================================================================================================
;_GUICtrlMarquee_Init       : Initialises a Marquee control
;_GUICtrlMarquee_SetScroll  : Sets movement parameters for Marquee
;_GUICtrlMarquee_SetDisplay : Sets display parameters for Marquee
;_GUICtrlMarquee_Create     : Creates Marquee
;_GUICtrlMarquee_Delete     : Deletes a marquee control
;_GUICtrlMarquee_Reset      : Resets a marquee control to current parameters
; ===============================================================================================================================

; #INTERNAL_USE_ONLY#============================================================================================================
;__GUIMarquee_MemReduce()   : Reduce memory usage by Shell.Explorer.2 objects
;================================================================================================================================

; #INCLUDES# ====================================================================================================================

; #GLOBAL VARIABLES# ============================================================================================================
; Array to hold Marquee parameters
Global $aMarquee_Params[1][13] = [[0, 0, 0, "scroll", "left", 6, 85, 0, 0, 0, 12, "Tahoma", ""]]
; [0][0]  = Count                [n][0]  = ControlID
; [0][1]                        [n][1]  = Obj Ref
; [0][2]  = Def loop state        [n][2]  = Loop state
; [0][3]  = Def move state        [n][3]  = Move state
; [0][4]  = Def move dirn        [n][4]  = Move dirn
; [0][5]  = Def scroll speed    [n][5]  = Scroll speed
; [0][6]  = Def delay time        [n][6]  = Delay time
; [0][7]  = Def border state    [n][7]  = Border state
; [0][8]  = Def text colour        [n][8]  = Text colour
; [0][9]  = Def back colour        [n][9]  = Back colour
; [0][10] = Def font family        [n][10] = Font size
; [0][11] = Def font size        [n][11] = Font family
; [0][12]                        [n][12] = Text

; Get system text and background colours
Global $aMarquee_Colours_Ret = DllCall("User32.dll", "int", "GetSysColor", "int", 8)
$aMarquee_Params[0][8] = BitAND(BitShift(String(Binary($aMarquee_Colours_Ret[0])), 8), 0xFFFFFF)
$aMarquee_Colours_Ret = DllCall("User32.dll", "int", "GetSysColor", "int", 5)
$aMarquee_Params[0][9] = BitAND(BitShift(String(Binary($aMarquee_Colours_Ret[0])), 8), 0xFFFFFF)

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_Init
; Description ...: Initialises UDF prior to creating a Marquee control
; Syntax.........: _GUICtrlMarquee_Init()
; Parameters ....: None
; Return values .: Index of marquee to be passed to other _GUICtrlMarquee functions
; Author ........: Melba 23
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_Init()

    ; Add a new line to the array
    $aMarquee_Params[0][0] += 1
    ReDim $aMarquee_Params[$aMarquee_Params[0][0] + 1][13]
    ; Copy over the default values
    For $i = 2 To 12
        $aMarquee_Params[$aMarquee_Params[0][0]][$i] = $aMarquee_Params[0][$i]
    Next
    ; Return index of marquee in array
    Return $aMarquee_Params[0][0]

EndFunc   ;==>_GUICtrlMarquee_Init

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_SetScroll
; Description ...: Sets movement parameters for a Marquee
; Syntax.........: _GUICtrlMarquee_SetScroll($iIndex, [$iLoop, [$sMove, [$sDirection, [$iScroll, [$iDelay]]]]])
; Parameters ....: $iIndex       - Index of marquee returned by _GUICtrlMarquee_Init
;                  $iLoop        - [optional] Number of loops to repeat. (Default = infinite, -1 = leave unchanged)
;                                      Use "slide" movement to keep text visible after stopping
;                  $sMove        - [optional] Movement of text.  From  "scroll" (Default), "slide" and "alternate". (-1 = leave unchanged)
;                  $sDirection   - [optional] Direction of scrolling.  From "left" (Default), "right", "up" and "down". (-1 = leave unchanged)
;                  $iScroll      - [optional] Distance of each advance - controls speed of scrolling (Default = 6, -1 = leave unchanged)
;                                      Higher numbers increase speed, lower numbers give smoother animation.
;                  $iDelay       - [optional] Time in milliseconds between each advance (Default = 85, -1 = leave unchanged)
;                                      Higher numbers lower speed, lower numbers give smoother animation.
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error to 1 - @extended set to index of parameter with error
; Author ........: Melba 23
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_SetScroll($iIndex, $iLoop = Default, $sMove = Default, $sDirection = Default, $iScroll = Default, $iDelay = Default)

    ; Errorcheck and set parameters
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 1, 0)
    EndSwitch

    Switch $iLoop
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][2] = $aMarquee_Params[0][2]
        Case Else
            If IsNumber($iLoop) Then
                $aMarquee_Params[$iIndex][2] = Int(Abs($iLoop))
            Else
                Return SetError(1, 2, 0)
            EndIf
    EndSwitch

    Switch $sMove
        Case -1
            ; No change
        Case "scroll", 'alternate', 'slide'
            $aMarquee_Params[$iIndex][3] = $sMove
        Case Default
            $aMarquee_Params[$iIndex][3] = $aMarquee_Params[0][3]
        Case Else
            Return SetError(1, 3, 0)
    EndSwitch

    Switch $sDirection
        Case -1
            ; No change
        Case 'left', 'right', 'up', 'down'
            $aMarquee_Params[$iIndex][4] = $sDirection
        Case Default
            $aMarquee_Params[$iIndex][4] = $aMarquee_Params[0][4]
        Case Else
            Return SetError(1, 4, 0)
    EndSwitch

    Switch $iScroll
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][5] = $aMarquee_Params[0][5]
        Case Else
            If IsNumber($iScroll) Then
                $aMarquee_Params[$iIndex][5] = Int(Abs($iScroll))
            Else
                Return SetError(1, 5, 0)
            EndIf
    EndSwitch

    Switch $iDelay
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][6] = $aMarquee_Params[0][6]
        Case Else
            If IsNumber($iDelay) Then
                $aMarquee_Params[$iIndex][6] = Int(Abs($iDelay))
            Else
                Return SetError(1, 6, 0)
            EndIf
    EndSwitch

    Return 1

EndFunc   ;==>_GUICtrlMarquee_SetScroll

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_SetDisplay
; Description ...: Sets display parameters for subsequent _GUICtrlCreateMarquee calls
; Syntax.........: _GUICtrlMarquee_SetDisplay($iIndex, [$iBorder, [$vTxtCol, [$vBkCol, [$iPoint, [$sFont]]]])
; Parameters ....: $iIndex  - Index of marquee returned by _GUICtrlMarquee_Init
;                  $iBorder - [optional] 0 = None (Default), 1 = 1 pixel, 2 = 2 pixel, 3 = 3 pixel (-1 = no change)
;                  $vTxtCol - [optional] Colour for text (Default = system colour, -1 = no change)
;                  $vBkCol  - [optional] Colour for Marquee (Default = system colour, -1 = no change)
;                             Colour can be passed as RGB value or as one of the following strings:
;                                'black', 'gray', 'white', 'silver', 'maroon', 'red', 'purple', 'fuchsia',
;                                'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua'
;                  $iPoint  - [optional] Font size (Default = 12, -1 = unchanged)
;                  $sFont   - [optional] Font to use (Default = Tahoma, "" = unchanged)
; Return values .: Success - Returns 0
;                  Failure - Returns 0 and sets @error to 1 - @extended set to index of parameter with error
; Author ........: Melba 23
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_SetDisplay($iIndex, $iBorder = Default, $vTxtCol = Default, $vBkCol = Default, $iPoint = Default, $sFont = Default)

    ; Errorcheck and set parameters
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 1, 0)
    EndSwitch

    Switch $iBorder
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][7] = $aMarquee_Params[0][7]
        Case 0 To 3
            $aMarquee_Params[$iIndex][7] = Int($iBorder)
        Case Else
            Return SetError(1, 2, 0)
    EndSwitch

    Switch $vTxtCol
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][8] = $aMarquee_Params[0][8]
        Case Else
            If Number($vTxtCol) Then
                $aMarquee_Params[$iIndex][8] = Int(Number($vTxtCol))
            Else
                $aMarquee_Params[$iIndex][8] = $vTxtCol
            EndIf
    EndSwitch

    Switch $vBkCol
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][9] = $aMarquee_Params[0][9]
        Case Else
            If Number($vBkCol) Then
                $aMarquee_Params[$iIndex][9] = Int(Number($vBkCol))
            Else
                $aMarquee_Params[$iIndex][9] = $vBkCol
            EndIf
    EndSwitch

    Switch $iPoint
        Case -1
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][10] = $aMarquee_Params[0][10]
        Case Else
            If IsNumber($iPoint) Then
                $aMarquee_Params[$iIndex][10] = Int(Abs($iPoint / .75))
            Else
                Return SetError(1, 5, 0)
            EndIf
    EndSwitch

    Switch $sFont
        Case ""
            ; No change
        Case Default
            $aMarquee_Params[$iIndex][11] = $aMarquee_Params[0][11]
        Case Else
            If IsString($sFont) Then
                $aMarquee_Params[$iIndex][11] = $sFont
            Else
                Return SetError(1, 5, 0)
            EndIf
    EndSwitch

    Return 1

EndFunc   ;==>_GUICtrlMarquee_SetDisplay

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_Create
; Description ...: Creates a marquee control
; Syntax.........: _GUICtrlMarquee_Create($iIndex, $sText, $iLeft, $iTop, $iWidth, $iHeight, [$sTipText])
; Parameters ....: $iIndex  - Index of marquee returned by _GUICtrlMarquee_Init
;                  $sText   - The text (or HTML markup) the marquee should display.
;                  $iLeft   - The left side of the control.
;                  $iTop    - The top of the control.
;                  $iWidth  - The width of the control.
;                  $iHeight - The height of the control.
;                  $sTipTxt - [optional] Tip text displayed when mouse hovers over the control.
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error as follows
;                                    1 = Invalid index
;                                    2 = Index already used
;                                    3 = Failed to create object
;                                    4 = Failed to embed object
; Author ........: james3mg, trancexx and jscript "FROM BRAZIL"
; Modified.......: Melba23
; Remarks .......: This function attempts to embed an 'ActiveX Control' or a 'Document Object' inside the GUI.
;                  The GUI functions GUICtrlRead and GUICtrlSet have no effect on this control. The object can only be
;                  controlled using other _GUICtrlMarquee functions
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_Create($iIndex, $sText, $iLeft, $iTop, $iWidth, $iHeight, $sTipText = "")

    ; Errorcheck index
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    ; Check not previously created
    If $aMarquee_Params[$iIndex][1] <> "" Then
        Return SetError(2, 0, 0)
    EndIf

    ; Store text
    $aMarquee_Params[$iIndex][12] = $sText

    ; Create marquee
    Local $oShell = ObjCreate("Shell.Explorer.2")
    If Not IsObj($oShell) Then
        Return SetError(3, 0, 0)
    Else
        $aMarquee_Params[$iIndex][1] = $oShell
    EndIf
    $aMarquee_Params[$iIndex][0] = GUICtrlCreateObj($oShell, $iLeft, $iTop, $iWidth, $iHeight)
    If $aMarquee_Params[$iIndex][0] = 0 Then
        Return SetError(4, 0, 0)
    EndIf

    ; Wait for marquee to be created
    $oShell.navigate("about:blank")
    While $oShell.busy
        Sleep(100)
    WEnd

    ; Add marquee content
    With $oShell.document
        .write('<style>marquee{cursor: default}></style>')
        .write('<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ondragstart="return false" ondragover="return false">')
        .writeln('<marquee width=100% height=100%')
        .writeln("loop=" & $aMarquee_Params[$iIndex][2])
        .writeln("behavior=" & $aMarquee_Params[$iIndex][3])
        .writeln("direction=" & $aMarquee_Params[$iIndex][4])
        .writeln("scrollamount=" & $aMarquee_Params[$iIndex][5])
        .writeln("scrolldelay=" & $aMarquee_Params[$iIndex][6])
        .write(">")
        .write($sText)
        .body.title = $sTipText
        .body.topmargin = 0
        .body.leftmargin = 0
        .body.scroll = "no"
        .body.style.borderWidth = $aMarquee_Params[$iIndex][7]
        .body.style.color = $aMarquee_Params[$iIndex][8]
        .body.bgcolor = $aMarquee_Params[$iIndex][9]
        .body.style.fontSize = $aMarquee_Params[$iIndex][10]
        .body.style.fontFamily = $aMarquee_Params[$iIndex][11]
    EndWith

    ; Free memory
    __GUIMarquee_MemReduce()

    Return 1

EndFunc   ;==>_GUICtrlMarquee_Create

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_Delete
; Description ...: Deletes a marquee control
; Syntax.........: _GUICtrlMarquee_Delete($iIndex)
; Parameters ....: $iIndex - Index of marquee returned by _GUICtrlMarquee_Init
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error to 1
; Author ........: Melba23
; Remarks .......:
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_Delete($iIndex)

    ; Errorcheck index
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    ; Delete the object
    $aMarquee_Params[$iIndex][1] = 0
    ; And free the memory
    __GUIMarquee_MemReduce()

    ; Remove that entry from the array
    GUICtrlDelete($aMarquee_Params[$iIndex][0])
    For $i = $iIndex To $aMarquee_Params[0][0] - 1
        For $j = 0 To UBound($aMarquee_Params, 2) - 1
            $aMarquee_Params[$i][$j] = $aMarquee_Params[$i + 1][$j]
        Next
    Next
    ReDim $aMarquee_Params[$aMarquee_Params[0][0]][13]
    $aMarquee_Params[0][0] -= 1

    ; Redraw the other marquees
    For $i = 1 To $aMarquee_Params[0][0]
        _GUICtrlMarquee_Reset($i)
    Next

EndFunc   ;==>_GUICtrlMarquee_Delete

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlMarquee_Reset
; Description ...: Resets a marquee control to current parameters
; Syntax.........: _GUICtrlMarquee_Reset($iIndex, $sText)
; Parameters ....: $iIndex - Index of marquee returned by _GUICtrlMarquee_Init
;                  $sText  - The text (or HTML markup) the marquee should display (Default leaves text unchanged)
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error as follows
;                                    1 = Invalid index
;                                    2 = Invalid object reference
; Author ........: rover
; Modified.......: Melba23
; Remarks .......:
; Related .......: Other _GUICtrlMarquee functions
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================

Func _GUICtrlMarquee_Reset($iIndex, $sText = Default)

    ; Errorcheck index
    Switch $iIndex
        Case 1 To $aMarquee_Params[0][0]
            $iIndex = Int($iIndex)
        Case Else
            Return SetError(1, 0, 0)
    EndSwitch

    ; Retrieve object reference
    $oShell = $aMarquee_Params[$iIndex][1]
    If Not IsObj($oShell) Then
        Return SetError(2, 0, 0)
    EndIf

    If $sText <> Default Then
        $aMarquee_Params[$iIndex][12] = $sText
    EndIf

    $oShell.document.body.innerHTML = '<body onselectstart="return false" oncontextmenu="return false" onclick="return false" ' & _
        'ondragstart="return false" ondragover="return false"> ' & _
        '<marquee width=100% height=100% ' & "loop=" & $aMarquee_Params[$iIndex][2] & _
        " behavior=" & $aMarquee_Params[$iIndex][3] & _
        " direction=" & $aMarquee_Params[$iIndex][4] & _
        " scrollamount=" & $aMarquee_Params[$iIndex][5] & _
        " scrolldelay=" & $aMarquee_Params[$iIndex][6] & _
        ">" & $aMarquee_Params[$iIndex][12]
    With $oShell.document
        .body.style.borderWidth = $aMarquee_Params[$iIndex][7]
        .body.style.color = $aMarquee_Params[$iIndex][8]
        .body.bgcolor = $aMarquee_Params[$iIndex][9]
        .body.style.fontSize = $aMarquee_Params[$iIndex][10]
        .body.style.fontFamily = $aMarquee_Params[$iIndex][11]
    EndWith

    Return 1

EndFunc   ;==>_GUICtrlMarquee_SetText

; #INTERNAL USE ONLY# ====================================================================================================================
; Name...........: _GUICtrlMarquee_MemReduce
; Description ...: Reduce memory usage by Shell.Explorer.2 objects
; Syntax.........: _GUICtrlMarquee_MemReduce()
; Author ........: AutoUt forum
; Remarks .......: This function is used internally by
; ===============================================================================================================================

Func __GUIMarquee_MemReduce()
    Local $aHandle = DllCall("kernel32.dll", "int", "OpenProcess", "int", 0x1f0fff, "int", 0, "int", @AutoItPID)
    DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", $aHandle[0])
    DllCall("kernel32.dll", "int", "CloseHandle", "int", $aHandle[0])
EndFunc

How do you get on? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@Melba

I think it would better if you used the following function:

BOOL WINAPI SetProcessWorkingSetSize(
  _In_  HANDLE hProcess,
  _In_  SIZE_T dwMinimumWorkingSetSize,
  _In_  SIZE_T dwMaximumWorkingSetSize
);

In any case, the changes were very good, thank you!

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • Moderators

JScript,

From what I have read about this looking for a solution you would need to set the Min/Max parameters to (SIZE_T)-1 in that snippet - and in any event it is functionally equivalent to the EmptyWorkingSet solution. Or do you have more information about all this than is available on MSDN? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Doesn't your MemReduce function just page the memory used to the hard drive, thus making things slower? Also, doesn't this just fool the user into thinking the memory used is less?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

BrewManNH,

From my reading of the function it seems that the function only pages the memory to the hard drive if the pages are in use. Using it once the Marquee is deleted should free the memory completely. I found this quote while I was researching (sorry I cannot remember from exactly where):

"The working set of an application is not guaranteed to be reserved. When the application is idle or the the memory runs low the OS will eventually reclaim/reduce the working set of an application. So, calling the EmptyWorkingSet/SetProcessWorkingSetSize is just a way to clean up before the OS does it."

But I freely admit I am well ouside my comfort zone here so (as always) I am more than ready to hear that I am completely wrong! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...