Click here to Skip to main content
15,924,367 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VS6 Service Pack 6 Pin
Alexander M.,30-Mar-04 7:36
Alexander M.,30-Mar-04 7:36 
GeneralFocus problem in FormView Pin
Raghunandan S29-Mar-04 22:04
Raghunandan S29-Mar-04 22:04 
Questionhow can i execute a REG_EXPAND_SZ command ? Pin
ohadp29-Mar-04 21:13
ohadp29-Mar-04 21:13 
GeneralScrolling Pin
Member 95412329-Mar-04 20:59
Member 95412329-Mar-04 20:59 
GeneralCompiling VC6.0 project in .NET command prompt using cl.exe Pin
Vini Deep29-Mar-04 20:50
Vini Deep29-Mar-04 20:50 
GeneralVptrs and Vtables Pin
vikramlinux29-Mar-04 20:23
vikramlinux29-Mar-04 20:23 
GeneralRe: Vptrs and Vtables Pin
Maxwell Chen29-Mar-04 22:52
Maxwell Chen29-Mar-04 22:52 
GeneralMemory allocation in CFileDialog Pin
Zerox Millienium29-Mar-04 20:00
Zerox Millienium29-Mar-04 20:00 
Very often when enabling the flag OFN_ALLOWMULTISELECT allows one to multiple select a number of files in a current folder.

However there's a limit where one can select a number of files and thereafter... the dialog hangs on you. I would like to find out a more economical method of dynamically allocating memory for this kind of situation. I derived the CFileDialog to a new class and gave it a new variable TCHAR* m_varString;

I override the OnFolderChange() putting some code that shows below..

However it's not efficient and it seems to show rubbish every time I reopen the CFileDialog. After certain time a memory violation occurred. It all seemed strange to me. Perhaps I'm heading the wrong way. Can someone please advise me what I shoud correct? Thanks...

void CFileDialogEx::OnFolderChange()
{
// TODO: Add your specialized code here and/or call the base class

CString cstrFolderPath = GetFolderPath();
DWORD dwBufCount = cstrFolderPath.GetLength();

cstrFolderPath += _T("\\*.*");
CFileFind ff;
BOOL bFound = ff.FindFile( cstrFolderPath );
while ( bFound )
{
bFound = ff.FindNextFile();
if ( !ff.IsDirectory() )
dwBufCount += ( ff.GetFilePath().GetLength() );
}
dwBufCount += 1;
ff.Close();

delete m_pszVar;

m_pszVar = (TCHAR*) new TCHAR[dwBufCount];
m_pszVar[0] = _T('\0');

m_pOFN->lpstrFile = m_pszVar;
m_pOFN->nMaxFile = dwBufCount;

CFileDialog::OnFolderChange();
}

GeneralRe: Memory allocation in CFileDialog Pin
PJ Arends29-Mar-04 20:27
professionalPJ Arends29-Mar-04 20:27 
GeneralRaw To Wave. Pin
Prakash Nadar29-Mar-04 19:14
Prakash Nadar29-Mar-04 19:14 
GeneralRe: Raw To Wave. Pin
Roger Wright29-Mar-04 19:39
professionalRoger Wright29-Mar-04 19:39 
GeneralRe: Raw To Wave. Pin
Prakash Nadar30-Mar-04 8:06
Prakash Nadar30-Mar-04 8:06 
GeneralRe: Raw To Wave. Pin
Paul Ranson30-Mar-04 3:04
Paul Ranson30-Mar-04 3:04 
GeneralRe: Raw To Wave. Pin
Prakash Nadar30-Mar-04 8:02
Prakash Nadar30-Mar-04 8:02 
QuestionBraindead? Pin
Anonymous29-Mar-04 18:40
Anonymous29-Mar-04 18:40 
AnswerRe: Braindead? Pin
ohadp29-Mar-04 20:01
ohadp29-Mar-04 20:01 
GeneralReturn values Pin
Timothy Grabrian29-Mar-04 17:52
professionalTimothy Grabrian29-Mar-04 17:52 
GeneralRe: Return values Pin
Maxwell Chen29-Mar-04 18:31
Maxwell Chen29-Mar-04 18:31 
GeneralHours and minutes Pin
dstory29-Mar-04 17:44
sussdstory29-Mar-04 17:44 
GeneralRe: Hours and minutes Pin
Christian Graus29-Mar-04 17:47
protectorChristian Graus29-Mar-04 17:47 
GeneralThis isn't really a question Pin
MrNiceBerG29-Mar-04 17:16
MrNiceBerG29-Mar-04 17:16 
GeneralThis isn't really an answer Pin
Roger Wright29-Mar-04 18:14
professionalRoger Wright29-Mar-04 18:14 
GeneralRe: This isn't really an answer Pin
Prakash Nadar29-Mar-04 19:07
Prakash Nadar29-Mar-04 19:07 
General#include <string> and errors... help me fix Pin
HuuQuynh29-Mar-04 17:09
HuuQuynh29-Mar-04 17:09 
GeneralRe: #include <string> and errors... help me fix Pin
Christian Graus29-Mar-04 17:46
protectorChristian Graus29-Mar-04 17:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.