Click here to Skip to main content
15,920,576 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionExport the CListView data or GridView data into Excel or .CSV usig MFC Pin
sma123#14-Oct-13 6:09
sma123#14-Oct-13 6:09 
AnswerRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
Richard MacCutchan14-Oct-13 6:55
mveRichard MacCutchan14-Oct-13 6:55 
AnswerRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
Rajesh R Subramanian14-Oct-13 22:30
professionalRajesh R Subramanian14-Oct-13 22:30 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
sma123#15-Oct-13 1:12
sma123#15-Oct-13 1:12 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
Rajesh R Subramanian15-Oct-13 1:28
professionalRajesh R Subramanian15-Oct-13 1:28 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
sma123#15-Oct-13 1:40
sma123#15-Oct-13 1:40 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
Rajesh R Subramanian15-Oct-13 1:47
professionalRajesh R Subramanian15-Oct-13 1:47 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
sma123#15-Oct-13 1:54
sma123#15-Oct-13 1:54 
GeneralRe: Export the CListView data or GridView data into Excel or .CSV usig MFC Pin
Rajesh R Subramanian15-Oct-13 2:24
professionalRajesh R Subramanian15-Oct-13 2:24 
QuestionDual monitor problem [Solved] Pin
yu-jian14-Oct-13 5:37
yu-jian14-Oct-13 5:37 
QuestionRe: Dual monitor problem Pin
Richard MacCutchan14-Oct-13 6:54
mveRichard MacCutchan14-Oct-13 6:54 
AnswerRe: Dual monitor problem Pin
yu-jian14-Oct-13 23:12
yu-jian14-Oct-13 23:12 
QuestionHow to use DisableProcessWindowsGhosting in a VC6 application? Pin
Erik13-Oct-13 20:14
Erik13-Oct-13 20:14 
AnswerRe: How to use DisableProcessWindowsGhosting in a VC6 application? Pin
Richard MacCutchan13-Oct-13 20:45
mveRichard MacCutchan13-Oct-13 20:45 
GeneralRe: How to use DisableProcessWindowsGhosting in a VC6 application? Pin
Erik13-Oct-13 22:33
Erik13-Oct-13 22:33 
GeneralRe: How to use DisableProcessWindowsGhosting in a VC6 application? Pin
Richard MacCutchan13-Oct-13 22:47
mveRichard MacCutchan13-Oct-13 22:47 
GeneralRe: How to use DisableProcessWindowsGhosting in a VC6 application? Pin
Jochen Arndt13-Oct-13 23:42
professionalJochen Arndt13-Oct-13 23:42 
Question"Pure WIN32 Self-Extract EXE Builder" not working in Windows 7 Pin
Member 1023629813-Oct-13 12:59
Member 1023629813-Oct-13 12:59 
AnswerRe: "Pure WIN32 Self-Extract EXE Builder" not working in Windows 7 Pin
Garth J Lancaster13-Oct-13 16:17
professionalGarth J Lancaster13-Oct-13 16:17 
AnswerRe: "Pure WIN32 Self-Extract EXE Builder" not working in Windows 7 Pin
Richard MacCutchan13-Oct-13 20:44
mveRichard MacCutchan13-Oct-13 20:44 
QuestionImport binary .exe resource in VS2012? Pin
Member 1023629813-Oct-13 12:37
Member 1023629813-Oct-13 12:37 
AnswerRe: Import binary .exe resource in VS2012? Pin
Richard Andrew x6413-Oct-13 14:16
professionalRichard Andrew x6413-Oct-13 14:16 
GeneralRe: Import binary .exe resource in VS2012? Pin
Member 1023629813-Oct-13 14:58
Member 1023629813-Oct-13 14:58 
QuestionSingle click self extracting .exe in Visual c++ 2012? Pin
Member 1033375713-Oct-13 10:45
Member 1033375713-Oct-13 10:45 
QuestionMemory leak with CString Pin
Manoj Kumar Rai12-Oct-13 20:02
professionalManoj Kumar Rai12-Oct-13 20:02 
I have found a very interesting incident of memory leak in my code. Although I have not been able to find the root cause of the leak still thought to share with you all. I will really appreciate any help on this. I am rather curious to know how come a memory leak can be seen in use of CString in such a simple way.
Code:
We have a thread function:

C++
UINT __cdecl LogWriteThread(void *pParam)
{
  CLog* pLog = (CLog*)pParam;
  UNUSED_ALWAYS(pParam);
  try
  {
    pLog->LogWriteFunc();
  }
  .................
  .................
  return 0;
}

UINT __cdecl CLog::LogWriteFunc(void *pParam)
{
      ..........
      CString  cstrLogDataBuffer = m_cstrLogLine;
      m_cstrLogLine = _T("");
      CopyLogToFileByThread(cstrLogDataBuffer);
}

void CMpmLog::CopyLogToFileByThread(const CString& cstrLogDataBuffer)
{
      ....................
      const long iLength = cstrLogDataBuffer.GetLength();
      char *pBuffer = new char[iLength + 1];
      for (long iIndex = 0;iIndex < iLength; iIndex++)
      {
        pBuffer[iIndex] = (char)cstrLogDataBuffer.GetAt(iIndex);
      }
      pBuffer[iLength] = '\0';
        
      const unsigned int uiWriteLen = fwrite((const void *)pBuffer, sizeof(char),iLength, m_pofLogStream);

      delete[] pBuffer;
      ....................
}

========================
If I commment call for "CopyLogToFileByThread" in function LogWriteFunc then memory leak goes away. But thats not the solution.
Manoj
Never Gives up

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.