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

📄 imcf.cpp

📁 EP9315开发板的Wince6.0的BSP包文件
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++


Module Name:

    imcf.cpp

Abstract:

    MS Qwerty Input Method COM Class Factory CClassFactory implementation.


Revision History:

--*/

#include "dllmain.h"
#include "imcf.h"
#include <sipapi.h>
#include "im.h"


//
// Ctor, Dtor.
//

CClassFactory::CClassFactory( REFCLSID rclsid )
{
    g_dwObjectCount++ ;

    m_cRef = 1;
    m_clsid = rclsid;
    
}

CClassFactory::~CClassFactory()
{
    g_dwObjectCount-- ;
}


//
// IUnknown methods.
//

STDMETHODIMP CClassFactory::QueryInterface( REFIID riid, LPVOID FAR* ppobj )
{
    *ppobj = NULL;
    
    if( IID_IUnknown == riid || IID_IClassFactory == riid ) {
        *ppobj = (LPVOID)this;
        AddRef();
        return NOERROR;
    }

    return E_NOINTERFACE;
}

STDMETHODIMP_(ULONG) CClassFactory::AddRef(VOID)
{
    return ++m_cRef;
}

STDMETHODIMP_(ULONG) CClassFactory::Release(VOID)
{
    if( --m_cRef ) {
        return m_cRef;
    }
    delete this;
    return 0;
}


//
// IClassFactory methods.
//

extern "C" const CLSID CLSID_CMSQwertyIm;

STDMETHODIMP CClassFactory::CreateInstance(
    IUnknown FAR* pUnkOuter,
    REFIID riid,
    LPVOID FAR *ppunkObject )
{
    HRESULT hr = E_FAIL;


    if( ppunkObject ) {
        *ppunkObject = NULL;
    }


    //
    // We don't aggregate
    //

    if( pUnkOuter ) {
        return CLASS_E_NOAGGREGATION;
    }


    if( pUnkOuter && riid != IID_IUnknown ) {
        return E_INVALIDARG;
    }


    //
    // Create the class object and retrieve the requested interface.
    //

    if( CLSID_CMSQwertyIm == m_clsid ) {
        CInputMethod *pInputMethod = new CInputMethod( pUnkOuter, g_hInstDll );
        if (pInputMethod) {
            hr = pInputMethod->QueryInterface( riid, ppunkObject );
        }
    }
              
    return hr;
}

STDMETHODIMP CClassFactory::LockServer( BOOL fLock )
{
    if( fLock ) {
        g_dwObjectCount++;
    }else{
        g_dwObjectCount--;
    }

    return NOERROR;
}

⌨️ 快捷键说明

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