Jump to content

Recommended Posts

Hi

I am trying to check a number of applications are up to date and install the update if required. This will run as a shutdown script, pushed out through Group Policy.

I am querying various registry keys to determine if

  1. The software is actually installed
  2. The software is at the correct version

Once the need for update is determined then it calls another function to run the update.

If the software is up to date or not installed, it moves down to the next software section which changes the registry key variables and calls the registry query function again

I have managed to get the function for (un)installs to work but I am having trouble with the registry query function

#NoTrayIcon
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>

; Here we go!
;##########################################################################################################

;Declare variables
Global $RegKey86, $RegKey64, $RegValueName, $RegValueData, $CheckVersion86, $CheckVersion64


; 7Zip
;##########################################################################################################
_7Zip_Function()
Func _7Zip_Function()

; Registry location and values that are checked for current software version
; Ensure the x64 key is preceeded with 'HKLM64'
$RegKey86="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
$RegKey64="HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
$RegValueName="DisplayVersion"
$RegValueData="16.04"

; Excecution
; ---------------------------------------------------------------------------------------------------------

If _CheckSW() = 1 Then
        _UninstallOldVer()
        _InstallSW()
    EndIf
EndFunc ;==>_7Zip_Function


; Functions
;##########################################################################################################
Func _CheckSW()
    $CheckVersion86=RegRead ($RegKey86, $RegValueName)
    $CheckVersion64=RegRead ($RegKey64, $RegValueName)
    If $CheckVersion86=$RegValueData Or $CheckVersion64=$RegValueData Then
        Return 0
    ElseIf $CheckVersion86="" And $CheckVersion64="" Then
        Return 0
    Else
        Return 1
    EndIf
EndFunc ;==>CheckSW

 

Edited by MarkBe
Solved
Link to post
Share on other sites

What trouble are you having?  Personally I would use _VersionCompare something like:

#NoTrayIcon
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Misc.au3>

; Here we go!
;##########################################################################################################

;Declare variables
Global $RegKey86, $RegKey64, $RegValueName, $RegValueData, $CheckVersion86, $CheckVersion64

; 7Zip
;##########################################################################################################
_7Zip_Function()
Func _7Zip_Function()

; Registry location and values that are checked for current software version
; Ensure the x64 key is preceeded with 'HKLM64'
    $RegKey86="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
    $RegKey64="HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
    $RegValueName="DisplayVersion"
    $RegValueData="16.04"

; Excecution
; ---------------------------------------------------------------------------------------------------------
    If _RegVersionCompare($RegKey64, $RegValueName, $RegValueData) = 1 Then
        _UninstallOldVer()
        _InstallSW()
    EndIf
EndFunc ;==>_7Zip_Function

; Functions
;##########################################################################################################
Func _RegVersionCompare($sRegHive, $sRegKey, $sRegValue)
    Local $iVersionCompare = _VersionCompare(RegRead($sRegHive, $sRegKey), $sRegValue)
    Switch $iVersionCompare
        Case 0
            Return 0
        Case 1
            Return 0
        Case -1
            Return 1
    EndSwitch
EndFunc ;==>CheckSW

 

Link to post
Share on other sites

Thanks Subz

This is very close. Once I had put in #include <Misc.au3> it runs the installer if the software is out of date and does not run the installer if it is current.

There is one scenario that isn't working quite right for me yet, if the software isn't installed at all, I don't want the installer to run. Do you have a suggestion for handling that?

Thanks

p.s. I like the fact that if someone has manually installed a newer version that the script you suggested doesn't roll it back

Edited by MarkBe
p.s.
Link to post
Share on other sites

You could use the following:

Func _RegVersionCompare($sRegHive, $sRegKey, $sRegValue)
    If RegRead($sRegHive, $sRegKey) = "" Then Return 0
    Local $iVersionCompare = _VersionCompare(RegRead($sRegHive, $sRegKey), $sRegValue)
    Switch $iVersionCompare
        Case 0
            Return 0
        Case 1
            Return 0
        Case -1
            Return 1
    EndSwitch
EndFunc ;==>CheckSW

 

Link to post
Share on other sites

Thanks Subz

You have pointed me in the right direction. Unfortunately the old version of 7Zip I am updating stores the version in a different hive ... I'll try and fix this new development myself and post back if I get stuck again

Now I just need to work out how to mark your reply as the answer ...

Link to post
Share on other sites

There's probably a more elegant way to do this but I ended up with the following:

#NoTrayIcon
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Misc.au3>

; Here we go!
;##########################################################################################################

