| Thread overview | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
June 06, 2015 mouse pointer | ||||
|---|---|---|---|---|
| ||||
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. | ||||
June 06, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cassio Butrico | 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.
| |||
June 06, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | 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:
>> 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.
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.
| |||
June 06, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cassio Butrico | 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;
}
| |||
June 06, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cassio Butrico | 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?
| |||
June 06, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Kagamin | 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:
>> 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?
I actually wanted to change the mouse pointer , the arrow to hand, but do not know if it is possible .
| |||
June 07, 2015 Re: mouse pointer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Cassio Butrico | SetCursor? https://msdn.microsoft.com/en-us/library/windows/desktop/ms648393%28v=vs.85%29.aspx | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply