Click here to Skip to main content
15,926,174 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Tools for detecting memory leaks Pin
Rick York12-Mar-02 14:51
mveRick York12-Mar-02 14:51 
GeneralRe: Tools for detecting memory leaks Pin
Nish Nishant12-Mar-02 16:14
sitebuilderNish Nishant12-Mar-02 16:14 
Generallistboxes Pin
12-Mar-02 11:55
suss12-Mar-02 11:55 
GeneralRe: listboxes Pin
Ravi Bhavnani12-Mar-02 11:59
professionalRavi Bhavnani12-Mar-02 11:59 
GeneralRe: How can I get the item text from other ListView Pin
Tim Smith12-Mar-02 10:33
Tim Smith12-Mar-02 10:33 
Generalequal_range Pin
12-Mar-02 9:50
suss12-Mar-02 9:50 
GeneralRe: equal_range Pin
Joaquín M López Muñoz12-Mar-02 9:52
Joaquín M López Muñoz12-Mar-02 9:52 
QuestionFindResourceEx not working ??????? Pin
Wolfram Steinke12-Mar-02 9:33
Wolfram Steinke12-Mar-02 9:33 
I have come across an interesting problem. I have a Resource only DLL which contains only string tables in about 7 languages. Using the resource editor I can confirm that the Dll is built correctly.

In InitInstance of my app I call LoadLibrary and save the returned handle. ( m_hInstDLL )

The I added a function for extracting the strings. This is when the fun starts.

This code works and returns the string from the default language table.

HINSTANCE hInst = AfxGetResourceHandle();
CString theString;
AfxSetResourceHandle( m_hInstDLL );
theString.LoadString( IDS_TESTDTRING );
AfxSetResourceHandle( m_hInst );

However if I use the FindResource or FindResourceEx functions they fail as in the following code.

HINSTANCE hInst = AfxGetResourceHandle();
CString theString;
AfxSetResourceHandle( m_hInstDLL );
theString.LoadString( IDS_TESTDTRING );
HINSTANCE hInst2 = AfxFindResourceHandle(MAKEINTRESOURCE(IDS_TESTSTRING), RT_STRING);
HRSRC hRes = ::FindResource(hInstDLL,MAKEINTRESOURCE(IDS_TESTSTRING), RT_STRING);
......
AfxSetResourceHandle( m_hInst );


The interesting thing is that AfxFindResourceHandle returns the same value as hInstDLL, as it should. This means that AfxFindResourceHandle finds the string resource. FindResource on the other hand returns 0.
Calling FindResourceEx with the appropriate language code also returns 0.

What makes this even more confusing is that in searching through MSDN it is stated that AfxFindResourceHandle actually calls FindResource.


Ideas anyone? It must be possible to make it work.

Happy programming!!
AnswerRe: FindResourceEx not working ??????? Pin
Joaquín M López Muñoz12-Mar-02 9:50
Joaquín M López Muñoz12-Mar-02 9:50 
GeneralRe: FindResourceEx not working ??????? Pin
Wolfram Steinke12-Mar-02 10:15
Wolfram Steinke12-Mar-02 10:15 
QuestionI found 2 issues in ATL 7.0 Service projects: Should I put this somewhere here? Pin
Le centriste12-Mar-02 8:19
Le centriste12-Mar-02 8:19 
AnswerRe: I found 2 issues in ATL 7.0 Service projects: Should I put this somewhere here? Pin
Tomasz Sowinski12-Mar-02 8:57
Tomasz Sowinski12-Mar-02 8:57 
GeneralCFileDialog UNICODE concern Pin
12-Mar-02 8:12
suss12-Mar-02 8:12 
GeneralRe: CFileDialog UNICODE concern Pin
Joaquín M López Muñoz12-Mar-02 9:16
Joaquín M López Muñoz12-Mar-02 9:16 
GeneralRe: CFileDialog UNICODE concern Pin
12-Mar-02 10:55
suss12-Mar-02 10:55 
GeneralRe: CFileDialog UNICODE concern Pin
Joaquín M López Muñoz12-Mar-02 20:00
Joaquín M López Muñoz12-Mar-02 20:00 
GeneralRe: CFileDialog UNICODE concern Pin
13-Mar-02 5:00
suss13-Mar-02 5:00 
GeneralPrinting - size of font Pin
Wizard_0112-Mar-02 4:42
Wizard_0112-Mar-02 4:42 
GeneralRe: Printing - size of font Pin
Tomasz Sowinski12-Mar-02 4:56
Tomasz Sowinski12-Mar-02 4:56 
GeneralRe: Printing - size of font Pin
Tomasz Sowinski12-Mar-02 5:00
Tomasz Sowinski12-Mar-02 5:00 
GeneralRe: Printing - size of font Pin
Wizard_0112-Mar-02 5:02
Wizard_0112-Mar-02 5:02 
GeneralRe: Printing - size of font Pin
Tomasz Sowinski12-Mar-02 5:09
Tomasz Sowinski12-Mar-02 5:09 
Generalbitwise command Pin
SilverShalkin12-Mar-02 4:29
SilverShalkin12-Mar-02 4:29 
GeneralRe: bitwise command Pin
Tim Smith12-Mar-02 4:39
Tim Smith12-Mar-02 4:39 
GeneralRe: bitwise command & MFC Pin
SilverShalkin12-Mar-02 4:50
SilverShalkin12-Mar-02 4:50 

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.