Hi Dave,
I'm sending you the code of the application so it's clear for you what i'm trying to do. All of this code it goes inside the main function.
int ctrlHelper; //Helper control ID
int errorCtrlHelper; //Error obtaining Helper control ID
char * robotNames; //Robots names (alias)
CAObjHandle controlHelperHandle; //Handle from control Helper
char selectedRobot[16]; //Name of the selected robot
CAObjHandle positionHandle; //Handle of the object
VARIANT myVariant; //Variant to store the position of the robot
float robotPosX; //Float to store the position of the robot in X
CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);
//Creates a Helper control and obtains the handle of the control
RimbaseLib_New_DHelper (panelHandle, "", 0, 0, &ctrlHelper, &errorCtrlHelper);
GetObjHandleFromActiveXCtrl (panelHandle, ctrlHelper, &controlHelperHandle);
//Returns the total number of robots connected
RimbaseLib__DHelperGetAliasListCount (controlHelperHandle, NULL, &numAlias);
//Ask for all the robots connected and select the first one on the list (in this case the only robot
//connected)
for (i = 0 ; i < numAlias ; i++)
{
//This is a read-only String array property that contains the list of configured Alias names.
RimbaseLib__DHelperGetAliasList (controlHelperHandle, NULL, i, &robotNames);
InsertListItem (panelHandle, PANEL_ROBOTSELECTOR, -1, robotNames, robotNames);
}
GetCtrlVal (panelHandle, PANEL_ROBOTSELECTOR, selectedRobot);
//This is a String property used to select the S4 control alias that the WebWare ActiveX control is
//attached
RimbaseLib__DHelperSetRobot (controlHelperHandle, NULL, selectedRobot);
//Till this point everything works ok, i'm only have asked about properties, the problem comes when i begin
//to ask about methods
//Use this function to create a new IPos object, and obtain a handle to the object. This one is the one
//that asks for the server
RimbaseLib_NewIPos (NULL, 0, LOCALE_NEUTRAL, 0, &positionHandle);
//This object type encapsulates the RAPID pos data type (array of three elements, x, y, z positions)
RimbaseLib_IPosGetList (positionHandle, NULL, 1, &myVariant);
//It returns a float with the robot position in X
RimbaseLib_IPosGetx (positionHandle, NULL, &robotPosX);
This last functions (that are methods) don't seem to work properly, they must be doing something because the values obtained change, but, for instance, the the robotPosX is always 0.00 (even moving the robot in that axis). I've asked the people from ABB and they told me thet it could be a problem with the definition of the server, but as they don't develop applications in C they don't know what should i do. What i don't understand is why the control Helper doesn't need the server to communicate with the robot, and the other control does.
I haven't use on this sample the function RimbaseLib__DHelperS4CurrentPositionGet, because it doesn't work, and is not clearly explained.
Now i send you all the definitions of the funtions that are not from NI so you know what they use:
RimbaseLib_New_DHelper (int panel, const char *label, int top, int left, int *controlID, int *UILError);
RimbaseLib__DHelperGetAliasListCount (CAObjHandle objectHandle, ERRORINFO *errorInfo, short *returnValue);
RimbaseLib__DHelperGetAliasList (CAObjHandle objectHandle, ERRORINFO *errorInfo, short index, char **returnValue);
RimbaseLib__DHelperSetRobot (CAObjHandle objectHandle, ERRORINFO *errorInfo, const char *newValue);
RimbaseLib_NewIPos (const char *server, int supportMultithreading, LCID locale, int reserved, CAObjHandle *objectHandle);
RimbaseLib_IPosGetList (CAObjHandle objectHandle, ERRORINFO *errorInfo, short num, VARIANT *returnValue);
RimbaseLib_IPosGetx (CAObjHandle objectHandle, ERRORINFO *errorInfo, float *returnValue);
I hope that this is useful to show you what i'm trying to do, and how the functions work.