;Declare variables
Global $RegHive86, $RegHive64, $RegKey, $RegValue, $OldVerRegHive86, $OldVerRegHive64, $OldVerRegHive86on64, $OldVerRegVerString, $OldVerRegVerValue, $OldVerUninstallStringx86, $OldVerUninstallStringx64

; 7Zip
;##########################################################################################################
_7Zip_Function()
Func _7Zip_Function()

; Variables
; ---------------------------------------------------------------------------------------------------------
; Registry location and values that are checked for current software version. Don't use paths with hash values
; Ensure the x64 key is preceeded with 'HKLM64'
$RegHive86="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
$RegHive64="HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\7-Zip"
$RegKey="DisplayVersion"
$RegValue="16.04"

; Reg keys and values that are checked for old versions
$OldVerRegHive86="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0920-000001000000}"
$OldVerRegHive64="HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2702-0920-000001000000}"
$OldVerRegHive86on64="HKLM64\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0920-000001000000}"

    If _RegVersionCompare($RegHive64, $RegHive86, $OldVerRegHive64, $OldVerRegHive86, $OldVerRegHive86on64, $RegKey, $RegValue) = 1 Then
        _UninstallOldVer()
        _InstallSW()
    EndIf
EndFunc ;==>_7Zip_Function


; Functions
;##########################################################################################################
Func _RegVersionCompare($sRegHive64, $sRegHive86, $sOldVerRegHive64, $sOldVerRegHive86, $sOldVerRegHive86on64, $sRegKey, $sRegValue)
    If Not RegRead($sRegHive64, $sRegKey) = "" Then
        Local $iVersionCompare = _VersionCompare(RegRead($sRegHive64, $sRegKey), $sRegValue)
        Switch $iVersionCompare
            Case 0
                Return 0
            Case 1
                Return 0
            Case -1
                Return 1
        EndSwitch
    ElseIf Not RegRead($sRegHive86, $sRegKey) = "" Then
        Local $iVersionCompare = _VersionCompare(RegRead($sRegHive86, $sRegKey), $sRegValue)
        Switch $iVersionCompare
            Case 0
                Return 0
            Case 1
                Return 0
            Case -1
                Return 1
        EndSwitch
    ElseIf Not RegRead($sOldVerRegHive64, $sRegKey) = "" Then
        Return 1
    ElseIf Not RegRead($sOldVerRegHive86, $sRegKey) = "" Then
        Return 1
    ElseIf Not RegRead($sOldVerRegHive86on64, $sRegKey) = "" Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==>_RegVersionCompare

 

Link to post
Share on other sites

Couple of things to note:

$OldVerRegHive86 = $OldVerRegHive86on64
- HKLM on a x64 system accesses 32 bit hive i.e. HKLM\Software\Wow6432Node

Since x64 and x86 versions of 7-zip are different installers you should specify which version to install using @OSArch macro, you may also need to get the Guids for both x86/x64 to uninstall for example:

  • "{23170F69-40C1-2701-0920-000001000000}" ; 7-Zip 9.20 x86 Msi Version
  • "{23170F69-40C1-2702-0920-000001000000}" ; 7-Zip 9.20 x64 Msi Version
  • "{23170F69-40C1-2701-1604-000001000000}" ; 7-Zip 16.04 x86 Msi Version
  • "{23170F69-40C1-2702-1604-000001000000}" ; 7-Zip 16.04 x64 Msi Version
Link to post
Share on other sites

Yes, discovered that the hard way - last time I deployed this using a batch script

What I have in that section for 7Zip is

#NoTrayIcon
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <Misc.au3>

$SoftwareName="7Zip Archiver"
$SoftwareVersion="16.04"
$InstallingUpdateMessage="Updating " & $SoftwareName & " to " & $SoftwareVersion & "."
$EndMessage="The current version of " & $SoftwareName & " is now installed."
$FailMessage=$SoftwareName & " update failed to install. Please report error to your local IT department."
$UninstallingOldMessage="Uninstalling old versions of " & $SoftwareName & "."

