Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS Console and Mouse Events

Status
Not open for further replies.

Ati2ude

Programmer
Dec 11, 2001
79
US
I am trying to send mouse events to a DOS Console to select the entire Presentation Space. However this is not working at all. Any pointers???

ptTop.x = Rect.TopLeft().x + 10;
ptTop.y = Rect.TopLeft().y + 10;
ptBottom.x = Rect.BottomRight().x - 10;
ptBottom.y = Rect.BottomRight().y - 10;


PostMessage(m_h_Wnd, WM_LBUTTONDOWN, 1, MAKELPARAM(ptTop.x,ptTop.y));
Sleep(0);

PostMessage(m_h_Wnd, WM_MOUSEMOVE, 1, MAKELPARAM(ptBottom.x,ptBottom.y));
Sleep(0);

PostMessage(m_h_Wnd, WM_LBUTTONUP, NULL, MAKELPARAM(ptBottom.x,ptBottom.y));
Sleep(0);

Thanks in advance,
Brian
 
To use this I will need a Handle to the console input buffer. However the DOS window I am looking at was not Allocated by me. Therefore I do not have access to the STD_INPUT_HANDLE,
STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE. I am under the impression that these are only avaliable if you allocate the console. Is that correct??? Thanks in advance.
 
Ati2ude,

I think you're not correct. Maybe you think the STD_*_HANDLE are the handles you need. That's not correct, you can get the handles by calling GetStdHandle:
HANDLE hStdIn = GetStdHandle ( STD_INPUT_HANDLE );

Marcel
 
Marcel,

According to MSDN, "If an application does not have associated standard handles, such as a service running on an interactive desktop, and has not redirected them, the return value is NULL." The handles are null if I try to obtain them using GetStdHandle. However, while researching this I noticed a function that I overlooked before, SetStdHandle. With this function I am able to define them with any handle I want and then use them. This allows me to do everything I need. Thanks for pushing me out of the box!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top