OSDN Git Service

IEコンポーネント使い始めまで
authorqwerty2501 <riot313@gmail.com>
Sun, 5 Feb 2012 09:57:46 +0000 (18:57 +0900)
committerqwerty2501 <riot313@gmail.com>
Sun, 5 Feb 2012 09:57:46 +0000 (18:57 +0900)
16 files changed:
nlib/nlib.h
nlib/nlib.vcxproj.filters
nlib/nlib_nicoLive.cpp
nlib/nlib_nicoVideoAuth.cpp
nlite.suo
nlite/nlite.cpp
nlite/nlite.h
nlite/nlite.vcxproj
nlite/nlite_addTomylistWindow.cpp
nlite/nlite_addTomylistWindow.h
nlite/nlite_commentview.cpp
nlite/nlite_include.h
nlite/nlite_nlib.cpp
nlite/nlite_nlib.h
nlite/stdafx.h
nlite_stub/nlite_stub.cpp

index fd3e4b1..ce72471 100644 (file)
@@ -437,6 +437,11 @@ extern "C" {
 
 
        ///
+       ///\83\86\81[\83U\81[\83Z\83b\83V\83\87\83\93\8eæ\93¾
+       ///
+       NLIB_DECLSPEC LPCTSTR NicoVideoAuth_getUserSession(NicoVideoAuth_P self);
+
+       ///
        ///\83j\83R\83j\83R\93®\89æ\94F\8fØ\8fî\95ñ\8eæ\93¾
        ///
        NLIB_DECLSPEC NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE browserType);
index eda4e6b..323c18b 100644 (file)
@@ -18,9 +18,6 @@
     <None Include="ReadMe.txt" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="nlib_nicoVideoAuth.cpp">
-      <Filter>ソース ファイル</Filter>
-    </ClCompile>
     <ClCompile Include="nlib_xmlHandler.cpp">
       <Filter>ソース ファイル</Filter>
     </ClCompile>
@@ -42,6 +39,9 @@
     <ClCompile Include="nlib_exception.cpp">
       <Filter>ソース ファイル</Filter>
     </ClCompile>
+    <ClCompile Include="nlib_nicoVideoAuth.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="nlib_xmlHandler.h">
index eacf8f8..e918430 100644 (file)
@@ -208,7 +208,7 @@ NicoLiveStream_P NicoLiveStream_new(){
 
        InitializeCriticalSection(&self->sessionManager.cs);
 
-       self->chatManager.heartBeatTime = 180000;
+       self->chatManager.heartBeatTime = 60000;
 
        self->chatManager.heartBeatFlag = TRUE;
 
index 8dd4ba2..fae7300 100644 (file)
@@ -14,12 +14,14 @@ NicoVideoAuth_P NicoVideoAuth_new(){
 
 VOID NicoVideoAuth_delete(NicoVideoAuth_P* self){
 
-
+       
        free(*self);
        *self = NULL;
 
 }
 
+
+
 NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE browserType){
 
        NLIB_RESULT rslt = NLIB_ERR_CODE_NOTSET;
@@ -33,4 +35,10 @@ NLIB_RESULT NicoVideoAuth_getNicoVideoAuth(NicoVideoAuth_P self,BROWSERTYPE brow
 end:
 
        return rslt;
+}
+
+LPCTSTR NicoVideoAuth_getUserSession(NicoVideoAuth_P self){
+
+       return self->userSession;
+       
 }
\ No newline at end of file
index 411dad8..14ca9f8 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 847d433..99421dd 100644 (file)
@@ -29,12 +29,16 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE,
                //
                //\83A\83v\83\8a\83P\83P\81[\83V\83\87\83\93\8f\89\8aú\89»\8f\88\97\9d
                //
-
-               InitCommonControls();
-
-               if(_Module.Init(NULL, hInstance) != S_OK){
+               HRESULT hRes = ::CoInitialize(NULL);
+               ATLASSERT(SUCCEEDED(hRes));
+               //InitCommonControls();
+                AtlInitCommonControls(ICC_COOL_CLASSES | ICC_WIN95_CLASSES);
+                GUID guid;
+               if(_Module.Init(NULL, hInstance,&guid) != S_OK){
                        throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
                }
+
+               AtlAxWinInit();
                        
                if(InitializeNlite() != TRUE){
                        throw AppInitException(__LINE__,TEXT(__FILE__),TEXT(__FUNCTION__));
@@ -98,7 +102,7 @@ nliteend:
        _Module.RemoveMessageLoop();
        FinalizeNlite();
        _Module.Term();
-
+       ::CoUninitialize();
 
        return nRet;
 }
index c5f706f..8fcd98a 100644 (file)
@@ -29,10 +29,18 @@ namespace nlite{
 
        namespace nliteregex{
                typedef std::tr1::basic_regex<TCHAR> tregex;
-               const static tregex URL(TEXT("(https?|ftp)(://[-_.!~*\'()a-zA-Z0-9;/?:@&=+$,%#]+)"));
-               const static tregex TAGSTRING(TEXT("<[/a-zA-Z0-9= ]*>"));
-               const static tregex VIDEOID(TEXT("(sm|nm)([0-9])+"));
-               const static tregex LIVEID(TEXT("(lv)([0-9])+"));
+               namespace text{
+                       const static CString URL_TEXT = TEXT("(https?|ftp)(://[-_.!~*\'()a-zA-Z0-9;/?:@&=+$,%#]+)");
+                       const static CString TAG_TEXT = TEXT("<[\"#/a-zA-Z0-9= ]*>");
+                       const static CString VIDEOID_TEXT = TEXT("(sm|nm)([0-9])+");
+                       const static CString LIVEID_TEXT = TEXT("(lv)([0-9])+");
+                       const static CString LINK_TEXT = TEXT("(") + URL_TEXT + TEXT(")|(") + VIDEOID_TEXT + TEXT(")|(") + LIVEID_TEXT + TEXT(")");
+               }
+               const static tregex URL(text::URL_TEXT);
+               const static tregex TAGSTRING(text::TAG_TEXT);
+               const static tregex VIDEOID(text::VIDEOID_TEXT);
+               const static tregex LIVEID(text::LIVEID_TEXT);
+               const static tregex LILNKREGEX(text::LINK_TEXT);
                const static tstring NUTHINGSTRING(TEXT(""));
        }
 
index 318eeea..62936c2 100644 (file)
@@ -24,6 +24,7 @@
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
+    <UseOfAtl>Static</UseOfAtl>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-window|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
index 646c2ba..63b7991 100644 (file)
@@ -4,6 +4,7 @@
 
 namespace nlite{
 
+       static const LPCTSTR ADDMYLIST_URL = TEXT("http://www.nicovideo.jp/mylist_add/video/");
 
        CAddToMyListWindow::CAddToMyListWindow(CNicoVideoAuth &in_auth):refAuth(in_auth){}
 
@@ -39,14 +40,26 @@ namespace nlite{
                SetMsgHandled(false);
        }
 
-       VOID WINAPI CAddToMyListWindow::OnTitleChange(BSTR title){
-               GetTopLevelWindow().SetWindowText(COLE2CT(title));
-       }
+       VOID WINAPI CAddToMyListWindow::OnBeforeNavigate2(IDispatch** dispatch, VARIANT* url, VARIANT* flags,VARIANT* frameName, VARIANT* postData, VARIANT* headers, VARIANT_BOOL* cancel){
+
+               dumpln(TEXT("event:Set"));
+               return;
 
+       }
+       
        VOID CAddToMyListWindow::Navigate(LPCTSTR lpszUrl){
                if(m_pWB2){
                        CComVariant v;
-                       m_pWB2->Navigate(CComBSTR(lpszUrl), &v, &v, &v, &v);
+                       CNLiteString userSession(refAuth.GetUserSession());
+                       CComVariant header(userSession);
+                       
+                       
+                       //header.SetByRef((BSTR)userSession);
+                       
+                       m_pWB2->Navigate(CNLiteString(lpszUrl), &v, &v, &v, &v);
+
+                       
+                       
                }
        }
        
@@ -54,7 +67,15 @@ namespace nlite{
 
 
        }
-       
+       VOID CAddToMyListDialog::SetLiveNo(LPCTSTR lvNo){
+               liveNo = ADDMYLIST_URL;
+               liveNo += lvNo;
+       }
+
+       VOID CAddToMyListDialog::OnEndDialog(){
+
+               addToMyListWindow.DestroyWindow();
+       }
 
        BOOL CAddToMyListDialog::OnInitDialog(CWindow wndFocus, LPARAM lInitParam){
                
@@ -76,23 +97,28 @@ namespace nlite{
                        ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
                SetIcon(hIconSmall, FALSE);
                */
-               //addToMyListWindow.Create(m_hWnd, rcDefault,_T("Shell.Explorer.2"),WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE, IDC_IE);
+               RECT selfRc;
+               this->GetClientRect(&selfRc);
+
+               addToMyListWindow.Create(m_hWnd, selfRc,_T("Shell.Explorer.2"),WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE, IDC_IE);
                
 
 
 
 
 
-               //addToMyListWindow.Navigate(_T("http://wtl.sourceforge.net/"));
+               addToMyListWindow.Navigate(liveNo);
                
                return TRUE;
        }
 
        VOID CAddToMyListDialog::OnOK(UINT uNotifyCode, int nID, CWindow wndCtl){
+               OnEndDialog();
                EndDialog(nID);
        }
 
        VOID CAddToMyListDialog::OnCancel(UINT uNotifyCode, int nID, CWindow wndCtl){
+               OnEndDialog();
                EndDialog(nID);
        }
 
index 2f13b72..c75f5aa 100644 (file)
@@ -27,7 +27,7 @@ namespace nlite{
 
                BEGIN_SINK_MAP(CAddToMyListWindow)
                        SINK_ENTRY_EX(IDC_IE, 
-                       DIID_DWebBrowserEvents2, DISPID_TITLECHANGE, OnTitleChange)
+                       DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, OnBeforeNavigate2)
                END_SINK_MAP()
 
 
@@ -48,8 +48,7 @@ namespace nlite{
 
 
 
-               VOID WINAPI OnTitleChange(BSTR title);
-
+               VOID WINAPI OnBeforeNavigate2(IDispatch** dispatch, VARIANT* url, VARIANT* flags,VARIANT* frameName, VARIANT* postData, VARIANT* headers, VARIANT_BOOL* cancel);
                VOID Navigate(LPCTSTR lpszUrl);
 
 
@@ -61,7 +60,7 @@ namespace nlite{
 
                CAddToMyListWindow addToMyListWindow;
 
-               
+               CNLiteString liveNo;
                CNicoVideoAuth &refAuth;
 
        public:
@@ -76,6 +75,12 @@ namespace nlite{
 
                CAddToMyListDialog(CNicoVideoAuth &in_auth);
 
+               VOID SetLiveNo(LPCTSTR lvNo);
+
+
+       private:
+
+               VOID OnEndDialog();
        private:
                BOOL OnInitDialog(CWindow wndFocus, LPARAM lInitParam);
                VOID OnOK(UINT uNotifyCode, int nID, CWindow wndCtl);
index ac98a1b..9542bfe 100644 (file)
@@ -18,9 +18,7 @@ namespace nlite{
                        
                        tstring viewString(regex_replace(tstring(chat.chatBuf),nliteregex::TAGSTRING,nliteregex::NUTHINGSTRING));
                        rslt = __super::SetWindowText(viewString.c_str());
-                       linkStringBeside(viewString,nliteregex::URL);
-                       linkStringBeside(viewString,nliteregex::VIDEOID);
-                       linkStringBeside(viewString,nliteregex::LIVEID);
+                       linkStringBeside(viewString,nliteregex::LILNKREGEX);
                        
                        
 
@@ -1532,6 +1530,7 @@ end:
                                        } else if(regex_match((LPCTSTR)selTextBuf,nliteregex::VIDEOID) == TRUE){
 
                                                CAddToMyListDialog addToMyListDialog(self.refAuth);
+                                               addToMyListDialog.SetLiveNo(selTextBuf);
                                                addToMyListDialog.DoModal();
                                                
                                                
index 229c275..37e16be 100644 (file)
@@ -7,6 +7,8 @@
 #include <nlib_define.h>
 #include "resource.h"
 
+
+
 #include "nlite.h"
 #include "nlite_string.h"
 #include "nlite_exception.h"
index 45c2123..7ba889c 100644 (file)
@@ -50,6 +50,12 @@ CNicoVideoAuth::~CNicoVideoAuth(){
        NicoVideoAuth_delete(&nicoVideoAuth);
 }
 
+LPCTSTR CNicoVideoAuth::GetUserSession(){
+
+       return NicoVideoAuth_getUserSession(nicoVideoAuth);
+
+}
+
 VOID CNicoVideoAuth::SetBrowserType(BROWSERTYPE bt){
        NLIB_RESULT rslt;
 
index 289a5f5..b1600ca 100644 (file)
@@ -21,6 +21,11 @@ namespace nlite{
                ///\83f\83X\83g\83\89\83N\83^
                ///
                ~CNicoVideoAuth();
+
+               ///
+               ///\83\86\81[\83U\83Z\83b\83V\83\87\83\93\82ð\8eæ\93¾
+               ///
+               LPCTSTR GetUserSession();
                
                ///
                ///\83u\83\89\83E\83U\83^\83C\83v\82ð\83Z\83b\83g
index 11b5d0b..8dd4297 100644 (file)
@@ -11,7 +11,7 @@
 #define WIN32_LEAN_AND_MEAN                                    // Windows \83w\83b\83_\81[\82©\82ç\8eg\97p\82³\82ê\82Ä\82¢\82È\82¢\95\94\95ª\82ð\8f\9c\8aO\82µ\82Ü\82·\81B
 #define _CRT_SECURE_NO_WARNINGS 1                      //vc++\82Ì\82¨\82¹\82Á\82©\82¢\82È\8cx\8d\90\82ð\8fÁ\82·
 #define  _CRT_NON_CONFORMING_SWPRINTFS 1       //vc++\82Ì\82¨\82¹\82Á\82©\82¢\82È\8cx\8d\90\82ð\8fÁ\82·
-#define USE_STUB                                                       //\83X\83^\83u\82ð\8eg\97p\82·\82é\8fê\8d\87\82Í\83R\83\81\83\93\83g\83A\83E\83g\82ð\89ð\8f\9c\82·\82é
+//#define USE_STUB                                                     //\83X\83^\83u\82ð\8eg\97p\82·\82é\8fê\8d\87\82Í\83R\83\81\83\93\83g\83A\83E\83g\82ð\89ð\8f\9c\82·\82é
 #define WINDEBUGER_NOPRINTING                          //\83f\83o\83b\83O\8fo\97Í\82ð\83R\83\93\83\\81[\83\8b\82É\95\\8e¦\82µ\82½\82­\82È\82¢\8fê\8d\87\92è\8b`\82·\82é
 #define _WTL_NO_CSTRING
 
@@ -55,6 +55,8 @@
 #include <atlapp.h>
 
 #include <atlcom.h>
+#include <atlcoll.h>
+#include <atlsimpcoll.h>
 extern CAppModule _Module;
 #include <atlwin.h>
 #include <atlhost.h>
index 9b8d424..31e5134 100644 (file)
@@ -211,7 +211,7 @@ unsigned int WINAPI commentthread(VOID *usadata){
 
                for(index2 = 0;index2 < ONERECEVECHATCOUNT;index2++){
 
-                       liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 254 http://live.nicovideo.jp/") : TEXT("<font color=FF0000>sm552447 nm6655447 lv25447 </font >");
+                       liveChat.chatBuf = commentcount % 2 == 0 ? TEXT("http://live.nicovideo.jp/watch/lv79715214?alert=1 254 http://live.nicovideo.jp/") : TEXT("<font color=FF0000>sm552447 sm1543514 lv25447 </font >");
                        _stprintf((LPTSTR)liveChat.user_id,user_id_format,rand() % 15);
                        commentcount++;
                        _stprintf((LPTSTR)liveChat.no,TEXT("%u"),commentcount);
@@ -507,4 +507,14 @@ LPCTSTR NicoLiveStream_getTitle(NicoLiveStream_P self){
        static const LPCTSTR rslt = TEXT("");
        return rslt;
 #endif
+}
+
+
+
+
+LPCTSTR NicoVideoAuth_getUserSession(NicoVideoAuth_P self){
+
+       
+       return TEXT("sm9681193");
+       
 }
\ No newline at end of file