Код:
#include <GUIConstantsEx.au3>
$StatSetting_ini = @ScriptDir & '\' & "StatSetting.ini"
Global $rD1 = 0, $rD2 = 0, $rD3 = 0, $rD4 = 0, $rD5 = 0, $rD1 = 0, $rD6 = 0
$rD1 = IniRead($StatSetting_ini, "Длинна строки", "Баланс", 0)
$rD2 = IniRead($StatSetting_ini, "Длинна строки", "Израсходовано", 0)
$rD3 = IniRead($StatSetting_ini, "Длинна строки", "Предоплаченны", 0)
$rD4 = IniRead($StatSetting_ini, "Длинна строки", "Осталось", 0)
$rD5 = IniRead($StatSetting_ini, "Длинна строки", "Время", 0)
$rD6 = IniRead($StatSetting_ini, "Длинна строки", "Разделитель", 0)
$sTitle = _
"# Баланс : 90.79руб. ## Израсх : 60.93 (Мб) ## Предопл : 200 (Мб) ##" & _
"Ост : 139.07 (Мб) ## Обновл : 23:54:15 (23:54:15) ##"
;$sTitle = $rD1 & $rD2 & $rD3 & $rD4 & $rD5 & $rD6
$hForm = GUICreate($sTitle, -1, 10, 0, 0)
$iGUI_Width = _GUIGetTitleWidthEx($hForm, $sTitle)
WinMove($hForm, "", 0, 0, $iGUI_Width[0])
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _GUIGetTitleWidthEx($hWnd, $s_Data)
Local Const $WM_GETFONT = 0x31
Local $hDC = DLLCall("user32.dll", "int", "GetDC", "hwnd", $hWnd)
Local $hFont = DllCall("user32.dll", "ptr", "SendMessage", "hwnd", $hWnd, "int", $WM_GETFONT, "int", 0, "int", 0)
Local $hOld = DllCall("gdi32.dll", "Hwnd", "SelectObject", "int", $hDC[0], "ptr", $hFont[0])
Local $iStruct_size = DllStructCreate("int;int")
DllCall("gdi32.dll", "int", "GetTextExtentPoint32", _
"int", $hDC[0], "str", $s_Data, "long", _StringGetProperLen($s_Data), "ptr", DllStructGetPtr($iStruct_size))
$hOld = DllCall("gdi32.dll", "Hwnd", "SelectObject", "int", $hDC[0], "ptr", $hOld)
Local $a_RetLen[2] = [DllStructGetData($iStruct_size, 1), DllStructGetData($iStruct_size, 2)]
DLLCall("user32.dll","int", "ReleaseDC", "hwnd", $hWnd, "int", $hDC[0])
$iStruct_size = 0
Return $a_RetLen
EndFunc
Func _StringGetProperLen($sString)
;Here we increese the UPPER letters by 0.5 (length of one 'A' will be equel 1.5, not 1).
StringRegExpReplace($sString, "[A-ZА-Я]", "")
Local $iExtended = @extended ;The number of UPPER case letters
Local $iLength = Ceiling((StringLen($sString) - $iExtended) + ($iExtended + ($iExtended * 0.5)))
Switch $iLength
Case 1 To 10
$iLength += 30
Case 11 To 20
$iLength += 25
Case 21 To 40
$iLength += 20
Case 41 To 90
$iLength += 15
EndSwitch
Return $iLength
EndFunc