DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: 'Locking' a Form in Place

  1. #1
    Eric Hudson Guest

    'Locking' a Form in Place


    Greetings,

    I have a form that must not only always be the top most form, but must also
    not be moveable by the user. I have coded the app so that the form always
    stays on top. My problem is that the user can still reach up and 'grab' the
    title bar with his/her mouse and pull the form downward, exposing the forms
    beneath. This presents a significant security breach as the application is
    used for testing. Does anyone know how to stop the user from being able to
    drag the form exposing the forms underneath. Thanks for any help you may
    be able to render.

    Eric


  2. #2
    Jim Edgar Guest

    Re: 'Locking' a Form in Place

    Eric --

    You can subclass the form and trap the WM_WINDOWPOSCHANGING
    message. Try the example at www.softcircuits.com ...

    Jim Edgar

    "Eric Hudson" <eric@hudnet.com> wrote in message
    news:3957e510$1@news.devx.com...
    >
    > Greetings,
    >
    > I have a form that must not only always be the top most form, but must

    also
    > not be moveable by the user. I have coded the app so that the form always
    > stays on top. My problem is that the user can still reach up and 'grab'

    the
    > title bar with his/her mouse and pull the form downward, exposing the

    forms
    > beneath. This presents a significant security breach as the application is
    > used for testing. Does anyone know how to stop the user from being able to
    > drag the form exposing the forms underneath. Thanks for any help you may
    > be able to render.
    >
    > Eric
    >




  3. #3
    David Crowell Guest

    Re: 'Locking' a Form in Place

    > You can subclass the form and trap the WM_WINDOWPOSCHANGING
    > message. Try the example at www.softcircuits.com ...


    Can't you just set the Moveable property to FALSE?

    Dave
    www.davidcrowell.com




  4. #4
    Jim Edgar Guest

    Re: 'Locking' a Form in Place

    > > You can subclass the form and trap the WM_WINDOWPOSCHANGING
    > > message. Try the example at www.softcircuits.com ...

    >
    > Can't you just set the Moveable property to FALSE?
    >


    Absolutely. I keep forgetting about that one...

    Jim Edgar



  5. #5
    Eric Hudson Guest

    Re: 'Locking' a Form in Place


    One thing I failed to mention. Because this program must be able to be run
    without an install, I had to use VB 3.0. The 'Moveable' property is not available
    in this version. I cannot use an OCX since an install would then be required.
    Any other thougths on how I can get around this?

    Eric

  6. #6
    Phil Weber Guest

    Re: 'Locking' a Form in Place

    > One thing I failed to mention. Because this program
    > must be able to be run without an install, I had to use
    > VB3.


    Eric: In that case, use Jim Edgar's original suggestion: subclass the form
    and hook the WM_POSCHANGING message. You can use Mabry Software's free
    MsgHook VBX ( http://www.teleport.com/~pweber/msghook.exe ) to do the
    subclassing.
    ---
    Phil Weber



  7. #7
    Rick Rothstein Guest

    Re: 'Locking' a Form in Place

    What about simply using the Hide method for the displayed forms before
    showing the form in question and the Show method for them when this form is
    "removed"?

    Rick


    "Eric Hudson" <eric@hudnet.com> wrote in message
    news:3957e510$1@news.devx.com...
    >
    > Greetings,
    >
    > I have a form that must not only always be the top most form, but must

    also
    > not be moveable by the user. I have coded the app so that the form always
    > stays on top. My problem is that the user can still reach up and 'grab'

    the
    > title bar with his/her mouse and pull the form downward, exposing the

    forms
    > beneath. This presents a significant security breach as the application is
    > used for testing. Does anyone know how to stop the user from being able to
    > drag the form exposing the forms underneath. Thanks for any help you may
    > be able to render.
    >
    > Eric
    >




  8. #8
    Dan Rhea Guest

    Re: 'Locking' a Form in Place

    Since you indicated you are in VB 3...

    If you don't want to subclass, Save the top and left of the form during the
    load into private variables in the declarations. Start a short duration
    timer. In the timer event, if top or left changes, move the form back to the
    saved location.

    Ok, so It's really ugly... You don't have to subclass to do it. <grin>
    ___________________________
    Dan Rhea - Mailto:danr@sirs.com
    Windows CD-ROM Programmer
    SIRS Mandarin, Inc.
    (561) 994-0079 x757
    "Eric Hudson" <eric@hudnet.com> wrote in message
    news:3957e510$1@news.devx.com...
    >
    > Greetings,
    >
    > I have a form that must not only always be the top most form, but must

    also
    > not be moveable by the user. I have coded the app so that the form always
    > stays on top. My problem is that the user can still reach up and 'grab'

    the
    > title bar with his/her mouse and pull the form downward, exposing the

    forms
    > beneath. This presents a significant security breach as the application is
    > used for testing. Does anyone know how to stop the user from being able to
    > drag the form exposing the forms underneath. Thanks for any help you may
    > be able to render.
    >
    > Eric
    >




  9. #9
    Faraw Guest

    Re: 'Locking' a Form in Place


    What about making your form Title-less and fake a title bar using a label
    with a highligted background ? Since your app is for test, this must be sufficient.


    "Dan Rhea" <danr@sirs.com> wrote:
    >Since you indicated you are in VB 3...
    >
    >If you don't want to subclass, Save the top and left of the form during

    the
    >load into private variables in the declarations. Start a short duration
    >timer. In the timer event, if top or left changes, move the form back to

    the
    >saved location.
    >
    >Ok, so It's really ugly... You don't have to subclass to do it. <grin>
    >___________________________
    >Dan Rhea - Mailto:danr@sirs.com
    >Windows CD-ROM Programmer
    >SIRS Mandarin, Inc.
    >(561) 994-0079 x757
    >"Eric Hudson" <eric@hudnet.com> wrote in message
    >news:3957e510$1@news.devx.com...
    >>
    >> Greetings,
    >>
    >> I have a form that must not only always be the top most form, but must

    >also
    >> not be moveable by the user. I have coded the app so that the form always
    >> stays on top. My problem is that the user can still reach up and 'grab'

    >the
    >> title bar with his/her mouse and pull the form downward, exposing the

    >forms
    >> beneath. This presents a significant security breach as the application

    is
    >> used for testing. Does anyone know how to stop the user from being able

    to
    >> drag the form exposing the forms underneath. Thanks for any help you may
    >> be able to render.
    >>
    >> Eric
    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center