<dfn id="is4kg"></dfn>
  • <ul id="is4kg"></ul>
  • <abbr id="is4kg"></abbr>
  • <ul id="is4kg"></ul>
    <bdo id="is4kg"></bdo>

    曙海教育集團論壇Win CE 專區(qū)WinCE應用開發(fā) → WinCE應用開發(fā)——觸摸屏輸入


      共有8430人關注過本帖樹形打印

    主題:WinCE應用開發(fā)——觸摸屏輸入

    美女呀,離線,留言給我吧!
    wangxinxin
      1樓 個性首頁 | 博客 | 信息 | 搜索 | 郵箱 | 主頁 | UC


    加好友 發(fā)短信
    等級:青蜂俠 帖子:1393 積分:14038 威望:0 精華:0 注冊:2010-11-12 11:08:23
    WinCE應用開發(fā)——觸摸屏輸入  發(fā)帖心情 Post By:2010-11-26 9:10:54

    一,信息

    觸摸屏信息同鼠標信息,不過只有WM_LBUTTONDOWNWM_LBUTTONUP WM_MOUSEMOVE 三種。

    二,捕捉函數(shù)

    BOOL GetMouseMovePoints (PPOINT pptBuf, UINT nBufPoints,

    UINT *pnPointsRetrieved);

    三,實例

    PenTrac.h
    #define dim(x) (sizeof(x) / sizeof(x[0]))
    struct decodeUINT {                             // Structure associates
        UINT Code;                                  // messages 
                                                    // with a function. 
        LRESULT (*Fxn)(HWND, UINT, WPARAM, LPARAM);
    }; 
    struct decodeCMD {                              // Structure associates
        UINT Code;                                  // menu IDs with a 
        LRESULT (*Fxn)(HWND, WORD, HWND, WORD);     // function.
    };
    HWND InitInstance (HINSTANCE, LPWSTR, int);
    int TermInstance (HINSTANCE, int);
    LRESULT CALLBACK MainWndProc (HWND, UINT, WPARAM, LPARAM);
    LRESULT DoPaintMain (HWND, UINT, WPARAM, LPARAM);
    LRESULT DoMouseMain (HWND, UINT, WPARAM, LPARAM);
    LRESULT DoDestroyMain (HWND, UINT, WPARAM, LPARAM);
    PenTrac.cpp
    #include <windows.h>                 // For all that Windows stuff
    #include "pentrac.h"                 // Program-specific stuff
    const TCHAR szAppName[] = TEXT ("PenTrac");
    HINSTANCE hInst;                     // Program instance handle
    const struct decodeUINT MainMessages[] = {
        WM_LBUTTONDOWN, DoMouseMain,
        WM_MOUSEMOVE, DoMouseMain,
        WM_DESTROY, DoDestroyMain,
    };
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        LPWSTR lpCmdLine, int nCmdShow) {
        MSG msg;
        int rc = 0;
        HWND hwndMain;
        hwndMain = InitInstance (hInstance, lpCmdLine, nCmdShow);
        if (hwndMain == 0)
            return 0x10;
        while (GetMessage (&msg, NULL, 0, 0)) {
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
        return TermInstance (hInstance, msg.wParam);
    }
    HWND InitInstance (HINSTANCE hInstance, LPWSTR lpCmdLine, int nCmdShow) {
        WNDCLASS wc;
        HWND hWnd;
    #if defined(WIN32_PLATFORM_PSPC)
        hWnd = FindWindow (szAppName, NULL);
        if (hWnd) {
            SetForegroundWindow ((HWND)(((DWORD)hWnd) | 0x01));    
            return 0;
        }
    #endif
        hInst = hInstance;
        wc.style = 0;                             // Window style
        wc.lpfnWndProc = MainWndProc;             // Callback function
        wc.cbClsExtra = 0;                        // Extra class data
        wc.cbWndExtra = 0;                        // Extra window data
        wc.hInstance = hInstance;                 // Owner handle
        wc.hIcon = NULL,                          // Application icon
        wc.hCursor = LoadCursor (NULL, IDC_ARROW);// Default cursor
        wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName =  NULL;                  // Menu name
        wc.lpszClassName = szAppName;             // Window class name
        if (RegisterClass (&wc) == 0) return 0;
        hWnd = CreateWindowEx (WS_EX_NODRAG, szAppName, TEXT ("PenTrac"),
                             WS_VISIBLE | WS_CAPTION | WS_SYSMENU,
                             CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
                             CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
        if (!IsWindow (hWnd)) return 0;
        ShowWindow (hWnd, nCmdShow);
        UpdateWindow (hWnd);
        return hWnd;
    }
    int TermInstance (HINSTANCE hInstance, int nDefRC) {
        return nDefRC;
    }
    LRESULT CALLBACK MainWndProc (HWND hWnd, UINT wMsg, WPARAM wParam,
                                  LPARAM lParam) {
        INT i;
        for (i = 0; i < dim(MainMessages); i++) {
            if (wMsg == MainMessages[i].Code)
                return (*MainMessages[i].Fxn)(hWnd, wMsg, wParam, lParam);
        }
        return DefWindowProc (hWnd, wMsg, wParam, lParam);
    }
    LRESULT DoMouseMain (HWND hWnd, UINT wMsg, WPARAM wParam, 
                         LPARAM lParam) {
        POINT pt[64];
        POINT ptM;
        UINT i, uPoints = 0;
        HDC hdc;
        ptM.x = LOWORD (lParam);
        ptM.y = HIWORD (lParam);
        hdc = GetDC (hWnd);
        if (wMsg == WM_MOUSEMOVE) {
            if (wParam & MK_SHIFT) 
                GetMouseMovePoints (pt, 64, &uPoints);
            for (i = 0; i < uPoints; i++) {
                pt[i].x /= 4;  // Convert move pts to screen coords
                pt[i].y /= 4;
                MapWindowPoints (HWND_DESKTOP, hWnd, &pt[i], 1);
                SetPixel (hdc, pt[i].x,   pt[i].y, RGB (255, 0, 0));
                SetPixel (hdc, pt[i].x+1, pt[i].y, RGB (255, 0, 0));
                SetPixel (hdc, pt[i].x,   pt[i].y+1, RGB (255, 0, 0));
                SetPixel (hdc, pt[i].x+1, pt[i].y+1, RGB (255, 0, 0));
            }
        }
        SetPixel (hdc, ptM.x, ptM.y, RGB (0, 0, 0));
        SetPixel (hdc, ptM.x+1, ptM.y, RGB (0, 0, 0));
        SetPixel (hdc, ptM.x, ptM.y+1, RGB (0, 0, 0));
        SetPixel (hdc, ptM.x+1, ptM.y+1, RGB (0, 0, 0));
        ReleaseDC (hWnd, hdc);
        Sleep(25);
        return 0;
    }
    LRESULT DoDestroyMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                           LPARAM lParam) {
        PostQuitMessage (0);
        return 0;
    }

    clip_image001


    支持(0中立(0反對(0單帖管理 | 引用 | 回復 回到頂部

    返回版面帖子列表

    WinCE應用開發(fā)——觸摸屏輸入








    簽名
    主站蜘蛛池模板: 欧美特黄a级高清免费大片| 亚洲欧美日韩一区在线观看| 久久这里精品国产99丫e6| 玩弄丰满少妇XXXXX性多毛| 国产日产精品_国产精品毛片| 三级伦理在线播放| 日本高清免费一本视频在线观看| 亚洲香蕉久久一区二区三区四区| 经典三级完整版电影在线观看| 国产精品区免费视频| 一级欧美一级日韩| 无遮无挡非常色的视频免费| 亚洲欧洲自拍拍偷午夜色无码| 男人边吃奶边做边爱完整| 国产免费人人看大香伊| 8090韩国理伦片在线天堂| 天堂中文资源网| 久9热免费精品视频在线观看| 日韩小视频网站| 亚洲欧美国产免费综合视频| 狠狠色丁香婷婷| 国产aaa毛片| 香港三级电影在线观看| 国产精品视频全国免费观看| 一本色道久久综合亚洲精品高清| 新版天堂中文在线8官网| 亚洲人jizz| 欧美成人免费观看的| 免费无码AV一区二区三区| 精品综合久久久久久98| 国产在线色视频| 777777农村一级毛片| 国产麻豆精品入口在线观看| 一本一本久久aa综合精品| 成人性一级视频在线观看| 久久精品一区二区东京热| 日韩精品极品视频在线观看免费 | 在线观看的网站| 两根黑人粗大噗嗤噗嗤视频| 手机av在线播放| 久久精品一区二区东京热|