|
-
June 20th, 1999, 07:38 AM
#1
DLL classes and AFX_MANAGE_STATE( AfxGetStaticModuleState( ))
Do I need to use the macro "AFX_MANAGE_STATE( AfxGetStaticModuleState( ))" in every member of an exported class?
-
June 20th, 1999, 11:40 AM
#2
Re: DLL classes and AFX_MANAGE_STATE( AfxGetStaticModuleState( ))
No.
You should use this macro in every C-style function (if any) that your DLL exports. If you're exporting a class, you can simply prefix your class declaration with the declspec() macro - alternatively, you can prefix each public method you want to export with the declspec() macro.
/ravi
-
June 20th, 1999, 12:50 PM
#3
Re: DLL classes and AFX_MANAGE_STATE( AfxGetStaticModuleState( ))
I have a DLL which has a C-style fn fnLogData (int nResourceID_OfStringToLog).
If I include the AFX_MANAGE_STATE( AfxGetStaticModuleState( )), then it is not possible to get the string resource from the calling application!
In another case, I try to create a dlg box thru a call to another C-style fn. In this case, however,
If I do NOT include the AFX_MANAGE_STATE( AfxGetStaticModuleState( )), I get an error.
I am still sorting this out.
-
June 20th, 1999, 01:59 PM
#4
Re: DLL classes and AFX_MANAGE_STATE( AfxGetStaticModuleState( ))
__declspec( dllimport ) and __declspec( dllexport ) are just replacements for the EXPORT/IMPORT tag in the .def file.
While AFX_MANAGE_STATE( AfxGetStaticModuleState( )) changes the INSTANCE from where windows loads all its resources.
So the question still remains unanswered....
// Jarmo
-
June 20th, 1999, 02:33 PM
#5
Re: DLL classes and AFX_MANAGE_STATE( AfxGetStaticModuleState( ))
OK, let's try this again. You must (at least MS says you must) use the macro in every exported C-style function. My point is, you shouldn't use in your exported methods. Use AfxGetInstanceHandle() and AfxGet/SetResourceHandle() to enable your code to load resources from the correct source (your DLL vs. calling app).
Hope this helps.
/ravi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|