OSDN Git Service

クッキー意味不明で終了
[nlite/nlite.git] / nlite / nlite_addTomylistWindow.cpp
1 #include "stdafx.h"
2 #include "nlite_include.h"
3
4
5 namespace nlite{
6
7         static const LPCTSTR ADDMYLIST_URL = TEXT("MSHTML:<HTML><BODY><SCRIPT TYPE=\"text/javascript\">document.cookie=\"{0}\";window.open('http://www.nicovideo.jp/mylist_add/video/{1}', 'nicomylistadd', 'width=500,height=360');</SCRIPT></BODY></HTML>");
8
9
10         BOOL CAddToMyListWindow::PreTranslateMessage(MSG* pMsg){
11                 if((pMsg->message < WM_KEYFIRST || pMsg->message > WM_KEYLAST) &&
12                         (pMsg->message < WM_MOUSEFIRST || pMsg->message > WM_MOUSELAST))
13                         return FALSE;
14
15                 return (BOOL)SendMessage(WM_FORWARDMSG, 0, (LPARAM)pMsg);
16         }
17
18
19         VOID CAddToMyListWindow::ShowAddWindow(CNicoVideoAuth &refAuth,LPCTSTR lvNo){
20                 liveNo = ADDMYLIST_URL;
21                 liveNo.Replace(TEXT("{0}"),refAuth.GetUserSession());
22                 liveNo.Replace(TEXT("{1}"), lvNo);
23
24                 if(m_pWB2){
25                         CComVariant v;
26
27                         
28                         
29                         HRESULT rslt = this->CreateControlEx(liveNo);
30                 
31
32                         
33                         
34                 }
35         }
36
37
38         INT_PTR CAddToMyListWindow::OnCreate(LPCREATESTRUCT lpCreateStruct){
39                 LRESULT lRet = DefWindowProc();
40
41                 HRESULT hRet = QueryControl(&m_pWB2);
42                 if(SUCCEEDED(hRet)){
43                         DispEventAdvise(m_pWB2, &DIID_DWebBrowserEvents2);
44                 }
45
46                 
47                 
48                 
49
50                 return lRet;
51         }
52
53
54         VOID CAddToMyListWindow::OnDestroy(){
55                 
56                 
57                 
58                 if(m_pWB2){
59                         if(DispEventUnadvise(m_pWB2, &DIID_DWebBrowserEvents2) == S_OK){
60                                 m_pWB2 = NULL;
61                         }
62                 }
63
64                 SetMsgHandled(false);
65         }
66
67         
68 }