; Paths and files (Don't forget the "\" at the end of the path)==> \\Servername\Share\
$SourcePath="\\domain\dfsroot\share\7Zip\"
$WorkingDirectory="C:\InstallCache\7zip\"
$x86Installer="7z1604.exe"
$x64Installer="7z1604x64.exe"
$SWInstaller=((@OSArch = "X86") ? $x86Installer : $x64Installer)
$InstallerSwitches=" /S"

_InstallSW()
Func _InstallSW()
    MsgBox ($MB_ICONINFORMATION, "Installing", $InstallingUpdateMessage, 3)
    FileCopy ($SourcePath & $SWInstaller, $WorkingDirectory & $SWInstaller, $FC_OVERWRITE + $FC_CREATEPATH)
    If StringLower(StringRight($SWInstaller, 4))=".exe" Then
        RunWait (@ComSpec & ' /k START "' & $SoftwareName & ' Installer" /wait "' & $WorkingDirectory & $SWInstaller & '"' & $InstallerSwitches & ' && EXIT', @SystemDir, @SW_HIDE)
    Else
        RunWait ('msiexec /i "' & $WorkingDirectory & $SWInstaller & '"' & $InstallerSwitches, @SystemDir)
    EndIf
EndFunc ;==>InstallSW

 

Link to post
Share on other sites

You should be able to run the install directly from the domain share, but if you wish to copy, I would probably place an "If FileExists" so that it doesn't copy down everytime, I would also use SplashTextOn function to display the progress of the install.  Not sure why you need cmd to run the exe you should be able to just run it directly from the Working directory using RunWait.  Lastly not sure what the last Runwait ('msiexe /i... is suppose to do :)

Link to post
Share on other sites
2 minutes ago, Subz said:

You should be able to run the install directly from the domain share, but if you wish to copy, I would probably place an "If FileExists" so that it doesn't copy down everytime, I would also use SplashTextOn function to display the progress of the install.  Not sure why you need cmd to run the exe you should be able to just run it directly from the Working directory using RunWait.  Lastly not sure what the last Runwait ('msiexe /i... is suppose to do :)

I used to run the installers from the domain share but some remote users found that the script timed out before completion

I also decided to replace on copy because some users got a corrupted copy on the C:\ and so I needed the EXE to be replaced so it didn't fail repetitively! There are some awful network connections between the servers and some of my users - being addressed at the moment though :-)

SplashTextOn sounds good. I haven't discovered many of the cool features of AutoIT yet ... I'm a bit of a noob!

This was taken all from a RunAsWait so I needed to plug in credentials to elevate. Not sure why I used CMD ... think it was because I used to do all the grunt work with CMD and just use AutoIT to elevate. Ran into problems (x64 v x86 batch) so decided to learn AutoIT.

Lastly, I have the msiexec in the function so that if, in the next software section the installer is an MSI then I can still call the same _InstallSW() function and just pipe in different variables

Link to post
Share on other sites

definitely cleaner:

Func _InstallSW()
    MsgBox ($MB_ICONINFORMATION, "Installing", $InstallingUpdateMessage, 3)
    FileCopy ($SourcePath & $SWInstaller, $WorkingDirectory & $SWInstaller, $FC_OVERWRITE + $FC_CREATEPATH)
    If StringLower(StringRight($SWInstaller, 4))=".exe" Then
        RunWait ('"' & $WorkingDirectory & $SWInstaller & '"' & $InstallerSwitches)
    Else
        RunWait ('msiexec /i "' & $WorkingDirectory & $SWInstaller & '"' & $InstallerSwitches)
    EndIf
