bookmarks of the day 04/26/2010

Posted by Toshi | | Posted On Apr 26, 2010 at 11:30 PM

  • tags: icon, tasktray, vc, c++

    • タスクトレイにアイコンを登録する方法



      CDialog クラスの派生型なら

      protected:
      NOTIFYICONDATA m_stNtfyIcon;



      をメンバ変数として追加。



      アイコンの登録

      CMyDialog::OnInitDialog あたりに

      /////////////////////////////////////////////////
      // アイコンをタスクトレイに表示します。
      m_stNtfyIcon.cbSize = sizeof( NOTIFYICONDATA );
      m_stNtfyIcon.uID = 0;
      m_stNtfyIcon.hWnd = m_hWnd;
      m_stNtfyIcon.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
      m_stNtfyIcon.hIcon = AfxGetApp()->LoadIcon( IDR_MAINFRAME );
      m_stNtfyIcon.uCallbackMessage = WM_USER_NTFYICON;
      lstrcpy( m_stNtfyIcon.szTip, _T( "テスト" ) );
      ::Shell_NotifyIcon( NIM_ADD, &m_stNtfyIcon );



      アイコンの削除

      CMyDialog::OnDestroy あたりに
      //タスクトレイのアイコンを削除します。
      ::Shell_NotifyIcon( NIM_DELETE, &m_stNtfyIcon );




      タスクトレイ上のアイコンに操作があった場合の処理


      LRESULT CMyDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
      {
      switch( message )
      {
      case WM_USER_NTFYICON: //アイコンからのメッセージ。
      {
      if( lParam == WM_LBUTTONDOWN ){
      // 左クリック時の処理
      }
      else if( lParam == WM_RBUTTONDOWN ){
      // 右クリック時の処理
      }
      }
      return 0;
      }
      return CDialog::WindowProc(message, wParam, lParam);
      }
  • tags: google, calendar, googlecalendar, app

  • tags: python, google, code, ttk, gui


Posted from Diigo. The rest of my favorite links are here.
blog comments powered by Disqus