Code:
AStatusBar = {} AStatusBar.InitCommonControls = function() local lpBuff = MemoryEx.Allocate(MemoryEx.StructSize(INITCOMMONCONTROLSEX) + 100); if(lpBuff)then hStruct = MemoryEx.AssignStruct(lpBuff + 50,INITCOMMONCONTROLSEX); if(hStruct)then local ICC_BAR_CLASSES = 0x00000004; hStruct.dwSize = hStruct:Size(); hStruct.dwICC = ICC_BAR_CLASSES; else MemoryEx.Free(lpBuff); return false, "Can't open structure" end else return false, "Can't create buffer" end if (Comctl32Library.InitCommonControlsEx(hStruct:GetPointer())) == 0 then MemoryEx.Free(lpBuff); hStruct:Close(); return false, "Can't get common controls" else MemoryEx.Free(lpBuff); hStruct:Close(); AToolBar.CommomCTRLS = 1; return true, "OK" end end; AStatusBar.Create = function() if AToolBar.CommomCTRLS ~= 1 then x, y = AStatusBar.InitCommonControls() if not x then return false, y end end local WS_CHILD = 0x40000000; local STATUSCLASSNAMEA = "msctls_statusbar32"; local WS_VISIBLE = 0x10000000; local SBARS_TOOLTIPS = 0x0800; local SBARS_SIZEGRIP = 0x100; local S = WS_CHILD + WS_VISIBLE + SBARS_TOOLTIPS + SBARS_SIZEGRIP local hWnd = Application.GetWndHandle() local X = User32Library.CreateWindowExA(0,STATUSCLASSNAMEA,"",S,0,0,0,0,hWnd,0,0,0) if X and (type(X) ~= "number") then return false, "Can't create tool bar" end AStatusBar.Handle = X return true, "OK" end; AStatusBar.SetText = function(Txt) if not AStatusBar.Handle then return false, "Not loaded" end local SB_SETTEXT = 0x40B; local Txt = Txt or "" local n = String.Length(Txt) + 1 local t = MemoryEx.Allocate(n) MemoryEx.String(t, -1, MEMEX_UNICODE, Txt) local y = Bitwise.Or(Bitwise.ASL(0,16),0); local x = Bitwise.Or(Bitwise.ASL(0,16),y); if tonumber(User32Library.SendMessageA(AStatusBar.Handle,SB_SETTEXT,x,t)) == 0 then MemoryEx.Free(t); return false, "Can't set text" else MemoryEx.Free(t); return true, "OK" end end;
Code:
Buff = MemoryEx.Allocate(10) Dialog.Message("",tostring(Buff))
Code:
MemoryEx.String(t, -1, MEMEX_UNICODE, Txt)
Code:
MemoryEx.String(t, -1, MEMEX_ASCII, Txt)
Comment