zachman123
Programmer
This is a compilation of my posts on Neowin, but they couldn't help (at least so far)
I'm using C#. I'm creating a program similar to the OSX expose feature. Using the user32 MoveWindow, I can do this to move every window to the left edge of the screen,
But if I try to make the while loop lower than 0 (negitive), the program freezes. Anyone have any ideas?
It works if I put -10 right into it like this...
UnManagedMethods.MoveWindow(this.hWnd,-10,this.Location.Y,this.Size.Width,this.Size.Height,false);
so it is possible, I think it might have to so with the loop, but I'm not sure
Also, while(item.Location.X >= 0) doesn't work, but while(item.Location.X >= 1) does, so it appears the problem is when the window edge hits 0
Just tried it with SetWindowPos and it didn't work either (worked with 0 though). If anyone has any idea, please tell me. If I'm not giving enough source code, just ask here/PM me and I'll give it to you.
Same thing also happens if I just use true in the while loop (that's obvious that the infinate loop will freeze it), but I've been trying to figure out what's making this loop infinite (Or if it just freezes)
Anyways, I'm so confused
Thanks for any help
edit: Also, if I switch it around to move to the right, and switch the operator to <, it only works with a negitive in the while loop.
Please Help
From
I'm using C#. I'm creating a program similar to the OSX expose feature. Using the user32 MoveWindow, I can do this to move every window to the left edge of the screen,
Code:
foreach (EnumWindowsItem item in eW.Items)
{
if (item.Visible)
{
if (item.Maximised)
{
item.UnMax();
}
while(item.Location.X > 0){
item.Moveit(); /*Moves window one to the left, using this code
UnManagedMethods.MoveWindow(this.hWnd,this.Location.X-1,this.Location.Y,this.Size.Width,this.Size.Height,false);
this.location.X refers to the window, as item is the current window
*/
}
}
}
It works if I put -10 right into it like this...
UnManagedMethods.MoveWindow(this.hWnd,-10,this.Location.Y,this.Size.Width,this.Size.Height,false);
so it is possible, I think it might have to so with the loop, but I'm not sure
Also, while(item.Location.X >= 0) doesn't work, but while(item.Location.X >= 1) does, so it appears the problem is when the window edge hits 0
Just tried it with SetWindowPos and it didn't work either (worked with 0 though). If anyone has any idea, please tell me. If I'm not giving enough source code, just ask here/PM me and I'll give it to you.
Same thing also happens if I just use true in the while loop (that's obvious that the infinate loop will freeze it), but I've been trying to figure out what's making this loop infinite (Or if it just freezes)
Anyways, I'm so confused
Thanks for any help
edit: Also, if I switch it around to move to the right, and switch the operator to <, it only works with a negitive in the while loop.
Please Help
From