OemLogo Creater: โปรแกรมสร้างโลโก้และรายละเอียดลงใน System Properties
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Global $sINI = Concat(@SystemDir, "\oeminfo.ini")
Global $Image = Concat(@SystemDir, "\oemlogo.bmp")
Global $Section1 = "General", $Section2 = "Support Information"
Global $sFile = ConCat(@SystemDir, "\readme.txt")
Global $OemLogo = ConCat(@SystemDir, "\oemlogo.bmp")
Global $fLine, $i, $fLine, $nMsg, $sData2 = ""
Global $sFile = @SystemDir & "\oeminfo.txt"
Global $bmpPicture = ConCat(@SystemDir, "\oemlogo.bmp")
Global $hGui = GUICreate("OEMLogo Creater", 400, 417, -1, -1)
GUICtrlCreateLabel("Manufacturer :", 16, 16, 73, 17)
Global $Input1 = GUICtrlCreateInput("", 90, 13, 289, 21)
GUICtrlCreateLabel("Model :", 39, 41, 39, 17)
Global $Input2 = GUICtrlCreateInput("", 90, 38, 289, 21)
GUICtrlCreateLabel("Support info :", 16, 61, 67, 17)
Global $hEdit = GUICtrlCreateEdit("", 88, 64, 258, 145)
Global $Btn_txt = GUICtrlCreateButton("...", 352, 72, 23, 21)
GUICtrlCreateLabel("Open logo :", 19, 222, 59, 17)
Global $Inp_picture = GUICtrlCreateInput("", 88, 219, 257, 21)
Global $Btn_Logo = GUICtrlCreateButton("...", 355, 218, 23, 21)
GUICtrlCreateGraphic(88, 245, 182, 112, BitOR($SS_ETCHEDFRAME,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlCreateLabel("Logo preview :", 12, 248, 74, 17)
GUICtrlCreateLabel("Image(180 x114)", 140, 300, 100, 17)
Global $Btn_Save = GUICtrlCreateButton("Save", 16, 376, 75, 25)
GUICtrlSetCursor (-1, 0)
Global $Btn_del = GUICtrlCreateButton("Delete", 112, 376, 75, 25)
GUICtrlSetCursor (-1, 0)
Global $Btn_view = GUICtrlCreateButton("Test", 208, 376, 75, 25)
GUICtrlSetCursor (-1, 0)
Global $Btn_close = GUICtrlCreateButton("Exit", 304, 376, 75, 25)
GUICtrlSetCursor (-1, 0)
Global $hPic = GUICtrlCreatePic("", 128, 256, 100, 100)
GUISetState(@SW_SHOW)
_ReadOemInfo()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Btn_close
GUIDelete()
ExitLoop
Case $Btn_Logo
Dim $ImagePath
$ImagePath = FileOpenDialog("Choose Picture", Concat(@DesktopDir,"\"), "Images File (*.bmp)", 1 + 4, "", $hGui)
If $ImagePath Then
GUICtrlSetData($Inp_picture, $ImagePath)
GUICtrlSetImage($hPic, $ImagePath)
EndIf
Case $Btn_txt
Dim $text, $files, $read
$text = FileOpenDialog("Choose Text", Concat(@DesktopDir,"\"), "Text File (*.txt)", 1 + 4, "", $hGui)
If $text Then
$files = FileOpen($text, 0)
$read = FileRead($files)
GUICtrlSetData($hEdit, $read)
FileClose($files)
EndIf
Case $Btn_Save
If FileExists($sINI) Then FileDelete($sINI)
_WriteOemInfo()
Case $Btn_del
_DelOemInfo()
Case $Btn_view
ShellExecute("sysdm.cpl")
EndSwitch
WEnd
Global $data1, $data2
Func ConCat($data1="", $data2="")
Return ($data1&$data2)
EndFunc
Func _ReadOemInfo()
Local $array[31]
Local $Section = "Support Information"
Local $aData = ""
GUICtrlSetData($Input1, IniRead($sINI, "General", "Manufacturer", ""))
GUICtrlSetData($Input2, IniRead($sINI, "General", "Model", ""))
$array[0] = IniRead($sINI, $Section, "Line1", "")
$array[1] = IniRead($sINI, $Section, "Line2", "")
$array[2] = IniRead($sINI, $Section, "Line3", "")
$array[3] = IniRead($sINI, $Section, "Line4", "")
$array[5] = IniRead($sINI, $Section, "Line5", "")
$array[4] = IniRead($sINI, $Section, "Line6", "")
$array[5] = IniRead($sINI, $Section, "Line7", "")
$array[6] = IniRead($sINI, $Section, "Line8", "")
$array[7] = IniRead($sINI, $Section, "Line9", "")
$array[8] = IniRead($sINI, $Section, "Line10", "")
$array[9] = IniRead($sINI, $Section, "Line11", "")
$array[10] = IniRead($sINI, $Section, "Line12", "")
$array[11] = IniRead($sINI, $Section, "Line13", "")
$array[12] = IniRead($sINI, $Section, "Line14", "")
$array[13] = IniRead($sINI, $Section, "Line15", "")
$array[14] = IniRead($sINI, $Section, "Line16", "")
$array[15] = IniRead($sINI, $Section, "Line17", "")
$array[16] = IniRead($sINI, $Section, "Line18", "")
$array[17] = IniRead($sINI, $Section, "Line19", "")
$array[18] = IniRead($sINI, $Section, "Line20", "")
$array[19] = IniRead($sINI, $Section, "Line21", "")
$array[20] = IniRead($sINI, $Section, "Line22", "")
$array[21] = IniRead($sINI, $Section, "Line23", "")
$array[22] = IniRead($sINI, $Section, "Line24", "")
$array[23] = IniRead($sINI, $Section, "Line25", "")
$array[24] = IniRead($sINI, $Section, "Line26", "")
$array[25] = IniRead($sINI, $Section, "Line27", "")
$array[26] = IniRead($sINI, $Section, "Line28", "")
$array[27] = IniRead($sINI, $Section, "Line29", "")
$array[28] = IniRead($sINI, $Section, "Line30", "")
$array[29] = IniRead($sINI, $Section, "Line31", "")
For $i = 0 To UBound($array)-1
$aData &= $array[$i] & @CRLF
Next
GUICtrlSetData($hEdit, $aData)
GUICtrlSetImage($hPic, $Image)
EndFunc
Func _WriteOemInfo()
IniWrite($sINI, $Section1, "Manufacturer", GUICtrlRead($Input1))
IniWrite($sINI, $Section1, "Model", GUICtrlRead($Input2))
FileWrite($sFile, ControlGetText($hGui, "", $hEdit))
If Not @error Then
For $i = 1 to 30
$fLine =FileReadLine($sFile, $i)
$sData2 &= "LINE" & $i & "=" & $fLine & @CRLF
Next
FileClose($fLine)
FileDelete($sFile)
IniWriteSection($sINI, $Section2, $sData2)
If GUICtrlRead($Inp_picture)<> "" Then FileCopy($ImagePath, $bmpPicture, 1)
EndIf
EndFunc
Func _DelOemInfo()
FileDelete($sINI)
GUICtrlSetData($Input1, "")
GUICtrlSetData($Input2, "")
GUICtrlSetData($hEdit, "")
GUICtrlSetData($Inp_picture, "")
FileDelete($bmpPicture)
GUICtrlSetImage($hPic, "")
EndFunc