|
I don't see any harmful error there.
Just MB_EXCLAMATION is not a MessageBox flag and that can be observed/fixed (replaced with MB_ICONEXCLAMATION) after the first compilation.
Don't shoot the typist!
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
|
|
|
You are missing the point of the post. The problem is that if you ever catch that exception, you should never try to handle it in the way that the snippet demonstrates.
There are only two reasons to get that exception (ignore the fact that some developers call AfxThrowMemoryException() for the wrong reasons): [1] A heap request cannot be allocated due to an out of memory condition, and [2] the heap is corrupted and Thinks it is out of memory .
For either case, you probably should not be then trying to allocate memory again.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Well, sometime happens. Making confusion between heap and stack, we are in a hurry calling others "stupid" then abort (call AfxAbort).
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Of course I do...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I can just see a developer, patting himself on the back with having put together an exception handler and then stress testing to see it invoked and wondering why the messagebox is never displayed.
This is a really good example of not seeing the forest for the trees solution to a problem.
Chris Meech
I am Canadian. [heard in a local bar]
When no one was looking, every single American woman between the ages of 18 and 32 went out and got a tatoo just above their rumpus. [link[^]]
|
|
|
|
|
if we select the folder automatically all the files in the folder should be loaded in the listbox.iam able to select the folder but i don't know how to get the total number of files in folder and how to load this files into listbox,
please help me,
sree.
|
|
|
|
|
if you want to get files or folders if you use ListBox see DlgDirList and use m_ListBox.GetCount()
whitesky
|
|
|
|
|
actually my intension just like winamp application,in winamp we have two option add file or add folder.i write for files and i get a problem when i dealing with folders.
how we select the folder and how to add contentsof that folder to listbox.
thank u,
please help me,urgent .
sree
|
|
|
|
|
here is the sample snippet
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
if (finder.IsDots())
continue;
if (!finder.IsDirectory())
{
bWorking = finder.FindNextFile();
m_ListBox.AddString((LPCTSTR) finder.GetFileName());
}
}
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Another way to do the same thing
extern CListBox* pmyListBox;
TCHAR lpszWinPath[MAX_PATH], lpszOldPath[MAX_PATH];
::GetWindowsDirectory(lpszWinPath, MAX_PATH);
::GetCurrentDirectory(MAX_PATH, lpszOldPath);
::SetCurrentDirectory(lpszWinPath);
pmyListBox->ResetContent();
pmyListBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.*"));
::SetCurrentDirectory(lpszOldPath);
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
|
first of all i add the files using follwing code
POSITION currPos;
char strFilter[] = { "Mp3 files (*.mp3)|*.mp3|All Files (*.*)|*.*||" };
CFileDialog avi(TRUE, ".mp3",NULL,OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, strFilter);
char drive[_MAX_DRIVE], middle[_MAX_PATH], filename[_MAX_FNAME], ext[_MAX_EXT];
if(avi.DoModal() == IDOK)
{
currPos = avi.GetStartPosition();
while(currPos != NULL)
{
m_SongName = avi.GetNextPathName(currPos);
_splitpath (m_SongName, drive, middle, filename, ext);
m_list7.AddString(m_SongName);
so tell atleast what modufication i should do to ad folder
|
|
|
|
|
|
ok!
how we use SHBrowseFolder it,
i know iam disturbing u,
really sorry,
but my work demands me please,
beacuse it is urgent,
sree.
|
|
|
|
|
sree_as wrote: how we use SHBrowseFolder it,
CString csFolderSelected;
BROWSEINFO bi = {0};
bi.ulFlags = BIF_RETURNONLYFSDIRS ;
LPITEMIDLIST pIt;
if( (pIt = SHBrowseForFolder( &bi )))
{
TCHAR tcPath[ MAX_PATH ];
if( SHGetPathFromIDList( pIt, tcPath ))
{
csFolderSelected = tcPath;
AfxMessageBox( "the user selected the folder " + csFolderSelected );
}
}
nave
|
|
|
|
|
After this,
TCHAR lpszOldPath[MAX_PATH];
::GetCurrentDirectory(MAX_PATH, lpszOldPath);
::SetCurrentDirectory(csFolderSelecter);
pmyListBox->ResetContent();
pmyListBox->Dir(DDL_READWRITE|DDL_DIRECTORY, _T("*.mp3"));
::SetCurrentDirectory(lpszOldPath);
This will work fine
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Thnak u sararth and naveen,
really it is working very nice,
thank u very much.
this is my friend login id because system has failed.
so iam sending message from my friend system.
thank u,
finally simple problem if i like to add items to listctrl instead of Listbox,
Dir function is not availble for that
what should i do
|
|
|
|
|
|
|
plz tell me where i found the function WM_ERASEBKGND to change color
in clas wizard
OnEraseBkgnd(CDC *pDC)
Please mail me
|
|
|
|
|
1. Go to Class Wizard and select required the message from the class (make sure that you have selected correct class) "Add Handler" there
2. Right click on the class and select "Add Message Handler"
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
sir i am sorry what i dont understand
when i go to class wizard there is no function WM_ERASEBKGND
plz help me
Please mail me
|
|
|
|