| | |
Making two infinate loops inside the other?
![]() |
Hello, I am creating a program that opens and closes your CD drive repeatedly, and fixes your mouse position. I have created an initial while condition that loops the opening and closing of the drive. I was wondering how I can introduce a second infinate loop, fixing the position of the mouse. Using SetCursorPos( X, Y ); I want to make sure that the user has his mouse fixed, so he can't move it. Placing this line of code after the device eject or load function still gives the user enough time to close the application.
Thank you.
*SP* infinite
while(1)
{
DWORD d = 0;
DeviceIoControl(hcd, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
DeviceIoControl(hcd, IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
}
CloseHandle(hcd);
return 0;
}
Thank you.
*SP* infinite
while(1)
{
DWORD d = 0;
DeviceIoControl(hcd, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
DeviceIoControl(hcd, IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
}
CloseHandle(hcd);
return 0;
}
Last edited by cosmos22; Feb 19th, 2008 at 2:36 pm.
Pray tell, why should we offer assistance toward something that sounds malicious?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Well, I've yet to purchase a virus, so color me unimpressed.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Ok, I understand this is potentially malicious, but I AM really not planning on releasing this to people or to any external sites. I just would like to know how to run a second loop inside the other, whilst continuing the other one.
Like most people who do this sort of thing, I'm not stupid enough to do so.
Like most people who do this sort of thing, I'm not stupid enough to do so.
Last edited by cosmos22; Feb 19th, 2008 at 3:25 pm.
Why would you need to nest infinite loops? Are you saying you want to execute 2 statements as part of a loop, and execute more statements as part of the same loop? Well, add another statement following the first two in the same loop.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
I can't, because if I do the below, it opens the drive, then stops on the looped cursor position.
while(1)
{
DWORD d = 0;
DeviceIoControl(hcd, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
while(2)
{
SetCursorPos( X, Y );
}
DeviceIoControl(hcd, IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
}
What should I do?
while(1)
{
DWORD d = 0;
DeviceIoControl(hcd, IOCTL_STORAGE_EJECT_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
while(2)
{
SetCursorPos( X, Y );
}
DeviceIoControl(hcd, IOCTL_STORAGE_LOAD_MEDIA, NULL, 0, NULL, 0,
&d, NULL);
}
What should I do?
![]() |
Other Threads in the C++ Forum
- Previous Thread: Socket Programming
- Next Thread: no clue how to start
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes code coding compaitibility compile console conversion count delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error factorial file floatingpoint forms fstream function functions game givemetehcodez graph guessing gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix maze memory multiple net news node oop output payment pointer practice problem program programming project projectassignmenthelp protection python random rank read recursion reference rpg skills string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






