|
this will only work if you somehow manage to patch SetWindowsHook for every running process...
the information you require is only available in kernel-mode. You will need a driver to access it. Under the current PEB structure for a process is a pointer to the PDESKTOP kernel object. Under this there is a linked-list of further difficult-to-understand kernel structures, some of which contain info about hooks and the DLLs that they belong to.
You need WinDbg+Symbols+lots of patience
James
Microsoft MVP: Windows SDK http://www.catch22.net
|
|
|
|
|
Hellow,
the type of Key is "int". can someone help?
|
|
|
|
|
i don't know about CMap ; i tried to use it when i designed the 1st version of VisualCalc but came back to the old standars C++ std::map<>.
if it is like the standard map, the map is already sorted by the "key".
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
thanks,i will have a test on CMap.
|
|
|
|
|
|
I got the result. it seems it is sorted by the time when item was put in.
|
|
|
|
|
xyhan wrote: I got the result.
Great!
But toxccts advice still stands: Stop using CMap and use std::map
CMap is Microsoft proprietary and is the legacy of a time when Microsofts C++ compiler was too braindead to cope with a STL. And when the STL itself was still in the process of definition.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi there,
Because of a post on the wrong forum i have to write this again...
I have to display a page in a little webbrowser on my dialog app and want to display the webpage background in the same color as the dialog background.
How can I get the Windows Standard Dialog Background color?
thx in advance
best regards
Michael
|
|
|
|
|
if you're talking about your windows configuration, this would better be placed into the OS/Admin forum than into a pure programming forum. anyway, i will not spam CP much than it is already.
you go there :
Start Menu > Control Panel > Display , Appearence Tab > Advanced Button.
there, under each category, you have one or more colors, which you can click on...
if it is not what you asked for, please reformulate with more details about what you have, what you need and what you do...
thx
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
toxcct wrote: Start Menu > Control Panel > Display , Appearence Tab > Advanced Button.
there, under each category, you have one or more colors, which you can click on...
I think he wanted to get it using the Win API ...
~RaGE();
|
|
|
|
|
Rage wrote: I think he wanted to get it using the Win API ...
yes, looking at nish's answer made me though of this too... but the question was not clear enough i find...
;P
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
seems that some guys have no humour (refering to the vote '1' my post have been shot - but strangely, not the first one )
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
:tease:
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
master87 wrote: How can I get the Windows Standard Dialog Background color?
You can use GetSysColor with COLOR_BTNFACE .
Regards,
Nish
|
|
|
|
|
@toxcct <ironie>thx for the very helpful post. here we have of corse a windows forum and not a visual C++ forum
I know but this doesn't work.
CString rgbcolors;
rgbcolors.Format("%d,%d,%d", GetRValue(COLOR_BTNFACE), GetGValue(COLOR_BTNFACE), GetBValue(COLOR_BTNFACE));
rgbcolors returns "15,0,0"
And thats black not the dialog gray.
|
|
|
|
|
ow, that was my mistake...
now it works...
COLORREF col = GetSysColor(COLOR_BTNFACE);
CString rgbcolors;
rgbcolors.Format("%d,%d,%d",GetRValue(col),GetGValue(col),GetBValue(col));
|
|
|
|
|
Do this :-
DWORD color = GetSysColor(COLOR_BTNFACE);
cout << (int)GetRValue(color);
cout << (int)GetGValue(color);
cout << (int)GetBValue(color);
Regards,
Nish
|
|
|
|
|
master87 wrote: here we have of corse a windows forum and not a visual C++ forum
Regards,
Nish
|
|
|
|
|
How to map a network on another one using C++ Builder 6?
|
|
|
|
|
See here.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I'm using callback functions to get rtf strings in and out of CRichEditCtrl and I'm not happy with any I tried.
1. Works great until I try to get unicode string (SF_UNICODE) - if I do i only get the first letter of the string.
<br />
DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
CString *psBuffer = (CString *)dwCookie;<br />
if (cb < psBuffer->GetLength()) cb = psBuffer->GetLength();<br />
for (int i=0;i<cb;i++) {<br />
*(pbBuff+i) = psBuffer->GetAt(i);<br />
}<br />
*pcb = cb;<br />
*psBuffer = psBuffer->Mid(cb);<br />
return 0;<br />
}<br />
<br />
DWORD __stdcall MEditStreamOutCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)<br />
{<br />
CString sThisWrite;<br />
sThisWrite.GetBufferSetLength(cb);<br />
CString *psBuffer = (CString *)dwCookie; <br />
for (int i=0;i<cb;i++) {<br />
sThisWrite.SetAt(i,*(pbBuff+i));<br />
}<br />
*psBuffer += sThisWrite;<br />
*pcb = sThisWrite.GetLength();<br />
sThisWrite.ReleaseBuffer();<br />
return 0;<br />
}<br />
2. Tricky. No problems with UNICODE (at least not with unicode as such - it basicaly works from time to time)
<br />
static DWORD CALLBACK StreamOut( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )<br />
{<br />
<br />
char* buff;<br />
buff = new char[ cb + 1 ];<br />
buff[ cb ] = ( char ) 0;<br />
strncpy( buff, ( LPCSTR ) pbBuff, cb );<br />
int max = strlen( buff );<br />
<br />
CString* str = ( CString* ) dwCookie;<br />
<br />
#ifdef _UNICODE<br />
<br />
int length = ::MultiByteToWideChar( CP_UTF8, 0, buff, max, NULL, 0 );<br />
if( length )<br />
{<br />
TCHAR* wBuff = new TCHAR[ length ];<br />
::MultiByteToWideChar( CP_UTF8, 0, buff, max, wBuff, length );<br />
*str += wBuff;<br />
delete[] wBuff;<br />
}<br />
#else<br />
*str += buff;<br />
#endif<br />
delete[] buff;<br />
*pcb = max; <br />
return 0;<br />
}<br />
and 'bout 2-3 found over net - none of them works as I'd like it to.
If you have a WORKING, TESTED callback functions for CRichEditCtrl and with unicode support let mi know. If you know what's wrong with these 2 sert and/or how to correct it just tell me
I apologise for any mistakes made in this post - it's my third day of non-stop coding and sleep depravation starts to kick in..
Maciej Lisiewski
The sad thing is that due to bad luck with code and deadlines my uptime makes me a good server.
-- modified at 9:49 Monday 9th January, 2006
|
|
|
|
|
Maciej Lisiewski wrote: DWORD __stdcall MEditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString *psBuffer = (CString *)dwCookie;
if (cb < psBuffer->GetLength()) cb = psBuffer->GetLength();
for (int i=0;i *(pbBuff+i) = psBuffer->GetAt(i);
}
*pcb = cb;
*psBuffer = psBuffer->Mid(cb);
return 0;
}
The for has not been correctly transposed (the < got read as HTML tag, and the rest was ignored).
Anyway, I suppose you get the first char read in for some reason as non unicode (that's "the first letter of the string") and the second char, also read in as non unicode, and which should be the Unicode char second byte, terminates the string. So you get a string with only one char.
~RaGE();
|
|
|
|
|
I haven't got a clue why am I getting only the first char. It could happen with a unicode string read as single byte char string, but that's not the case. And it's true for every string I came up with, which, again, proves your theory wrong (I really wish it was that simple, I really do).
If anybody has any idea what's the problem - do write. Meanwhile I'll get myself an unhealthly large cup of coffee hoping to finish the code before my heart explodes
More on the subject: if I stream rft into CRich.. as unicode (sf_rtf|sf_unicode) and read it as (sf_text) I get whole string with some characters replaced with '?', which is normal.
It it's (sf_rtf) in and (sf_text|sf_unicode) out I get just the first char (sligtly odd..)
(sf_rtf|sf_unicode) + (sf_text|sf_unicode) exacly the same.
Conclusion:
(sf_text|sf_unicode) = getting 1 char regardles of the string.
Could you look at the code please? I can't find the mistake (I hardly see anything being awake like 50 hours )
DWORD CALLBACK CAutoRichEditCtrl::CBStreamOut(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString sThisWrite;
sThisWrite.GetBufferSetLength(cb);
CStringW *psBuffer = (CStringW *)dwCookie;
for (int i=0;i<cb;i++) {
sThisWrite.SetAt(i,*(pbBuff+i));
}
*psBuffer += sThisWrite;
*pcb = sThisWrite.GetLength();
sThisWrite.ReleaseBuffer();
return 0;
}
[..]
EDITSTREAM es;
es.dwError = 0;
es.pfnCallback = CBStreamOut;
CStringW theStringYouShouldBeLookingAt = _T(" ");
es.dwCookie = (DWORD) &theStringYouShouldBeLookingAt;
StreamOut(SF_TEXT, es); //(SF_TEXT|SF_UNICODE, es);
[..]
Maciej Lisiewski
Bioengineered coffee2code converter
-- modified at 12:58 Monday 9th January, 2006
|
|
|
|
|
Maybe a dumb question again, but what happens when you debug-run through
DWORD CALLBACK CAutoRichEditCtrl::CBStreamOut(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
CString sThisWrite;
sThisWrite.GetBufferSetLength(cb);
CStringW *psBuffer = (CStringW *)dwCookie;
for (int i=0;i<cb;i++) {
sThisWrite.SetAt(i,*(pbBuff+i));
}
*psBuffer += sThisWrite;
*pcb = sThisWrite.GetLength();
sThisWrite.ReleaseBuffer();
return 0;
}
Where does it go wrong ?
~RaGE();
|
|
|
|
|
Hello Everybody
I am getting the user input using "stdin" from a seperate thread running in application "ABC". The problem I am facing is that when the application "ABC" is finished and user didnt enter any input than a deadlock is created between stdin and fflush. because "stdin" is still running in the thread and "fflush" is called by OS when it is terminating the program even I am terminating the threads explicitly. I am facing the same problem on AIX.
Any body have any idea that how can i remove deadlock.
Secondly How can I get the control back from "stdin" or how can i call "stdin" in non blocking mode.
Thanx in advance for your help and suggestions
Best Regards
Moin
|
|
|
|
|