⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 infoapp.hpp

📁 一个WinCE6。0下的IP phone的源代码
💻 HPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
#pragma once
#ifndef __INFOAPP_HPP__
#define __INFOAPP_HPP__


#include <windows.h>
#include <list.hxx>

#include <atlbase.h>
#include "voipstore.h"
#include "IExchangeClient.h"
#include <pimstore.h>
#include "Debug.hpp"
#include "DatabaseAPI.hpp"
#include <SettingsApi.hpp>

#define WM_SCREEN_REFRESH            (WM_APP + 1)
#define WM_MENU_DONE                 (WM_APP + 2)
#define WM_EXCHANGE_QUERY_COMPLETED  (WM_APP + 3)
#define WM_INFOAPP_SETTINGSCHANGE    (WM_APP + 4)

//
//  Setup PHInfo logging zones and module names.
//
#ifdef DEBUG
    //
    //  PhInfo debug zones
    //
    #define ZONE_PHINFO_ERROR         DEBUGZONE(0) //an error has occurred
    #define ZONE_PHINFO_CTOR          DEBUGZONE(1) //constructor/destructor/initialization calls (tracing)
    #define ZONE_PHINFO_WARNING       DEBUGZONE(2) //Warning
    #define ZONE_PHINFO_INFORMATION   DEBUGZONE(3) //Information
    
#else 
    //
    //  Do nothing in retail.
    //
    #define ZONE_PHINFO_ERROR
    #define ZONE_PHINFO_CTOR
    #define ZONE_PHINFO_WARNING
    #define ZONE_PHINFO_INFORMATION
#endif

class InfoApp_t :
    public IExchangeClientRequestCallback
{

public:
    enum ScreenId
    {
        IdDefault = 0,
        IdEmpty,

        //
        //  Options from the Information menu screen.
        //
        IdCallLogMenu,
        IdContactMenu,
        IdSpeedDialList,
        IdBlockedCallers, 

        //
        //  Deeper within speed dial screen.
        //        
        IdSpeedDialEdit,

        //
        // Dialogs that are shown when one of the Call log menus are selected.
        //  
        IdIncomingCallsListDialog,
        IdOutgoingCallsListDialog,
        IdMissedCallsListDialog,
        IdBlockedCallsListDialog, 

        //
        //  Dialogs that show contact lists.
        //
        IdOutlookContactListDialog,
        IdGalContactListDialog,
        
        //
        //  Dialogs that show the call details.
        //
        IdOutlookContactDetailsDialog,
        IdGalContactDetailsDialog,
        
        IdIncomingCallDetailsDialog,
        IdOutgoingCallDetailsDialog,
        IdMissedCallDetailsDialog,
        
        IdLast          //MUST be last item
    };


public:

    InfoApp_t();
   ~InfoApp_t();

    //
    // IUnknown
    //
    ULONG STDMETHODCALLTYPE AddRef();
    ULONG STDMETHODCALLTYPE Release();
    
    HRESULT STDMETHODCALLTYPE QueryInterface(
        REFIID riid, 
        __deref_out_opt VOID** ppvObj
        );

    //
    // IExchangeClientRequestCallback
    //
    HRESULT STDMETHODCALLTYPE OnRequestProgress(
        __in IExchangeClientRequest* piRequest, 
        ExchangeClientRequestStatus status
        );

    HRESULT STDMETHODCALLTYPE OnShutdown();

    //
    // Public non-COM APIs
    //
        
    static 
    HRESULT 
    s_SendCommandLine(
        __in const WCHAR*  pCommandLine
        );
    
    HRESULT 
    Run(
        __in const WCHAR*  pCommandLine
        );

    static 
    LRESULT WINAPI   
    s_HiddenWndProc(
        HWND   Window, 
        UINT   Message, 
        WPARAM wParam, 
        LPARAM lParam
        );
     
    HRESULT 
    CreateNewScreen(
        ScreenId Id
        );
    
    HRESULT 
    GoBackToPreviousScreen (
        void
        );

    HRESULT 
    AddToScreenSequence (
        ScreenId Id,
        HWND     NewWindow
        );

    HRESULT
    GetCallerInfoDB(
        IVoIPCallerInfoDB** ppDB
        );

    HRESULT
    GetCallLogDB(
        IVoIPCallLogDB** ppDB
        );

    HRESULT
    GetExchangeClient(
        __deref_out_opt IExchangeClient** ppExchangeClient
        );
    
    HRESULT
    GetOutlookApp(
        __deref_out_opt IPOutlookApp** ppOutlookApp
        );
    
    HRESULT
    CreateSpeedDialEditScreen(
        __in_opt IUnknown* pUnk
        );

    HRESULT 
    CreateDetailsScreen(
        ScreenId       DetailsScreenId,
        __in IUnknown* pUnk
        );

    HRESULT 
    AddToSpeedDial(
        PH_SPEEDDIAL_ENTRY* pEntry,
        BOOL                ResetNavigation = FALSE
        );
    
private:
    
    LRESULT 
    HiddenWndProc(
        HWND   Window, 
        UINT   Message, 
        WPARAM wParam, 
        LPARAM lParam
        );

    HRESULT 
    CreateHiddenWindow(
        void
        );

    HRESULT
    ListenForSettingsChanges();

    HRESULT
    SetHttpProxy();
    
    HRESULT
    SetExchangeServer();

    void
    DestroyHiddenWindow(
        void
        );
    
    HRESULT 
    OnCommandLine(
        ScreenId Id
        );    

    BOOL
    OnHelp (
        void
        );
    
    HRESULT
    OnSettingsChange(
        DWORD ChangedSettings
        );

    HRESULT
    AuthenticateUser(
        __inout BOOL* pfAlreadyAuthenticated
        );
    
    HRESULT
    OnAuthRequestComplete(
        AuthenticationResult_e Result
        );
    
    HWND 
    CreatePhoneInformationMenuScreen (
        ScreenId Id
        );

    HRESULT
    Exit();

    void 
    ClearScreenSequence (
        void
        );

    void 
    DestroyHelpWindow (
        void
        );

private:
    //
    //  Structure that holds the screen information that are displayed.
    //
    struct ScreenInformation
    {
        HWND     WindowHandle;
        ScreenId Id;
    };    
    typedef ce::list<ScreenInformation> ScreenList;

private:  
    
    bool         m_IsRunning;
    bool         m_WaitingForAuth;

    HWND         m_HiddenWindow;
    HWND         m_HelpDialog;
    ULONG        m_RefCount;
    HREGNOTIFY   m_NotifyHandle;    
    ScreenList   m_ScreenSequence;
    ScreenId     m_PendingAuthScreenId;
    
    CComPtr<IVoIPCallLogDB>     m_cpCallLogDB;
    CComPtr<IVoIPCallerInfoDB>  m_cpCallerInfoDB;
    CComPtr<IExchangeClient>    m_cpExchangeClient;
    CComPtr<IPOutlookApp>       m_cpOutlookApp;
    CComPtr<IUnknown>           m_cpPendingAuthSpeedDialRecord;
};

//
// Global data
//
struct PhInfoGlobalData_t
{
    static InfoApp_t* pPhInfoApp;
};

#endif 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -