Jay1b Posted September 17, 2003 Posted September 17, 2003 (edited) Is there a way to catch the user minimising the form. Similar to the way below which catches the user trying to close the form. Private Sub frmOption_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing I found that i can do this by cheating, ie. using the form.resize event and then use an if statement to check on the windowstate, but was wondering if theres a proper way of doing it? Thanks. Edited September 17, 2003 by Jay1b Quote
Jay1b Posted September 17, 2003 Author Posted September 17, 2003 In addition to that : - I can still alt+tab to the form, which i dont want. - The icon for alt+tab isnt the one that i set for the program - When minimised i get an annoying minimised bit over the start button, just above my taskbar. Which needless to say i dont want. Can anybody advise of a way to stop those 3 points above please? Quote
Mehyar Posted September 17, 2003 Posted September 17, 2003 Well i will try to look it up for you but i guess you should go for using API's, search for API's and detecting minimize button and other stuff.. Quote Dream as if you'll live forever, live as if you'll die today
Administrators PlausiblyDamp Posted September 17, 2003 Administrators Posted September 17, 2003 (edited) [edit]removed due to posting guidelines - Orbity[/edit] Edited September 18, 2003 by John Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jay1b Posted September 17, 2003 Author Posted September 17, 2003 I am not trying to prevent the alt+tab from working - i just dont want my app to appear in it when its minimized to the statusbar. Just the same way you cant alt+tab into the volume control in windows when its minimized or an anti-virus. Quote
Jay1b Posted September 17, 2003 Author Posted September 17, 2003 PD I think the link is more aimed at completely stopping it from working. Thanks anyway. Quote
Administrators PlausiblyDamp Posted September 17, 2003 Administrators Posted September 17, 2003 My mistake - I misred the question. Hopefully to make up for that Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) If m.Msg = 5 Then 'WM_SIZE If m.WParam.ToInt32 = 1 Then 'SIZE_MINIMIZED Me.WindowState = FormWindowState.Normal End If Else MyBase.WndProc(m) End If End Sub also if you set the formBorderStyle to one of the toolwindow options it doesn't appear in the alt+tab list. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jay1b Posted September 17, 2003 Author Posted September 17, 2003 I tried setting the formborderstyle to the toolwindow options, and it doesnt appear in the alt+tab. But it also doesnt have a minimise icon...doh! :) Does the code need to go anywhere in particular? I tried pasting it in, and it just stopped me from minimising the form. So i changed the normal to minimise and it didnt do anything :( Thanks for giving it a shot though. Quote
Administrators PlausiblyDamp Posted September 17, 2003 Administrators Posted September 17, 2003 If the form is displaying as an icon in the System Tray just hide the form instead of the Me.WindowState = FormWindowState.Normal and un hide when they restore it from your context menu. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jay1b Posted September 17, 2003 Author Posted September 17, 2003 That does work, but i found that the comm connection in the form didnt work. I will try it again 2mrw, just incase there was another piece of code interferring with it. 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.