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 


editbox and label question
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat May 10, 2008 12:35 pm    Post subject: Reply with quote

Create a textbox then create a font and make the italic parameter valid, then send WM_SETFONT to the edit control. Then use SetTextColor (use GetDC to get the HDC paramater) then the color ref will be the function RGB(r,g,b)

CreateFont - http://msdn.microsoft.com/en-us/library/ms534214(VS.85).aspx

SetTextColor - http://msdn.microsoft.com/en-us/library/ms534209(VS.85).aspx

Then filter WM_NOTIFY and switch case for EN_CHANGE or EN_SETFOCUS and then SetDlgItemText to "" when changed if text is the default (GetDlgItemText and _tcscmp with default text)

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat May 10, 2008 12:43 pm    Post subject: Reply with quote

Cool. Thanks lurc. But what about the label one. Because that's a little more important to me.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat May 10, 2008 12:54 pm    Post subject: Reply with quote

in the WNDCLASSEX struct definition change the Background struct thing to (HBRUSH)(COLOR_BTNSHADOW)
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat May 10, 2008 1:17 pm    Post subject: Reply with quote

lurc wrote:
Create a textbox then create a font and make the italic parameter valid, then send WM_SETFONT to the edit control. Then use SetTextColor (use GetDC to get the HDC paramater) then the color ref will be the function RGB(r,g,b)

CreateFont - http://msdn.microsoft.com/en-us/library/ms534214(VS.85).aspx

SetTextColor - http://msdn.microsoft.com/en-us/library/ms534209(VS.85).aspx

Then filter WM_NOTIFY and switch case for EN_CHANGE or EN_SETFOCUS and then SetDlgItemText to "" when changed if text is the default (GetDlgItemText and _tcscmp with default text)


Say I wanted to make the text color red (I'm not), would I do:

Code:

SetTextColor(dc, RGB(255, 0, 0));


or

Code:

SetTextColor(dc, RGB(FF, 00, 00);

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sat May 10, 2008 1:53 pm    Post subject: Reply with quote

yes cept for the second one FF is hex so you gotta do 0xFF
_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat May 10, 2008 5:11 pm    Post subject: Reply with quote

Hey how do I switch case for EN_SETFOCUS. Like, for the specific controls. Here's my current code, but I don't think it's right at all.

Code:

case WM_NOTIFY:
         switch(LOWORD(wParam)) {
            case IDC_NAME_EDIT:
               switch(HIWORD(wParam)) {
                  case EN_SETFOCUS:
                     int len2 = GetWindowTextLength(GetDlgItem(hwnd, IDC_NAME_EDIT));
                     char Ndefault[] = "Enter name here...";
                     char *test;
                     test = (char*)GlobalAlloc(GPTR, len2+1);
                     GetDlgItemText(hwnd, IDC_NAME_EDIT, test, len2+1);
                     if(strcmp(test, Ndefault) == 0) {
                     SetDlgItemText(hwnd, IDC_NAME_EDIT, "");
                     }
                     GlobalFree((HANDLE)test);
                     break;
               }
            break;
         }
      break;

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat May 10, 2008 5:19 pm    Post subject: Reply with quote

God, one of the most annoying things is when people come in with errors and don't know how to fix them when the answer is right there.

you HAVE to learn to fix your own errors. Exp. Linking errors mean you have to link to the right lib so you google comctl and get the MSN page and find the right lib.

_________________
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Sat May 10, 2008 5:20 pm    Post subject: Reply with quote

Lol jeez, Blankrider. Way to hurt my feelings, jk. I know, but with this kind of error when most of the thread was based on this, it was quicker just to post and get an answer rather then google it. But we're past that lol.
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat May 10, 2008 5:33 pm    Post subject: Reply with quote

lol i went through the same thing except much more intelligent people told me that xP
_________________
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 programming All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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