Making two infinate loops inside the other?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2008
Posts: 80
Reputation: cosmos22 is an unknown quantity at this point 
Solved Threads: 0
cosmos22's Avatar
cosmos22 cosmos22 is offline Offline
Junior Poster in Training

Making two infinate loops inside the other?

 
0
  #1
Feb 19th, 2008
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;
}
Last edited by cosmos22; Feb 19th, 2008 at 2:36 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Making two infinate loops inside the other?

 
0
  #2
Feb 19th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 80
Reputation: cosmos22 is an unknown quantity at this point 
Solved Threads: 0
cosmos22's Avatar
cosmos22 cosmos22 is offline Offline
Junior Poster in Training

Re: Making two infinate loops inside the other?

 
0
  #3
Feb 19th, 2008
I'm not planning on releasing this commercially, I only plan to see its cause and effect, the programming interests me.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Making two infinate loops inside the other?

 
0
  #4
Feb 19th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Making two infinate loops inside the other?

 
0
  #5
Feb 19th, 2008
Two nested infinite loops? Is that what you'd call an alpha loop?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 80
Reputation: cosmos22 is an unknown quantity at this point 
Solved Threads: 0
cosmos22's Avatar
cosmos22 cosmos22 is offline Offline
Junior Poster in Training

Re: Making two infinate loops inside the other?

 
0
  #6
Feb 19th, 2008
Not sure, do you have any ideas?
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,951
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Making two infinate loops inside the other?

 
0
  #7
Feb 19th, 2008
It's a joke. Google around "infinity" and "cardinality".
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 80
Reputation: cosmos22 is an unknown quantity at this point 
Solved Threads: 0
cosmos22's Avatar
cosmos22 cosmos22 is offline Offline
Junior Poster in Training

Re: Making two infinate loops inside the other?

 
0
  #8
Feb 19th, 2008
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.
Last edited by cosmos22; Feb 19th, 2008 at 3:25 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,335
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 236
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: Making two infinate loops inside the other?

 
0
  #9
Feb 19th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 80
Reputation: cosmos22 is an unknown quantity at this point 
Solved Threads: 0
cosmos22's Avatar
cosmos22 cosmos22 is offline Offline
Junior Poster in Training

Re: Making two infinate loops inside the other?

 
0
  #10
Feb 19th, 2008
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?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC