V
vvitchev
Guest
Hi,
I have a C++ application (Visual Studio 2010) .NET 4.0 with some buttons reacting on button down and up events. Now I am trying to run it on Windows 8.1 64-bit (Asus all-in-one ET1620 multi touch) and the problem is that my program receives mouse down AFTER I remove my finger from the button on the screen. I was not able to find any pen and touch settings that can make it to send button down when the screen is touched and finally gave up (if someone has a solution for that, I will appreciate it).
Now I am trying to modify my program to receive WM_POINTERDOWN even and react to it the same way as on button down. I included the code to register the application window to receive Windows Touch input in my main form constructor after InitializeComponent() as follows:
BOOL res;
HWND hWnd;
int value = GetSystemMetrics(SM_DIGITIZER);
hWnd = static_cast<HWND>(this->Handle.ToPointer());
if (value & NID_READY) {
// stack is ready
if (value & NID_MULTI_INPUT) {
// digitizer is multitouch
if (value & NID_INTEGRATED_TOUCH) {
// Integrated touch
;
}
res = RegisterTouchWindow( hWnd, 0);
if (!res) {
int err = GetLastError();
}
}
}
RegisterTouchWindow() returns 1 - success.
I also implemented the following message loop in the main form:
protected: virtual void
Form1::WndProc( System::Windows::Forms::Message %m) override {
if(m.Msg == WM_POINTERDOWN) {
m.Msg = WM_LBUTTONDOWN;
richTextBox1->AppendText( DateTime::Now.ToString() + " buttonDownUp: pointer down\n");
} else if(m.Msg == WM_POINTERUP) {
m.Msg = WM_LBUTTONUP;
richTextBox1->AppendText( DateTime::Now.ToString() + " buttonDownUp: pointer up\n");
} else if (m.Msg == WM_GESTURE) {
richTextBox1->AppendText(DateTime::Now.ToString() + " buttonDownUp: WM_GESTURE up\n");
} else if (m.Msg == WM_TOUCH) {
richTextBox1->AppendText(DateTime::Now.ToString() + " buttonDownUp: WM_TOUCH up\n");
}
System::Windows::Forms::Form::WndProc(m);
}
but it still does not receive any of the WM_POINTERDOWN, WM_POINTERUP, or WM_TOUCH messages.
Spy++ shows the following messages sent to my application:
...
000007 000507F8 S WM_PARENTNOTIFY fwEvent:WM_POINTERDOWN
000008 000507F8 R WM_PARENTNOTIFY
000009 001303FC S WM_POINTERACTIVATE hwndActive:0001008B wHitTest:07F8 wPointerID:0005
000012 001303FC R WM_POINTERACTIVATE pmsd->lResult:FFFFFFFF
000013 001303FC S WM_MOUSEACTIVATE hwndTopLevel:000507F8 nHittest:HTCLIENT uMsg:WM_POINTERDOWN
000016 001303FC R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
000067 001303FC P WM_POINTERENTER wPointerID:008B wFlags:6017
000068 001303FC P WM_POINTERDOWN wPointerID:008B wFlags:6017 ptX:366 ptY:107
There are some WM_POINTERDOWN messages in the Spy++ log but none of these gets handled by my message loop.
What am I missing?
Thanks,
Continue reading...
I have a C++ application (Visual Studio 2010) .NET 4.0 with some buttons reacting on button down and up events. Now I am trying to run it on Windows 8.1 64-bit (Asus all-in-one ET1620 multi touch) and the problem is that my program receives mouse down AFTER I remove my finger from the button on the screen. I was not able to find any pen and touch settings that can make it to send button down when the screen is touched and finally gave up (if someone has a solution for that, I will appreciate it).
Now I am trying to modify my program to receive WM_POINTERDOWN even and react to it the same way as on button down. I included the code to register the application window to receive Windows Touch input in my main form constructor after InitializeComponent() as follows:
BOOL res;
HWND hWnd;
int value = GetSystemMetrics(SM_DIGITIZER);
hWnd = static_cast<HWND>(this->Handle.ToPointer());
if (value & NID_READY) {
// stack is ready
if (value & NID_MULTI_INPUT) {
// digitizer is multitouch
if (value & NID_INTEGRATED_TOUCH) {
// Integrated touch
;
}
res = RegisterTouchWindow( hWnd, 0);
if (!res) {
int err = GetLastError();
}
}
}
RegisterTouchWindow() returns 1 - success.
I also implemented the following message loop in the main form:
protected: virtual void
Form1::WndProc( System::Windows::Forms::Message %m) override {
if(m.Msg == WM_POINTERDOWN) {
m.Msg = WM_LBUTTONDOWN;
richTextBox1->AppendText( DateTime::Now.ToString() + " buttonDownUp: pointer down\n");
} else if(m.Msg == WM_POINTERUP) {
m.Msg = WM_LBUTTONUP;
richTextBox1->AppendText( DateTime::Now.ToString() + " buttonDownUp: pointer up\n");
} else if (m.Msg == WM_GESTURE) {
richTextBox1->AppendText(DateTime::Now.ToString() + " buttonDownUp: WM_GESTURE up\n");
} else if (m.Msg == WM_TOUCH) {
richTextBox1->AppendText(DateTime::Now.ToString() + " buttonDownUp: WM_TOUCH up\n");
}
System::Windows::Forms::Form::WndProc(m);
}
but it still does not receive any of the WM_POINTERDOWN, WM_POINTERUP, or WM_TOUCH messages.
Spy++ shows the following messages sent to my application:
...
000007 000507F8 S WM_PARENTNOTIFY fwEvent:WM_POINTERDOWN
000008 000507F8 R WM_PARENTNOTIFY
000009 001303FC S WM_POINTERACTIVATE hwndActive:0001008B wHitTest:07F8 wPointerID:0005
000012 001303FC R WM_POINTERACTIVATE pmsd->lResult:FFFFFFFF
000013 001303FC S WM_MOUSEACTIVATE hwndTopLevel:000507F8 nHittest:HTCLIENT uMsg:WM_POINTERDOWN
000016 001303FC R WM_MOUSEACTIVATE fuActivate:MA_ACTIVATE
000067 001303FC P WM_POINTERENTER wPointerID:008B wFlags:6017
000068 001303FC P WM_POINTERDOWN wPointerID:008B wFlags:6017 ptX:366 ptY:107
There are some WM_POINTERDOWN messages in the Spy++ log but none of these gets handled by my message loop.
What am I missing?
Thanks,
Continue reading...