|
Hi,
I have developed a program in which i intall a WH_CBT. But as soon as the code for installing the hook executes, the taskbar of my computer disappears and my computer halts.
Please give me any idea why this is so...
|
|
|
|
|
You must call CallNextHookEx after you finish processing the hook information.
From MSDN:
Calling CallNextHookEx is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.
Nibu thomas
Software Developer
|
|
|
|
|
Here's my theory:
You are installing a global hook; that is you called SetWindowsHookEx with the hMod non NULL and the dwThreadId parameter equal to zero. This causes the dll identified by hMod to be injected in all processes with message pumps; this is how global hooks work. Your DLL contains a bug and this buggy code has been injected into explorer via the global hook. Do you really need a global hook?
Steve
|
|
|
|
|
I have put this code in button click event;
but notting happens as the button is pressed.
it should display the string on desktop.
CWnd wnd;
char str[] = "Test String";
wnd.m_hWnd = (GetDesktopWindow())->m_hWnd;
CDC* dc = wnd.GetDC();
dc->TextOut(100,100,str);
An alternate which I have also tried is
CString str = "Test String";
((GetDesktopWindow())->GetDC())->TextOut(100,100,str);
but no result.
Thanks in advance.
|
|
|
|
|
Use GetWindowDC();
Nibu thomas
Software Developer
|
|
|
|
|
I am currently using rtx for some application and i obtained this warning after i editted some of the settings. I think the /DRIVER setting is required by rtx, but i dont see where the /EDITANDCONTINUE come from.
Does anyone know how to solve this warning ?
LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /DRIVER specification
I am currently using VC 6 and apparently /INCREMENTAL:NO is required for this application...
-- modified at 4:34 Thursday 9th March, 2006
|
|
|
|
|
I came across the following window message codes sent to WndProc of the main form of a C# application. These messages are generated when the form starts up. There are no published WM_ constants for these. Does anyone have an idea what they represent?
UNKNOWN: 297 (H129)
UNKNOWN: 295 (H127)
|
|
|
|
|
Try the C# Forum[^]
might get a better response there
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Please reply ASAP
I am unable to change the bitmap at runtine.
Ashok Reddy
|
|
|
|
|
Use a CBitmapButton .
Nibu thomas
Software Developer
|
|
|
|
|
|
FooButton^ for everything you need with a Button
VuNic
|
|
|
|
|
|
no need to repost
the previous answer were good already. if can't do it, it is because of you, not the inconsistent answers...
|
|
|
|
|
Please let me know how to change the color of the button at runtime i.e How to handle such events at runtime.
Please Reply soon
Ashok Reddy(ashokbngr@gmail.com)
|
|
|
|
|
You will have to ownerdraw the button.
Here[^] is a demo.
Nibu thomas
Software Developer
|
|
|
|
|
u have to change the property of button to BS_OWNERDRAW, overide the function DrawItem .You can now draw the button from that function.
There are many article in code project that describes owner draw button. Simply Search...
nave
|
|
|
|
|
you need to class derived from CButton and use WM_DRAWITEM
if you want to change CButton
and in the Codeproject you found your answer
|
|
|
|
|
If you want to change background color you can override OnEraseBackGround Func.
else you override OnDrawItem to draw on your button.
You can capture message CTLCOLOR_BTN to handle such events at runtime.
|
|
|
|
|
|
Hi
How to capture System Shutdown/Restart/Stand By messeges from a Visual C/C++ Program
thanx in advance
by
KK
|
|
|
|
|
Take a look at WM_QUERYENDSESSION and WM_ENDSESSION .
Nibu thomas
Software Developer
|
|
|
|
|
Hold on!, i've been trying to capture these messages in the PreTranslateMessage, but i dont know what mistake i'm making. its not getting trapped. can you help me out?
<code>
BOOL CTESTMFC2Dlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message==WM_QUERYENDSESSION)
{
if(pMsg->lParam==0x80000000)
{
}
}
if(pMsg->message==WM_ENDSESSION)
{
}
return CDialog::PreTranslateMessage(pMsg);
}
</code>
Actually the 0x80000000 is to check if its a LogOff. the owner of this thread may also like to see your reply.
VuNic
|
|
|
|
|
BOOL CMainFrame::OnQueryEndSession()
{
if (!CFrameWnd::OnQueryEndSession())
return FALSE;
AfxMessageBox("I caught System ShutDown");
return TRUE;
}
also c WM_ENDSESSION
|
|
|
|
|
If its a dialog based application?
VuNic
|
|
|
|