API Support Forum
OEC API > API Support > About contracts subscribing
Author Topic: About contracts subscribing
(3 messages, Page 1 of 1)
Moderators: VPfau
IIvanus
Posts: 7
Joined: May 14, 2009


Posted: Jun 09, 2009 @ 12:00 AM             Msg. 1 of 3
Hello.
at first sorry for my english.

I have problems with requesting and subscribing contracts.
Also sample "CppComSample" is not working.

I am getting contract from OECAPI()->BaseContracts succesfuly.

and then i am trying to request it:
OECAPI()->RequestContracts(contract);
and returned value is S_OK.

But after that i am trying this:
OECAPI()->Subscribe(OECAPI()->Contracts->GetByIndex(0));
and have error.

P.s. and few months ago it was working.

Ivanus Treneov
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Jun 09, 2009 @ 12:00 AM             Msg. 2 of 3
As most of the OECClient methods, RequestContracts is asynchronous. Though it returns immediately, results are available only after the contracts are downloaded and event is fired.
Make sure you got an event OnContractsChanged before accessing the contracts.
IIvanus
Posts: 7
Joined: May 14, 2009


Posted: Jun 09, 2009 @ 12:00 AM             Msg. 3 of 3
Ohh... It works!!
Thank you.

Ivanus Treneov