文档章节

Windows Mobile Incoming Call View Custom

AK_47
 AK_47
发布于 2014/07/09 17:41
字数 1316
阅读 3
收藏 0

Incoming call view custom of Windows Mobile PhoneCanvas

 

关于WinMobile电话自定义, 在SDK Documents里已经有说明 "Phone Canvas Customization"

位置: Shell, GWES, and User Interface > Shell > Shell OS Design Development >

Sample Code: ../WM650/PUBLIC/APPS/OAK/SAMPLES

1. Customizing Controls in the Phone Canvas

Shell > Shell OS Design Development > Phone Canvas Customization >

添加注册表, 告诉MSFT的程序说我们要自定义电话,  并说明要加载哪个DLL文件.

2. PHExtGetPhoneViewInfo 函数.  通过它, 可以调用自己自定义的对话框,

Shell > Shell OS Design Development > Phone Canvas Customization > 这里有说明哪些电话对框可以充许自定义

下面关于PHExtGetPhoneViewInfo的例子:
 /*PHExtGetPhoneViewInfo
   
    Used to provide a new layout for the dialog box representing the phone view
    specified in parameter "view".  Not all views support this functionality.  See the
    below table.

    Either PH_VIF_SQUARE, PH_VIF_PORTRAIT, or PH_VIF_LANDSCAPE will be set in the
    pvif member indicating the dialog template that the phone application is
    requesting.  To specify a dialog template, fill in the phInstance parameter
    and the plpTemplateName.  phInstance identifies a module that
    contains a dialog box template named by the plpTemplateName parameter.
    plpTemplateName  is a long pointer to a null-terminated string that names
    the dialog box template resource in the module identified by the phInstance
    parameter. This template is substituted for the phone application抯 dialog
    box template used to create the phone view. For numbered dialog box
    resources, plpTemplateName can be a value returned by the MAKEINTRESOURCE
    macro.

    Additionally, the OEM can provide a plpfnHook hook procedure in the phone
    view.  The hook procedure can process messages sent to the dialog box
    representing the phone view.  To enable a hook procedure, add the
    PH_VIF_ENABLEHOOK flag to the pvif parameter and specify the address of
    the hook procedure in the plpfnHook parameter.  The hook procedure should
    return TRUE to indicate that the phone application should not process
    this message.  A return value of FALSE will cause  the phone application
    to continue with its default handling of the message.

    Note that if controls are added and/or removed, their control ids should not
    coincide with the same id's used in the default layouts.  The phone dialogs
    may attempt to communicate with these controls via their control id.

    This function is called by the phone application both when phone
    view is being created and when the phone view needs to rotate
    due to a screen orientation change.  This allows the phone application
    to use different dialog templates for portrait and landscape.
   
    Table:
    PH_VIEW_INCOMING          // template : incoming call view
    PH_VIEW_DIALER            // template : PocketPC dialer view
    PH_VIEW_CALL_PICKER       // template : remove a call from a conference (GSM only)
    PH_VIEW_NETWORK_SELECTION // template : manual network selection (GSM only)
    PH_VIEW_CALL_HISTORY      // NA (for PocketPC only, bitmaps can be changed)
    PH_VIEW_SPEED_DIAL        // NA (for PocketPC only, bitmaps can be changed)
    PH_VIEW_SIM_PIN,          // NA (for PocketPC only, bitmaps can be changed)
    PH_VIEW_PROGRESS          // template : call progress or active calls view
   
    [in]     view : Any of the PH_VIEW enums.  It indicates which view
                      the phone application is creating or rotating.  Call history,
                      speed dial, and the unlock SIM PIN views are not replaceable
                      by the OEM.  Hence, the phone application will not call
                      PHExtGetPhoneViewInfo for these views.
    [in/out] pvif            : PH_VIF_SQUARE, PH_VIF_PORTRAIT, and PH_VIF_LANDSCAPE
                               are set as input.  The client can add PH_VIF_ENABLEHOOK to
                               indicate that plpfnHook is valid.
    [out]    phInstance      : see above.
    [out]    plpTemplateName : See above.
    [out]    plpfnHook       : See above.
   
    returns:
    S_OK      : success.
    E_NOTIMPL : the phone application should use its defaults.*/
