在线中文-在线在线ccc66-在线永久免费观看的毛片-在线永久免费观看的a站视频-久久精品最新免费国产成人-久久精品综合一区二区三区


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


  共有9302人關(guān)注過(guò)本帖樹形打印

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

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


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

一,信息

觸摸屏信息同鼠標(biāo)信息,不過(guò)只有WM_LBUTTONDOWNWM_LBUTTONUP WM_MOUSEMOVE 三種。

二,捕捉函數(shù)

BOOL GetMouseMovePoints (PPOINT pptBuf, UINT nBufPoints,

UINT *pnPointsRetrieved);

三,實(shí)例

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反對(duì)(0單帖管理 | 引用 | 回復(fù) 回到頂部

返回版面帖子列表

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








簽名
主站蜘蛛池模板: 中国一级淫片 | 国产手机在线小视频免费观看 | 中文字幕有码热在线视频 | 久久国产免费一区二区三区 | 中文字幕日本在线mv视频精品 | 伊人婷婷在线 | 黄色在线网站视频 | 日本波多野结衣字幕久久 | 久九九久福利精品视频视频 | 日韩精品久久久久久久电影99爱 | 亚洲欧美偷拍另类 | 欧美图片自拍偷拍 | 九九99香蕉在线视频网站 | 五月激情婷婷丁香 | 国内自拍视频一区二区三区 | 精品国产高清在线看国产 | 欧美久久久久久久久 | 最新qvod电影| 亚洲色图综合网 | 日韩欧美亚洲视频 | 一级国产精品一级国产精品片 | 精品福利在线观看 | 亚洲国产精品一区二区久 | 日本不卡视频一区二区三区 | 国产在线播放网址 | 四虎www | 亚洲成a人一区二区三区 | 在线看片亚洲 | 中文字幕在第10页线观看 | 六月丁香激情 | 午夜看片在线 | 亚洲综合丁香 | 国产欧美一区二区 | 亚洲精品在线免费 | 夜色资源站www国产在线资源 | 手机在线国产视频 | 国产精品精品国产一区二区 | 午夜视频福利 | 亚洲第一免费网站 | 亚洲国产成人精彩精品 | 欧美精品久久久久久久久大尺度 |