DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

GPI extension: channel name truncate

Hi,
 
I used the hDataObjChannelGet() function to create a channel in the Data Portal. But I notice that all names are truncated to 17 characters.
 
Is it a limitation of the GPI Extension?
 
What is the better solution to implement a channel name up to 50 characters ?
 
Best regards,
 
Fred
0 Kudos
Message 1 of 13
(5,768 Views)
Hi,

please use the GPI Function "hDataObjChannelGetW" instead of "hDataObjChannelGet" in a way like this:

  hDataObjChannelGetW(L"N_23456789N_23456789N_23456789N_23456789N_23456789N_23456789XXX",
                                         1024,
                                         1,
                                         eChannelDataTypeReal64,
                                         0);

Thomas
0 Kudos
Message 2 of 13
(5,750 Views)
 


Message Edité par Fred91 le 01-24-2008 12:28 PM
0 Kudos
Message 3 of 13
(5,746 Views)
 


Message Edité par Fred91 le 01-24-2008 12:27 PM
0 Kudos
Message 4 of 13
(5,746 Views)
 


Message Edité par Fred91 le 01-24-2008 12:27 PM
0 Kudos
Message 5 of 13
(5,745 Views)
 


Message Edité par Fred91 le 01-24-2008 12:25 PM
0 Kudos
Message 6 of 13
(5,744 Views)
 


Message Edité par Fred91 le 01-24-2008 12:25 PM
0 Kudos
Message 7 of 13
(5,744 Views)
 


Message Edité par Fred91 le 01-24-2008 12:24 PM
0 Kudos
Message 8 of 13
(5,744 Views)
Thank you for the answer.
 
Two more questions:
   1. What is the best way to convert my CString in TDataWChar ?
 
    2. What is the difference between eDataObjCommentarySetW and eDataObjCommentarySetTDataWChar ?
 
Best regards,
 
Frederic


Message Edité par Fred91 le 01-24-2008 12:23 PM
0 Kudos
Message 9 of 13
(5,744 Views)
Hello Frederic!
 
To convert a CString to Unicode you can use this code:
WCHAR* wszCommandT;
int    nLenT;
 
// determine the buffer size
nLenT = MultiByteToWideChar(CP_ACP, 0, sgCommand, -1, NULL, NULL);
 
// allocate result buffer
wszCommandT = new WCHAR[nLenT];
 
// Convert the string from ANSI to Unicode
nLenT = MultiByteToWideChar(CP_ACP, 0, sgCommand,-1,wszCommandT,nLenT);
 
if( nLenT > 0)
{
  // do something ...
}
 
// free result buffer
delete wszCommandT;
 
You can replace WCHAR with TDataWChar if you want.
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 10 of 13
(5,722 Views)