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 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 PostOh there is a way to make your program run on a certain date/time, on W7 it's under:
Accessories -> System Tools -> Task SchedulerIt's a very useful Windows feature too :D
Also, I'm not yet convinced it's impossible to block ctrl + alt + delete, as …
Jump to Postok, i am going to have the program open another program that i downloaded from your second link and i am wondering how to position a different window from the console window using SetWindowPos(). How would you?
Jump to PostHave you tried it? It works ok for me.
#define _WIN32_WINNT 0x0500 #include <windows.h> bool IsPressed(int vkey) { return GetAsyncKeyState(vkey) >> 15; } void MyMoveWindow(HWND hwnd, int dx, int dy) { RECT wrect; GetWindowRect(hwnd, &wrect); MoveWindow(hwnd, wrect.left + dx, wrect.top + dy, wrect.right - wrect.left, wrect.bottom - …
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.