|
In order for this to work, both of your view classes must support dynamic creation.
The macro 'DECLARE_DYNCREATE' or 'DECLARE_DYNAMIC' must be found at the start of both classes header files. The parameter for the macro is the class name.
Additionally, a macro 'IMPLEMENT_DYNCREATE' or 'IMPLEMENT_DYNAMIC' must be placed near the top of your implementation file (after the headers, but before function definitions). Parameters for this macro are the class name and the name of the base class.
See the MSDN for information about the differences between these macros.
If all macros are correctly placed in your files, then see if the error is caused by missing header files. Your main frame implementation file must have the header files of both view classes. Otherwise an error is generated.
In addition, the way you create the views is a bit dangerous. A more convinient way is to add the headers into the main frame header file, then create two member variables (either static or dynamic), one of each view class. After this, you can create the views, and specify the splitter window as the parent. Using 'CSplitterWnd::IdFromRowCol' allows you to get the identifier of the pane. When you put this identifier as the id of the newly created view window, the view gets placed into inside the pane.
If you use this technique, however, you must be certain that you destroy the views when your program is closing up. You must first destroy the view windows, then destroy the splitter window, and after this, if you used dynamic variables, you can delete the reserved memory.
There is an article in the works about this method. I'm not sure when it will be out, but I bet in the next few months or so..
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
If all macros are correctly placed in your files, then see if the error is caused by missing header files.
When I add header files of both view classes to the main frame implementation file, I get another error:
MySDI\MySDIView.h(17): error C2143: syntax error : missing ';' before '*'
- this one refers to the line: CMySDIDoc* GetDocument() const;
class CMySDIView : public CView
{
DECLARE_DYNCREATE(CMySDIView)
protected: // create from serialization only
CMySDIView();
// Attributes
public:
CMySDIDoc* GetDocument() const;
...............
and there are 3 more errors that are triggerred by the first one:
MySDI\MySDIView.h(17): error C2501: 'CMySDIView::CMySDIDoc' : missing storage-class or type specifiers
MySDI\MySDIView.h(17): error C2501: 'CMySDIView::GetDocument' : missing storage-class or type specifiers
MySDI\MySDIView.h(17): warning C4183: 'GetDocument': missing return type; assumed to be a member function returning 'int'
How can I fix this?
Thank you for you help!!!!
|
|
|
|
|
At the top of the MainFrm.cpp, you probably need something like:
#include "MainFrm.h"
#include "MySDIDoc.h"
#include "LeftPaneView.h"
#include "RightPaneView.h"
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
when I do this, I get the error I described above (please, see it in the third message in this thread)

|
|
|
|
|
The compiler is telling you that CMySDIDoc is being referenced before it has been declared.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I added
#include "MySDIDoc.h"
to the MySDIView.h file and it solved the problem.
Thank you!!!
|
|
|
|
|
I'm using a CHtmlView control and I want to store the content displayed in the control in a CString object or as a string. How do I go about it?
Thanks in advance,
Vikram.
Shameless plug: http://www.geocities.com/vpunathambekar
"And above all, watch with glittering eyes the world around you because the greatest secrets are always hidden in the most unlikely places. Those who don't believe in magic will never find it." - Roald Dahl.
Mrs. Schroedinger: "Erwin, what have you been doing to the cat? It looks half-dead!"
|
|
|
|
|
|
How?
I get an error saying GetSource is not a member of this class. And MSDN says GetSource belongs to IErrorInfo.
Am I completely missing the point?
Vikram.
Shameless plug: http://www.geocities.com/vpunathambekar
"And above all, watch with glittering eyes the world around you because the greatest secrets are always hidden in the most unlikely places. Those who don't believe in magic will never find it." - Roald Dahl.
Mrs. Schroedinger: "Erwin, what have you been doing to the cat? It looks half-dead!"
|
|
|
|
|
Sorry, they added that API in VC7. This[^] link may help. Unfortunately Ehsan's articles[^] aren't available because the site is currently down.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Alright, I tried it under VS.net 2002 and it works. Would there be a way of getting the text alone, without the tags?
I could strip out the tags, but just want to know if there's an easier way out.
Vikram.
Shameless plug: http://www.geocities.com/vpunathambekar
"And above all, watch with glittering eyes the world around you because the greatest secrets are always hidden in the most unlikely places. Those who don't believe in magic will never find it." - Roald Dahl.
Mrs. Schroedinger: "Erwin, what have you been doing to the cat? It looks half-dead!"
|
|
|
|
|
If you decide to strip the tags, there's a removeHtml() API in this[^] article that you may want to use.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Re: chatting, check your email. Yahoo web messenger is hopelessly broken.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
Re: chatting, check your email. Yahoo web messenger is hopelessly broken.
I wasn't able to get YM to connect.
Vikram.
Shameless plug: http://www.geocities.com/vpunathambekar
"And above all, watch with glittering eyes the world around you because the greatest secrets are always hidden in the most unlikely places. Those who don't believe in magic will never find it." - Roald Dahl.
Mrs. Schroedinger: "Erwin, what have you been doing to the cat? It looks half-dead!"
|
|
|
|
|
Vikram, I'm also reachable on AIM (see your email).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You can call GetHtmlDocument() , which returns a pointer to a IHTMLDocument .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi, I am trying to write/read a large vector of vector of doubles to comma delimited text file using std::ofstream. The problem is that it doesn't seem to be very fast, taking a few minutes at a time.
The matrix to be written/read is of the size N x M, where N is approx. 2,000 and M is between 1,000 and 40,000. That means a file size of up to approx. 800Mb for M == 40,000.
Should I consider serialization as something that might be faster?
At the moment I am not doing anything complicated, below is my code for writing the 'spreads' matrix to file (removed conditional error checks, etc):
ofstream write_file;
write_file.open(fileName.c_str(), ios_base::out | ios_base::trunc );
int numRows = spreads.size();
int numCols = spreads[0].size();
for (int row = 0; row < numRows; row++)
{
for (int col = 0; col < numCols; col++)
{
write_file << "," << spreads[row][col];
}
write_file << endl;
}
write_file.close();
When reading it in I do much the same thing, reading in the file line by line and using a split string algorithm to extract each row of doubles, building up the matrix of doubles.
The CPU is at 100% at all times when this is run, so it's not slow file I/O that's the problem.
Any suggestions would be appreciated.
Thanks,
Christopher
The bomb lives only as it is falling
|
|
|
|
|
One solution is the STL's copy() algorithm and ostream_iterator.
Kuphryn
|
|
|
|
|
copy() works, but i still need to do it row by row. it turns out to be only marginally faster for 1900 rows and 10000 columns. It takes 91 seconds to write this matrix to file using copy() and 95 seconds using a raw loop.
was considering writing the raw byte in memory representation of the matrix to file using the Win32 API WriteFile(). i don't know how wise that would be, or how to do it properly though.
christopher
The bomb lives only as it is falling
|
|
|
|
|
I had a similar problem, when I read a large vector from ifstream via STL.
It's a sad disadvantage of STL - it's too generic to be efficient. For example the stl::copy of vectors is implemented as a cycle, which applies copy constructor to each member of the vector. If you have a vector of complex objects with nontrivial copy constructors, this approach is fair. But if you have for a vector of int 's or char 's, the STL implementation is too much slower than a simple memcpy .
I think, that std::vector is internally stored as a continuous array of objects, so the iterators to the first and last members should be pointers to begin and end of a memory block, where the array is stored. Thus using of CFile::Write is simple.
Reading a vector is more complex, I think, that you should write your own allocator, which builds a vector from a memory block. But it's only my opinion, I've never write any allocator
The general solution would be to write a STL extension with containers optimized for special member types. Do anybody know, whether such a library exists?
Robert-Antonio
Love, truth and electric traction must gain victory over hate, lie
and diesel traction.
|
|
|
|
|
I have some code that retrieves simple URL's as follows,
DWORD nStatus = NULL;
CHttpFile* pFile = NULL;
CHttpConnection* pConn = NULL;
CInternetSession ISess;
pConn = ISess.GetHttpConnection(sz_Server);
pFile = pConn->OpenRequest(CHttpConnection::HTTP_VERB_GET, sz_ServiceURL);
pFile->SendRequest();
pFile->QueryInfoStatusCode(nStatus);
if ( nStatus == HTTP_STATUS_OK )
{
CString strBuff;
CString strRead;
while ( pFile->ReadString(strRead) )
{
strBuff += strRead;
}
cout << (LPCTSTR)strBuff << endl;
}
I would like to remove the looping reading and replace it with a single read. But I'm not able to figure out how big a buffer to allocate. Is there some method of the CHttpFile class that I could use that would give me the amount of data to expect. I've tried the GetLength method, but this is not returning the correct value. Thanks.
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
I have an application developed on Win2K. The problem that I am experiencing with my application has to do with the non-client area(title bar). My application changes the color of the background of the title bar. So, I have to redraw the min/max/close buttons. On Win2K, everything seems to work ok, but I have noticed that when I run my application on Windows XP(with theme enabled), my min/max/close buttons are off. The buttons are bigger, but the hit tests are off(obviously). How do I detect themes enabled for an application developed on Win2k(without uxtheme.dll/.lib/.h etc)?
The CaptionPainter class that I am using is from the following link:
www.codeproject.com/dialog/gradienttitlebar.asp
|
|
|
|
|
|
Mike,
Thanks for the reply, but I am constrained to Win2k development. SetWindowTheme doesn't come with Studio 6.0 libs. Maybe platform SDKs?
|
|
|
|
|
It doesn't matter what OS you use for development, you can call any API you want. BUt yes, you'll need the Platform SDK to get the lastest header files.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|