Detecting events generated with SendMessage or mouse_event

Jan 4, 2012 at 6:56 PM


I want to detect whether the detected mouse event was generated by other program or not. According to MSLLHOOKSTRUCT structure I should use the Flags field and check LLMHF_INJECTED flag. However the mouse struct in the source does not contain this field. I read the internal documentation about this structure and tried adding the flags field but either it was always containing some random data or it was inconsistent with programmatically generated mouse event. What is the correct definition for the flags field or is there any way to detect such mouse events?