|
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
|
|
|
|
|
afx_msg void CShutWindowDlg::OnEndSession( BOOL bEnding )
{
AfxMessageBox("Shut Down Message Caught");
}
|
|
|
|
|
Did you chage your post?? what's that afx_msg void?? it only returns a BOOL right?
Btw, still its not working.
I tried both ::OnEndSession(BOOL b) and ::OnQueryEndSession()
BOOL CTESTMFC2Dlg::OnEndSession(BOOL bEnding)
{
//Not entering here
}
BOOL CTESTMFC2Dlg::OnQueryEndSession()
{
// Not entering here
}
What'd have gone wrong?
VuNic
|
|
|
|
|
afx_msg void CShutWindowDlg::OnEndSession( BOOL bEnding )
{
AfxMessageBox("System ShutDown Message Caught");
}
Handel WM_ENDSESSION Message
|
|
|
|