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 


GetComboBoxInfo and COMBOBOXINFO structure

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri Oct 30, 2020 9:08 pm    Post subject: GetComboBoxInfo and COMBOBOXINFO structure Reply with quote

I am trying to implementation GetComboBoxInfo but I need to understand about COMBOBOXINFO structure.

1. Is create COMBOBOXINFO structure in CE Lua by using Lua table or memory stream?. The structure of COMBOBOXINFO is:

Code:
COMBOBOXINFO {
  DWORD cbSize;
  RECT  rcItem;
  RECT  rcButton;
  DWORD stateButton;
  HWND  hwndCombo;
  HWND  hwndItem;
  HWND  hwndList;
}


2. Since I found a statement in a script said 'blabla.cbSize := sizeof(blabla), I think the COMBOBOXINFO structure is creating using memory stream if write in CE Lua, isn't right?.

3. How to properly writing COMBOBOXINFO structure (as pointer) in CE Lua?,

Regards,

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Oct 31, 2020 1:36 am    Post subject: Reply with quote

yes, use a memorystream.
you can use memorystreamobject.Memory to get the pointer ti the data

Look at msdn and c headers on how to fill it.
dword can be written with writeDword
rect is just 4 dwords
hwnd is a dword in 32 bit, qword in 64 bit

use stream.position=0 followed by stream.writeDword(stream.Size) to finish it

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 31, 2020 6:25 am    Post subject: Reply with quote

Thank DB, I tried but seem not work. What I am trying to do is to make combobox with transparent background. It work when I am using Lazarus.

So far I tried:

Code:
struct = [[
COMBOBOXINFO {
DWORD cbSize;  --int32
RECT  rcItem;  --rect
RECT  rcButton; --rect
DWORD stateButton;  --flag
HWND  hwndCombo; --intptr
HWND  hwndItem;  --intptr
HWND  hwndList;  --intptr
]]

rect1 = {}
rect1.left = cb.left
rect1.top = cb.top
rect1.right = cb.width
rect1.bottom = cb.DropDownCount

rect2 = {}
rect2.left = cb.left
rect2.top = cb.top
rect2.right = 200
rect2.bottom = 30

cbinfo = {}
cbinfo.cbSize = 0
cbinfo.rcItem = rect1
cbinfo.rcButton = rect2
cbinfo.stateButton = 0  --> button exist no pressed
cbinfo.hwndCombo = ?  --cb.handle
cbinfo.hwndItem = ? --cb.handle
cbinfo.hwndList = ? --cb.handle

theinfo = createMemoryStream()
theinfo.Size = 1024
theinfo.Position = 0
theinfo.write(cbinfo)


And apply in a function:

Code:

cb = createComboBox(f)
cb.setSize(200,30)
cb.setPosition(10,10)
cb.DropDownCount = 8
cb.Style = 'csDropDownList'

function cbTransparent(val)
 local h, c, dc, check
 if c1.Checked then check = 0 else check = 1 end

 theinfo.cbSize = theinfo.writeDword(theinfo.Size)
 getcomboboxinfo(cb.handle, theinfo.memory)
 h = theinfo.hwndList
 dc = getdc(h)
 c = getbkcolor(dc)
 releasedc(h, dc)

  if c2.Checked then
     setwindowlong(h,gwl_style, getwindowlong(h, gwl_style) and (not ws_border))
  else
     setwindowlong(h,gwl_style, getwindowlong(h, gwl_style) or ws_border)
  end

  setwindowlong(h,gwl_exstyle, getwindowlong(h, gwl_exstyle) or ws_ex_layered);
  setlayeredwindowattributes(h, c, val, check+1)
end


Others winapi functions already made and flag values already set.
I am still browse for easy example but didn't find it yet.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Oct 31, 2020 8:24 am    Post subject: Reply with quote

stream.write only accepts bytetables , you're not passing one

you need to write using the basic types, writeDword and writeQword

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 31, 2020 12:15 pm    Post subject: Reply with quote

Ok, I will try again. Thanks DB

EDIT:
I tried with another method to get handle of Combobox listbox but seem setWindowLong, getWindowLong or SetLayeredWindowAttributes (winapi), not work to make combobox listbox transparent. FindWindowEx and SetWindowText (winapi) just work fine.

I am also note this work on windows xp. But the method is work when use on lazarus on windows 64 bit.

Code:
GWL_EXSTYLE  = -20
LWA_ALPHA = 0x2
WS_EX_LAYERED = 0x80000
CB_ADDSTRING = 0x143
CB_SETITEMDATA = 0x151

function test()
 h = FindWindowEx(cb.handle, 0, 0, 0)
 SetWindowText(h, "FindWindowEx found it!")
 _SendMessage(cb.handle, CB_ADDSTRING, 0, "GetComboBoxInfo: List handle is "..tostring(h))
 SetWindowText(h, "FindWindowEx found it!")
 dc = getDC(h)
 c = GetBkColor(dc)
 ReleaseDC(h, dc)
 SetWindowLong(h, GWL_EXSTYLE, GetWindowLong(h, GWL_EXSTYLE) or WS_EX_LAYERED)
 SetLayeredWindowAttributes(h, c, 0, 0x2)
end

test()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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