Click here to Skip to main content
15,922,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaloutlook express config Pin
naradaji6-Feb-03 21:11
naradaji6-Feb-03 21:11 
GeneralRe: outlook express config Pin
OBRon7-Feb-03 3:53
OBRon7-Feb-03 3:53 
GeneralRe: outlook express config Pin
naradaji7-Feb-03 4:42
naradaji7-Feb-03 4:42 
QuestionHow to serialize (MFC) Image? Pin
Roman Shchugarev6-Feb-03 19:43
Roman Shchugarev6-Feb-03 19:43 
AnswerRe: How to serialize (MFC) Image? Pin
Chris Losinger6-Feb-03 19:56
professionalChris Losinger6-Feb-03 19:56 
GeneralRe: How to serialize (MFC) Image? Pin
Roman Shchugarev6-Feb-03 20:34
Roman Shchugarev6-Feb-03 20:34 
GeneralRectangle Pin
satyavasu6-Feb-03 19:13
satyavasu6-Feb-03 19:13 
GeneralFixing Memory Leaks Pin
abhinarulkar6-Feb-03 18:18
abhinarulkar6-Feb-03 18:18 
Hi,
I've written a DLL which modifies some of the Registry Entries. I've used RegOpenKeyEx method for opening and RegCloseKey for closing the registry keys. When I run this code many times in a loop it shows a memory leak and the virtual byte count increases in the performance monitor. I've taken all precautions to check for any key remaining open. I've tried a similar code in a EXE code and it works fine without any byte increase. Can somebody help me in this regard.

Thanks and Regards,
Abhishek.

I hope this code would give you some idea.
**************************************************
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}

BOOL _cdecl CheckClient::Run(TCHAR *szEventLogMessage, TCHAR *szAlarmMessage)
{

long lRetValue = 0;
HKEY hkey = NULL;
TCHAR szRegPath[100] = {0};

_tcscpy(szRegPath, _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"));

lRetValue = RegOpenKeyEx(HKEY_LOCAL_MACHINE,szRegPath,0,KEY_AL
L_ACCESS,&hkey);
if (lRetValue == ERROR_SUCCESS)
{
long lRetVal = 0;
_tcscpy(szEventLogMessage, _T("Executed this code"));
lRetVal = RegCloseKey(hkey);
if (lRetVal == ERROR_SUCCESS)
{
_tcscat(szEventLogMessage, _T("Success in closing the key"));
}
hkey = NULL;
}
hkey = NULL;
if (_tcscmp(szEventLogMessage,_T("")) == 0)
_tcscpy(szEventLogMessage, _T("The method has been executed first time."));
else
_tcscat(szEventLogMessage, _T("The method has been executed second time."));


return TRUE;
}


__________________


GeneralRe: Fixing Memory Leaks Pin
Joaquín M López Muñoz6-Feb-03 21:15
Joaquín M López Muñoz6-Feb-03 21:15 
GeneralMFC Tutor Pin
shanksprasad6-Feb-03 17:42
shanksprasad6-Feb-03 17:42 
GeneralRe: MFC Tutor Pin
Chris Richardson6-Feb-03 18:20
Chris Richardson6-Feb-03 18:20 
GeneralRe: MFC Tutor Pin
shanksprasad7-Feb-03 1:33
shanksprasad7-Feb-03 1:33 
GeneralRe: MFC Tutor Pin
Chris Richardson7-Feb-03 9:36
Chris Richardson7-Feb-03 9:36 
GeneralDownload file from http using mfc Pin
Anonymous6-Feb-03 17:29
Anonymous6-Feb-03 17:29 
GeneralRe: Download file from http using mfc Pin
OBRon7-Feb-03 4:05
OBRon7-Feb-03 4:05 
GeneralNeed help in using CryptoAPI Pin
Vu Truong6-Feb-03 17:34
Vu Truong6-Feb-03 17:34 
GeneralRe: Need help in using CryptoAPI Pin
karl_w6-Feb-03 19:48
karl_w6-Feb-03 19:48 
GeneralCTreeCtrl selects item by itself!!! Pin
Mr.Freeze6-Feb-03 15:19
Mr.Freeze6-Feb-03 15:19 
GeneralEasy question: Pin
Sunnygirl6-Feb-03 13:35
Sunnygirl6-Feb-03 13:35 
GeneralRe: Easy question: Pin
Chris Losinger6-Feb-03 14:09
professionalChris Losinger6-Feb-03 14:09 
GeneralRe: Easy question: Pin
georgiek506-Feb-03 14:18
georgiek506-Feb-03 14:18 
GeneralRe: Easy question: Pin
Harold Bamford7-Feb-03 5:49
Harold Bamford7-Feb-03 5:49 
GeneralRe: Easy question: Pin
georgiek507-Feb-03 6:00
georgiek507-Feb-03 6:00 
GeneralRe: Easy question: Pin
Harold Bamford7-Feb-03 6:18
Harold Bamford7-Feb-03 6:18 
GeneralRe: Easy question: Pin
georgiek507-Feb-03 7:38
georgiek507-Feb-03 7:38 

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.