U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » While loop, sleep
Re: While loop, sleep [message #60257 is a reply to message #60255] Thu, 26 October 2023 16:14 Go to previous messageGo to previous message
sniffgriff is currently offline  sniffgriff
Messages: 10
Registered: May 2023
Location: NY
Promising Member
Hi friends, thank you for replying!

The function im trying to run is to move the mouse to a certain position on the desktop, and I want it to loop in a while:

void Random_Mouse()
{

while (1)
{

Ctrl::ProcessEvents();

SetCursorPos(329,654); // move mouse to this position
Sleep(2200);
SetCursorPos(329,784);
Sleep(2200);

}

}


I put this function in a button:


MyAppWindow() {

...

Button_Random << [=] { Random_Mouse(); };
...

}


Even with ProcessEvents, the program stalls for every sleep. Am I placing the function wrong?

Thank you all for your patience with me
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Java Script
Next Topic: How do I write string_view to Cout() without copying to a String?
Goto Forum:
  


Current Time: Mon Jun 15 22:35:54 GMT+2 2026

Total time taken to generate the page: 0.00884 seconds