Application.Run forcing visibility

Discussion in 'Microsoft VB .NET' started by Nick, Sep 20, 2005.

  1. Nick

    Nick Guest

    Hi there,

    I'm having slight troubles using Application.Run and keeping a form
    invisible. The method appears to force the visibility of the form even if I
    override the createparams function with the following,

    ---------------

    Protected Overrides ReadOnly Property CreateParams() As
    System.Windows.Forms.CreateParams
    Get
    Const WS_VISIBLE As Integer = &H10000000
    Dim pCPsParams As CreateParams = MyBase.CreateParams()
    If ((Not showthisformflag) And CBool(pCPsParams.Style And
    WS_VISIBLE)) Then pCPsParams.Style = pCPsParams.Style Xor WS_VISIBLE
    Return (pCPsParams)
    End Get
    End Property

    ---------------

    Ive tried changing the visibility in so many different places now and it
    just does *not* work, even on activate with a static flag so it only happens
    once. Any ideas on how to achieve this? Thanks loads in advance!

    --
    Nick Pateman

    ---------------------------------------------------------------
    Please do not reply directly to me, but the entire newsgroup.
    Any views expressed above are my own
    Without predjudice
     
    Nick, Sep 20, 2005
    #1
    1. Advertisements

  2. Nick

    Mr Newbie Guest

    What about setting the Opacity property to 0%

    ?

    "Nick" <> wrote in message
    news:...
    > Hi there,
    >
    > I'm having slight troubles using Application.Run and keeping a form
    > invisible. The method appears to force the visibility of the form even if
    > I override the createparams function with the following,
    >
    > ---------------
    >
    > Protected Overrides ReadOnly Property CreateParams() As
    > System.Windows.Forms.CreateParams
    > Get
    > Const WS_VISIBLE As Integer = &H10000000
    > Dim pCPsParams As CreateParams = MyBase.CreateParams()
    > If ((Not showthisformflag) And CBool(pCPsParams.Style And
    > WS_VISIBLE)) Then pCPsParams.Style = pCPsParams.Style Xor WS_VISIBLE
    > Return (pCPsParams)
    > End Get
    > End Property
    >
    > ---------------
    >
    > Ive tried changing the visibility in so many different places now and
    > it just does *not* work, even on activate with a static flag so it only
    > happens once. Any ideas on how to achieve this? Thanks loads in advance!
    >
    > --
    > Nick Pateman
    >
    > ---------------------------------------------------------------
    > Please do not reply directly to me, but the entire newsgroup.
    > Any views expressed above are my own
    > Without predjudice
    >
     
    Mr Newbie, Sep 20, 2005
    #2
    1. Advertisements

  3. "Nick" <> schrieb:
    > I'm having slight troubles using Application.Run and keeping a form
    > invisible. The method appears to force the visibility of the form even if
    > I override the createparams function with the following,


    You can use 'Application.Run()' (parameterless version) to start a message
    loop without showing a form.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>
     
    Herfried K. Wagner [MVP], Sep 20, 2005
    #3
  4. Nick

    Nick Guest

    Hi there,

    That's quite a mad one I hadn't thought of, what I've ended up doing is
    creating a new visible flag for the form and exposing it as a property. The
    when the visiblechanged event on the form fires I set the forms visibility
    property to me custom flag. Even though the event seems to get fired about
    3 times to start with this seems to work pretty well. Thanks for your idea
    though, thinking outside the box huh?

    Cheers again :)

    Nick.

    "Mr Newbie" <> wrote in message
    news:...
    > What about setting the Opacity property to 0%
    >
    > ?
    >
    > "Nick" <> wrote in message
    > news:...
    >> Hi there,
    >>
    >> I'm having slight troubles using Application.Run and keeping a form
    >> invisible. The method appears to force the visibility of the form even
    >> if I override the createparams function with the following,
    >>
    >> ---------------
    >>
    >> Protected Overrides ReadOnly Property CreateParams() As
    >> System.Windows.Forms.CreateParams
    >> Get
    >> Const WS_VISIBLE As Integer = &H10000000
    >> Dim pCPsParams As CreateParams = MyBase.CreateParams()
    >> If ((Not showthisformflag) And CBool(pCPsParams.Style And
    >> WS_VISIBLE)) Then pCPsParams.Style = pCPsParams.Style Xor WS_VISIBLE
    >> Return (pCPsParams)
    >> End Get
    >> End Property
    >>
    >> ---------------
    >>
    >> Ive tried changing the visibility in so many different places now and
    >> it just does *not* work, even on activate with a static flag so it only
    >> happens once. Any ideas on how to achieve this? Thanks loads in
    >> advance!
    >>
    >> --
    >> Nick Pateman
    >>
    >> ---------------------------------------------------------------
    >> Please do not reply directly to me, but the entire newsgroup.
    >> Any views expressed above are my own
    >> Without predjudice
    >>

    >
    >
     
    Nick, Sep 20, 2005
    #4
  5. Nick

    Nick Guest

    Hi Herfried,

    >> I'm having slight troubles using Application.Run and keeping a form
    >> invisible. The method appears to force the visibility of the form even
    >> if I override the createparams function with the following,

    >
    > You can use 'Application.Run()' (parameterless version) to start a message
    > loop without showing a form.


    I've come up with a different method, mentioned in the post to "Mr
    Newbie". Im slightly curious where the message loops is processed for the
    parameterless Application.Run()? If there is no form attached to it how can
    you start an application? does execution continue but not quit until the
    loop is stopped? I should have a try at it really, thanks for the advice
    Herfried :)

    Nick.
     
    Nick, Sep 20, 2005
    #5
  6. Nick

    Mr Newbie Guest

    Mad Idea Eh!,

    >>;-}



    "Nick" <> wrote in message
    news:%...
    > Hi there,
    >
    > That's quite a mad one I hadn't thought of, what I've ended up doing is
    > creating a new visible flag for the form and exposing it as a property.
    > The when the visiblechanged event on the form fires I set the forms
    > visibility property to me custom flag. Even though the event seems to get
    > fired about 3 times to start with this seems to work pretty well. Thanks
    > for your idea though, thinking outside the box huh?
    >
    > Cheers again :)
    >
    > Nick.
    >
    > "Mr Newbie" <> wrote in message
    > news:...
    >> What about setting the Opacity property to 0%
    >>
    >> ?
    >>
    >> "Nick" <> wrote in message
    >> news:...
    >>> Hi there,
    >>>
    >>> I'm having slight troubles using Application.Run and keeping a form
    >>> invisible. The method appears to force the visibility of the form even
    >>> if I override the createparams function with the following,
    >>>
    >>> ---------------
    >>>
    >>> Protected Overrides ReadOnly Property CreateParams() As
    >>> System.Windows.Forms.CreateParams
    >>> Get
    >>> Const WS_VISIBLE As Integer = &H10000000
    >>> Dim pCPsParams As CreateParams = MyBase.CreateParams()
    >>> If ((Not showthisformflag) And CBool(pCPsParams.Style And
    >>> WS_VISIBLE)) Then pCPsParams.Style = pCPsParams.Style Xor WS_VISIBLE
    >>> Return (pCPsParams)
    >>> End Get
    >>> End Property
    >>>
    >>> ---------------
    >>>
    >>> Ive tried changing the visibility in so many different places now and
    >>> it just does *not* work, even on activate with a static flag so it only
    >>> happens once. Any ideas on how to achieve this? Thanks loads in
    >>> advance!
    >>>
    >>> --
    >>> Nick Pateman
    >>>
    >>> ---------------------------------------------------------------
    >>> Please do not reply directly to me, but the entire newsgroup.
    >>> Any views expressed above are my own
    >>> Without predjudice
    >>>

    >>
    >>

    >
    >
     
    Mr Newbie, Sep 21, 2005
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. IcedCrow

    Forcing the garbage collector to run

    IcedCrow, Sep 15, 2003, in forum: Microsoft VB .NET
    Replies:
    4
    Views:
    185
    Herfried K. Wagner [MVP]
    Sep 15, 2003
  2. David
    Replies:
    1
    Views:
    734
    Guest
    Sep 21, 2004
  3. Guest
    Replies:
    1
    Views:
    4,907
    Guest
    Sep 24, 2004
  4. Guest
    Replies:
    0
    Views:
    207
    Guest
    Sep 17, 2004
  5. Jeff

    Forcing page.ispostback to run...

    Jeff, Aug 15, 2006, in forum: Microsoft VB .NET
    Replies:
    1
    Views:
    172
    Cor Ligthert [MVP]
    Aug 15, 2006
Loading...

Share This Page