Jump to content
Sign in to follow this  
JonBMN

[SOLVED]Config GUI; Saving to .Ini file using save button

Recommended Posts

JonBMN

I'm trying to make a GUI interface that recieves data from my Archangel.ini as default, but can be changed and then saved to the .ini from the GUI program. I'm having trouble creating the save button function that actually writes to the .ini file. Any help would be much appreciated.

My ConfigurationGUI.au3

#include <GlobalVars.au3>
#include <ArchLib.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
Global $ButtonSave, $ButtonCancel, $msg, $PRI1, $PRI2, $PRI3, $PRI4, $PRI5, $PRI6, $PRI7, $PRI8, $PRI9, $PRI10, $msg2


DecodeIni("Archangel.Ini", False) ;Decodes the .Ini File
;ConsoleWrite($IniProgramGroup & @CR)
GUICreate("Archangel Configuration Setup", 500, 400) ;Creates the GUI window
GUISetBkColor(0x00E0eeeF) ;Sets Background color
$ButtonSave = GUICtrlCreateButton("Save", 200, 350, 45, 30) ;Save button
$ButtonCancel = GUICtrlCreateButton("Cancel", 300, 350, 45, 30) ;Cancel Button
GUICtrlCreateTab(0, 0, 500, 340) ;Creates the tab
GUICtrlCreateTabItem("Speed") ;First tab item
GUICtrlCreateLabel("Speed Settings", 10, 25) ;Creates the label for the configuration drop down menu
GUICtrlCreateLabel("Show the Speed:", 10, 100) ;Creates the label for the Show the speed config
GUICtrlCreateLabel("Speed limit:", 10, 175) ;Creates the label for the Speed limit config
GUICtrlCreateCombo("", 275, 100) ;Creates the drop down box
GUICtrlSetData(10, "Yes|No", $ShowSpeed) ;Puts the data into the drop down box
GUICtrlCreateCombo("", 275, 175) ;Creates the drop down box
GUICtrlSetData(11, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30", $SpeedLimit) ;Puts the data into the drop down box

GUICtrlCreateTabItem("Serial Settings") ;Tab with serial settings
GUICtrlCreateLabel("Serial Settings", 10, 25) ;Creates the label for the serial settings
GUICtrlCreateLabel("Communications Port:", 10, 75) ;Creates the label for the commport setting
GUICtrlCreateLabel("Baudrate:", 10, 150) ;Creates the label for the Baudrate
GUICtrlCreateCombo("", 275, 75) ;Creates the drop down box
GUICtrlSetData(16, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50", $NumericPort) ;Puts data into drop down box
GUICtrlCreateCombo("", 275, 150) ;Creates drop down box
GUICtrlSetData(17, "2400|4800|9600|19200|38400|57600|115200|31250", $BaudRate) ;Puts data into drop down box

GUICtrlCreateTabItem("Accesories") ;keyboard, mouse, touchscreen options
GUICtrlCreateLabel("Accesories settings", 10, 25) ;Creates label for accesories settings
GUICtrlCreateLabel("Block options:", 10, 75) ;Creates the label for the block options
GUICtrlCreateCombo("", 275, 75) ;Creates the dorp down box
GUICtrlSetData(21, "None|Both|Mouse/Touchscreen|Keyboard", $AlphaBlock[$BlockOption]) ;Puts data into drop down box

GUICtrlCreateTabItem("Run Plates") ;Run plate option tab
GUICtrlCreateLabel("Ability to run plates", 10, 25) ;creates label for plate running config
GUICtrlCreateLabel("Run Plates", 10, 75) ;creates the label for plate running setting
GUICtrlCreateCombo("", 275, 75) ;creates drop down box
GUICtrlSetData(25, "Yes|No", $RunPlates) ;puts data into drop down box

GUICtrlCreateTabItem("Windows Priority") ;windows priority tab
GUICtrlCreateLabel("Select Windows Priority", 10, 25) ;creates label for windows priority config
GUICtrlCreateLabel("Priority 1:", 10, 40) ;creates label for windows priority 1
GUICtrlCreateLabel("Maximize:", 100, 40) ;creates label for maximize window
GUICtrlCreateLabel("Priority 2:", 10, 80) ;creates label for windows priority 2
GUICtrlCreateLabel("Maximize:", 100, 80) ;creates label for maximize window
GUICtrlCreateLabel("Priority 3:", 10, 120) ;creates label for windows priority 3
GUICtrlCreateLabel("Maximize:", 100, 120) ;creates label for maximize window
GUICtrlCreateLabel("Priority 4:", 10, 160) ;creates label for windows priority 4
GUICtrlCreateLabel("Maximize:", 100, 160) ;creates label for maximize window
GUICtrlCreateLabel("Priority 5:", 10, 200) ;creates label for windows priority 5
GUICtrlCreateLabel("Maximize:", 100, 200) ;creates label for maximize window
GUICtrlCreateLabel("Priority 6:", 200, 40) ;creates label for windows priority 6
GUICtrlCreateLabel("Maximize:", 300, 40) ;creates label for maximize window
GUICtrlCreateLabel("Priority 7:", 200, 80) ;creates label for windows priority 7
GUICtrlCreateLabel("Maximize:", 300, 80) ;creates label for maximize window
GUICtrlCreateLabel("Priority 8:", 200, 120) ;creates label for windows priority 8
GUICtrlCreateLabel("Maximize:", 300, 120) ;creates label for maximize window
GUICtrlCreateLabel("Priority 9:", 200, 160) ;creates label for windows priority 9
GUICtrlCreateLabel("Maximize:", 300, 160) ;creates label for maximize window
GUICtrlCreateLabel("Priority 10:", 200, 200) ;creates label for windows priority 10
GUICtrlCreateLabel("Maximize:", 300, 200) ;creates label for maximize window
GUICtrlCreateCombo("", 100, 55) ;Drop down box for maximize selection
GUICtrlSetData(48, "Yes|No", $IniMaximize[1]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 95) ;Drop down box for maximize selection
GUICtrlSetData(49, "Yes|No", $IniMaximize[2]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 135) ;Drop down box for maximize selection
GUICtrlSetData(50, "Yes|No", $IniMaximize[3]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 175) ;Drop down box for maximize selection
GUICtrlSetData(51, "Yes|No", $IniMaximize[4]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 215) ;Drop down box for maximize selection
GUICtrlSetData(52, "Yes|No", $IniMaximize[5]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 55) ;Drop down box for maximize selection
GUICtrlSetData(53, "Yes|No", $IniMaximize[6]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 95) ;Drop down box for maximize selection
GUICtrlSetData(54, "Yes|No", $IniMaximize[7]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 135) ;Drop down box for maximize selection
GUICtrlSetData(55, "Yes|No", $IniMaximize[8]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 175) ;Drop down box for maximize selection
GUICtrlSetData(56, "Yes|No", $IniMaximize[9]) ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 215) ;Drop down box for maximize selection
GUICtrlSetData(57, "Yes|No", $IniMaximize[10]) ;puts data into drop down box for maximize selection
$PRT1 = GUICtrlCreateCombo("", 10, 55) ;Drop down box for priority input
GUICtrlSetData(58, "Spillman Mobile|None|Example1|Example2", $IniPriority[1]) ;puts data into drop down box for priority input/selection
$PRT2 = GUICtrlCreateCombo("", 10, 95) ;Drop down box for priority input
GUICtrlSetData(59, "Spillman Mobile|None|Example1|Example2", $IniPriority[2]) ;puts data into drop down box for priority input/selection
$PRT3 = GUICtrlCreateCombo("", 10, 135) ;Drop down box for priority input
GUICtrlSetData(60, "Spillman Mobile|None|Example1|Example2", $IniPriority[3]) ;puts data into drop down box for priority input/selection
$PRT4 = GUICtrlCreateCombo("", 10, 175) ;Drop down box for priority input
GUICtrlSetData(61, "Spillman Mobile|None|Example1|Example2", $IniPriority[4]) ;puts data into drop down box for priority input/selection
$PRT5 = GUICtrlCreateCombo("", 10, 215) ;Drop down box for priority input
GUICtrlSetData(62, "Spillman Mobile|None|Example1|Example2", $IniPriority[5]) ;puts data into drop down box for priority input/selection
$PRT6 = GUICtrlCreateCombo("", 200, 55) ;Drop down box for priority input
GUICtrlSetData(63, "Spillman Mobile|None|Example1|Example2", $IniPriority[6]) ;puts data into drop down box for priority input/selection
$PRT7 = GUICtrlCreateCombo("", 200, 95) ;Drop down box for priority input
GUICtrlSetData(64, "Spillman Mobile|None|Example1|Example2", $IniPriority[7]) ;puts data into drop down box for priority input/selection
$PRT8 = GUICtrlCreateCombo("", 200, 135) ;Drop down box for priority input
GUICtrlSetData(65, "Spillman Mobile|None|Example1|Example2", $IniPriority[8]) ;puts data into drop down box for priority input/selection
$PRT9 = GUICtrlCreateCombo("", 200, 175) ;Drop down box for priority input
GUICtrlSetData(66, "Spillman Mobile|None|Example1|Example2", $IniPriority[9]) ;puts data into drop down box for priority input/selection
$PRT10 = GUICtrlCreateCombo("", 200, 215) ;Drop down box for priority input
GUICtrlSetData(67, "Spillman Mobile|None|Example1|Example2", $IniPriority[10]) ;puts data into drop down box for priority input/selection
GUISetState(@SW_SHOW) ;Shows the GUI window
;MsgBox(2, "Checker", $PRT1) ;Checks the ControlID
;MsgBox(2, "error detection", $DataSelect) ;error detection(combo 4)

;Makes cancel button and the close button(top right x) close the program
While -1
$msg = GUIGetMsg()
Select
Case $msg = $ButtonCancel Or $msg = $GUI_EVENT_CLOSE
Case "Show the speed"
If "Yes" Or "No" Then
FileWriteLine("Archangel.ini", 10)
EndIf
ExitLoop
EndSelect
WEnd

My GlobalVars.au3

; Path Variables
Global $IniName = "Archangel.ini"
Global $ProgramDir = @ProgramFilesDir & "\Archangel"

;From ini
Global $IniProgramGroup = ""
Global $IniVersion = ""
Global $ShowSpeed = "No"
Global $CommPort = ""
Global $NumericPort
Global $BaudRate = 9600
Global $SpeedLimit = 15
Global $ClearOnTop = "No"
Global $IniFiles, $IniFileName[10]
Global $IniPriorities, $IniPriority[11], $IniMaximize[11]
Global $RunPlates = "No"
Global $BlockOption = 1
Global $BlockMouse = True
Global $AlphaBlock[4]
$AlphaBlock[0] = "None"
$AlphaBlock[1] = "Both"
$AlphaBlock[2] = "Mouse/TouchScreen"
$AlphaBlock[3] = "Keyboard"

; Log Variables
Global $LogHandle = -1
Global $LogError = False
Global $LogDetail = "No"
Global $LogFile = ""
Global $Sequence = "Init"

; Log / Error / Debugs
Global $Debug = False
Global $IsErrorFatal = "No", $ErrorTitle = "", $ErrorMessage = ""

; Miscellaneous
Const $SpeedCursor = "Current speed is "
Global $LenSpeedCursor = StringLen($SpeedCursor)
Global $SFResult[2]
$SFResult[0] = "failed"
$SFResult[1] = "successful"

; Speed Variables
Global $LastSpeed = 0

; Communications to Herbie
Global $Kernel32Handle = -1
Global $SerialPortHandle = -1
Global $DCB_Struct = ""
Global $CommTimeout = ""
Global $CommTimeout_Struct = ""
Global $CommState = ""
Global $CommState_Struct = ""
Global $HerbieError = False
Global $ReceivedFromHerbie = ""
Global $SpeedValidation = "410D"
Global $CurrentSpeed = 0

; SDX Dongle
Global $SDXHandle = -1
Global $tSDXHID = DllStructCreate("DWORD")

My Archlib.au3

Func DecodeIni($FullIniPath, $LogIt)
Local $NotFound = "Not Found", $Result = 0, $Index = 0
$ErrorTitle = "Error Reading Initialization File"
$ErrorMessage = $FullIniPath
$IsErrorFatal = True
$IniProgramGroup = IniRead($FullIniPath, "Version", "ProgramGroup", $NotFound)
If $IniProgramGroup = $NotFound Then
MyError()
EndIf
$IniVersion = IniRead($FullIniPath, "Version", "VersionNumber", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$NumericPort = IniRead($FullIniPath, "Communication", "Port", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$CommPort = "COM" & $NumericPort
If ($NumericPort > 9) Then
$CommPort = "\\.\" & $CommPort
EndIf
$BaudRate = IniRead($FullIniPath, "Communication", "Baudrate", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$SpeedLimit = IniRead($FullIniPath, "ProgramOptions", "SpeedLimit", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$ShowSpeed = IniRead($FullIniPath, "ProgramOptions", "ShowSpeed", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$ClearOnTop = IniRead($FullIniPath, "ProgramOptions", "ClearOnTop", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$RunPlates = IniRead($FullIniPath, "ProgramOptions", "RunPlates", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$Result = IniRead($FullIniPath, "ProgramOptions", "Block", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$BlockMouse = True
Select
Case $Result = "None"
$BlockOption = 0
$BlockMouse = False
Case $Result = "Both"
$BlockOption = 1
Case $Result = "Mouse"
$BlockOption = 2
Case $Result = "Keyboard"
$BlockOption = 3
$BlockMouse = False
Case Else
$BlockOption = 0
EndSelect
$LogDetail = IniRead($FullIniPath, "LogOptions", "LogDetail", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$LogFile = IniRead($FullIniPath, "LogOptions", "LogFile", $NotFound)
If $IniVersion = $NotFound Then
_MyError()
EndIf
$Index = 1
While 1
$IniFileName[$Index] = IniRead($FullIniPath, "Files", "File" & $Index, $NotFound)
If $IniFileName[$Index] = $NotFound Then
ExitLoop
EndIf
$Index += 1
WEnd
$IniFiles = $Index - 1
$Index = 1
While 1
$IniPriority[$Index] = IniRead($FullIniPath, "WindowPriorties", "WindowPriority" & $Index, $NotFound)
If $IniPriority[$Index] = $NotFound Then
ExitLoop
EndIf
$Index += 1
WEnd
$IniPriorities = $Index - 1
$Index = 1
While 1
$IniMaximize[$Index] = IniRead($FullIniPath, "WindowPriorties", "WindowMaximize" & $Index, $NotFound)
If $IniMaximize[$Index] = $NotFound Then
ExitLoop
EndIf
$Index += 1
WEnd
If $LogIt = False Then
Return
EndIf
WriteLog(" Ini Path: " & $FullIniPath)
WriteLog(" Program: " & $IniProgramGroup)
WriteLog(" Version: " & $IniVersion)
WriteLog(" Port: " & $CommPort)
WriteLog(" Baudrate: " & $BaudRate)
WriteLog("SpeedLimit: " & $SpeedLimit)
WriteLog(" ShowSpeed: " & $ShowSpeed)
WriteLog("ClearOnTop: " & $ClearOnTop)
WriteLog(" RunPlates: " & $RunPlates)
WriteLog(" Block: " & $AlphaBlock[$BlockOption])
WriteLog(" LogDetail: " & $LogDetail)
WriteLog(" LogFile: " & $LogFile)
WriteLog("Priorities: " & $IniPriorities)
If $IniPriorities >= 1 Then
For $Index = 1 To $IniPriorities
WriteLog("Priority " & $Index & ": " & $IniPriority[$Index])
WriteLog("Maximize " & $Index & ": " & $IniMaximize[$Index])
Next
EndIf
EndFunc

Func MyCopyProgressOn($Title, $SFileName, $DFileName, $FileSize, $Operation)
Local $DisplayName = ""
$DisplayName = "Source: " & StringLower($SFileName)
ProgressOn($Title, $DisplayName, "0 of " & _StringAddThousandsSepEx($FileSize) & " bytes " & $Operation & " (0%)")
EndFunc

Func MyCopyProgressSet($ProgressBytes, $FileSize, $Operation)
Local $Percent = 0
$Percent = Round((($ProgressBytes / $FileSize) * 100), 0)
If $Percent >= 100 Then
$Percent = 99
$ProgressBytes = $FileSize - 1
EndIf
ProgressSet($Percent, _StringAddThousandsSepEx($ProgressBytes) & " of " & _StringAddThousandsSepEx($FileSize) & " bytes " & $Operation & " (" & $Percent & "%)")
Sleep(1)
EndFunc

Func MyCopyProgressOff()
ProgressSet(100 , "Done")
Sleep(500)
ProgressOff()
EndFunc

Func MyError()
Beep()
MsgBox(0, $ErrorTitle, $ErrorMessage)
If $IsErrorFatal = True Then
Exit
EndIf
EndFunc

Func MyProgressCopy($FullSRC, $FullDST)
Dim $OptEnv = "", $OptVar = "", $size = 0, $count = 0, $timer = 0, $progress = 0, $in = 0, $out = 0
Local $Bin, $Chunk, $ProgTitle
$ErrorTitle = "Error Copying File"
$ErrorMessage = $FullSRC
$IsErrorFatal = True
; Turn off expanded environment or variables, can cause problems for binary read
$OptEnv = Opt("ExpandEnvStrings", 0)
$OptVar = Opt("ExpandVarStrings", 0)
; Get size of file to determine remaining
$Size = FileGetSize($FullSRC)
If $Size = 0 Then
MyError()
EndIf
; Set up initial variables
$Count = 0 ;keep count of bytes copied
$Chunk = 102400 ;amount of data to copy at a time (bytes) (10kB)
$Progtitle = "Copying File ..." ;title of progress bar window
$Timer = TimerInit() ;initialize timer to keep track of update frequency
; Show progress bar
MyCopyProgressOn("Copying File ...", $FullSRC, $FullDST, $size, "copied")
; Open input and output files (exit if error)
$In = FileOpen($FullSRC, 4)
If @error <> 0 Then
MyError()
EndIf
$Out = FileOpen($FullDST, 2)
If @error = -1 Then
FileClose($In)
MyError()
EndIf
; Start reading input
$Bin = FileRead($In, $Chunk)
While @error = 0
; Write chunk of data, keep trying for up to 10 seconds if failed
Do
FileWrite($Out, $Bin)
Until (@error = 0) Or (TimerDiff($timer) > 10000)
If @error <> 0 Then
FileClose($In)
FileClose($Out)
MyError()
EndIf
; Update copy counter
$Count = $Count + $Chunk
; Update progress as specified
MyCopyProgressSet($Count, $Size, "copied")
$timer = TimerInit()
; get chunk of data
$bin = FileRead($In, $Chunk)
WEnd
FileClose($In)
FileClose($Out)
MyCopyProgressOff()
; Reset expanded environment or variables
Opt("ExpandEnvStrings", $OptEnv)
Opt("ExpandVarStrings", $OptVar)
EndFunc

Func WaitWithProgress($Caption, $Seconds)
ProgressOn($Caption & ". Please wait ...", "")
Local $Loops = 0, $Delay = 0, $Percent = 0
$Loops = Round(($Seconds * 2.0),0)
$Delay = Round ((($Seconds / $Loops) * 1000), 0)
For $I = 1 to $Loops
$Percent = (($I / $Loops) * 100)
ProgressSet($Percent)
Sleep($Delay)
Next
ProgressOff()
EndFunc

Func TurnOffOnTop()
Local $Index = 0, $Result = 0, $WindowList, $iExStyles = 0, $Candidate = 0
$WindowList = WinList()
For $Index = 1 to $WindowList[0][0]
$iExStyles = _WinAPI_GetWindowLong($WindowList[$Index][1],$GWL_EXSTYLE)
$Candidate = ($WindowList[$Index][0] <> "") And (IsWindowVisible($WindowList[$Index][1]))
$Candidate = $Candidate And (BitAND($iExStyles,$WS_EX_TOPMOST))
$Candidate = $Candidate And (StringLeft($WindowList[$Index][0], $LenSpeedCursor) <> $SpeedCursor)
If $Candidate = 1 Then
$Result = WinSetOnTop($WindowList[$Index][1], "", 0)
WriteLog($WindowList[$Index][0] & " topmost set was: " & $SFResult[$Result])
EndIf
Next
EndFunc

Func IsWindowVisible($WindowHandle)
If BitAnd( WinGetState($WindowHandle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc

My Archangel.ini file

[Version]

ProgramGroup=Archangel

VersionNumber=1.00

[Communication]

Port=35

Baudrate=9600

[ProgramOptions]

SpeedLimit=25

ShowSpeed=No

ClearOnTop=Yes

RunPlates=No

Block=None

[LogOptions]

LogDetail=No

LogFile=Archangel.log

[Files]

File1=Archangel.exe

File2=sdx.dll

File3=Green.ico

File4=Red.ico

[WindowPriorties]

WindowPriority1=Spillman Mobile -

WindowMaximize1=Yes

Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

Just reverse the process you use to read from the INI file when you're writing to it. When you press save, you can (for example) use IniWrite($FullIniPath, "LogOptions", "LogDetail", $LogDetail). This will write to the LogOptions section, in the key LogDetail the contents of the variable $LogDetail.


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

Share this post


Link to post
Share on other sites
JonBMN

Thank you BrewManNH I shall try that out and post my results.

Share this post


Link to post
Share on other sites
JonBMN

I'm stuck on getting the window to stay open because of the case statements I put in to save to the .ini file. Any suggestions?

Share this post


Link to post
Share on other sites
BrewManNH

I'm not a mind reader, post the script so I can see what you're doing and perhaps I can figure out what is wrong.


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

Share this post


Link to post
Share on other sites
JonBMN

#include <GlobalVars.au3>
#include <ArchLib.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
Global $ButtonSave, $ButtonCancel, $msg, $PRI1, $PRI2, $PRI3, $PRI4, $PRI5, $PRI6, $PRI7, $PRI8, $PRI9, $PRI10, $msg2


DecodeIni("Archangel.Ini", False)   ;Decodes the .Ini File
;ConsoleWrite($IniProgramGroup & @CR)
GUICreate("Archangel Configuration Setup", 500, 400)   ;Creates the GUI window
GUISetBkColor(0x00E0eeeF)   ;Sets Background color
$ButtonSave = GUICtrlCreateButton("Save", 200, 350, 45, 30)   ;Save button
$ButtonCancel = GUICtrlCreateButton("Cancel", 300, 350, 45, 30)    ;Cancel Button
GUICtrlCreateTab(0, 0, 500, 340)   ;Creates the tab
GUICtrlCreateTabItem("Speed")   ;First tab item
GUICtrlCreateLabel("Speed Settings", 10, 25)   ;Creates the label for the configuration drop down menu
GUICtrlCreateLabel("Show the Speed:", 10, 100)  ;Creates the label for the Show the speed config
GUICtrlCreateLabel("Speed limit:", 10, 175)   ;Creates the label for the Speed limit config
GUICtrlCreateCombo("", 275, 100)   ;Creates the drop down box
GUICtrlSetData(10, "Yes|No", $ShowSpeed)    ;Puts the data into the drop down box
GUICtrlCreateCombo("", 275, 175)   ;Creates the drop down box
GUICtrlSetData(11, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30", $SpeedLimit)    ;Puts the data into the drop down box

GUICtrlCreateTabItem("Serial Settings")    ;Tab with serial settings
GUICtrlCreateLabel("Serial Settings", 10, 25)   ;Creates the label for the serial settings
GUICtrlCreateLabel("Communications Port:", 10, 75)    ;Creates the label for the commport setting
GUICtrlCreateLabel("Baudrate:", 10, 150)    ;Creates the label for the Baudrate
GUICtrlCreateCombo("", 275, 75)   ;Creates the drop down box
GUICtrlSetData(16, "1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50", $NumericPort)   ;Puts data into drop down box
GUICtrlCreateCombo("", 275, 150)   ;Creates drop down box
GUICtrlSetData(17, "2400|4800|9600|19200|38400|57600|115200|31250", $BaudRate)  ;Puts data into drop down box

GUICtrlCreateTabItem("Accesories")   ;keyboard, mouse, touchscreen options
GUICtrlCreateLabel("Accesories settings", 10, 25)   ;Creates label for accesories settings
GUICtrlCreateLabel("Block options:", 10, 75) ;Creates the label for the block options
GUICtrlCreateCombo("", 275, 75) ;Creates the dorp down box
GUICtrlSetData(21, "None|Both|Mouse/Touchscreen|Keyboard", $AlphaBlock[$BlockOption]) ;Puts data into drop down box 

GUICtrlCreateTabItem("Run Plates") ;Run plate option tab
GUICtrlCreateLabel("Ability to run plates", 10, 25)  ;creates label for plate running config
GUICtrlCreateLabel("Run Plates", 10, 75) ;creates the label for plate running setting
GUICtrlCreateCombo("", 275, 75) ;creates drop down box
GUICtrlSetData(25, "Yes|No", $RunPlates) ;puts data into drop down box

GUICtrlCreateTabItem("Windows Priority") ;windows priority tab
GUICtrlCreateLabel("Select Windows Priority", 10, 25) ;creates label for windows priority config
GUICtrlCreateLabel("Priority 1:", 10, 40)  ;creates label for windows priority 1
GUICtrlCreateLabel("Maximize:", 100, 40)    ;creates label for maximize window
GUICtrlCreateLabel("Priority 2:", 10, 80)   ;creates label for windows priority 2
GUICtrlCreateLabel("Maximize:", 100, 80)  ;creates label for maximize window
GUICtrlCreateLabel("Priority 3:", 10, 120)   ;creates label for windows priority 3
GUICtrlCreateLabel("Maximize:", 100, 120)   ;creates label for maximize window
GUICtrlCreateLabel("Priority 4:", 10, 160)   ;creates label for windows priority 4
GUICtrlCreateLabel("Maximize:", 100, 160)   ;creates label for maximize window
GUICtrlCreateLabel("Priority 5:", 10, 200)   ;creates label for windows priority 5
GUICtrlCreateLabel("Maximize:", 100, 200)   ;creates label for maximize window
GUICtrlCreateLabel("Priority 6:", 200, 40)   ;creates label for windows priority 6
GUICtrlCreateLabel("Maximize:", 300, 40)   ;creates label for maximize window
GUICtrlCreateLabel("Priority 7:", 200, 80)   ;creates label for windows priority 7
GUICtrlCreateLabel("Maximize:", 300, 80)    ;creates label for maximize window
GUICtrlCreateLabel("Priority 8:", 200, 120)  ;creates label for windows priority 8
GUICtrlCreateLabel("Maximize:", 300, 120)    ;creates label for maximize window
GUICtrlCreateLabel("Priority 9:", 200, 160)  ;creates label for windows priority 9
GUICtrlCreateLabel("Maximize:", 300, 160)   ;creates label for maximize window
GUICtrlCreateLabel("Priority 10:", 200, 200)   ;creates label for windows priority 10
GUICtrlCreateLabel("Maximize:", 300, 200)   ;creates label for maximize window
GUICtrlCreateCombo("", 100, 55)      ;Drop down box for maximize selection
GUICtrlSetData(48, "Yes|No", $IniMaximize[1])  ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 95)   ;Drop down box for maximize selection
GUICtrlSetData(49, "Yes|No", $IniMaximize[2])  ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 135)    ;Drop down box for maximize selection
GUICtrlSetData(50, "Yes|No", $IniMaximize[3])   ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 175)      ;Drop down box for maximize selection
GUICtrlSetData(51, "Yes|No", $IniMaximize[4])    ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 100, 215)    ;Drop down box for maximize selection
GUICtrlSetData(52, "Yes|No", $IniMaximize[5])    ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 55)    ;Drop down box for maximize selection
GUICtrlSetData(53, "Yes|No", $IniMaximize[6])  ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 95)   ;Drop down box for maximize selection
GUICtrlSetData(54, "Yes|No", $IniMaximize[7])     ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 135)   ;Drop down box for maximize selection
GUICtrlSetData(55, "Yes|No", $IniMaximize[8])   ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 175)   ;Drop down box for maximize selection
GUICtrlSetData(56, "Yes|No", $IniMaximize[9])   ;puts data into drop down box for maximize selection
GUICtrlCreateCombo("", 300, 215)    ;Drop down box for maximize selection
GUICtrlSetData(57, "Yes|No", $IniMaximize[10])   ;puts data into drop down box for maximize selection
$PRT1 = GUICtrlCreateCombo("", 10, 55)    ;Drop down box for priority input
GUICtrlSetData(58, "Spillman Mobile|None|Example1|Example2", $IniPriority[1])  ;puts data into drop down box for priority input/selection
$PRT2 = GUICtrlCreateCombo("", 10, 95)    ;Drop down box for priority input
GUICtrlSetData(59, "Spillman Mobile|None|Example1|Example2", $IniPriority[2])  ;puts data into drop down box for priority input/selection
$PRT3 = GUICtrlCreateCombo("", 10, 135)    ;Drop down box for priority input
GUICtrlSetData(60, "Spillman Mobile|None|Example1|Example2", $IniPriority[3])  ;puts data into drop down box for priority input/selection
$PRT4 = GUICtrlCreateCombo("", 10, 175)    ;Drop down box for priority input
GUICtrlSetData(61, "Spillman Mobile|None|Example1|Example2", $IniPriority[4])  ;puts data into drop down box for priority input/selection
$PRT5 = GUICtrlCreateCombo("", 10, 215)    ;Drop down box for priority input
GUICtrlSetData(62, "Spillman Mobile|None|Example1|Example2", $IniPriority[5])  ;puts data into drop down box for priority input/selection
$PRT6 = GUICtrlCreateCombo("", 200, 55)    ;Drop down box for priority input
GUICtrlSetData(63, "Spillman Mobile|None|Example1|Example2", $IniPriority[6])  ;puts data into drop down box for priority input/selection
$PRT7 = GUICtrlCreateCombo("", 200, 95)    ;Drop down box for priority input
GUICtrlSetData(64, "Spillman Mobile|None|Example1|Example2", $IniPriority[7])  ;puts data into drop down box for priority input/selection
$PRT8 = GUICtrlCreateCombo("", 200, 135)    ;Drop down box for priority input
GUICtrlSetData(65, "Spillman Mobile|None|Example1|Example2", $IniPriority[8])  ;puts data into drop down box for priority input/selection
$PRT9 = GUICtrlCreateCombo("", 200, 175)    ;Drop down box for priority input
GUICtrlSetData(66, "Spillman Mobile|None|Example1|Example2", $IniPriority[9])  ;puts data into drop down box for priority input/selection
$PRT10 = GUICtrlCreateCombo("", 200, 215)    ;Drop down box for priority input
GUICtrlSetData(67, "Spillman Mobile|None|Example1|Example2", $IniPriority[10])  ;puts data into drop down box for priority input/selection
GUISetState(@SW_SHOW)    ;Shows the GUI window
;MsgBox(2, "Checker", $PRT1)   ;Checks the ControlID
;MsgBox(2, "error detection", $DataSelect)   ;error detection(combo 4)

;Makes cancel button and the close button(top right x) close the program
While -1
   $msg = GUIGetMsg()
   Select
   Case $msg = $ButtonCancel Or $msg = $GUI_EVENT_CLOSE
   Case $ButtonSave 
 IniWrite("Archangel.ini", "Show the speed", $ShowSpeed, 10)

   ExitLoop
   EndSelect
WEnd

Share this post


Link to post
Share on other sites
JonBMN

This is the first time I've done this and am still learning; so don't be to harsh :)

Share this post


Link to post
Share on other sites
BrewManNH

It exits because you put an ExitLoop in there after the first IniWrite statement, after it leaves the While loop, there's nothing left for it to do so it closes.


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

Share this post


Link to post
Share on other sites
JonBMN

Fixed:

While -1
$msg = GUIGetMsg()
Select
Case $msg = $ButtonCancel Or $msg = $GUI_EVENT_CLOSE
Quit()
Case $ButtonSave
$result = IniWrite("Archangel.ini", "ProgramOptions", "ShowSpeed", $ShowSpeed)
ConsoleWrite($result & $ShowSpeed & @CR)
EndSelect
WEnd

Func Quit()
Exit
EndFunc

It still does not save yes to the $ShowSpeed variable

Edited by JonBMN

Share this post


Link to post
Share on other sites
BrewManNH

Is $ShowSpeed a variable that holds a control ID for a control of some sort? If so, use GUICtrlRead($ShowSpeed) instead.


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

Share this post


Link to post
Share on other sites
JonBMN

Thank you BrewMan

EDIT: $ShowSpeed was the variable that holds the default selection from the .ini

Edited by JonBMN

Share this post


Link to post
Share on other sites
JonBMN

Using the GUICtrlRead function instead of putting in the $ShowSpeed variable, which did not particularly work, I put in the handle for the drop down box selection GUICtrlRead(10); which succesfully worked.

Edited by JonBMN

Share this post


Link to post
Share on other sites
JonBMN

Also tried the same for the SpeedLimit selection with GUICtrlRead(11); it worked successfully as well.

Share this post


Link to post
Share on other sites
BrewManNH

Never EVER use hard coded numbers in place of controlIDs or handles. Assign the control IDs and handles to a variable when you create the controls in your script, and always use the variable in the rest of the script. All it takes is for you to add or remove a control and the whole script starts acting weird, with no indication of why it's acting the way it is.


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

Share this post


Link to post
Share on other sites
JonBMN

Can you show me an example of the single variable holding all the controlIDs? I don't know if you meant variables or really did mean variable

Share this post


Link to post
Share on other sites
BrewManNH

Obviously I didn't mean assign them all to the same variable, that would be silly. You create either a separate variable for each control you're going to need to interact with later, or create one array that holds all the control IDs.


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

Share this post


Link to post
Share on other sites
JonBMN

Okay thank you for the clarification.

Share this post


Link to post
Share on other sites
JonBMN

I'm having trouble getting the $Index to hold the 1-10 numbers so that I don't have to write all the windows priorities out and instead use a loop to plugin 1, 2, 3, etc.. If more of my code needs to be posted let me know, but thanks for the help everyone.

Figured it out; heres the code for it.

;creates the while loop for the cancel button and the save button/saves configuration settings as well
While -1
   $msg = GUIGetMsg()
   Select
   Case $msg = $ButtonCancel Or $msg = $GUI_EVENT_CLOSE
 Quit()
   Case $ButtonSave 
 IniWrite("Archangel.ini", "ProgramOptions", "ShowSpeed", GUICtrlRead($Speed1))
 IniWrite("Archangel.ini", "ProgramOptions", "SpeedLimit", GUICtrlRead($Speed2))
 IniWrite("Archangel.ini", "Communication", "Port", GUICtrlRead($Commun1))
 IniWrite("Archangel.ini", "Communication", "Baudrate", GUICtrlRead($Commun2))
 IniWrite("Archangel.ini", "ProgramOptions", "Block", GUICtrlRead($Block1))
 IniWrite("Archangel.ini", "ProgramOptions", "RunPlates", GUICtrlRead($RunP1))
      ;creates a for loop to plugin 1-10 using index for the windows priorities and maximize boxes
 For $Index = 1 to 10
        IniWrite("Archangel.ini", "WindowPriorties", "WindowPriority" & $Index, GUICtrlRead($PRI[$Index]))
   IniWrite("Archangel.ini", "WindowPriorties", "WindowMaximize"  & $Index, GUICtrlRead($MAX[$Index]))
      Next
;ConsoleWrite($result & $ShowSpeed & @CR)    ;error detector
   EndSelect
WEnd
Edited by JonBMN

Share this post


Link to post
Share on other sites
JonBMN

I have another question. Lets say that one of my windows priorities is "Example1" and I want to enter Example2 into the program; instead of the code; how if I'm using GUICtrlCreateCombo and GUISetData would I be able to do this?

EDIT: There is no way to do what I wanted to do with GUICtrlCreateCombo; I had to change all of them to GUICtrlCreateInput like so:

$PRI[1] = GUICtrlCreateInput("", 10, 55, 100) ;creates input control
GUICtrlSetData($PRI[1], $IniPriority[1], $IniPriority[1]) ;puts data into input control for priority input
Edited by JonBMN

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • nooneclose
      By nooneclose
      Good morning everyone, I thought I had already solved this issue but it turns out I did not. 
      My code finds unread emails with this specific subject line of "request" but when I change the subject to SKIPPED + "request" = ("SKIPPED request") the program still finds the email and tries to process it. I only want to process emails with the exact match subject of "request".
      Here is my code that "finds" the unread emails with the subject of "request" or so I thought. 
      Func ListUnreadEmails() ;******************************************************************************* ; Lists all unread E-mails from the folder Outlook-UDF-Test ;******************************************************************************* ; Stores all the unRead emails into an array Global $aItems = _OL_ItemFind($oOutlook, "*\Outlook-UDF-Test", $olMail, _ "[UnRead]=True", "Subject", "request", "EntryID,Subject", "", 1) ; Displays the array of unRead emails If IsArray($aItems) Then ;_ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", _ "Could not find an unread mail. @error = " & @error & ", @extended: " & @extended) EndIf ; Gets the number of unread emails Global $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ;MsgBox("", "Number of Unread emails", $numberOfUnRead) EndFunc It acts as if any part of the subject containing the word "request" and the email is unread that it will try to process it. (I think)
    • KhalidAnsari
      By KhalidAnsari
      Hi,
      I need to automate Java application using AutoIt, I have refer forum for the same, as per forum I am using Java Access Bridge to finding control name. But could not set value to control. Below is my sample code 
      Send("#r")
      sleep(1500)
      Send("D:\javaapplication\javaapplication\Hello.jar{Enter}")
      WinActivate("Penjumlahan")
      sleep(1500)
      ControlSetText("Penjumlahan", "", "Name:  A :", "demo")
      Java Application and Java Ferret screen

    • QaisBsharat
      By QaisBsharat
      Hello, 
      May i know how can i automation qt application?
      Using controlclick not mouse and positions
       
      Thanks
    • nooneclose
      By nooneclose
      Good afternoon, I am in need of some help. I am sure this is a stupid question requiring only one or two lines of code. However, I would greatly appreciate the help I cannot figure this out. I also tried searching for the answer on the internet but no one except me apparently seems to be having a hard time figuring this out and or is asking about it. 
      I simply want to change the "status" of an email from unread to read once I have processed it. My code is over 500 lines and I would like not to clutter this post with it. Assume I have all my includes and connections properly defined and stuff. 
      Here is the bit of code where I am trying to change the email that was used from unread to read:
      Func ChangeEmailStatus() ;******************************************************************************* ; changes the status of an email from unread to Read ;******************************************************************************* Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (Before Change)", $iRows) _OL_ItemModify($oOutlook,$aItems[$i][0], Default, "Read=True") MsgBox("", "Array Display 1", $aItems[1][0]) MsgBox("", "Array Display 2", $aItems[2][0]) Local $iRows = UBound($aItems, $UBOUND_ROWS) MsgBox("", "Number of Unread emails (After Change)", $iRows) EndFunc  
    • SharpDressedMan
      By SharpDressedMan
      Hello,
      Is there any way to check for validity of a pointer to a DllStruct ?
      In the above code, a DllStruct is created from an invalid pointer. How to prevent from doing this ?
      local $tStruct = DllStructCreate("int i") DllStructSetData($tStruct, "i", 123) local $pStruct = DllStructGetPtr($tStruct) $tStruct = 0 ; destroy DllStruct ==> $pStruct becomes invalid ; how to check here for validity of $pStruct and prevent from doing the following ? $tStruct = DllStructCreate("int i", $pStruct) ; create DllStruct from invalid pointer... MsgBox(0, @ScriptName, @error) ; displays '0' : invalid pointer is not detected by DllStructCreate() MsgBox(0, @ScriptName, IsDllStruct($tStruct)) ; displays '1' : tStruct is assumed as a valid DllStruct object, which is not Thanks for help
×