Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Im trying to create a support system program.

 

When using the system you can run it in the Systray, and when a request come in a POPUP form will display indicating the request.

 

The problem is I dont want to lose focus from the program that the users in as it just a notiforcation (VISUAL ONLY).

 

I know the API method in VB6 with ShowWindow using SW_SHOWNOACTIVE but have no idea what to do in VB.NET

 

Can anyone help

 

Cheers

 

Andy

Code today gone tomorrow!
  • 2 weeks later...
Posted

When you have created form do not display it with Show method!

Use API function ShowWindow found in User32.dll like this :

 

Declare Ansi Function ShowWindow Lib "User32" (ByVal HWND As IntPtr, ByVal nCmdShow As Integer) As Boolean

Const SW_SHOWNOACTIVATE As Integer = 4

 

Call it like this :

 

Dim F As MyForm

F = New MyForm()

ShowWindow(F.Handle, SW_SHOWNOACTIVATE)

Posted
Instead of using .Show just use .Visible=True. This doesn't effect the window ZOrder (at least, it didn't in my tests) and keeps the active window active.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Posted
I believe the question was how to show form without activating it and I assume that a_jam_sandwich has tried what you just writed. Setting visible to True do activates form!!! Can you send me your source code of the test where you can do what you have described?
Posted
Ahh - it could be a quirk with my system (Win2000). I often get windows opening behind active windows, such as my outlook reminders which often open in the background and without focus.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...