Hi everyone.
I'm a total newbie to this autoit scripting, so is to this programming sort of thing.
I have a problem with this code i've been writing for a few days.
I'm building a GUI for my PE cd. this gui will become a loader for all of the tools that I included in my pe to replace PExplorer.exe. Unfortunately I have this problem I can't overcome with.
So basically what I'm trying to do is:
1, pe loads, then this cpe09load.exe will be the shell replacement. I has 2 windows, one is to show all the tools in this cd, i named it "frmCPE09";
another is "frmWindows", which has a listbox, and a button. Initially, both are hidden.
2, at start-up, function "_checkWindowsFolder()" check all the hard drives, to see if there are folder name "windows"
3, If a drive contain a folder named "windows", save it to a array, and then continue until all the hard drive are checked.
4, then it will write things in that array to the listbox, then show "frmWindows" windows, therefore user can choose one and then write it to another var for later.(like _checkREG()). and then make "frmCPE09" visible.
when I type all the codes and then test it in a real windows, this works, everything acts as expected. But when I put it in the pe, the "frmWindows" doesn't show, it will directly goes to "frmCPE09". whither there is a drive with "windows" folder or not.
oh and I made my pe based on AIK 3.0(windows7)
thanks in advanced.
#AutoIt3Wrapper_icon=..\cpe09icon.ico
#AutoIt3Wrapper_outfile=Build\cpe09load.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;#include <7zip.au3>
;#include <FindCD.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=d:\cpe09.kxf
$frmCPE09 = GUICreate("CPE v. 0.9", 485, 571)
GUISetOnEvent($GUI_EVENT_CLOSE, "frmCPE09Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "frmCPE09Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "frmCPE09Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "frmCPE09Restore")
;;;; lots of button controls to launch apps.
$frmWindows = GUICreate("Select Windows Location", 372, 205, 192, 114)
$lstWindows = GUICtrlCreateList("", 16, 8, 329, 97)
GUISetOnEvent($GUI_EVENT_CLOSE, "frmWindowsClose")
$btnWindowsSel = GUICtrlCreateButton("OK", 136, 136, 75, 25)
GUICtrlSetOnEvent(-1, "btnWindowsSelClick")
Global $WinFolder =""
Global $regFileLoc[6]
$checkRegOK = _checkREG()
$winFind =_checkWindowsFolder()
While 1
Sleep(100)
WEnd
Func _checkWindowsFolder()
Local $winDrive[4]
;Local $frmWindows
$findHDD = DriveGetDrive( "fixed" )
if $findHDD[0] > 1 Then
for $i = 1 to $findHDD[0]
if FileExists($findHDD[$i] & "\windows") Then
$winDrive[$i] = $findHDD[$i] & "\Windows\"
$winDrive[0] = $i
for $i2 = 1 to $winDrive[0]
GUICtrlSetData($lstWindows, $winDrive[$i2])
Next
EndIf
Next
GUISetState(@SW_SHOW,$frmWindows)
Else
GUISetState(@SW_HIDE,$frmWindows)
GUISetState(@SW_SHOW,$frmCPE09)
EndIf
EndFunc
Func btnWindowsSelClick()
$winPath = GUICtrlRead($lstWindows)
If $winPath = "" Then
MsgBox(1,"Error","Please select a Windows Folder.")
Sleep(1000)
Else
$winFolder = $winPath
GUISetState(@SW_HIDE,$frmWindows)
GUISetState(@SW_show,$frmCPE09)
EndIf
EndFunc
Func _checkREG()
Local $regFileNames = StringSplit("system,software,SECURITY,sam",",")
Local $regFileFolder = $WinFolder & "\system32\config\"
for $i = 1 to $regFileNames[0]
$regFileLoc[$i] = $regFileFolder & $regFileNames[$i]
if FileExists($regFileLoc[$i]) Then
$checkRegOK = 1
$regFileLoc[0] = $i
Else
$checkRegOK = 0
ExitLoop
EndIf
Next
EndFunc
Func frmCPE09Maximize()
EndFunc
Func frmCPE09Minimize()
EndFunc
Func frmCPE09Restore()
EndFunc
Func frmWindowsClose()
GUISetState($frmWindows,@SW_HIDE)
EndFunc
; other functions.