Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by Jay1b
Posted

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?

Posted
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..
Dream as if you'll live forever, live as if you'll die today
Posted
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.
  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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.

Posted
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.

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...