|
Is there some limitation on the vector template that I should know about?
I have a vector of 45,000 string pointers. It's a dictionary file . Anyway, I need to iterate through these strings checking if more than one definition is present on the same line. Multiple definition are seperated with the '|' character, when I find one I create a new string and push it to the end of the vector. Simple enough you would think.
So, here is my code.
vector< LPENTRY >::iterator vIter = vEntries.begin();
while ( vIter != vEntries.end() )
{
LPSTR szEng = strchr( (*vIter)->English, '|' );
if ( szEng != NULL )
{
LPENTRY pEntry = new ENTRY;
*pEntry = *vIter;
strcpy_s( pEntry->English, MAX_LINE_LENGTH, &szEng[ 1 ] );
*szEng = 0x00;
vEntries.push_back( pEntry );
}
vIter++;
}
The problem is, when the vector grows to a size of 61447 and when pushing a new value to the end, it causes the iterator to become invalid ( pointing to 0xfeeefeee ). Hence when trying to increase it it triggers a breakpoint. Any ideas what is going wrong?
Waldermort
|
|
|
|
|
Firstly, see here[^] for the meaning of 0xfeeefeee .
See here[^] for a description of "iterator invalidation". Here's a quote:
[2] Memory will be reallocated automatically if more than
capacity() - size() elements are inserted into the vector. Reallocation does not change size(),
nor does it change the values of any elements of the vector. It does, however, increase capacity(),
and it invalidates [5] any iterators that point into the vector.
Steve
|
|
|
|
|
That value of 0xfeeefeee should have given it away. I worked around the issue by throwing out the iterator and used the indexing method instead. Though thanks for the reply
Waldermort
|
|
|
|
|
Hi...
CString str;
str = "www.google.com";
ShellExecute(NULL, "open" ,str, NULL, NULL, SW_SHOW);
this is my code....
but the error is
'ShellExecute': identifier not found.
what is the procedure for use shellexecute?
paulraj
|
|
|
|
|
|
already i included the header file...
paulraj
|
|
|
|
|
include
shellapi.h enclosed with <> (notice the '<>' instead of '""')
Come online at:-
jubinc@skype
|
|
|
|
|
i include like #include <shellapi.h>
now also same error
paulraj
|
|
|
|
|
Show us more code. Are you including the file in the correct place?
Steve
|
|
|
|
|
#include "stdafx.h"
#include "Pdf_Example.h"
#include "Pdf_ExampleDoc.h"
#include "Pdf_ExampleView.h"
#include <shellapi.h>
...
...
...
void CPdf_ExampleView::OnBnClickedButton1()
{
CString str;
str = "www.google.com";
ShellExecute(NULL, "open" ,str, NULL, NULL, SW_SHOW);
}
thats all....
if i click a button that should be open....
shall i put instead of str, D:\\Paul.pdf?
paulraj
|
|
|
|
|
Just for tracking the error. Please try like this and let me know the result...
#undef _INC_SHELLAPI<br />
#include <shellapi.h><br />
...<br />
...<br />
...<br />
void CPdf_ExampleView::OnBnClickedButton1()<br />
{<br />
CString str;<br />
str = "www.google.com";<br />
ShellExecute(NULL, "open" ,str, NULL, NULL, SW_SHOW);<br />
<br />
}
|
|
|
|
|
i got the output for MFC.
how to open in this for windows mobile6?
can help anybody?
paulraj
|
|
|
|
|
But what was the problem?
|
|
|
|
|
Probably the programmer?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Everything looks fine, except you should probably use SW_NORMAL , but this will not be the cause of your problems. What's happening? Are you still getting a compiler error?
Steve
|
|
|
|
|
I don't see anything wrong with your code. Is rebuilding the whole thing of any help?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
hi... i got it.......
thanks to all....
paulraj
|
|
|
|
|
You're welcome. Glad you got it done.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
What was the issue? I'm having the same and I can't resolve it
|
|
|
|
|
When I click them, they become visible again.
void CMyDlg::OnPaint()
{
...
Graphics g(GetSafeHwnd());
g.DrawImage(m_pMemBmp,0,0);
}
|
|
|
|
|
U should draw the image in response to
WM_ERASEBKGND message
Come online at:-
jubinc@skype
|
|
|
|
|
I don't have any great experience with GDI+ as such, but it may help if you tick the "Clip children" style for your dialog box.
Iain.
|
|
|
|
|
|
This is absolut correct. If you wish your image be drawn as background, you draw it in the OnEraseBkgrnd() handler.
Greetings from Germany
|
|
|
|
|
can any one give me idea how to play .tga file on device context.
GDI+ is not playing. I did not want to use third party library.
|
|
|
|