|
OBS!<br />
No MFC sh*t now! Okay? :)
How can I keep the background color white when I have a read-only edit box?
I do my painting with SetBkColor() in WM_CTLCOLOREDIT.
But that may be wrong? Or...
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
You should probably have to derivate your own class from CEdit, and try to catch the reflection of WM_CTLCOLOR (ON_WM_CTLCOLOR_REFLECT() ), then implement HBRUSH CMyEdit::CtlColor(CDC* pDC, UINT nCtlColor)
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
KaЯl wrote:
CEdit
But KaЯl, what did I said in the beginning of my message?
"No MFC sh*t now"
Do you know how to cath the reflection in pure Win32?
Thank you anyway!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
, my apologizes, I wasn't careful enough.
In MFC sources:
#define ON_WM_CTLCOLOR_REFLECT() \<br />
{ WM_CTLCOLOR+WM_REFLECT_BASE, 0, 0, 0, AfxSig_hDw, \<br />
(AFX_PMSG)(AFX_PMSGW)(HBRUSH (AFX_MSG_CALL CWnd::*)(CDC*, UINT))CtlColor },
I have really few experience of pure Win32 programming, it is possible to catch in your message loop the one corresponding to (WM_CTLCOLOR+WM_REFLECT_BASE), for the window with
the HWND of the Edit control ?
Perhaps this page [^] may help you.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
Intercept WM_CTLCOLORSTATIC in the window procedure of the control's parent.
rechi
|
|
|
|
|
Woohoo!
Danke schön!
BUT!
The whole edit box doesn't get white!
My edit is 300 in height and if I have not put text on all lines there will be grey color on lines where I don't have text. Daoh... it's difficult to explain... my egnlish just went broken!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Call
SetBkColor((HDC)wParam, BACKGROUND_COLOR); before returning from the handler of WM_CTLCOLORSTATIC .
rechi
|
|
|
|
|
Bogdan Rechi wrote:
before returning from the handler of WM_CTLCOLORSTATIC
Huh?
What do you mean?
I do like this:
....
case WM_CTLCOLORSTATIC:
if((HWND)lParam == myEdit)
SetBkColor((HDC)wParam, RGB(255,255,255));
break;
....
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Do it like this:
case WM_CTLCOLORSTATIC:
if((HWND)lParam == myEdit)
{
SetBkColor((HDC)wParam, RGB(255,255,255));
return (BOOL)GetStockObject(WHITE_BRUSH);
}
rechi
|
|
|
|
|
Hello, hope you can see this!
I did like you said, it is painting the whle edit white now, BUT!
When I put 10 lines with text and then put 1 line text to the edit box, the old text is still there!
The text is in the "DC" I think, because when I move the window outside the screen, it will remove the text. Hope you understand!
Do you know how to fix that? I've tried UpdateWindow() and InvalidateRect() but they don't work!
Thank you!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
hi
does anybody know how to create a 24-bpp bitmap on the fly (ie not from a resource, or by loading), change a pixel in it, and then output it to a dialog box?
thanx,
paul.
|
|
|
|
|
sntpaul wrote:
does anybody know how to create a 24-bpp bitmap on the fly
Yes. CreateBitmap.
change a pixel in it
SetPixel
and then output it to a dialog box?
BitBlt
You might also want to read up on some of the large amount of samples provided by e.g. MSDN.
|
|
|
|
|
hello all,
i try to disable scrollbar in HtmlView.
i know i must work with IDocHostUIHandler::GetHostInfo();
and put the flag DOCHOSTUIFLAG_SCROLL_NO.
but i don't understand how implement this
you know how to do this?
PS : i work with VC7.
|
|
|
|
|
VC7 makes your life easy! You only need to implement the new invented function OnGetHostInfo(DOCHOSTUIINFO *pInfo ).
F.i:
HRESULT MyView::OnGetHostInfo(
DOCHOSTUIINFO *pInfo )
{
pInfo->cbSize = sizeof(DOCHOSTUIINFO);
pInfo->dwFlags = DOCHOSTUIFLAG_SCROLL_NO;
return S_OK;
}
|
|
|
|
|
THX for your answer!!
yes with vc7 it seems easy
but what is the command in message map ?
|
|
|
|
|
jeremysay wrote:
but what is the command in message map ?
No entry in the message map required - it's a virtual function
|
|
|
|
|
Thx again Schlaubi!!
it's works perfectly !
but i can't decide when i want to show scrollbar or not.
its a problem for me...
|
|
|
|
|
sorry i have another question
you knwo how get the scrollabr position (always for htmlview)?
i can set a position to scrollbars
IDispatch *pDisp = GetHtmlDocument();
IHTMLDocument2 *pDocument = NULL;
pDisp->QueryInterface( IID_IHTMLDocument2, ( void** )&pDocument );
IHTMLElement* pBody = NULL;
pDocument->get_body( &pBody );
IHTMLWindow2* pWindow = NULL;
pDocument->get_parentWindow( &pWindow );
pWindow->scroll( 250, 300 );
but i don't know how get the position
|
|
|
|
|
When possessing a pointer to the body element (and you already have one), you could try calling IHTMLElement's offsetTop function. It should return the body's offset from the top of the page, and I hope that's what you're looking for
|
|
|
|
|
I think it's not exactly what i need.
when i resize window i want to scroll exactly where it is before resizing.
that's why i need to know the position of scrollbars.
You think with offsetTop,offsetLeft... i can do this ?
|
|
|
|
|
there is no problem i find how to do.
i want to thank you Schlaubi for your help !!
|
|
|
|
|
Hi,
I'm having a problem getting my hooks to work. I can successfully hook Keyboard and System messages (WH_KEYBOARD and WH_SYSMSGFILTER) but can't seem to be able to prevent Ctrl+Alt+Delete or MSGF_NEXTWINDOW from doing what they normally do.
I'm trying to prevent users of my app from accessing windows (definately not what i'd want, i know, but clients are clients), and i've got a feeling that part of the problem is the differences between 95/98 and 2k/XP? any ideas?
Thanks in advance to anyone who can help,
Alex
|
|
|
|
|
You'll never be able to hook that keystroke using a system wide hook or any other technique...
In order to do that you must create a GINA.DLL that handles that keystroke as you want...
Hope this helps...
|
|
|
|
|
Joan Murt wrote:
You'll never be able to hook that keystroke using a system wide hook or any other technique...
In order to do that you must create a GINA.DLL that handles that keystroke as you want...
I've been told this before - do you mean MSGINA.DLL? My version of Win98 doesn't have this dll present, but apparently WinNT does. does this matter?
Have you got any idea where I can look to find out a few clues on how to do this?
Cheers for the response,
Alex
|
|
|
|
|
hi
It is possible to hook Ctrl+Alt+Del combination by replacing the definition to Msgina.DLL in the registry by your own dll that is handling all the keyboard messages and forwarding all allowed key combinations to the original msgina.dll.
The easiest way to prevent unauthorized process kills is to use the VC++ resource editor, open msgina.dll and by making all buttons in the task manager dialog box disabled except Cancel. This is not a very beautiful method, but it works...
i saw an article on CP last days..search for it..it was on hooking ctrl + alt + del.. type something..
hope this works..
Himanshu
|
|
|
|