|
-
Jul 1st, 2002, 01:48 PM
#1
Thread Starter
Frenzied Member
WM_CTLCOLORSTATIC: Try #2
Ok the fourm is all messed up. So if this gets posted more than once I am going to be pissed
I have this problem with changing the background color and text color of an edit box. It looks like it is no getting set right on the paint. If you look at the attached pic you will see.
Here is the code:
PHP Code:
case WM_CREATE:
{
hBrush_Changes = CreateSolidBrush(RGB(0,0,0));
hBrush_AppInfo = CreateSolidBrush(RGB(0,0,0));
return DefWindowProc(hWnd, message, wParam, lParam);
}
case WM_CLOSE:
{
DeleteObject(hBrush_Changes);
DeleteObject(hBrush_AppInfo);
DestroyWindow(hWnd);
m_hWnd_About = NULL;
break;
}
case WM_CTLCOLORSTATIC:
if ((HWND)lParam == m_hWnd_Changes)
{
SetTextColor((HDC)wParam, RGB(0,100,255));
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)hBrush_Changes;
}
if ((HWND)lParam == m_hWnd_AppInfo)
{
SetTextColor((HDC)wParam, RGB(0,100,255));
SetBkMode((HDC)wParam, TRANSPARENT);
return (long)hBrush_AppInfo;
}
break;
case WM_PAINT:
{
BeginPaint(hWnd,&ps);
EndPaint(hWnd,&ps);
break;
} //WM_PAINT
Any suggestions?
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 1st, 2002, 01:49 PM
#2
Thread Starter
Frenzied Member
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 1st, 2002, 10:24 PM
#3
PowerPoster
if your Edit control is not set to Read Only, then you need to move you code to the WM_CTLCOLOREDIT event instead of the WM_CTLCOLORSTATIC
-
Jul 2nd, 2002, 10:04 AM
#4
Thread Starter
Frenzied Member
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 2nd, 2002, 07:34 PM
#5
PowerPoster
Juz can't anything out from your code & it seem weird 'coz i did the same thing in my application too.
Perhaps, the problem is from where you update the text in the edit control?
-
Jul 3rd, 2002, 12:15 PM
#6
Thread Starter
Frenzied Member
Well here is the rest of my code. Its not pretty because I havent finished it.
PHP Code:
/*###########################################################################################*/
BOOL ShowAbout()
{
int i;
CLog.LogInfo("Started ShowAbout()",TRUE,TRUE,FALSE);
UnregisterClass(szAboutClass,m_hInst);
if(!InitAbout())
return FALSE;
if(!InitAboutInstance())
return FALSE;
CEdit.EditWrite(m_hWnd_AppVer,"Got Mail Verison #3",TRUE);
CEdit.EditWrite(m_hWnd_AppVer,"",TRUE);
CEdit.EditWrite(m_hWnd_AppVer,"Main: 1",TRUE);
CEdit.EditWrite(m_hWnd_AppVer,"Major: ",FALSE);
CEdit.EditWrite(m_hWnd_AppVer,MAJOR,TRUE);
CEdit.EditWrite(m_hWnd_AppVer,"Build: ",FALSE);
CEdit.EditWrite(m_hWnd_AppVer,BUILD,FALSE);
CEdit.EditWrite(m_hWnd_AppInfo,CHANGES,FALSE);
CEdit.EditWrite(m_hWnd_Changes,BUGS,FALSE);
CEdit.EditWrite(m_hWnd_Changes,TODO,FALSE);
CLog.LogInfo("Completed ShowAbout()",TRUE,TRUE,FALSE);
return TRUE;
}
/*###########################################################################################*/
BOOL InitAbout()
{
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
WNDCLASS wc; //Class
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
//Setup The Class
wc.style = 0;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.lpfnWndProc = (WNDPROC)AboutMainWndProc;
wc.hInstance = (HINSTANCE)m_hInst;
wc.hbrBackground = (HBRUSH)(COLOR_ACTIVEBORDER+1);
wc.hIcon = LoadIcon((HINSTANCE)m_hInst, MAKEINTRESOURCE(IDI_MAIL));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpszMenuName = NULL;
wc.lpszClassName = szAboutClass;
return RegisterClass(&wc);
}
/*###########################################################################################*/
BOOL InitAboutInstance()
{
static HWND hWnd;
DWORD dwFlags = WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
int h,w;
h = 400;
w = 400;
//Create The Window
hWnd = CreateWindow(szAboutClass, "About", dwFlags,
CENTERX(w), CENTERY(h), w, h, NULL, NULL, m_hInst, NULL);
//If The Handle Is Not Created
if(!hWnd)
{
ErrorHandler("InitPopupInstance()","hWnd Was NULL. CreateWindow May Have Failed",FALSE);
return FALSE;
}
//Put The Handle Into The Class
m_hWnd_About = hWnd;
ShowWindow(m_hWnd_About,SW_NORMAL);
hWnd = NULL;
dwFlags = WS_CHILD | ES_MULTILINE | ES_READONLY;
hWnd = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY,
"Edit",
NULL,
dwFlags,
0,
0,
w-105,
h/4,
m_hWnd_About,
NULL,
m_hInst,
NULL);
//If The Handle Is Not Created
if(!hWnd)
{
ErrorHandler("InitPopupInstance()","hWnd Was NULL. CreateWindow May Have Failed",FALSE);
return FALSE;
}
m_hWnd_AppVer = hWnd;
ShowWindow(m_hWnd_AppVer,SW_NORMAL);
dwFlags = WS_CHILD | ES_MULTILINE | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_READONLY;
hWnd = NULL;
hWnd = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY,
"Edit",
NULL,
dwFlags,
0,
h/4,
w-5,
((h-(h/4))-30)/2,
m_hWnd_About,
NULL,
m_hInst,
NULL);
//If The Handle Is Not Created
if(!hWnd)
{
ErrorHandler("InitPopupInstance()","hWnd Was NULL. CreateWindow May Have Failed",FALSE);
return FALSE;
}
m_hWnd_AppInfo = hWnd;
ShowWindow(m_hWnd_AppInfo,SW_NORMAL);
dwFlags = WS_CHILD | ES_MULTILINE | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_READONLY;
hWnd = NULL;
hWnd = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_NOPARENTNOTIFY,
"Edit",
NULL,
dwFlags,
0,
(h-(((h-(h/4)))/2))-16,
w-5,
((h-(h/4))-30)/2,
m_hWnd_About,
NULL,
m_hInst,
NULL);
//If The Handle Is Not Created
if(!hWnd)
{
ErrorHandler("InitPopupInstance()","hWnd Was NULL. CreateWindow May Have Failed",FALSE);
return FALSE;
}
m_hWnd_Changes = hWnd;
ShowWindow(m_hWnd_Changes,SW_NORMAL);
hWnd = NULL;
hWnd = CreateWindow("Button", "Send Log", BS_PUSHBUTTON | WS_CHILD, w-105, 25, 100, 25, m_hWnd_About, (HMENU)BTNLOG, m_hInst, NULL);
//If The Handle Is Not Created
if(!hWnd)
{
ErrorHandler("InitPopupInstance()","hWnd Was NULL. CreateWindow May Have Failed",FALSE);
return FALSE;
}
m_hWnd_Btn_Log = hWnd;
ShowWindow(m_hWnd_Btn_Log,SW_NORMAL);
UpdateWindow(m_hWnd_About);
return TRUE;
}
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Jul 3rd, 2002, 11:34 PM
#7
PowerPoster
I copy all your code into a new project except those CEdit section and it work fine. 
I guest the problem is not on WM_CTLCOLORSTATIC but is somewhere else.
-
Jul 5th, 2002, 10:05 AM
#8
Thread Starter
Frenzied Member
Bah
Well if I could I would post the entire project, but it requires Novell GW to run.
Oh well I guess I will just have to keep working on the problem.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|