|
Call Invalidate and draw nothing in the OnPaint()
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
thanx for your reply;
I used your approach. However i had the background (the web browser) erased evrytime Invalidate is called. So i did what guys suggested (hiding the control).
cheers
llp00na
|
|
|
|
|
Cédric Moonen is absolutely correct; that is the simplist solution.
But since you say you have a picture control placed on top of the other window, why don't you just hide it. The problem with not drawing anything when OnPaint() is called (for the picture control) is that the picture control is still there and it may call a function to erase the background before calling OnPaint(), which would leave an empty blank spot on the screen.
Just some thoughts,
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thanx alot,
Cedric Moonen' suggestion was n't giving me the right result. It's exactly how u explained it. I had the background erased everytime Invalidate was called. Hiding the control worked much better.
llp00na
|
|
|
|
|
Maybe for you task is more appropriate to hide your picture control? When you click the Clear button, you can call m_cMyPicture.ShowWindow(SW_HIDE) function for your picture, and when you click the Draw button you can execute m_cMyPicture.ShowWindow(SW_SHOWNA) . Now you do not need to check a flag in OnPaint .
|
|
|
|
|
hi dear i am sorry i put my problem but u dont ans me
so plz
tel me result for this
cn u send me an example as i easily undestand
i hav three dialog boxes
third dialog box contain menu
i want that when i goto third dialog box from first dialog box then its menu are disabled but when i go from second dialog box third dialog box menues are not disabled.
plz send me code how to do it
note : specially for viorel
Please mail me
|
|
|
|
|
Thanx very much for the code. It really helped alot, hiding the control was the trick. But i still need flag in OnPaint() because the drawings are only done when the user requests.
llp00na
|
|
|
|
|
how do i incorporate socket arrays in this code..
CAsyncSocket m_sListener,m_sConnected;
void CCsDlg::OnAccept()
{
CString serverIP;
UINT port;
port=2000;
serverIP="10.1.46.37";
if(m_sListener.Accept(m_sConnected))
{
m_sConnected.GetSockName(serverIP,port);
UpdateData(TRUE);
}
else
{
AfxMessageBox("Cannot Accept Connection");
}
}
|
|
|
|
|
Hi,
I need develop a zip/unzip folders and files in C++.
Have any one help me with some open source link or example code?
Tx
|
|
|
|
|
|
Check out InfoZip. http://www.info-zip.org/[^]
AFAIK, both Winzip and java.util.zip are based om InfoZip. So there won't be any compatibility problems using it.
|
|
|
|
|
|
Hi all,
I like to create a kind of digital clock as an ocx. therefore other programmer can use my ocx inside their program. problem is:
1. How can i set up the timer for an ocx?
Note: I have create a WM_CREATE message handler and put the SetTimer command in it. Then I Create a WM_TIMER message handler and put the increment of the "second" in it, and display the number inside the OnDraw. But, it seems that the WM_TIMER message handler is never been called (that make my "Second" number never changed)
2. Is it possible to use a dialog box for an ocx, or do I have to always use OnDraw to draw something inside the ocx?
Below is the code that mimic the functionality of my digital clock. I use a data member called m_number that has been set to 0 inside the CxxxCtrl constructor. I expect to have this number increased each second elapsed. But it just didn't work. Any help please. Thanks.
// CTimerOcxCtrl::OnDraw - Drawing function
void CTimerOcxCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
CRect rectOcx = rcBounds;
CString strNumber;
strNumber.Format("%ld", m_number);
pdc->DrawText(strNumber, rectOcx, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}
/////////////////////////////////////////////////////////////////////////////
// CTimerOcxCtrl message handlers
void CTimerOcxCtrl::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
m_number ++;
if (m_number > 100)
m_number = 0;
COleControl::OnTimer(nIDEvent);
}
int CTimerOcxCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
/*
CWnd *pMainWnd = AfxGetMainWnd();
HWND hWnd = pMainWnd->GetSafeHwnd();
*/
//SetTimer(hWnd, ID_TIMER1, 100, NULL);
SetTimer(ID_TIMER1, 100,NULL);
return 0;
}
|
|
|
|
|
budihartanto wrote: Is it possible to use a dialog box for an ocx,
its possible..
in the CTimerOcxCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
funtion u can create a child dialog. It will be displayed when the ocx is inserted.
nave
|
|
|
|
|
budihartanto wrote: But, it seems that the WM_TIMER message handler is never been called (that make my "Second" number never changed)
I think you need to invalidate or redraw the window on each WM_TIMER message. In your OnTimer handler, before returning you should try one of this:
InvalidateControl(NULL, FALSE);
or
InvalidateControl(NULL, TRUE);
or
Invalidate(FALSE);
or
Invalidate(TRUE);
or
RedrawWindow(NULL, NULL, RDW_UPDATENOW);
or
RedrawWindow(NULL, NULL, RDW_UPDATENOW | RDW_ERASENOW);
or other appropriate.
Hope it helps.
|
|
|
|
|
Dear Sir,
this is like A declare my Command :
CCommand<caccessor<cdboficag2accessor> >table;
when i do table.MoveNext() all is good but when I write table.Moveprev() it can't work.
I am using Visual c++ 6.0.
What to do.
|
|
|
|
|
Make sure that you havent opened the cusrsor set as forwardonly. Double chk how you opened the table.
cheers...milton.
|
|
|
|
|
Can you show me how to open table not fordwarding
|
|
|
|
|
mikobi wrote: table.Moveprev() it can't work.
What doesn't work with it? Is the compiler/linker complaining? Is an exception thrown? Please elaborate on the "error."
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
No error, but the moving previous to the record back is not done. That my complain
|
|
|
|
|
Have you stepped into the method to see what condition is prohibiting the movement?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I don't understand what happens because when I do MoveFirst() I go to the next record, but why when i do MovePrev it does n't go back. That's my complain
|
|
|
|
|
Hence my suggestion to step into the MovePrev() call to see what is actually happening.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello!
I hope someone can help with this stuff.
I tried to set up a sample webservice/client stuff, the service is the default c# helloworld service which comes with the ide, the client is a simple c++ mfc app.
I followed the tutorials on msdn to create and deploy the service, which worked fine.
Then i followed the instructions on how to create a client, add web resource etc.
The problem is, that when i try to run the client from my system (windows 2000 sp4) it fails before even starting, saying:
"The procedure entry point getaddrinfo could not be located in the dynamic link library WS2_32.dll."
It runs finely on windows 2003 though.
I googled around a bit for the cause of this problem, but i couldn't find any solutions for win 2000, only xp or 2003.
I checked the 2003 and 2000 ws2_32.dll-s with depends, and in the 2000 version i didn't find the mentioned function. Why does my compiler include references to a function not in my dll?
If anyone can help me to solve this problem, please post a reply.
Ngetal
|
|
|
|
|
Now. I have to change messagebox to (OK - Cancel) to the French language. In source English use MB_OKCANCEL. I have to change MB_OKCANCEL to another to my messagebox have 2 buttons: OK - Annuler
Please help me
Software Engineer
|
|
|
|