;Autor: Inf0Byt3 EnableExplicit Define EventID Procedure.l SetToolbarItemText(Toolbar.l, TolbarItem.l, Text.s) Protected i.l, hdc.l, hToolbar.l, ButtonInfo.TBBUTTONINFO, Size.SIZE , hFont.l, hFontOld.l Static *FakeButtonStrings If *FakeButtonStrings = #Null *FakeButtonStrings = AllocateMemory(256) ; should be enough [127 icons] If *FakeButtonStrings For i = 0 To 254 Step 2 PokeB(*FakeButtonStrings + i, 32) Next EndIf EndIf hToolbar = ToolBarID(Toolbar) If hToolbar ButtonInfo\cbSize = SizeOf(TBBUTTONINFO) ButtonInfo\dwMask = #TBIF_TEXT | #TBIF_COMMAND |#TBIF_SIZE ButtonInfo\pszText = @Text ButtonInfo\idCommand = TolbarItem hdc = GetDC_(hToolbar) If hdc hFont = SendMessage_(hToolbar, #WM_GETFONT, 0, 0) hFontOld = SelectObject_(hdc, hFont) GetTextExtentPoint32_(hdc, Text, Len(Text), @Size) ButtonInfo\cx = Size\cx + 10 SelectObject_(hdc, hFontOld) ReleaseDC_(hToolbar, hdc) EndIf If *FakeButtonStrings SendMessage_(hToolbar, #TB_ADDSTRING, 0, *FakeButtonStrings) EndIf SendMessage_(hToolbar, #TB_SETBUTTONINFO, TolbarItem, @ButtonInfo) SendMessage_(hToolbar, #TB_AUTOSIZE, 0, 0) EndIf EndProcedure If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) If CreateToolBar(1,WindowID(0)) ToolBarStandardButton(0, #PB_ToolBarIcon_New) ToolBarStandardButton(1, #PB_ToolBarIcon_Open) ToolBarStandardButton(2, #PB_ToolBarIcon_Save) SetToolbarItemText(1, 0, "t1hk") SetToolbarItemText(1, 1, "t2hjkhk") SetToolbarItemText(1, 2, "thjkhk3") EndIf Repeat EventID=WaitWindowEvent() If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf