05-21-2007 07:02 AM
#import
"DIAdem.tlb" no_namespace::CoInitialize(NULL);
ITOCommandPtr pITOCommandT;
pITOCommandT.CreateInstance(
"DIAdem.ToCommand"); pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", 1.734)")); ::CoUninitialize();
Actually, the 10 as a channel number is hardcoded here, in the program, I am getting it when creating the channel, via
hDataObjTData = hDataObjChannelGet( szDataObjNameT,f_size_,1,1);
int chn = hDataObjTData;And then chn contains the channel number. Don't know if that is the way to go, but it's the only solution I have found quickly..
Anyhow, the CmdExecuteSync-call always fails. I have tried it with call, without call, " and ' as quotation marks, and also with and without brackets.
What have I missed, how does it work?
Many thx!!
05-21-2007 08:44 AM
Actually, after trying this
//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", 1.734)"));
//pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet 10, \"wf_start_offset\", 1.734")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", 1.734)")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10, \"wf_start_offset\", 1.734")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 \"wf_start_offset\" 1.734")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 'wf_start_offset' 1.734")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", 2)")); //pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet(10, \"wf_start_offset\", \"1.734\")")); //pITOCommandT->CmdExecuteSync(_variant_t("Call ChnPropSet 10, \"wf_start_offset\", \"1.734\"")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet(10, \"wf_start_offset\", \"1.734\")")); // <- good //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10, \"wf_start_offset\", \"1.734\"")); // <- good //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 \"wf_start_offset\" \"1.734\"")); //pITOCommandT->CmdExecuteSync(_variant_t("ChnPropSet 10 'wf_start_offset' '1.734'"));I found out that the last parameter also needs quotation marks. Did I miss this in the documentation??
I already have a new problem though: how can I tell DIAdem that this is a waveform channel?
This one, it does not like:
_snprintf(temp,
sizeof(temp), "ChnPropSet %i, \"waveform\", \"Yes\"", chn);pITOCommandT->CmdExecuteSync(_variant_t(temp));
, just like these lines of code
// wf_samples
_snprintf(temp,
sizeof(temp), "ChnPropSet %i, \"wf_samples\", \"%i\"", chn, length);pITOCommandT->CmdExecuteSync(_variant_t(temp));
// wf_time_pref_snprintf(temp,
sizeof(temp), "ChnPropSet %i, \"wf_time_pref\", \"relative\"", chn);So, again, I don't know what to do..
Any ideas?
05-21-2007 12:18 PM
Hi diadev,
the channel property "waveform" is read-only.
Check out this command instead (requires DIAdem 10.1 or higher):
ChnWfPropSet(ChnNoStr, WfXName, WfXUnitString, WfStartOffset, WfIncrement)
This command also converts a normal channel to a waveform channel if necessary.
Generally use ChnPropValSet instead of ChnPropSet (requires also DIAdem 10.1) when setting other channel properties:
ChnPropValSet(TargetChn, PropName, PropValue)
The last parameter of ChnPropValSet is a variant, the one of ChnPropSet is always a string.
I hope this helps,
Christian
05-22-2007 11:23 AM