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 


ListBox Text Color

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sat Feb 06, 2010 11:34 am    Post subject: ListBox Text Color Reply with quote

So, i'm coding this in a dll and I can't add window forms so I use CreateWindowEx as my alternative. I have everything down and everything works fine but I wan't to change my listboxes text color, so I try this:

Code:

HDC DC = GetDC(ListBox1);
SetTextColor(DC, RGB(255, 0, 0));


Didn't work.

Code:

PAINTSTRUCT ps;
HDC DC = BeginPaint(ListBox1, &ps);
SetTextColor(DC, RGB(255, 0, 0));
EndPaint(ListBox1, &ps);


Didn't work.

Tried doing some research but nothing, so what do I do?
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Sat Feb 06, 2010 5:38 pm    Post subject: Reply with quote

Do you mean the color of a spesific listitem? or just the background color of the list itself?
_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Sat Feb 06, 2010 8:41 pm    Post subject: Reply with quote

SetBgColor()
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sat Feb 06, 2010 10:20 pm    Post subject: Reply with quote

@JesusLovesQlimax

Specific listitem, i'm thinking change the default item color to my color then back.

I'm trying to determine static addresses as green, and others are black.

@Vision

That doesn't work.
Back to top
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Feb 07, 2010 11:18 am    Post subject: Reply with quote

WM_CTLCOLORLISTBOX
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Feb 07, 2010 12:51 pm    Post subject: Reply with quote

Hmm?

Code:

case WM_CTLCOLORLISTBOX:
               {
                  HDC DC = GetDC(ListBox1);
                  SetBkColor(DC, RGB(0, 255, 0));
                  break;
               }
               break;


EDIT

nvm got it

Code:

case WM_CTLCOLORLISTBOX:
               {
                  HDC DC = (HDC) wParam;
                  SetDCPenColor(DC, RGB(0, 255, 0));
                  return (BOOL) GetStockObject(DC_BRUSH);
               }
Back to top
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Sun Feb 07, 2010 5:45 pm    Post subject: Reply with quote

if that is your only use of the dc, there is no need to declare it. just typecast the wparam within your stedcpencolor
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Sun Feb 07, 2010 10:39 pm    Post subject: Reply with quote

question

can I instead of putting it in a case send a message?

Code:

// Get & Set DC
HDC DC = GetDC(ListBox1);
SetDCPenColor(DC, RGB(0, 255, 0));

// Get ListBox1 Handle
DWORD ProcId;
HANDLE LB;

GetWindowThreadProcessId(ListBox1, &ProcId);
LB = OpenProcess(PROCESS_ALL_ACCESS, false, ProcID);

// Send Message
SendMessage(ListBox1, WH_CTLCOLORLISTBOX, (WPARAM) DC, (LPARAM) LB);


Because I wan't to change the pen color at any time w/o a case because while im scanning for addresses, for each static address, I change the color but for regular addresses, I change it back?
Back to top
View user's profile Send private message MSN Messenger
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Mon Feb 08, 2010 6:41 am    Post subject: Reply with quote

iPromise wrote:
question

can I instead of putting it in a case send a message?

Code:

// Get & Set DC
HDC DC = GetDC(ListBox1);
SetDCPenColor(DC, RGB(0, 255, 0));

// Get ListBox1 Handle
DWORD ProcId;
HANDLE LB;

GetWindowThreadProcessId(ListBox1, &ProcId);
LB = OpenProcess(PROCESS_ALL_ACCESS, false, ProcID);

// Send Message
SendMessage(ListBox1, WH_CTLCOLORLISTBOX, (WPARAM) DC, (LPARAM) LB);


Because I wan't to change the pen color at any time w/o a case because while im scanning for addresses, for each static address, I change the color but for regular addresses, I change it back?

what the heck are you doing with lparam there.... ?
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Mon Feb 08, 2010 7:14 am    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/bb761360%28VS.85%29.aspx

wParam
Handle to the device context for the list box.
lParam
Handle to the list box.

(WPARAM)DC
(LPARAM)HWND
...
Back to top
View user's profile Send private message
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Feb 08, 2010 9:27 am    Post subject: Reply with quote

@iPromise http://msdn.microsoft.com/en-us/library/bb761360: "WM_CTLCOLORLISTBOX Notification
Sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle."

A notification, not a message, you can't send it, only handle it, and then read _visiON_'s post, and make SURE that you know the difference between a Handle to a process and a Handle to a window!, if you don't, you got some serious studying to do before you continue your Memory "Engine"!, no wonder it doesen't work...
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Mon Feb 08, 2010 5:37 pm    Post subject: Reply with quote

EDIT

I found the answer, thanks.
Back to top
View user's profile Send private message MSN Messenger
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue Feb 09, 2010 7:43 am    Post subject: Reply with quote

iPromise wrote:
EDIT

I found the answer, thanks.

sharing is careing.

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Tue Feb 09, 2010 8:26 pm    Post subject: Reply with quote

Code:

case WM_CTLCOLORLISTBOX:
{
if (static_address == 1)
{
SetTextColor((HDC) wParam, RGB(0, 255, 0));
}

if (dynamic_address == 1)
{
SetTextColor((HDC) wParam, RGB(0, 0, 0));
}

return (BOOL) GetStockObject(DC_TEXT);

break;
}


thats my code.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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