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

📄 tchbasic.c

📁 Windows CE下的触控屏驱动程序源代码
💻 C
字号:
//
// 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.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

@doc EX_TOUCH_DDI INTERNAL DRIVERS MDD TOUCH_PANEL

Module Name:  

@module mdd.c

Abstract:  
    This module contains the touch panel DLL entry point.<nl>


Functions:
TouchPanelDllEntry
Notes: 


--*/

#include    <windows.h>
#include    <types.h>
#include    <memory.h>
#include    <nkintr.h>
#include    <tchddi.h>
#include    <tchddsi.h>

PFN_TOUCH_PANEL_CALLBACK v_pfnCgrPointCallback;
PFN_TOUCH_PANEL_CALLBACK v_pfnCgrCallback = NULL;
extern ULONG   culReferenceCount;              //@globalvar ULONG | culReferenceCount | Count of attached threads
extern PFN_TOUCH_PANEL_CALLBACK v_pfnPointCallback;


/*++
Autodoc Information:

    @func BOOL | TouchPanelDllEntry |
    Dll entry point.

    @rdesc
    TRUE if the function succeeds. Otherwise, FALSE.

--*/
BOOL
TouchPanelDllEntry(
    HANDLE  hinstDll,    //@parm Process handle.
    DWORD   fdwReason,   //@parm Reason for calling the function.
    LPVOID  lpvReserved  //@parm Reserved, not used.
    )
{

    BOOL ReturnCode = TRUE;

    switch ( fdwReason )
    {
        case DLL_PROCESS_ATTACH:
            DEBUGREGISTER(hinstDll);
            DEBUGMSG( ZONE_FUNCTION, (TEXT("Dll Process Attach\r\n")) );

             //
             // Process is attaching.  We allow only 1 process to be attached.
             // If our global counter (maintained by the PDD) is greater than 0,
             //   error.
             //

            if ( DdsiTouchPanelAttach() > 1 )
            {
                DEBUGMSG( ZONE_FUNCTION, (TEXT("DdsiTouchPanelAttach > 1\r\n")) );
                DdsiTouchPanelDetach(); // if a process attach fails, the detach is
                 // never called. So adjust the count here.
                ReturnCode = FALSE;
            }

            break;

        case DLL_THREAD_ATTACH:
            DEBUGMSG( ZONE_FUNCTION, (TEXT("Dll Thread Attach\r\n")) );

             //
             // Thread is attaching.  We allow only 1 thread to be attached.
             //

            if ( ++culReferenceCount > 1 )
                ReturnCode = FALSE;
            break;

        case DLL_THREAD_DETACH:
            DEBUGMSG( ZONE_FUNCTION, (TEXT("Dll Thread Detach\r\n")) );

             //
             // Thread is detaching. If the detaching thread is the thread that
             // was allowed to attach, we now have no one to process touch panel
             // points. In this case we clear the callback functions, disable the
             // touch panel hardware, and disconnect from the logical interrupt.
             //

            if ( --culReferenceCount == 0 )
            {
                v_pfnPointCallback = NULL;
                DdsiTouchPanelDisable();
                InterruptDisable( gIntrTouch );
                if( SYSINTR_NOP != gIntrTouchChanged )
	                InterruptDisable( gIntrTouchChanged );
            }
            break;

        case DLL_PROCESS_DETACH:
            DEBUGMSG( ZONE_FUNCTION,
                      (TEXT("Dll Process Detach\r\n")) );

             //
             // Process is detaching.
             // If the detaching process is the process that was allowed
             // to attach, we reset the callback functions,
             // reference count, disable the touch panel, and disconnect from the
             // logical interrupt.
             //
             //
            DdsiTouchPanelDetach();
            break;
    }
    return ( ReturnCode );
}

⌨️ 快捷键说明

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