We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2012-08-02 09:24 AM - last edited on 2023-08-02 04:22 PM by Doreena Deng
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.
2012-08-03 11:59 AM
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.
2012-08-03 01:51 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();