How can I get the Resource ID I want?
-
Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:
freeman
-
Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:
freeman
i'm not sure at all to understand what you want. if i'm right, you want to get the actual string behing the string ID in the resource string table. for this, 2 solutions :
CString::LoadString()
orCString::Format()
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:
freeman
See if this answers your question.... Answer 1: CString Str; Str.Format(IDS_STRING1); Answer 2: CString str; if (! str.LoadString( IDS_STRING1 )) { AfxMessageBox("Error Loading String: IDS_STRING1"); ... }
-
Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:
freeman
In additional with other members after reads Resource with CString::Load on the loop you can read all strings for example IDS_STRING1 has "one,two,three,four," now on a loop set for find , in this string and reads all strings :)
WhiteSky
-
Hello,everyone! I want to ask a question about my practice. I created some string entries in the string table such as IDS_STRING1,IDS_STRING2,IDS_STRING3... .Now, I want to load one of them for the CString object by a string I specified. for example, the string I specified was "IDS_STRING1" , how can I convert "IDS_STRING1" to the right Resource ID? Thank u so much!:confused:
freeman
There's no automatic way to do that. You'll basically need a lookup table to know that "IDS_STRING1" should be mapped to 101 or whatever the numeric value is.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
There's no automatic way to do that. You'll basically need a lookup table to know that "IDS_STRING1" should be mapped to 101 or whatever the numeric value is.
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
Thank u, u get my idear!I know how to resolve it now. :)
freeman
-
i'm not sure at all to understand what you want. if i'm right, you want to get the actual string behing the string ID in the resource string table. for this, 2 solutions :
CString::LoadString()
orCString::Format()
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
Thank u for your reply, I wish u a good day! :)
freeman
-
See if this answers your question.... Answer 1: CString Str; Str.Format(IDS_STRING1); Answer 2: CString str; if (! str.LoadString( IDS_STRING1 )) { AfxMessageBox("Error Loading String: IDS_STRING1"); ... }
Thank u all the same!:)
freeman
-
In additional with other members after reads Resource with CString::Load on the loop you can read all strings for example IDS_STRING1 has "one,two,three,four," now on a loop set for find , in this string and reads all strings :)
WhiteSky
Thanks! God will bless u. :)
freeman
-
Thanks! God will bless u. :)
freeman
You're welcome :)
WhiteSky