Results 1 to 10 of 10

Thread: see if a form is with in range

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    I currently have this code:

    Code:
    If frm1.Left = frm2.Left + frm2.Width Then
    End
    End If
    that code makes it so that the program ends when form 1 is exactly to the right side of form 2 it ends. how to i make it so that if its in range of about 100, it will still end

    i hope my question was clear

    thanks in advance
    NXSupport - Your one-stop source for computer help

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you use End, some objects may not be unloaded correctly so don't use it. Unless you have a lot of modulebound objects, unload both forms, or any forms with unload statement, but if you have other objects in a module unload them first.

    To catch and close even if you are within 100 twips (i guess) you just test the range:

    If 100 < abs(frm2.Left + frm2.Width -frm1.Left) Then
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks, but that didn't work for me, this is my code:

    Code:
    Dim lngReturnValue As Long
    If Button = 1 Then
    Call ReleaseCapture
    lngReturnValue = SendMessage(frmMain.hwnd, WM_NCLBUTTONDOWN, _
    HTCAPTION, 0&)
    
    If 1 < Abs(frmMP3.Left + frmMP3.Width - frmMain.Left) Then
    MsgBox "You're Close"
    
    End If
    End If
    and any where every you move the form on the screen the message box pops up and i have 1600*1200 and the same thing happened when i put the 100 to 1 the same thing happens
    NXSupport - Your one-stop source for computer help

  4. #4
    Guest
    What even are you placing this code in? MouseDown? Or MouseMove?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    mouse move
    NXSupport - Your one-stop source for computer help

  6. #6
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372

    Try This

    Code:
    If 0 < (frmMP3.Left + frmMP3.Width - frmMain.Left) And 100 > (frmMP3.Left + frmMP3.Width - frmMain.Left) Then
    MsgBox "You're Close"


  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    it didn't work for me
    NXSupport - Your one-stop source for computer help

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    why did you replace 100 with 1? remember we're talking about twips
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    i tired it with 100 and it didn't work
    NXSupport - Your one-stop source for computer help

  10. #10
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Are you sure you tried to attach the right side of the frm2 to the left side of frm1?
    Are you sure the event you have the code in fires?
    Are you sure the formnames are spelled correctly?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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