I have tried using the touch screen with a large program ,which exhibits the same problem i.e. it is fine with the mouse, but it can be made to crash when selecting the menu by touch.
I have also ported to the tablet an old version of 'paintshop pro version 6' which according to the 'About' screen was built in 1999. This works fine with touch.
I have tried a c++ program in which I have registered the application window for WM_TOUCH messages. The programs window procedure recognises the WM_TOUCH messages ok, but still crashes when selecting the menu by touch.
The program listing is shown below.-
// Touch test
#include <windows.h>
#ifndef WINVER
#define winver 0x0601
#endif
// trial code
#define WM_TOUCH 0x0240
#define WM_GESTURE 0x0119
WINUSERAPI BOOL WINAPI RegisterTouchWindow(HWND hwnd, ULONG ulFlags);
LRESULT WINAPI MainWndProc( HWND, UINT, WPARAM, LPARAM );
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,win_int);
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,win_int nCmdShow)
{
HWND hWnd;
HWND ParentHandle;
WNDCLASS wc;
DWORD WindowStyle;
wchar_t *Alpha =L'Alpha' ;
wchar_t *Beta =L'Beta' ;
wchar_t *Beta1 =L'Beta1' ;
wchar_t *Beta2 =L'Beta2' ;
wchar_t *Beta3 =L'Beta3' ;
wchar_t *Gamma =L'Gamma' ;
int xtop,ytop,xbottom,ybottom;
char caption[50];
MSG Msg;
strcpy(caption,'Touch test');
xtop =300;
ytop =300;
xbottom = 800;
ybottom = 800;
ParentHandle =NULL;
WindowStyle = WS_OVERLAPPEDWINDOW |WS_VSCROLL |WS_HSCROLL
|WS_VISIBLE |WS_MAXIMIZE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
if (!hPrevInstance)
{
wc.style = CS_VREDRAW| CS_HREDRAW ;
wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = NULL; /* set by mouse movement */
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);;
wc.lpszMenuName = NULL ;
wc.lpszClassName = 'TouchClass';
if (!RegisterClass(&wc))
MessageBox(NULL,'Unable to Register Class','touchclass',MB_OK) ;
}
hWnd = CreateWindow(
'touchclass',
caption,
WindowStyle,
xtop,
ytop,
xbottom,
ybottom,
ParentHandle,
NULL,
hInstance,
NULL
);
// trial code
// RegisterTouchWindow(hWnd,0);
ShowWindow(hWnd, nCmdShow);
// Menu
HMENU TheMenu = CreateMenu();
AppendMenuW(TheMenu, MF_STRING,1,Alpha);
HMENU BetaMenu = CreatePopupMenu();
AppendMenuW(BetaMenu, MF_STRING,21,Beta1);
AppendMenuW(BetaMenu, MF_STRING,22,Beta2);
AppendMenuW(BetaMenu, MF_STRING,23,Beta3);
AppendMenuW(TheMenu,MF_POPUP,(UINT)BetaMenu,Beta);
AppendMenuW(TheMenu, MF_STRING,3,Gamma);
SetMenu(hWnd,TheMenu);
while (GetMessage(&Msg, NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
LRESULT CALLBACK MainWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
// case WM_TOUCH:
// MessageBox(0,'TOUCH','touched',MB_OK);
case WM_GESTURE:
MessageBox(0,'GESTURE','touched',MB_OK);
case WM_COMMAND:
switch(wParam)
{
case 1: MessageBox(0,'MENU HIT Alpha','touched',MB_OK);
return (0);
case 3: MessageBox(0,'MENU HIT Gamma','touched',MB_OK);
return (0);
case 21: MessageBox(0,'MENU HIT Beta1','touched',MB_OK);
return (0);
case 22: MessageBox(0,'MENU HIT Beta2','touched',MB_OK);
return (0);
case 23: MessageBox(0,'MENU HIT Beta3','touched',MB_OK);
return (0);
}
default: return DefWindowProc(hWnd,message,wParam,lParam) ;
}
}