Application.Run forcing visibility

N

Nick

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
 
H

Herfried K. Wagner [MVP]

Nick said:
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.
 
N

Nick

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 said:
What about setting the Opacity property to 0%

?
 
N

Nick

Hi Herfried,
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.
 
M

Mr Newbie

Mad Idea Eh!,


Nick said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top