digitalmars.D.learn - mouse pointer
- Cassio Butrico (3/3) Jun 05 2015 can anyone tell me that how to change mouse pointer in D console.
- Adam D. Ruppe (3/5) Jun 05 2015 Link to one.. I'm not sure what you mean and seeing one of the
- Cassio Butrico (5/10) Jun 05 2015 in a console application can get the mouse position read if there
- Cassio Butrico (73/73) Jun 05 2015 import std.stdio;
- Kagamin (2/6) Jun 06 2015 You mean you want to change the position of mouse pointer?
- Cassio Butrico (3/9) Jun 06 2015 I actually wanted to change the mouse pointer , the arrow to
- Kagamin (2/2) Jun 07 2015 SetCursor?
can anyone tell me that how to change mouse pointer in D console. please tell me the code. I have tried many from the internet but that are not working well.
Jun 05 2015
On Saturday, 6 June 2015 at 00:00:07 UTC, Cassio Butrico wrote:I have tried many from the internet but that are not working well.Link to one.. I'm not sure what you mean and seeing one of the possible solutions will help.
Jun 05 2015
On Saturday, 6 June 2015 at 02:04:44 UTC, Adam D. Ruppe wrote:On Saturday, 6 June 2015 at 00:00:07 UTC, Cassio Butrico wrote:in a console application can get the mouse position read if there was click etc .. but do not know if I can change the mouse pointer . Thanks for answering.I have tried many from the internet but that are not working well.Link to one.. I'm not sure what you mean and seeing one of the possible solutions will help.
Jun 05 2015
import std.stdio; import core.sys.windows.windows; int main(string[] args) { HANDLE hIn; HANDLE hOut; auto MouseWhere = COORD (18, 0); auto DClickWhere = COORD (18, 1); auto clickwher = COORD (18, 2); bool Continue = TRUE; DWORD EventCount; int LoopCount = 0; int KeyEvents = 0; INPUT_RECORD InRec; DWORD NumRead; hIn = GetStdHandle(STD_INPUT_HANDLE); hOut = GetStdHandle(STD_OUTPUT_HANDLE); writeln("Mouse is at = "); writeln("Double Click at = "); write ("Click at = "); stdout.flush(); while (Continue) { Sleep(10); // To slow it down!! GetNumberOfConsoleInputEvents(hIn,&EventCount); while (EventCount > 0) { ReadConsoleInputA(hIn,&InRec,1,&NumRead); if (InRec.EventType == KEY_EVENT) { if (InRec.KeyEvent.wVirtualKeyCode == VK_ESCAPE) { Continue = FALSE; } } else if (InRec.EventType == MOUSE_EVENT) { if (InRec.MouseEvent.dwEventFlags == MOUSE_MOVED) { SetConsoleCursorPosition(hOut, MouseWhere); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } else if (InRec.MouseEvent.dwEventFlags == DOUBLE_CLICK) { SetConsoleCursorPosition(hOut, DClickWhere); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } else if(InRec.MouseEvent.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED) { SetConsoleCursorPosition(hOut, clickwher); write(InRec.MouseEvent.dwMousePosition.X ," : "); write(InRec.MouseEvent.dwMousePosition.Y ," "); stdout.flush(); } } GetNumberOfConsoleInputEvents(hIn,&EventCount); } } return 0; }
Jun 05 2015
On Saturday, 6 June 2015 at 02:45:55 UTC, Cassio Butrico wrote:in a console application can get the mouse position read if there was click etc .. but do not know if I can change the mouse pointer . Thanks for answering.You mean you want to change the position of mouse pointer?
Jun 06 2015
On Saturday, 6 June 2015 at 09:35:20 UTC, Kagamin wrote:On Saturday, 6 June 2015 at 02:45:55 UTC, Cassio Butrico wrote:I actually wanted to change the mouse pointer , the arrow to hand, but do not know if it is possible .in a console application can get the mouse position read if there was click etc .. but do not know if I can change the mouse pointer . Thanks for answering.You mean you want to change the position of mouse pointer?
Jun 06 2015
SetCursor? https://msdn.microsoft.com/en-us/library/windows/desktop/ms648393%28v=vs.85%29.aspx
Jun 07 2015