extern "C" HRESULT PHExtGetPhoneViewInfo(PH_VIEW view, HINSTANCE* phInstance, PH_VIEWINFOFLAGS* pvif, LPPHONEVIEWHOOKPROC*  plpfnHook, LPCTSTR* plpTemplateName)
{
    HRESULT hr = E_NOTIMPL;

    // Specify dialog templates for dialer view
    switch (view)
    {
    // dialer view
    case PH_VIEW_DIALER:
        break;

    // progress view
    case PH_VIEW_PROGRESS:
        break;
   
    // incoming call view
    case PH_VIEW_INCOMING:
        switch(*pvif)
        {
        case PH_VIF_PORTRAIT:
            // Specify a calert portrait view dialog template
            *phInstance = g_MainWnd.m_hInst;
            *pvif = (PH_VIEWINFOFLAGS) (*pvif | PH_VIF_ENABLEHOOK);  //如果不想HOOK的话,这行和下面那一行可以注释掉
            *plpfnHook = (LPPHONEVIEWHOOKPROC)CalertWndProc;        //如果不想HOOK的话,本行和上面那一行可以注释掉
            *plpTemplateName = MAKEINTRESOURCE(dwIDD_CALERT_PORT);
            hr = S_OK;
            break;

        case PH_VIF_LANDSCAPE:
            // Specify a calert landscape view dialog template
            *phInstance = g_MainWnd.m_hInst;
            *pvif = (PH_VIEWINFOFLAGS) (*pvif | PH_VIF_ENABLEHOOK);
            *plpfnHook = (LPPHONEVIEWHOOKPROC)CalertWndProc;
            *plpTemplateName = MAKEINTRESOURCE(dwIDD_CALERT_LAND);
            hr = S_OK;
            break;

        default:
            break;
        }
        break;

    default:
        break;
    }

    return hr;
}

这样当有电话进来的时候, 就会调用CalertWndProc,  和调用dwIDD_CALERT_XXX资源对话框了. 我做的是整个来电对话框自己Draw上相关的来电信息,还有接听/挂断按钮,添加菜单等. 没用dwIDD_CALERT_XXX资源对话框, 所以没有试过不用HOOK, 只换Caler资源对框来自定义的情况, 不过文档上说是可以的...

3. 来电时会调用CalertWndProc, 这里要添加一些小小的处理. 这个CallBack里的hWnd是最底层的(用Remote SPY 可以看得到), 所以要用两次GetParent来取得MSFT显示的来电对话框的handle, 将其它Move出显示区域,并对它进行SetWindowLong.

/*********************************************************************
CalertWndProc

Purpose:
The windows procedure for the Calert control

Arguments:
HWND hWnd       - handle to the window
UINT uMsg       - the message to process
WPARAM wParam   - additional parameter
LPARAM lParam   - additional parameter

Returns:
LRESULT lRes 0 = success
**********************************************************************/
LRESULT CALLBACK CalertWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    LRESULT lRes = 0;
    HWND hWndWorker = NULL;

    switch (uMsg)
    {
    case WM_INITDIALOG:
        m_hWndCalert = hWnd;

        // to hide and SetWindowLong the MSFT incoming call view main dialog
        hWndWorker = GetParent(hWnd);
        if (hWndWorker == NULL)
        {
            break;
        }

        m_hWndIncomingCall = GetParent(hWndWorker);

        if (m_hWndIncomingCall != NULL)
        {

            // 这里我将MSFT的来电对话框Move出去,  这样它就不会显示出来了

            MoveWindow(m_hWndIncomingCall, -1, -1, 0, 0, FALSE);

            // set window long for MSFT incoming call view main dialog
            if (m_OldIncomingCallWndProc == NULL)
            {

                // 调用SetWindowLong, 来到来电对话框的CallBack消息.

                m_OldIncomingCallWndProc = (WNDPROC)SetWindowLong(m_hWndIncomingCall, GWL_WNDPROC, (LONG)IncomingCallWndProc);

                if(!m_OldIncomingCallWndProc)
                {
                    DEBUGMSG(1 , (L"m_OldIncomingCallWndProc == NULL"));
                }
            }
        }
        break;

    default:
        break;
    }

    return lRes;
}

4. IncomingCallWndProc 处理. SHBM_SHOW(用Remote SPY 可以看得到)这个就是来电BubbleBox, Show/Hide时的消息

