|
What is your problem?
In OnDraw() , you draw the curve (MoveTo() , LineTo() ) into the client rect . Whenever you get new data and fell the need to redraw, you Invalidate() .
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
hello
thanks for your answer
my problem is, how to make the curve move smoothly? it move from right to left with time going
wuhuaiji
|
|
|
|
|
Do you want algorithms to interpolate and smooth the curve-data?
Or do you want to reduce flicker on the screen?
Either case, there are articles here on codeproject and on the net.
E.G. here[^].
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
have you googled to for "Active X Control to draw a curve"
there are somany articles and active X controls related to that topic.
or if you want to develop one active X control, then i can guide you.
|
|
|
|
|
But why he must uses of Activexs control?
|
|
|
|
|
good question,
but as he said, he want to draw it on a picture.
so i thought, he would have to develop an AX to fulfil his task.
iam not sure, weather any existing control, has a mixture of both image and a graph on it.
|
|
|
|
|
Why are you so obsessed with ActiveX controls . Why not simply use a custom control ?
Do you know why ActiveX are used ? Do you know that the purpose of ActiveX is to have a control that can be used in different languages. If you just developping a C++ app, why bothering with an ActiveX when you can simply use a custom control.
|
|
|
|
|
yes you are right.
But i feel comfortable with AX because most of the times I use it in other languages also. Thats why i'm used to that.
Thank You.
|
|
|
|
|
Well, but for somebody that only wants to use a control in its C++ application, this is a bad advice to tell him to develop its own ActiveX control. Why do you want to make things even more complex to him ? Developping an ActiveX control is more complicated than developping a simple custom control.
|
|
|
|
|
yes and thanks,
i agree to your point.
|
|
|
|
|
thanks
i have googled, and now i know how to draw a static curve
but i want to draw a dynamic curve, which can move smoothly with time going
wuhuaiji
|
|
|
|
|
what is the difference you are referring to as static and dynamic curves.
you mean, you want to see the curve increasing from time to time, at run time?
if it is so, put your plotting code in a thread.
but i can suggest ful fledgedly, only, if u can provide a sample of code here, how you made it static.
gud luck.
|
|
|
|
|
|
Why you cant draw a curve with existing APIs? What kind of data and curve are you intended to use?
- NS -
|
|
|
|
|
thanks a lot
first, i am a newbie,
then, i just want draw a curve, which can move
now i have got many friends' help, thanks for all of your answer
and i think maybe i have found the solution
indeed, the question is a little problem, the big problem is that i am fresh in VC
wuhuaiji
|
|
|
|
|
You have two options:
1) Use an existing control, there are plenty existing on this website. I also developped one control that can do that (see the link in my sig). I think it is the easiest solution and the one that will save you a lot of troubles.
2) Create your own control. You seem to have some problems with the fact that the line should move. Well, there is no miracle: if you want to do such a thing, you have to make it move yourself (redraw the line completely).
I warn you that this is far from being the easiest solution. If you are completely new to this, I suggest you take the first option. But if you have some time and want to learn how it works, then it can be interesting to take that path. But then, start by reading some tutorials about how to create custom controls before starting to create your own.
|
|
|
|
|
Hi everybody,
i create my self a menu-object, so i can display the menu-items dynamically :
CMenu *Home = new CMenu();
Hom->AppendMenu(MF_STRING,ID_MYMENU_GO,"Go");
Home->TrackPopUpMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON,point.x,point.y,Parent);
The ID_MYMENU_GO isn't known and the menu item is disabled.
If i create a new String-Ressource with the ID of ID_MYMENU_GO and set a String of "-"
the Menu-Element is displayed correctly ...
Is it also possible to set the Menu-Item ID to the project/mainform/.. so that
the application knows the ID ?
For example adding the String via programmation into the known ID's ...
Big thanks for help
|
|
|
|
|
|
just wanted to know if there is any readymade application where in progress bar is used. want some application where the progress bar should should tell me the progress while i am copying or playing a song.
|
|
|
|
|
|
Im not sure CSkinProgress[^] is answer to your question or no if its not more explain will be helpful.
|
|
|
|
|
Hello.
I have found a bug (in Windows maybe) while writting in Win32 API.
I have the following code executed:
OPENFILENAME OpenFileName={0};
TCHAR szFilter[]=__TEXT("Graphs (*.graph)\0*.graph\0All Files(*.*)\0*.*\0\0");<br />
TCHAR szFile[MAX_PATH];<br />
szFile[0] = __TEXT('\0');<br />
OpenFileName.lStructSize = sizeof(OPENFILENAME);<br />
OpenFileName.hwndOwner = hwnd;<br />
OpenFileName.hInstance = NULL;<br />
OpenFileName.lpstrFilter = szFilter;<br />
OpenFileName.lpstrCustomFilter = (LPTSTR) NULL;<br />
OpenFileName.nMaxCustFilter = 0L;<br />
OpenFileName.nFilterIndex = 1L;<br />
OpenFileName.lpstrFile = szFile;<br />
OpenFileName.nMaxFile = sizeof(szFile)-1;<br />
OpenFileName.lpstrFileTitle = NULL;<br />
OpenFileName.nMaxFileTitle = 0;<br />
OpenFileName.lpstrInitialDir = NULL;<br />
OpenFileName.lpstrTitle = NULL;<br />
OpenFileName.nFileOffset = 0;<br />
OpenFileName.nFileExtension = 0;<br />
OpenFileName.lpstrDefExt = TEXT("graph");
OpenFileName.lCustData = 0;<br />
OpenFileName.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_LONGNAMES;<br />
if (GetOpenFileName(&OpenFileName)){<br />
return (CString)OpenFileName.lpstrFile;<br />
}<br />
return (CString)"";
This, as I hope you know, creates the Windows OpenFile Dialog.
When the window appears do the following:
1. Go to the Desktop.
2. Place the cursor above a file (not a link to a file) and wait for the tooltip to appear. Then press Esc to exit. Then execute again the code and do the same thing (on the same file extension). At that point I get a crash in SHELL32.DLL. See the debug output below. I tried that in an other app and I got the same crash. However, same apps do not crash, so I wonder if I am doing sth wrong or if someone knows sth more about this.
Loaded 'C:\WINDOWS\system32\xpsp2res.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Common Files\Ahead\Lib\NeroDigitalExt.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Common Files\Ahead\Lib\MFC71.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Common Files\Ahead\Lib\msvcr71.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Common Files\Ahead\Lib\msvcp71.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Common Files\Adobe\Acrobat\ActiveX\pdfshell.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.762_x-ww_6b128700\msvcr80.dll', no matching symbolic information found.
Loaded 'C:\Program Files\Illustrate\dBpowerAMP\dBShell.dll', no matching symbolic information found.
The thread 0x958 has exited with code 0 (0x0).
Loaded 'C:\WINDOWS\system32\browseui.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\netshell.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\credui.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\iphlpapi.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2_32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\ws2help.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\rtutils.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\shdocvw.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\crypt32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\msasn1.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\cryptui.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wintrust.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\imagehlp.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wininet.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\normaliz.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\iertutil.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\wldap32.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\riched20.dll', no matching symbolic information found.
The thread 0xD34 has exited with code 0 (0x0).
First-chance exception in PlotLibDemo.exe (SHELL32.DLL): 0xC0000005: Access Violation.
==============================================================================
I also think there is a bug in "SetClassLong" when changing the style and CS_NOCLOSE.
Any comments or suggestions would be appreciated.
Thanks.
kostas KEL
|
|
|
|
|
When I say:
"Then execute again the code and do the same thing"
I mean without closing your app and rerunning.
kostas KEL
|
|
|
|
|
Could u pls explain in detail? also pls explain what the following means?
" I tried that in an other app and I got the same crash. However, same apps do not crash, so I wonder if I am doing sth wrong or if someone knows sth more about this."
Ajay
|
|
|
|
|
e.g. Try the following:
Make a new MFC dialog project and add a button.
Add the code I posted above (without the return statement)
for the button click event.
Click on the button to make the code run once and then follow
the described steps (in my first post). Then click the button
again (after you close the dialog using "Esc" or "Cancel") and
do the same actions once again. Your app will crash when the
tooltip (showing the file type size etc...) appears for the
second time. And that happens ONLY on the Desktop (you should
try to see the tooltip on the Desktop, and on a file NOT a link
to a file).
I tried the same thing (openning a file etc...) with an other app
(that was a Hex editor I use) that was using (I guess) the same
code and I had the same crash.
However most of my apps on my PC do not crash when I do this (thank GOD).
e.g. Internet Explorer, Acrobat reader, WMedia Player etc.
I also tried to run the code on other machines and got the same crash
(using my app). The only things (dlls loaded by the shell) in common
where the SP2 DLL (xpsp2res.dll) and Acrobat (pdfshell.dll) (I think).
I don't know if the source of the problem is in one of them.
Note that my code is running perfectly in any folder and it fails ONLY
on the Desktop! I suspect that this is a bug of the shell, since there
is no obvious problem with my code.
I use MSVS 6 C++ and I have SP2 installed.
I do not use unicode libraries.
kostas KEL
|
|
|
|
|