|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System Menu (On Top) VB.NET 2003It's rare for me to ask a question in this newsgroup VB.NET 2003 ONLY - FRAMEWORK 1.1 -------------------------------------------------- How do I check/uncheck an extended System Menu item & handle the Click Event? Imports System.Runtime.InteropServices <DllImport("user32")> _ Public Shared Function GetSystemMenu(ByVal hwnd As IntPtr, _ ByVal bRevert As Boolean) As IntPtr End Function <DllImport("user32")> _ Public Shared Function AppendMenu(ByVal hMenu As IntPtr, _ ByVal wFlags As MenuFlags, ByVal wIDNewItem As Int32, _ ByVal lpNewItem As String) As Boolean End Function <Flags()> _ Public Enum MenuFlags As Integer MF_BYPOSITION = 1024 MF_REMOVE = 4096 MF_SEPARATOR = 2048 MF_STRING = 0 End Enum Private Const WM_SYSCOMMAND As Integer = &H112 Form Load Event: Dim ptrHandle As IntPtr = GetSystemMenu(Me.Handle, False) AppendMenu(ptrHandle, MenuFlags.MF_SEPARATOR, 1000, "") 'Seperator AppendMenu(ptrHandle, MenuFlags.MF_STRING, 1001, "On Top") ' New Menu Item WndProc: #Region "WndProc (SUB)" Protected Overrides Sub WndProc(ByRef m As Message) If m.Msg = WM_SYSCOMMAND Then Select Case m.WParam.ToInt32 Case 1000 'Do nothing as it's seperator Case 1001 ' Handle The TopMost Click Event Here End Select End If MyBase.WndProc(m) End Sub #End Region ------------------------------------ The way I want the System Menu to be handles is like so: MenuItem.Checked = Not MenuItem.Checked Me.TopMost = MenuItem.Checked Any ideas? Thanks in advance >How do I check/uncheck an extended System Menu item & handle the Click Use the CheckMenuItem or SetMenuItemInfo function.>Event? Mattias -- Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup. Mattias,
SYSTEM MENU not standard menu I have asked this question in C++ & VB.NET 2003 & no-one can come up with an answer & your suggestion is completely wrong Thanks for taking the time to TRY to help me though -- Show quoteHide quoteNewbie Coder (It's just a name) "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> wrote in message news:OuamTlCkHHA.1240@TK2MSFTNGP04.phx.gbl... > >How do I check/uncheck an extended System Menu item & handle the Click > >Event? > > Use the CheckMenuItem or SetMenuItemInfo function. > > > Mattias > > -- > Mattias Sjögren [C# MVP] mattias @ mvps.org > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com > Please reply only to the newsgroup.
Countdown
Fun with products and Expression columns .net dll vs vb6 dll File busy after sent via email Problem on shutdown computer if my appication is opened Write to an Access database Comparing Alphanumeric strings Difference between Dim I as ineteger and Dim I as New Integer Instance of the form How do I create a Serial port listner |
|||||||||||||||||||||||