/*********************************************************************
IncomingCallWndProc

Purpose:
The windows procedure for the Incoming Call control

Arguments:
HWND hWnd       - handle to the window
UINT uMsg       - the message to process
WPARAM wParam   - additional parameter
LPARAM lParam   - additional parameter

Returns:
LRESULT lRes 0 = success, else callback default

**********************************************************************/
LRESULT CALLBACK CCalert::IncomingCallWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    LRESULT lRet = S_OK;

    switch (uMsg)
    {
    case SHBM_SHOW:
        // shbox.h: Show/Hide dialog box. wParam == TRUE to Show. wParam == FALSE to Hide. lParam=TRUE to set foreground.
        if (wParam)
        {   
            // 来电对话框 Show

            // 这里用来添加自
        }

        // Hide the incoming call dialog box
        else
        {
            // hide the custome incoming call and the default incoming call
            // 来电对话框 Hide
        }
        break;

    default:
        return CallWindowProc(m_OldIncomingCallWndProc, hWnd, uMsg, wParam, lParam);
        break;
    }

    return lRet;
}

OK, 这样当来电的时候就显示自定义的窗口了...
关于来电防火墙的处理嘛,就应该更简单了:-<

关于来电话定义的东西比较多, 这里我先写点对来电对话框自定义显示的小结, 等有时间再写其它的.

© 著作权归作者所有

AK_47
粉丝 16
博文 533
码字总数 569998
作品 0
嘉定
程序员
私信 提问
SHOPPICA OPENCART 商城自适应主题模板 ABC-0002

SHOPPICA OPENCART 商城自适应主题模板 ABC-0002 Theme features 100% OpenCart 1.5.3.x / 1.5.4.x / 1.5.5.x / 1.5.6 compatible! Responsive layout – you shop will appear nicely on e......

OpenCart中国
2015/06/25
92
0
微软推送 10586.318 累积更新,针对 win10 PC 和 Mobile

微软今天面向Win10手机版和桌面版正式版用户开启了新一波累积更新推送。在此次更新之后,Win10 Mobile系统正式版版本号将升级为10586.318。与往常一样,本次更新以修复问题和提升系统性能为主...

oschina
2016/05/11
3.5K
20
Rocket.Chat 0.74.1 发布,Slack 开源替代品

Rocket.Chat 是特性最丰富的 Slack 开源替代品之一,主要功能:群组聊天,直接通信,私聊群,桌面通知,媒体嵌入,链接预览,文件上传,语音/视频 聊天,截图等等。 Rocket.Chat 原生支持 Wi...

程六金
02/03
638
1
chiuanwei/TinyTeam.Console

TTConsole The Best Debuger & Runtime Console For Unity3D ##一、Introduce This is a simple UGUI style console。In Mobile and Editor can quickly and easily view runtime Log inform......

chiuanwei
2016/02/21
0
0
SyncMate 3.5 发布,支持 Android 4.x 同步

SyncMate是新的信息管理工具,可同步文件夹,书签,通讯录, iCal, iTunes , iPhoto信息到你的装备上,并可以检查设备的电池状态。 Release Notes: 1. This release adds synchronization ...

红薯
2011/11/18
616
0

没有更多内容

加载失败,请刷新页面

加载更多

面试官问:平时碰到系统CPU飙高和频繁GC,你会怎么排查?

处理过线上问题的同学基本上都会遇到系统突然运行缓慢,CPU 100%,以及Full GC次数过多的问题。当然,这些问题的最终导致的直观现象就是系统运行缓慢,并且有大量的报警。本文主要针对系统运...

Java高级架构师n
35分钟前
18
0
面向对象编程

1、类和对象 类是对象的蓝图和模板,而对象是实例;即对象是具体的实例,类是一个抽象的模板 当我们把一大堆拥有共同特征的对象的静态特征(属性)和动态特征(行为)都抽取出来后,就可以定...

huijue
今天
18
0
redis异常解决 :idea启动本地redis出现 jedis.exceptions.JedisDataException: NOAUTH Authentication required

第一次安装在本地redis服务,试试跑项目,结果却出现nested exception is redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication required错误,真是让人头疼 先检查一...

青慕
今天
32
0
Spring 之 IoC 源码分析 (基于注解方式)

一、 IoC 理论 IoC 全称为 Inversion of Control,翻译为 “控制反转”,它还有一个别名为 DI(Dependency Injection),即依赖注入。 二、IoC方式 Spring为IoC提供了2种方式,一种是基于xml...

星爵22
今天
32
0
Docker安装PostgresSql

Docker安装PostgresSql 拉取docker镜像 # docker pull postgres:10.1010.10: Pulling from library/postgres9fc222b64b0a: Pull complete 38296355136d: Pull complete 2809e135bbdb: Pu......

Tree
今天
17
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部