G
Guest
I have former VC++ 6.0 application which was ported to .NET.
Now we continue to develop this app under VS.NET. The app
now contains both managed and unmanaged classes.
Now I have a problem with usage of resources in managed classes.
For example I want to display warning message and want to load
that warning message from the resource file. The problem is that
in this mixed managed/unmanaged project I don't have pure managed
resources (like for example in C#) and I can't use ResourceManager
to get strings from resources.
The project still has old unmanaged resource file (.rc)
So the only option I see is the following:
// Load from unmanaged resource file
CString strMsg ;
strMsg.LoadString(IDS_READ_PROGRAM_STATUS ) ;
// Convert to managed string
String* strMsgManaged = Marshal:trToStringAnsi(static_cast<IntPtr>(strMsg
) ) ;
This approach looks very ugly to me.
So here are my questions:
Is there simple way to load string from unmanaged resource file to managed
String object?
What are the best practices to handle resources in mixed managed/unmanaged
C++ projects?
Thanks
Now we continue to develop this app under VS.NET. The app
now contains both managed and unmanaged classes.
Now I have a problem with usage of resources in managed classes.
For example I want to display warning message and want to load
that warning message from the resource file. The problem is that
in this mixed managed/unmanaged project I don't have pure managed
resources (like for example in C#) and I can't use ResourceManager
to get strings from resources.
The project still has old unmanaged resource file (.rc)
So the only option I see is the following:
// Load from unmanaged resource file
CString strMsg ;
strMsg.LoadString(IDS_READ_PROGRAM_STATUS ) ;
// Convert to managed string
String* strMsgManaged = Marshal:trToStringAnsi(static_cast<IntPtr>(strMsg
) ) ;
This approach looks very ugly to me.
So here are my questions:
Is there simple way to load string from unmanaged resource file to managed
String object?
What are the best practices to handle resources in mixed managed/unmanaged
C++ projects?
Thanks