TopMost Property (System Menu)

C

Crouchie1998

Hello All

How do I get a Form on Top on the System Menu, please?

Of course I am using GetSystemMenu & AppendMenu - no problem but this part is:

Because I cannot put a checkmark on the system menu I want to toggle text.
Example:

'On Top' shown if for isn't topmost
'Not On Top' if the form is topmost

In WndProc I can handle the m.wParam.ToInt32 for the new appended menu item,
but how to change the text on click (toggle text)?

SOME CODE LEFT OUT

AppendMenu(MenuHandleHere, MF_STRING, 1001, "Not On Top")

in WndProc:

Select Case m.WParam.ToInt32
Case 1001
[GET MENU TEXT HERE] (On Top/Not On Top)
End Select

Any ideas would be appreciated
 
C

Crouchie1998

Hello All,

I can get it working but not how I wish to have it, although it works

I have added a hidden checkbox to the form & checked it

Have added the System Menu item with AppendMenu (Not TopMost)

In WndProc in my Case statement with a nested If/End If

If CheckBox1.Checked = False Then
CheckBox1.Checked = True
DeleteMenu(iMenu, 1001, MF_STRING)
AppendMenu(iMenu, MF_STRING, 1001, "Not Topmost")
Me.TopMost = True
Else
CheckBox1.Checked = False
DeleteMenu(iMenu, 1001, MF_STRING)
AppendMenu(iMenu, MF_STRING, 1001, "Topmost")
Me.TopMost = False
End If


Can you see a better way to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top