Technical Forum

SIMATIC WinCC

ODK function PDLCSSetPropertyEx doesn't work properly

Thread Starter: SpKV   Started: 6/29/2012 4:07 PM   Replies: 6

« Previous thread Next thread »
Page 1 of 1 (7 items)
  6/29/2012, 4:07 PM
Joined 2/3/2009
Last visit: 2/22/2013
Posts: 126
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
 
  Hello, colleagues.

  I have strange behavior of PDLCSSetPropertyEx ODK function.
 
  This code work properly:
  strcpy(ObjName, "Mixer");
  Value = 114;
  if (PDLCSSetPropertyEx(ProjectName, PictureName, ObjName, "Width", VT_I4, &Value, 0, NULL,   &Error )==FALSE){
    printf("\r\nError in PDLCSSetPropertyEx\r\n%s\r\n", Error.szErrorText);
  }
  After I execute this script in runtime and restart Runtime my object "Mixer" has width = 114, and this width is set in the object properties in Graphic Designer.

  This code work strange:
  strcpy(ObjName, "Mixer");
  Value = 1;
  if (PDLCSSetPropertyEx(ProjectName, PictureName, ObjName, "Visible", VT_BOOL, &Value, 0, NULL,   &Error )==FALSE){
    printf("\r\nError in PDLCSSetPropertyEx\r\n%s\r\n", Error.szErrorText);
  }
  After I execute this script in runtime and restart Runtime my object "Mixer" is visible (befor executing script I have set property "Visible" to "No" and it is realy was not visible). But if I open Graphic Designer the property "Visible" is set there to "No". However object is visible!

  That is this?!
  I try to solve this problem whole day! But not success.
  Experts, please help!
  
Top
  6/29/2012, 4:41 PM
Joined 10/26/2005
Last visit: 5/23/2013
Posts: 203
Rating:
Rated: Outstanding [3.28 out of 5 / rated 32 time(s)]. (32) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hello,


From "Picture Creator for WinCC (Open Source)" :
http://support.automation.siemens.com/WW/view/en/45947736


In file "ObjectGeneration.cpp" at line 154:
We need a "int" variable
http://msdn.microsoft.com/en-us/library/cc235117(v=prot.10).aspx


else if(vt == 11) // BOOL
 {
  iValue = atoi(szValue);
  ret = PDLCSSetPropertyEx(pConnect->szProjectFile, szPictureName, szObjectName,
     szPropertyName, vt, &iValue, 0, NULL, &Error);
Top
  7/2/2012, 9:44 AM
Joined 2/3/2009
Last visit: 2/22/2013
Posts: 126
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

  Hello, perdahlqvist!
  Unfortunately, I don't understand what is the differ between my and your code. I try to set Value =0xFFFF. But no success.
  And what is the instruction "atoi". ODK has not this instruction.

 Best regards, SpKV.
 
Top
  7/2/2012, 10:36 AM
Joined 10/3/2010
Last visit: 5/23/2013
Posts: 732
Rating:
Rated: Outstanding [3.39 out of 5 / rated 49 time(s)]. (49) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
SpKV wrote:

  Hello, perdahlqvist!
  Unfortunately, I don't understand what is the differ between my and your code. I try to set Value =0xFFFF. But no success.
  And what is the instruction "atoi". ODK has not this instruction.

 Best regards, SpKV.
 


http://www.thinkage.ca/english/gcos/expl/c/lib/atoi.html
Top
  7/2/2012, 12:49 PM
Joined 2/3/2009
Last visit: 2/22/2013
Posts: 126
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
 
 Do you mean that PDLCSSetPropertyEx work only with type VT_I4?

 Best regards,SpKV.
Top
  7/2/2012, 4:02 PM
Joined 12/14/2010
Last visit: 5/23/2013
Posts: 134
Rating:
Rated: Outstanding [3.5 out of 5 / rated 4 time(s)]. (4) 
Rated: Excellent [5 out of 5 / rated 1 time(s)]. (1) 
Hi SpKV,
As I see in the help of the WinCC-ODK, the argument "vt" of this function
( BOOL PDLCSSetPropertyEx (LPCTSTR lpszProjectName, LPCTSTR lpszPictureName, LPCTSTR lpszObjectName, LPCTSTR lpszPropName, VARTYPE vt,LPVOID pvProp, DWORD  dwFlags, LPVOID pData, PCMN_ERROR pError );

should not contain variants types and VT_BOOL is a variant type:

" vt

Data type of the value passed with pvProp. Valid types are defined in the "wtypes.h" Include file   belonging to the compiler.
No VT_VARIANT, VT_DISPATCH or other references should be used."

Proof using your variable "Value" as short (and vt = VT_I2) or as long (and vt =VT_I4) and assign it the values 1 and 0.

best regards
Top
  7/3/2012, 11:05 AM
Joined 2/3/2009
Last visit: 2/22/2013
Posts: 126
Rating:
Rated: Outstanding [4 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

  Jm1983, excellent!

  This code work properly:
  strcpy(ObjName, "Mixer");
  Value = 1;
  if (PDLCSSetPropertyEx(ProjectName, PictureName, ObjName, "Visible", VT_I4, &Value, 0, NULL,   &Error )==FALSE){
    printf("\r\nError in PDLCSSetPropertyEx\r\n%s\r\n", Error.szErrorText);
  }

  After executing this code property "Visible" is set to "Yes" in Graphic Designer.

 Thank you very much!
Top
Page 1 of 1 (7 items)
Actions