View previous topic :: View next topic |
Author |
Message |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sat Feb 06, 2010 11:34 am Post subject: ListBox Text Color |
|
|
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 |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Sat Feb 06, 2010 5:38 pm Post subject: |
|
|
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 |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
Posted: Sat Feb 06, 2010 8:41 pm Post subject: |
|
|
SetBgColor()
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sat Feb 06, 2010 10:20 pm Post subject: |
|
|
@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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Feb 07, 2010 11:18 am Post subject: |
|
|
WM_CTLCOLORLISTBOX
|
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Feb 07, 2010 12:51 pm Post subject: |
|
|
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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Sun Feb 07, 2010 5:45 pm Post subject: |
|
|
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 |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Sun Feb 07, 2010 10:39 pm Post subject: |
|
|
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 |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Mon Feb 08, 2010 6:41 am Post subject: |
|
|
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 |
|
 |
AtheistCrusader Grandmaster Cheater
Reputation: 6
Joined: 23 Sep 2006 Posts: 681
|
|
Back to top |
|
 |
Anden100 Grandmaster Cheater
Reputation: 0
Joined: 20 Apr 2007 Posts: 668
|
Posted: Mon Feb 08, 2010 9:27 am Post subject: |
|
|
@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 |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Mon Feb 08, 2010 5:37 pm Post subject: |
|
|
EDIT
I found the answer, thanks.
|
|
Back to top |
|
 |
NINTENDO Grandmaster Cheater Supreme
Reputation: 0
Joined: 02 Nov 2007 Posts: 1371
|
Posted: Tue Feb 09, 2010 7:43 am Post subject: |
|
|
iPromise wrote: | EDIT
I found the answer, thanks. |
sharing is careing.
_________________
Intel over amd yes. |
|
Back to top |
|
 |
iPromise Grandmaster Cheater
Reputation: -1
Joined: 27 Jun 2009 Posts: 529 Location: Canada
|
Posted: Tue Feb 09, 2010 8:26 pm Post subject: |
|
|
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 |
|
 |
|