DGGetItemText()
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-02
09:24 AM
- last edited on
2023-08-02
04:22 PM
by
Doreena Deng
2012-08-02
09:24 AM
Hi all,
I use Api DevKit 16 but the fonction DGGetItemText() doesn't have the same number of parameter than API DevKit 15.
-> "DGGetItemText (short dialId, short item, char* text, Int32 size);"
Do you know by what function it is replaced in API DevKit 16 ?
I'm searching for...
Thanks, Have a nice day.
I use Api DevKit 16 but the fonction DGGetItemText() doesn't have the same number of parameter than API DevKit 15.
-> "DGGetItemText (short dialId, short item, char* text, Int32 size);"
Do you know by what function it is replaced in API DevKit 16 ?
I'm searching for...
Thanks, Have a nice day.
Labels:
- Labels:
-
Add-On (C++)
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-03 12:49 AM
2012-08-03
12:49 AM
atila-diffusion wrote:It hasn't been replaced, just modified. The old method was a bit antiquated, relying on a caller-specified buffer. If the text content exceeded the buffer, the user's input would be truncated. The AC16 version is:
-> "DGGetItemText (short dialId, short item, char* text, Int32 size);"
Do you know by what function it is replaced in API DevKit 16 ?
DG_DLL_EXPORT GS::UniString CCALL DGGetItemText (short dialId, short item);This function simply returns a dynamic, Unicode string containing the full user input.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-03 11:59 AM
2012-08-03
11:59 AM
Thanks Ralph for your response,
So, I don't understand very well, the parameter "char* text" can be use like this ? :
My old code (api 15) :
char strPath[255];
DGGetItemText(intIdFenetreActuelle,2,strPath,DGGetItemText(intIdFenetreActuelle,2,NULL,0));
My new code (api 16) :
char strPath[255];
(GS::UniString)strPath = DGGetItemText(intIdFenetreActuelle,2);
PS : I have simplified my code
So, I don't understand very well, the parameter "char* text" can be use like this ? :
My old code (api 15) :
char strPath[255];
DGGetItemText(intIdFenetreActuelle,2,strPath,DGGetItemText(intIdFenetreActuelle,2,NULL,0));
My new code (api 16) :
char strPath[255];
(GS::UniString)strPath = DGGetItemText(intIdFenetreActuelle,2);
PS : I have simplified my code
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-03 12:38 PM
2012-08-03
12:38 PM
atila-diffusion wrote:No, it's much simpler than that:
My new code (api 16) :
char strPath[255];
(GS::UniString)strPath = DGGetItemText(intIdFenetreActuelle,2);
GS::UniString strPath = DGGetItemText(intIdFenetreActuelle, 2);If you really need a const char* you can request a C-string representation of the string data by calling the following method:
const char* strPathCStr = strPath.ToCStr();But ideally you should use a string class and not delve into the raw data if at all possible. You avoid all the risk of buffer overruns etc.
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-03 01:51 PM
2012-08-03
01:51 PM
Thank you so much Ralph !

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2012-08-08 04:16 PM
2012-08-08
04:16 PM
Ralph wrote:Be careful with that, though. Don't keep the pointer (strPathCStr above) around, just use it to copy the C string representation elsewhere.
If you really need a const char* you can request a C-string representation of the string data by calling the following method:const char* strPathCStr = strPath.ToCStr();
Also, you can pass a code page (in the form of the CC_xxx constants, see CH.hpp) to extract the string in a different codepage (e.g. UTF8).
Best, Akos