Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


how to change progressbar green color to another color

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
kucingkembar
How do I cheat?
Reputation: 0

Joined: 08 Oct 2020
Posts: 8

PostPosted: Sun Oct 18, 2020 2:56 am    Post subject: how to change progressbar green color to another color Reply with quote

I like to change the default green color of progressbar,
I tried this code:
Code:
UDF1.CEProgressbar1.color = 255

the properties in the "Object Inspector" changed to "clRED",
but there no change in the trainer,
what do I wrong?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 384

Joined: 09 May 2003
Posts: 22972
Location: The netherlands

PostPosted: Sun Oct 18, 2020 3:24 am    Post subject: Reply with quote

You can't. The progressbar is dependant on the windows theme you are currently using.

If you want a custom one you'll have to draw it yourself

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
kucingkembar
How do I cheat?
Reputation: 0

Joined: 08 Oct 2020
Posts: 8

PostPosted: Sun Oct 18, 2020 3:35 am    Post subject: Reply with quote

so, what that color I change previously do?
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 38

Joined: 10 Apr 2015
Posts: 1530

PostPosted: Sun Oct 18, 2020 8:32 am    Post subject: Reply with quote

As DB said, progress bar color depending by windows theme (Window version 6 and above, meant as Windows 7 and above). You need change your windows visual style and theme to get other progress bar color, default is green.

But, if you must, in windows 7 and above by default progress bar have 3 color refer indicated a progress, are green = normal, yellow = warning and red = critical.

So, you can use these 3 color for your progress bar using 'sendMessage' function.

Here is an example I wrote in CE Lua.
Code:

if f then f.destroy() end

f = createForm()
f.setSize(300,110)
f.Position = 'poScreenCenter'
f.BorderStyle = 'bsSingle'
f.Caption = 'Test Progressbar Color'
f.Name = 'form1'

pb = createProgressBar(f)
pb.setSize(280, 40)
pb.Left = 10
pb.Top = 10
pb.Position = 0
pb.Name = 'progressbar1'

tb = createTrackBar(f)
tb.setSize(280, 40)
tb.Left = 10
tb.Top = 60
tb.Min = 0
tb.Max = 100
tb.Step = 1
tb.Value = 0
tb.Name = 'trackbar1'

--------------------------------------------------------------------------------
PBST_NORMAL = 1  -- green
PBST_ERROR = 2   -- red
PBST_PAUSED = 3  -- yellow

tb.OnChange = function()
 local hwnd = pb.handle
 SendMessage(hwnd, PBM_SETSTATE, 2, 0)  -- red
 pb.Position = tb.Position
end

Note_to_check_windows_version = [[
local fck = io.popen("ver") -- runs command
local v = fck:read("*a") -- read output of command
print(v)
fck:close()
]]



Capture.JPG
 Description:
CE Progress bar in red color
 Filesize:  71.69 KB
 Viewed:  128 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
kucingkembar
How do I cheat?
Reputation: 0

Joined: 08 Oct 2020
Posts: 8

PostPosted: Mon Oct 19, 2020 5:03 am    Post subject: Reply with quote

Corroder, I very sorry for the late reply,

I tried your code (without any edit), then execute the script,
but the result is still green,
then I google about "SendMessage" and the result is this page
Code:

viewtopic.php?t=592635


and i edit some your code to this:

Code:

 --SendMessage(hwnd, PBM_SETSTATE, 2, 0)  -- red
 sendMessage(hwnd, 0x410, 2, 0)


and now it works, thank you very very very much
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 38

Joined: 10 Apr 2015
Posts: 1530

PostPosted: Mon Oct 19, 2020 5:56 am    Post subject: Reply with quote

Sorry I have post the script with not complete copied. Here is the complete script:

Code:
WM_USER = 1024

PBM_SETPOS = WM_USER + 2
PBM_DELTAPOS = WM_USER + 3
PBM_SETSTEP = WM_USER + 4
PBM_STEPIT = WM_USER + 5
PBM_SETRANGE32 = WM_USER + 6
PBM_SETMARQUEE = WM_USER + 10
PBM_SETSTATE = WM_USER + 16
PBM_SETBARCOLOR = WM_USER + 9
PBM_SETBKCOLOR = WM_USER + 7169

PBST_NORMAL = 1  -- green
PBST_ERROR = 2   -- red
PBST_PAUSED = 3  -- yellow

function SetWindowTheme(hWnd, pszSubAppName, pszSubIdList)
 return executeCodeLocalEx('uxtheme.SetWindowTheme', hWnd, pszSubAppName, pszSubIdList)
end

local function RGB(r, g, b)
 local redColor,greenColor,blueColor=r/255, g/255, b/255
 redColor, greenColor, blueColor = math.floor(redColor*100)/100, math.floor(greenColor*100)/100, math.floor(blueColor*100)/100
 return redColor, greenColor, blueColor, alpha
end

CETrackBar1 = component_findComponentByName(UDF1, "CETrackBar1")
CEProgressbar1 = component_findComponentByName(UDF1, "CEProgressbar1")
UDF1.show()

clrBar = RGB(0, 0, 0)
clrBg = RGB(255, 255, 255)

function CETrackBar1Change(sender)
 local hwnd = UDF1.CEProgressbar1.Handle
 --SetWindowTheme(hwnd, " ", nil)
 --SendMessage(hwnd, PBM_SETBARCOLOR, 0, clrBar)
 --SendMessage(hwnd, PBM_SETBKCOLOR, 0, clrBg)
 SendMessage(hwnd, PBM_SETSTATE, 2, 0);
 CEProgressbar1.Position = UDF1.CETrackBar1.Position
end

CETrackBar1.onChange = CETrackBar1Change


check_windows_version = [[
local f = io.popen("ver") -- runs command
local l = f:read("*a") -- read output of command
print(l)
f:close()
]]


As you see these lines:

Code:
SendMessage(hwnd, PBM_SETBARCOLOR, 0, clrBar)
SendMessage(hwnd, PBM_SETBKCOLOR, 0, clrBg)


Will not work on Windows 7 or later, but if you use windows XP or classic then the code will work.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
kucingkembar
How do I cheat?
Reputation: 0

Joined: 08 Oct 2020
Posts: 8

PostPosted: Mon Oct 19, 2020 6:35 am    Post subject: Reply with quote

I tried your code multiple times
and the result:
Code:
Error:Invalid class object


then I re-read
Code:
Will not work on Windows 7 or later, but if you use windows XP or classic then the code will work.


silly me,
thanks for the hard work, really appreciate it

Edit: turn out this code require a form, a progress bar, and a track bar, after test it, but the color still does not change,
anyway is there any reference like
Code:
PBM_SETSTATE = 0x410

maybe it will work, maybe
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites