a_jam_sandwich Posted January 20, 2003 Posted January 20, 2003 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 Quote Code today gone tomorrow!
dusans Posted January 30, 2003 Posted January 30, 2003 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) Quote
TechnoTone Posted January 30, 2003 Posted January 30, 2003 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. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
dusans Posted January 31, 2003 Posted January 31, 2003 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? Quote
TechnoTone Posted January 31, 2003 Posted January 31, 2003 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. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
a_jam_sandwich Posted January 31, 2003 Author Posted January 31, 2003 As you said above i have tried all and none work as soon as i find out ill let you all know Thanks anyway Quote Code today gone tomorrow!
dusans Posted February 4, 2003 Posted February 4, 2003 Have you checked your declaration of ShowWindow function and constant? Where do you put it? Have you replaced MyForm with name of your form? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.