Hi Qiang,
You are mixing Origin C and LabTalk code here. It is possible to execute LabTalk commands from OC using the LT_execute command, or to set properties of LabTalk objects from OC using the LabTalk.Object.Property method, but it is not possible to just write LabTalk commands inside the OC code.
I would rewrite your function as below:
Easwar
OriginLab.
void SP_JoinWorkSheets(string WinName, string WinName1, string WinName2)
{
// create the new worksheet
Worksheet wks;
wks.Create("..\..\..\Origin\Resources\empty.otw", CREATE_VISIBLE_SAME);
if(wks.GetPage().Rename(WinName))
printf("Page renamed\n");
else
printf("Failed to rename page\n");
// Set joinMode property of wks object in LabTalk
LabTalk.wks.joinMode = 0;
// Build a string of LabTalk command to join the first worksheet
string strCmd = wks.GetPage().GetName() + "!wks.join(" + WinName1 + ")";
// Execute the LabTalk command
LT_execute(strCmd);
// Repeat for second worksheet
strCmd = wks.GetPage().GetName() + "!wks.join(" + WinName2 + ")";
LT_execute(strCmd);
}