|
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
|
|
|
|
|
If I were to go a step further and prevent the Task Manager from even being shown, would I be able to write my own GINA.DLL (instead of changing microsoft's and just disabling buttons), and if so how easy is this to do and where would I start to look to do it?
Thanks for the reply!
-Alex
|
|
|
|
|
Win95 + 98 don't have a MSGINA.DLL. Hooking can be done by setting the screensaver state programatically. The call
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, lpvoid, 0)
blocks the keys, and
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, lpvoid, 0)
re-enables them.
For replacing MSGINA.DLL you should search the MSDN. There're some good examples and explanations.
|
|
|
|
|
Thanks for that. I'd figured out the screensaver bits but was unsure if that was the accepted way of doing it.
Basically it sounds like such a muck-about to do all this that i'm probably going to try and get my boss to persuade the clients that they don't realy want this feature after all. If there were one way for all versions of Windows, then perhaps it would work, but I would also need to disable the Windows Key, Alt+Tab, Alt+Esc and Ctrl+Tab to actually prevent anyone using the app from accessing the desktop. All in all I'd never implement something like this through choice
Thanks for the support though!
-Alex
|
|
|
|
|
I want to change the back ground color of whole of my application developed in VC++... Suppose I want to change the background to Green...
Every thing in green.... Toolbar, menu , status bar, title bar etc ....
any help? or comments
|
|
|
|