|
Why do I get an access violation when I try to get the value of the iterator "it" in this piece of code? When I look at the iterators they have no valid pointers to the strings.
typedef vector<CString*> TFileList;
typedef TFileList::iterator TFileListIt;
CStringList strlistFiles;
fsDlg.SelectFile(&strlistFiles);
int nFiles = strlistFiles.GetCount();
if (nFiles > 0)
{
int nIndex;
TFileList FileList(nFiles);
CString strFileName, strNewFileName;
POSITION pos;
for (nIndex = 0; nIndex < nFiles; nIndex++)
{
pos = strlistFiles.FindIndex(nIndex);
FileList.push_back(&strlistFiles.GetAt(pos));
}
TFileListIt start, end, it;
start = FileList.begin();
end = FileList.end();
for (it = start; it != end; it++)
{
TRACE("> %s\n", **it);
}
}
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Try *(*it)? (Just guessing ).
Best regards,
Alexandru Savescu
|
|
|
|
|
The problem is that my vector seems to be empty, even though I am filling it with valid pointers.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Did you call size() to see if it is empty?
Best regards,
Alexandru Savescu
|
|
|
|
|
size() returns 8, but I have added 4 pointers to the vector.
I have noticed that the vector elements does not point to m_pchData of the string list elements I am using, but to some other address.
_First and _Last of the vector are updated when adding to the vector.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Try not to store pointers, store CStrings directly. There is not much of a performance differnce since the CString does not get copied, its reference is increased.
Best regards,
Alexandru Savescu
|
|
|
|
|
Nah, didn't work either. The push_back seems broken...
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
It's this line:
Fredrik Skoog wrote:
TFileList FileList(nFiles);
This creates nFiles items initially empty and I guess NULL pointers. That's why you had 8 items, because 4 have already been created.
You shoud use:
TFileList FileList;
FileList.reserve (nFiles);
reserve allocates enough space, but does not create any items.
Best regards,
Alexandru Savescu
|
|
|
|
|
Yep, that's it. Thanks a million!
I think I'll have to hit the books now
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Hi...
I've a class MyClass which contain a member CFile m_MyFile.
I want to pass this file (open) to another class CMyOtherFile derived from CFile...
I tested while passing the handle of m_MyFile but that doesn't work (and it's not recommanded)...
Anybody can help me???
Thanks...
Hello World!!!
from Raphaël
|
|
|
|
|
If I understand you correctly, I think you should rethink your design strategy.
I think it might be better to pass the file name if possible.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
Of course... I've found another solution... A better solution...
Thanks...
Hello World!!!
from Raphaël
|
|
|
|
|
Hi,
I have an MDI CFormView that makes itself the exact size of the outer frame, and resizes with it. However, you can still grab the right bottom edge and size the child viewform independently. I want this to not happen. The user should not be able to resize just the child form, only the outer frame with which the child form resizes faithfully as it is currently written.
Thanks,
ns
|
|
|
|
|
I think
cs.style &= ~WS_THICKFRAME;
in the child precreate is doing what I want. Thanks!
ns
|
|
|
|
|
Filter need some data before playing(about 170KB). Can the size be changed? Where do DirectShow handle it? Thank you!
|
|
|
|
|
I am currently working on an AVI player for inclusion in a program I am working on, and am using the ActiveMovie4 directx control. However, I am having difficulty resizing the parent window to the movie size. When creating the original movie window, I set the rect at (0,0,500,500), but depending on the video opened, the window doesn't stay that size. The rect, though, seems to not change, because when I use a GetWindowRect() function, it is still set at (0,0,500,500). How can I get the right size?
Graham, Compass Systems
|
|
|
|
|
When you say "the" rect, which rect do you mean ? Could you post your code ? I think you are mistaking GetClientRect() with GetWindowRect() . One of both returns you the size of the window defined in the ressource editor, the other one the "present" size of your window. So if you´re not using the good one, the window size may actually change while running your app but you are still asking for the original size in the ressource editor which remains of course unchanged. See what I mean ?
~RaGE();
|
|
|
|
|
I am using GetWindowRect(), but I also tried get client rect, and this resulted in the window being moved outside the main window that was creating the dialog box that contained the ActiveMovie Control, and it still gave me the wrong rect. Thanks for your help though...Any other suggestions?
|
|
|
|
|
Just post your code, pls...
~RaGE();
|
|
|
|
|
here it is:
video->Create(0,"hi",WS_VISIBLE|WS_CHILD,CRect (0,0,500,500),this,10);
video->SetFileName(opendlg.GetFileName());
video->Run();
//Resize dialog box to hold the movie window
video->GetWindowRect(avidlg.newrect);
avidlg.MoveWindow(avidlg.newrect, TRUE);
avidlg.UpdateWindow();
|
|
|
|
|
To be honest, i do not see what´s wrong, sorry ... Ain´t it any MovieWindowSize() function like specified in MSDN ??
~RaGE();
|
|
|
|
|
Ah, thanks for your help anyway. We couldn't find anything wrong with it either. There is a MovieWindowSize() function, but it only takes a long as a parameter, 0 1 2 or 3. This doesn't seem to limit the size of the video to a point where I can get a decent resize factor. Anyway, thanks for giving it a shot. If you come up with anything else, let me know. Thanks.
|
|
|
|
|
Is it possible to draw a window directly on the memory dc as we are drawing on the screen.
|
|
|
|