|
masnu wrote: CView* pView = CFrameWnd::GetActiveView();
GetActiveView() is not a static function (i.e., one that can be called without an actual object). You must call it in the context of a CFrameWnd object, not CFrameWnd itself.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
David,
From what you said I assume I need to put the code in my CMainFrame class, which I did. I no longer get a compiler error, but I get an access violation error in the objcore.cpp file:
BOOL CObject::IsKindOf(const CRuntimeClass* pClass) const<br />
{<br />
ENSURE(this != NULL);<br />
ASSERT(AfxIsValidAddress(this, sizeof(CObject)));<br />
<br />
CRuntimeClass* pClassThis = GetRuntimeClass(); <br />
<br />
ENSURE(pClassThis);<br />
return pClassThis->IsDerivedFrom(pClass);<br />
}
What I have is:
void CMainFrame::Scroll()<br />
{<br />
CDC* pDC = CFrameWnd::GetActiveView()->GetDC();<br />
<br />
CStripChart* pStrip;<br />
pStrip->Scroll(pDC);<br />
}
Any suggestions?
Thanks.
|
|
|
|
|
masnu wrote: CStripChart* pStrip;
pStrip->Scroll(pDC);
This looks suspect. How has pStrip been initialized?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
When I debug, that code doesn't even run. The problem occurs when
CDC* pDC = CFrameWnd::GetActiveView()->GetDC();
is executed.
CStripChart is just a class I created to accept a DC and draw a grid to it and plot what ever data is sent to it. I have scroll function as a seperate thread. Could this be a problem?
Is there any way I can get a pointer to the view's DC and pass it to my class for furture use? Or would I need to pass a new DC everytime I wanted to update my window?
|
|
|
|
|
What does GetActiveView() return? If it is NULL , then dereferencing the pointer will cause problems.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
It doesn't return anything. I get the error before it returns.
|
|
|
|
|
When/how is CMainFrame::Scroll() called?
masnu wrote:
I get the error before it returns.
Since GetActiveView() and GetDC() are called within the same statement, are you sure?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
As a quick test I modified the app's file open command:
ON_COMMAND(ID_FILE_OPEN, &CMainFrame::Scroll)
|
|
|
|
|
masnu wrote: ON_COMMAND(ID_FILE_OPEN, &CMainFrame::Scroll)
What is the ampersand doing there?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I just followed the same format as all the other ON_COMMAND declarations. I tried runnig the program without the ampersand and I still get the same problem.
|
|
|
|
|
void CMainFrame::Scroll()
{
CDC *pDC = this->GetActiveView()->GetDC();
You may be right
I may be crazy
But it just may be a lunatic you’re looking for
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
I have created my own class CThread inherited from CWinThread,
I am Starting Threads using
for loop begin
AfxBeginThread(RUNTIME_CLASS(CThread));
for loop ends
I have created 15 thread in a loop, will they run parallely or with the time slice scheduling, Actualy I want that they should run parralelly , so that i can write in 15 different file simaltinoiusly.
I want to work fast on these threads.
Regards.
|
|
|
|
|
zahid_ash wrote: ...I have created 15 thread in a loop, will they run parallely or with the time slice scheduling...
They will never run in parallel on a uniprocessor machine.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Is there any technique to write in the in the different file parallely or read from them .
i want to shorten the read write time
Regards.
|
|
|
|
|
|
I think so, as long as the read and write operations are not happening at the exact spot in the file. See LockFile() for more.
zahid_ash wrote: i want to shorten the read write time
Well, creating a bunch of threads on a uniprocessor machine is one way to not "shorten the read write time." The overhead of context-switching between all of the threads will be your demise.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Will they run parallely on multi processor machine.
How can i demise the context switching of thread,
Regards.
|
|
|
|
|
zahid_ash wrote: Will they run parallely on multi processor machine.
Yes, but I've no experience with this. I think SetThreadIdealProcessor() will be required.
zahid_ash wrote: How can i demise the context switching of thread,
I'm not sure exactly what it is that you are asking here, but I think the answer is, "When more than one thread is involved, the processosr will need to periodically switch between them so that at any given monent, only one thread is actually active." This obviously incurs overhead that cannot be avoided.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi!
DOes anybody know, what I have to do, if I want either to create an new .XML-File or open an existing .XML-File to write at the beginning of this file?
I thought, that I can handle this like a normal text-file but that has been a mistake.
So, if anybody knows something about this, please let me know!
Thanks, Hanno
|
|
|
|
|
Use IXMLDocument or DOMDocument .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks for your help. Could you send a small piece of code, explaning this a little bit?
With best regards, Hanno
|
|
|
|
|
Why not just Google for those two interfaces? Also try CodeProject articles, and MSDN.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
If you want a light-weight XML library (i.e. not MSXML), have a look at http://tinyxml.sourceforge.net/[^].
I used TinyXML in several projects, it works pretty well.
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Whats the symbol to put to stdin to finish its reading
//console app reading in a loop until that magic symbol
while(res)
res = fscanf(stdin,"%s",&str);
//while pressing in console
string1
string2
string3
??? how to quit it
9ine
|
|
|
|
|
Use F6 or Ctrl-Z.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|