Hello everybody, I saw this nice feature on Skype. Whenever you move the Skype window to a corner of the desktop it snaps to the border. It is not glued or anything it just lightly snaps and can be moved again. Anybody know how to reproduce this effect in VB6?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.
Magnetic forms generally apply to keeping 2 or more forms together similar to WinAmp apps. Though the logic can be applied to the desktop, what you are asking could be much simpler. You can get the physical dimensions of the desktop, less any taskbars, and simply move your form to one of dimensions corners. To determine which corner to move, maybe compare the center of your form to desktop bounding rectangle. Depending on which quadrant the center is in, move the form to that quadrant's corner.
Here is the API to get the desktop dimensions, use the SPI_GETWORKAREA constant.
Edited: The tricky part is to know when your form was moved. VB doesn't provide an easy way to determine that. You can subclass the form looking for WM_MOVE messages or possibly use a timer that checks a few times a seconds to see if it was moved be comparing its current top/left properties with previously cached top/left properties. Other ideas may be presented.
Last edited by LaVolpe; Sep 23rd, 2009 at 01:28 PM.
Insomnia is just a byproduct of, "It can't be done"