EndFunc ;==>InstallSW

 

Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By ahha
      I seem to have lost my sense of how the Global scope works.  In this example $p is Global but I can't seem to set $p in function __One and then pass that version of $p to function __Two.  I thought you could set a Global to a new value from within a function and it would affect the Global value. 
      I've stared and played with this code for over an hour and I'm missing something really basic.  Help appreciated.
      #AutoIt3Wrapper_run_debug_mode=Y ; use this to debug in console window <--- LOOK Global $p = 999 MsgBox(0, "DEBUG", "MAIN - $p = '" & $p & "'") __One() Exit Func __One() ;Global $p ;this seems to make no difference - comment it out to see - how does one affect the Global in a function? MsgBox(0, "DEBUG", "Entering Func __One() - $p = '" & $p & "'") For $p = 1 to 3 MsgBox(0, "DEBUG", "IN Func __One() - $p = '" & $p & "'") __Two() Next EndFunc Func __Two() MsgBox(0, "DEBUG", "Entering __Two() $p = '" & $p & "'") EndFunc  
    • By PeterVerbeek
      This topic give you access to an AutoIt functions library I maintain which is called PAL, Peter's AutoIt Library. The latest version 1.26 contains 214 functions divided into these topics:
      window, desktop and monitor GUI, mouse and color GUI controls including graphical buttons (jpg, png) logics and mathematics include constants string, xml string and file string dialogues and progress bars data lists: lists, stacks, shift registers and key maps (a.ka. dictionaries) miscellaneous: logging/debugging, process and system info Change log and files section  on the PAL website (SourceForge).
      A lot of these functions were created in the development of Peace, Peter's Equalizer APO Configuration Extension, which is a user interface for the system-wide audio driver called Equalizer APO.
    • By meety
      My au3 script program needs administrator privileges on win10 to be executed correctly, because it needs to be added to the boot---Script code:RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)
      I need to let the program automatically get administrator privileges, so I use a function of #RequireAdmin. Although the program can be added to the boot, but does not execute after system boot up? why is that?
      What should I do?
      --------------------------------------------------------------------
      Update:
      I found that after using the #RequireAdmin function, the program cannot be executed after system boot up.
      An example is given below. after it is compiled, it will not be executed after system boot up in the following two ways.
      1. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\
      2. RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", @ScriptName, "REG_SZ", @ScriptFullPath)
      why is that?
      example
      #include <MsgBoxConstants.au3>
      #RequireAdmin
      Func test()
          MsgBox(0, "", "this is test message")
      EndFunc   ;==>test
      test()
       
       
    • By Dan_555
      Hi, here are few functions for the ListBox.
      I have searched the forum, but most of the functions are for listview, so i took one example code from melba23 (clear selection) and
      wrote few more functions. (Because my current project needs them).
       
      These functions work only on a Multi-selection ListBox . 
      Edit: Only 1 function does not work with single selection box.
      The functions do: Clear Selection, Delete Selected items, Invert Selection, Move selected items up and down.
       The example code has 2 Listboxes. The selected items on the left ListBox can be moved up and down. The right Listbox has buttons for the other functions.
      #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> Local $singlesel = 0, $iMsgBoxAnswer = 0 ;MsgBox features: Title=Yes, Text=Yes, Buttons=Yes and No, Icon=Question, Modality=Task Modal $iMsgBoxAnswer = MsgBox(8228, "Choose Listbox selecton type", "Yes for single, No for multi selection box") If $iMsgBoxAnswer = 6 Then $singlesel = 1 ;Yes Local $BL_1,$BL_2,$BR_1,$BR_2,$BR_3,$BR_4,$BR_5,$BR_6 Global $hForm1 = GUICreate("Listbox test", 349, 287) $LB_1 = GUICtrlCreateList("", 6, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) If $singlesel = 1 Then $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) Else $LB_2 = GUICtrlCreateList("", 179, 40, 157, 244, BitOR($LBS_NOTIFY, $LBS_MULTIPLESEL, $WS_HSCROLL, $WS_VSCROLL, $LBS_DISABLENOSCROLL)) $BR_3 = GUICtrlCreateButton("Reverse Sel", 272, 22, 68, 17) EndIf $BL_1 = GUICtrlCreateButton("Up", 20, 3, 35, 18) $BL_2 = GUICtrlCreateButton("Down", 60, 3, 35, 18) $BR_1 = GUICtrlCreateButton("Up", 200, 3, 35, 18) $BR_2 = GUICtrlCreateButton("Down", 240, 3, 35, 18) $BR_4 = GUICtrlCreateButton("Clear Sel", 217, 22, 52, 17) $BR_5 = GUICtrlCreateButton("Delete", 175, 22, 40, 17) $BR_6 = GUICtrlCreateButton("Populate", 290, 3, 50, 18) GUISetState(@SW_SHOW) For $x = 0 To 50 If $x <= 10 Then GUICtrlSetData($LB_1, $x & " test", 0) GUICtrlSetData($LB_2, $x & " Test", 0) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BL_1 $a = Listbox_ItemMoveUD($LB_1, -1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BL_2 $a = Listbox_ItemMoveUD($LB_1, 1) If $a > -1 Then WinSetTitle($hForm1, "", "Moved items: " & $a) Case $BR_1 Listbox_ItemMoveUD($LB_2, -1) Case $BR_2 Listbox_ItemMoveUD($LB_2, 1) Case $BR_3 Listbox_ReverseSelection($LB_2) Case $BR_4 Listbox_ClearSelection($LB_2) Case $BR_5 Listbox_DeleteSelectedItems($LB_2) Case $BR_6 ;Populate GUICtrlSetData($LB_2, "") ; Clears the listbox For $x = 0 To 50 GUICtrlSetData($LB_2, $x & " Test", 0) Next EndSwitch WEnd ;note $hLB_ID - is the Listbox id Func Listbox_DeleteSelectedItems($hLB_ID) Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Get selected items Local $i, $slb = 0, $y, $x If $aSel[0] = 0 Then ;If the array is empty, there is no selection, or it is a single selection listbox For $x = 0 To _GUICtrlListBox_GetCount($hLB_ID) - 1 $y = _GUICtrlListBox_GetSel($hLB_ID, $x) If $y = True Then $slb = 1 _GUICtrlListBox_DeleteString($hLB_ID, $x) ;Perform a delete on single sel. LB ExitLoop EndIf Next EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = $aSel[0] To 1 Step -1 ;Loop backwards and delete the selected items _GUICtrlListBox_DeleteString($hLB_ID, $aSel[$i]) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_DeleteSelectedItems Func Listbox_ClearSelection($hLB_ID) ;Removes the selection from multi and single selection ListBox Local $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Code from Melba23 - Autoit Forum Local $slb, $x, $y If $aSel[0] = 0 Then _GUICtrlListBox_SetCurSel($hLB_ID, -1) $slb = 1 EndIf If $slb = 0 Then _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 1 To $aSel[0] _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i], False) Next _GUICtrlListBox_EndUpdate($hLB_ID) EndIf EndFunc ;==>Listbox_ClearSelection Func Listbox_ReverseSelection($hLB_ID) ;Logically, this function works only on multi-selection listboxes Local $i Local $aCou = _GUICtrlListBox_GetCount($hLB_ID) Local $cSel = _GUICtrlListBox_GetCaretIndex($hLB_ID) ;Save the caret _GUICtrlListBox_BeginUpdate($hLB_ID) For $i = 0 To $aCou _GUICtrlListBox_SetSel($hLB_ID, $i, Not (_GUICtrlListBox_GetSel($hLB_ID, $i))) Next _GUICtrlListBox_SetCaretIndex($hLB_ID, $cSel) ;Restore the caret _GUICtrlListBox_EndUpdate($hLB_ID) EndFunc ;==>Listbox_ReverseSelection Func Listbox_ItemMoveUD($hLB_ID, $iDir = -1) ;Listbox_ItemMoveUD - Up/Down Move Multi/Single item in a ListBox ;$iDir: -1 up, 1 down ;Return values -1 nothing to do, 0 nothing moved, >0 performed moves Local $iCur, $iNxt, $aCou, $aSel, $i, $m = 0, $y, $slb = 0 ;Current, next, Count, Selection, loop , movecount $aSel = _GUICtrlListBox_GetSelItems($hLB_ID) ;Put selected items in an array $aCou = _GUICtrlListBox_GetCount($hLB_ID) ;Get total item count of the listbox If $aSel[0] = 0 Then $y = _GUICtrlListBox_GetCurSel($hLB_ID) If $y > -1 Then _ArrayAdd($aSel, $y) $aSel[0] = 1 $slb = 1 EndIf EndIf ;WinSetTitle($hGUI, "", $aSel[0]) ;Debugging info Select Case $iDir = -1 ;Move Up For $i = 1 To $aSel[0] If $aSel[$i] > 0 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] - 1) ;Save the selection index - 1 text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] - 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) ;Replace the index-1 text with the index text _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) ;Replace the selection with the saved var $m = $m + 1 EndIf Next For $i = 1 To $aSel[0] ;Restore the selections after moving If $aSel[$i] > 0 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] - 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] - 1) EndIf EndIf Next Return $m Case $iDir = 1 ;Move Down If $aSel[0] > 0 Then For $i = $aSel[0] To 1 Step -1 If $aSel[$i] < $aCou - 1 Then $iNxt = _GUICtrlListBox_GetText($hLB_ID, $aSel[$i] + 1) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i] + 1, _GUICtrlListBox_GetText($hLB_ID, $aSel[$i])) _GUICtrlListBox_ReplaceString($hLB_ID, $aSel[$i], $iNxt) $m = $m + 1 EndIf Next EndIf For $i = $aSel[0] To 1 Step -1 ;Restore the selections after moving If $aSel[$i] < $aCou - 1 Then If $slb = 0 Then _GUICtrlListBox_SetSel($hLB_ID, $aSel[$i] + 1, 1) Else _GUICtrlListBox_SetCurSel($hLB_ID, $aSel[$i] + 1) EndIf EndIf Next Return $m EndSelect Return -1 EndFunc ;==>Listbox_ItemMoveUD  
    • By Rabu
      I want to use the winsock overlapped/completion routine method of i/o, but how do I get the pointer to my user function.  I know it is possible because when using the old method of windows messages, the user function name was used instead of a pointer.
×
×
  • Create New...