hi, i am writing a program for my dad. I want it to keep the mouse in x=500 y=500 while waiting for input. So its asking for the password and if you try to move the mouse, it'll put the mouse back in x=500 and y=500 and have keep looping that until the correct password is inputed. Any solutions?
thecoolman5
8
Posting Whiz in Training
Recommended Answers
Jump to PostTry using the function SetCursorPos(int,int); (assuming Windows). You can use it with command prompt or Windows.
Edit: Dev-C++ is old, and I never used it. You should switch to more modern IDE which has a newer compiler.
Jump to PostOh, *facepalm* also use kbhit(), getch(). kbhit tells you if there is user input and getch gets the last character. (just google it). But I think they are only in conio.h and it is not stanard :(
Jump to PostAnother good option is the ClipCursor function:
#include <windows.h> int main() { RECT old_rect; GetClipCursor(&old_rect); RECT new_rect = { 500, 500, 501, 501 }; ClipCursor(&new_rect); Sleep(2500); ClipCursor(&old_rect); return 0; }
Jump to PostOk, so this is the example of my method, but m4ster_r0shi's method is good too :)
#include <iostream> #include <windows.h> #include <conio.h> #include <string> #include <time.h> using namespace std; void sleep(clock_t wait) {clock_t goal; goal = wait + clock(); while(goal > clock()) ;} int main() { bool …
Jump to Postalso, i need to disable the keyboard key that opens up the start menu and CTRL ALT DELETE.
You cannot block CTRLD+ALT+DELETE, it is impossible on Windows machine, but you can probably block home key, look
All 22 Replies
sergent
52
Posting Pro
thecoolman5
8
Posting Whiz in Training
sergent
52
Posting Pro
m4ster_r0shi
142
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
sergent
52
Posting Pro
sergent
52
Posting Pro
thecoolman5
8
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
pseudorandom21
166
Practically a Posting Shark
thecoolman5
8
Posting Whiz in Training
pseudorandom21
166
Practically a Posting Shark
thecoolman5
8
Posting Whiz in Training
m4ster_r0shi
142
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
pseudorandom21
166
Practically a Posting Shark
thecoolman5
8
Posting Whiz in Training
thecoolman5
8
Posting Whiz in Training
pseudorandom21
166
Practically a Posting Shark
pseudorandom21
166
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.