Click here to Skip to main content

C / C++ / MFC

 
GeneralRe: Best Approach to process KeyStrokes in Rich Edit PinmemberForNow28-May-12 19:25 
Questionquality metrics for edge detection PinmemberMamatha Eswaraiah24-May-12 8:26 
QuestionIs SetCursorPos() Calling MouseMove ? [modified] Pinmemberyogeshs24-May-12 3:34 
AnswerRe: Is SetCursorPos() Calling MouseMove ? PinmemberTomasRiker224-May-12 11:53 
AnswerRe: Is SetCursorPos() Calling MouseMove ? Pinmember«_Superman_»24-May-12 17:18 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmemberyogeshs24-May-12 20:56 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmember«_Superman_»24-May-12 21:12 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmemberyogeshs24-May-12 21:40 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmemberyogeshs24-May-12 22:19 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmember«_Superman_»24-May-12 22:42 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmemberyogeshs25-May-12 0:52 
GeneralRe: Is SetCursorPos() Calling MouseMove ? Pinmember«_Superman_»25-May-12 1:00 
GeneralRe: Is SetCursorPos() Calling MouseMove ? [Working] Pinmemberyogeshs25-May-12 3:55 
AnswerRe: Is SetCursorPos() Calling MouseMove ? Pinmember Randor 25-May-12 2:25 
Hi,
 
Rather than using SetCursorPos you could use the SendInput function[^]. This would allow you to set some 'extra info' for marking simulated user input.
 
For example:
 
BOOL setcursorposition(long x, long y)
{
	INPUT input = {0};
	input.type = INPUT_MOUSE;
	input.mi.dx = ((x - GetSystemMetrics(SM_XVIRTUALSCREEN)) * 65535) / (GetSystemMetrics(SM_CXVIRTUALSCREEN)-1);
	input.mi.dy = ((y - GetSystemMetrics(SM_YVIRTUALSCREEN)) * 65535) / (GetSystemMetrics(SM_CYVIRTUALSCREEN)-1);
	input.mi.dwFlags = MOUSEEVENTF_VIRTUALDESK | MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
	input.mi.dwExtraInfo = 0xC0DEDBAD;
	return SendInput(1, &input, sizeof(input));
}
 
void YourClass::OnMouseMove(UINT nFlags, CPoint point)
{
	if(0xC0DEDBAD != GetMessageExtraInfo())
	{
		//You would ignore the simulated input and do your processing here
	}
	YourBaseClass::OnMouseMove(nFlags, point);
}
 
Don't forget to convert client coordinates to screen before calling setcursorposition.
 
Best Wishes,
-David Delaune
GeneralRe: Is SetCursorPos() Calling MouseMove ? PinmemberJohnCz27-May-12 9:31 
Questionneed your help,to all programmers!!! Pinmemberambreen115324-May-12 1:54 
AnswerRe: need your help,to all programmers!!! PinmemberChris Losinger24-May-12 2:24 
AnswerRe: need your help,to all programmers!!! Pinmemberenhzflep24-May-12 2:27 
GeneralRe: need your help,to all programmers!!! Pinmemberambreen115324-May-12 2:32 
GeneralRe: need your help,to all programmers!!! Pinmemberenhzflep24-May-12 2:38 
AnswerRe: need your help,to all programmers!!! PinmvpCPallini24-May-12 3:06 
GeneralRe: need your help,to all programmers!!! PinmemberAescleal24-May-12 3:22 
GeneralRe: need your help,to all programmers!!! PinmvpCPallini24-May-12 4:51 
GeneralRe: need your help,to all programmers!!! PinmemberErudite_Eric24-May-12 5:36 
GeneralRe: need your help,to all programmers!!! PinmemberAescleal24-May-12 7:45 
AnswerRe: need your help,to all programmers!!! PinmemberErudite_Eric24-May-12 5:37 
AnswerRe: need your help,to all programmers!!! PinmemberAlbert Holguin24-May-12 6:15 
AnswerRe: need your help,to all programmers!!! Pinmemberjschell24-May-12 9:33 
AnswerRe: need your help,to all programmers!!! PinmemberVaclav_Sal24-May-12 23:45 
AnswerUnicorns and Rainbows Pinmemberjkirkerx25-May-12 9:49 
Question[SOLVED]: Error Returning CArray [modified] PinmemberOverloaded_Name23-May-12 22:30 
AnswerRe: Error Returning CArray PinmvpCPallini23-May-12 22:52 
GeneralRe: Error Returning CArray PinmemberOverloaded_Name23-May-12 23:45 
QuestionRe: Error Returning CArray PinmvpCPallini23-May-12 23:47 
AnswerRe: Error Returning CArray PinmemberOverloaded_Name23-May-12 23:56 
GeneralRe: Error Returning CArray PinmvpCPallini24-May-12 0:02 
QuestionReadFile bytes read not equla to bytes requested Pinmemberevs_bud23-May-12 22:27 
AnswerRe: ReadFile bytes read not equla to bytes requested PinmvpCPallini23-May-12 22:37 
QuestionCreate an incoming connection RAS server with C++ PinmemberMember 800297323-May-12 13:56 
AnswerRe: Create an incoming connection RAS server with C++ PinmemberErudite_Eric23-May-12 23:09 
GeneralRe: Create an incoming connection RAS server with C++ PinmemberMember 800297324-May-12 6:55 
QuestionCTabCtrl and CRuntimeClass - is there a better way? PinmemberVaclav_Sal23-May-12 7:08 
AnswerRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberAescleal23-May-12 7:47 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberVaclav_Sal23-May-12 8:42 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberVaclav_Sal23-May-12 11:29 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberAescleal24-May-12 0:46 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberAescleal24-May-12 0:57 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? PinmemberVaclav_Sal24-May-12 4:39 
GeneralRe: CTabCtrl and CRuntimeClass - is there a better way? [modified] PinmemberVaclav_Sal24-May-12 8:31 
Questionnew and free Pinmemberpix_programmer23-May-12 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.150224.1 | Last Updated 1 Mar 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid