See the question and my original answer on StackOverflow

What you can do is

1) hook up Web Browser events, using for example this sample How to sink HTML document events for WebBrowser host

2) once you get a hold on the loaded IHTMLDocument2 document interface, just read the value of the cookie property:

CComPtr<IHTMLDocument2> pDoc // get document from event as shown in the sample.

// read the cookie
CComBSTR cookie;
hr = pDoc->get_cookie(&cookie);

More on this here: Handling HTML Element Events

Note: for NSAPI I suggest you write another question with other tags as this is a totally different world.