Click here to Skip to main content
16,016,227 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionQuestion about Service Utility Functions. Pin
softgrid31-Oct-06 0:45
softgrid31-Oct-06 0:45 
AnswerRe: Question about Service Utility Functions. Pin
softgrid31-Oct-06 2:06
softgrid31-Oct-06 2:06 
GeneralRe: Question about Service Utility Functions. Pin
Jonathan [Darka]31-Oct-06 2:12
professionalJonathan [Darka]31-Oct-06 2:12 
GeneralRe: Question about Service Utility Functions. Pin
softgrid31-Oct-06 3:01
softgrid31-Oct-06 3:01 
GeneralRe: Question about Service Utility Functions. Pin
softgrid31-Oct-06 3:20
softgrid31-Oct-06 3:20 
GeneralRe: Question about Service Utility Functions. Pin
Jonathan [Darka]31-Oct-06 22:00
professionalJonathan [Darka]31-Oct-06 22:00 
AnswerRe: Question about Service Utility Functions. Pin
Jonathan [Darka]31-Oct-06 2:10
professionalJonathan [Darka]31-Oct-06 2:10 
QuestionHow to free memory, used by resources Pin
Kiomuto31-Oct-06 0:06
Kiomuto31-Oct-06 0:06 
Hello!
I have a simple question. Let us assume that all my resources are located in the resource-only DLLs. I load DLL, use resources from it, then unload it, load another DLL and use resources from that another DLL. What is bothering me that is: what happened to the memory, allocated to the resources from the first DLL.
For example:
<br />
HMODULE language_DLL_handle = LoadLibraryEx(language_DLL_file_name, NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
HRSRC hrsrcDlg = FindResource(language_DLL_handle, TEXT("MyDialog"), RT_DIALOG);<br />
HGLOBAL hglobalDlg = LoadResource(language_DLL_handle, hrsrcDlg);<br />
LPDLGTEMPLATE pDlgTemplate = (LPDLGTEMPLATE)LockResource(hglobalDlg);<br />
 <br />
 // Further, when I need to display the dialog, I call this function:<br />
DialogBoxIndirect(hInst, pDlgTemplate, NULL, (DLGPROC)DlgFunc);<br />
<br />
 // Here I want to change the resource-only DLL<br />
FreeLibrary(language_DLL_handle);<br />
language_DLL_handle = LoadLibraryEx(another_language_DLL_file_name, NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
<br />
 // And load resources from new DLL<br />
hrsrcDlg = FindResource(language_DLL_handle, TEXT("MyDialog"), RT_DIALOG);<br />
hglobalDlg = LoadResource(language_DLL_handle, hrsrcDlg);<br />
pDlgTemplate = (LPDLGTEMPLATE)LockResource(hglobalDlg);<br />

Here is the question: what happens to the memory, used by the first dialog template, loaded from the first DLL? Is it leaked? Does that mean that if, for example, I have changed DLLs 1000 times my app will allocate the huge amount of memory which is never freed?
Or that memory is somehow magically freed on the call to FreeLibrary?

PS: There are specialized functions LoadMenu - DestroyMenu, LoadCursor - DestroyCursor and so on. But in my case of the Dialog Template resource there is no such function. So, I am wondering ...
PPS: There is function FreeResource. But it is obsolete and is essentially a nop under Win32.
AnswerRe: How to free memory, used by resources Pin
led mike31-Oct-06 4:52
led mike31-Oct-06 4:52 
AnswerRe: How to free memory, used by resources Pin
Kiomuto31-Oct-06 5:39
Kiomuto31-Oct-06 5:39 
QuestionCMDIChildWnd Pin
baerten30-Oct-06 23:36
baerten30-Oct-06 23:36 
AnswerRe: CMDIChildWnd Pin
Mark Salsbery31-Oct-06 4:37
Mark Salsbery31-Oct-06 4:37 
GeneralRe: CMDIChildWnd Pin
baerten31-Oct-06 4:53
baerten31-Oct-06 4:53 
GeneralRe: CMDIChildWnd Pin
Mark Salsbery31-Oct-06 5:20
Mark Salsbery31-Oct-06 5:20 
GeneralRe: CMDIChildWnd Pin
baerten1-Nov-06 23:12
baerten1-Nov-06 23:12 
GeneralRe: CMDIChildWnd Pin
Mark Salsbery2-Nov-06 7:39
Mark Salsbery2-Nov-06 7:39 
GeneralRe: CMDIChildWnd [modified] Pin
baerten2-Nov-06 22:48
baerten2-Nov-06 22:48 
QuestionHelp and Hints needed / Motion Tracking Pin
luedfe30-Oct-06 23:34
luedfe30-Oct-06 23:34 
AnswerRe: Help and Hints needed / Motion Tracking Pin
Waldermort30-Oct-06 23:53
Waldermort30-Oct-06 23:53 
GeneralRe: Help and Hints needed / Motion Tracking Pin
luedfe31-Oct-06 2:10
luedfe31-Oct-06 2:10 
GeneralRe: Help and Hints needed / Motion Tracking Pin
Waldermort31-Oct-06 3:40
Waldermort31-Oct-06 3:40 
Questionhelp1 Pin
Kiethnt30-Oct-06 23:31
Kiethnt30-Oct-06 23:31 
Answera little off topic, but... Pin
toxcct30-Oct-06 23:41
toxcct30-Oct-06 23:41 
AnswerRe: help1 Pin
Hamid_RT31-Oct-06 0:20
Hamid_RT31-Oct-06 0:20 
JokeRe: help1 Pin
toxcct31-Oct-06 0:21
toxcct31-Oct-06 0:21 

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.