Click to See Complete Forum and Search --> : How to load a string from string table


ssivapra
April 7th, 2001, 07:08 PM
LoadString() function is used to load the string from a executable file, but this function is not working if I try to load a string from Library file( working fine with dll file).

For example I have executable named

1.exe which is linked with a library file 1.lib.

if i try to load a string from 1.lib using loadlibrary it is failing. Is their any way to load a string inside a library.

Please help

Ravindra Singh
May 10th, 2001, 12:52 PM
Use this line as the first line of your dll function that loads the String.
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));

e.g.

void LoadString()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
CString str;
str.LoadString(IDS_MYSTR);
}
This should work