|
The problem was that I would set a flag for my OnDraw routine to do as you suggested, but in the function that set that flag I simply did
flag = NOTDRAW;
Invalidate(0);
When I did this, with the OnDraw routine simply returning when it saw that flag, the old info in the client window would not be erased.
When I changed things to
Invalidate(0);
flag = NOTDRAW;
Invalidate(0);
in the function that set the flag, then the old info in the client window would get erased. So I'm confused as to what is happening with the Invalidate(0) function.
|
|
|
|
|
I am not sure why it happens. I usually use the Invalidate () without 0 and just afterwards an UpdateWindow (). It is supposed that Invalidate triggers the update, but I got used to that when I start coding in MFC because of some tutorials I used. The only problem with this is that depending on how much info is on the screen it can make it flick a bit.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Kwanalouie wrote: I am looking for some window function that will clear everything
Write a handler for WM_ERASEBKGND [^]
/ravi
|
|
|
|
|
I have a doubt whether it is possible to creat a C++ object in C with new operator. As show below?
//////////////////////////ExmCPP.cpp///////////////////////////////////////
class TDM_API
{
public:
TDM_API();
~TDM_API();
int WriteIntoLog(const string sStr);
}
////////////////////ExampleC.c File/////////////////////////////////////
#ifdef __cplusplus
extern "C" {
#endif
DLLEXPORT int td_init()
{
TDM_API* td = new TDM_API();
m_nHandle = (int) td;
td->WriteIntoLog("This is for test");
return (int) m_nHandle;
}
|
|
|
|
|
By default, Visual Studio will compile ExampleC.c as a C program, and will signal an error on the new operator. You can set a compile option to compile it as C++, which eliminates the error.
|
|
|
|
|
can you please guide me to change the compailer option in VS 6.0.
Thanks,
Nandu
|
|
|
|
|
Hmmm. I just started up VC6. It doesn't have an option for compiling a .C source file as C++. This option must have come later, in Visual Studio .NET or 2003.
You may have to rename your .C file to .CPP in order to get VC6 to compile it as C++.
|
|
|
|
|
Thanks, the above solution solved my problem.
|
|
|
|
|
Hi all,
Esc Button use for Close the Dialog Box.i want to remove the funcnality how can i do this.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
If you are using MFC, add an OnCancel() handler to your CDialog -derived class.
|
|
|
|
|
He wants to remove the OnCancel, not to call it :P
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
It sounded like he wanted to prevent the ESC key from closing the dialog. To do that in an MFC application with a CDialog -derived dialog class, you add an empty OnCancel member function.
You can't "remove" OnCancel in any case. The CDialog window procedure is going to call it, either in your class or the base class.
|
|
|
|
|
Gary R. Wheeler wrote: It sounded like he wanted to prevent the ESC key from closing the dialog
Yes, but if you add the OnCancel () in MFC it usually comes with the return CDialog::OnCancel ()... you just said to add the OnCancel but nothing about an empty OnCancel (what you do have said now )
EDIT:
Gary R. Wheeler wrote: add an OnCancel() handler
Sorry I missread the word handler , so actually the dialog has the function in header but no code in definition, isn't it?
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: so actually the dialog has the function in header but no code in definition, isn't it?
No, it is not like that. In that case, the linker will issue an unresolved external symbol error.
The OnCancel() function is a virtual function, which can be over-ridden in order to customize its behavior.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
You can add the OnCancel and insteads of return CDialog::OnCancel (); just use an empty return;
Maybe is not the best option but it should work. Other possibility should be to intercept the message loop, but I don't know for sure how to do it correctly, sorry.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
now it is not close even with close button or close option from system menu.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
If you just want to disable the Escape button, then do it in the PreTranslateMessage() . See sample below. Now your escape keydown will not be processed. So it won't affect the behavior of cancel and close buttons.
BOOL CDialogDlg::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE ))
{
return TRUE;
}
return CDialog::PreTranslateMessage(pMsg);
}
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thats what I meant. Thanks for the answer.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
Hello all,
I have requirement of encrypting a string in VC++ and decrypting it in ASP. so how could i accomplish this task.??
Please help me out in this situation.
Thanks & Regards,
Hemang
|
|
|
|
|
You can use crypto++ for encryption in C++. For decrypting in ASP...well ask in ASP forum
-Saurabh
|
|
|
|
|
|
Hi Friends
How to get count of columns in a CListCtrl
-RisKhan-
|
|
|
|
|
Use Header Control of CListCtrl.
For Example:
CListCtrl* pmyListCtrl;
int nColumnCount = pmyListCtrl->GetHeaderCtrl()->GetItemCount();
Mukesh Kumar
Software Engineer
|
|
|
|
|