Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linking dynamically to string tables from inside a dll 1

Status
Not open for further replies.

txjump

Programmer
May 17, 2002
76
US
hello all,

i created an error handling dialog class inside an application. now i want to move that error handler to a library. the problem is that ive allowed string table IDs to be used in calling the handler.

that was fine when it was all contained in the same app but now it has its own string table and doesnt understand ids from tables outside the dll. is there a way to load/link to the apps string table?

if there isnt i will just convert the ids to strings and pass the strings...but thats not my first choice.

any suggestions would be helpful!
thanks
[ponytails2]
 
Try this:

HINSTANCE hInstResClient = ::AfxGetResourceHandle();
// use DLL's res handle
::AfxSetResourceHandle:):GetModuleHandle("dllname.dll"));
CString strRes;
strRes.LoadString(IDS_STRINGID);
// restore instance handle
::AfxSetResourceHandle(hInstResClient);

:)
 
thanks gednick!

that was just what i needed. i passed the value from
AfxGetResourceHandle() to the dll and then i used it in this version of loadstring

Code:
int LoadString(HINSTANCE hInstance,
    UINT uID,
    LPTSTR lpBuffer,
    int nBufferMax
);

thanks for your help,
txjump
[ponytails2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top