Results 1 to 5 of 5

Thread: Snap-to effect like Skype in VB6?

  1. #1

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    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?

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: Snap-to effect like Skype in VB6?

    search the forum for MAGNET forms..
    _____________________________________________________________________

    ----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.



  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Last edited by LaVolpe; Sep 23rd, 2009 at 01:28 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Snap-to effect like Skype in VB6?

    Quote Originally Posted by LaVolpe View Post
    ...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.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Hyperactive Member Hassan Basri's Avatar
    Join Date
    Sep 2006
    Posts
    324

    Re: Snap-to effect like Skype in VB6?

    Thanks everybody, I will take a look at your suggestions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width