Snap-to effect like Skype in VB6?
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?
Re: Snap-to effect like Skype in VB6?
search the forum for MAGNET forms..
Re: Snap-to effect like Skype in VB6?
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.
1 Attachment(s)
Re: Snap-to effect like Skype in VB6?
Quote:
Originally Posted by
LaVolpe
...The tricky part is to know when your form was moved. VB doesn't provide an easy way to determine that...
You need to subclass WM_MOVING message. Sample project is attached.
Re: Snap-to effect like Skype in VB6?
Thanks everybody, I will take a look at your suggestions.