"Jordi Rico" <jo*******@gmail.com> schrieb:
we are making custom forms in our app, so we use forms with no border
and no control buttons in order to make all at our own.
The problem is that our customer wants the system menu functionality in
these forms, and since there is no border, the system menu don't show
when clicking on the top-left corner. I've added a button there, and
I'd like to know how to call this sytem menu from the click event in
this button.
\\\
Private Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32
Private Const WM_GETSYSMENU As Int32 = &H313
Public Class WordConverter
<StructLayout(LayoutKind.Explicit)> _
Private Structure DWord
<FieldOffset(0)> Public LongValue As Integer
<FieldOffset(0)> Public LoWord As Short
<FieldOffset(2)> Public HiWord As Short
End Structure
Private Shared m_DWord As DWord
Public Shared Function MakeLong( _
ByVal LoWord As Short, _
ByVal HiWord As Short _
) As Integer
m_DWord.LoWord = LoWord
m_DWord.HiWord = HiWord
Return m_DWord.LongValue
End Function
Public Shared Function MakeLong( _
ByVal LoWord As Integer, _
ByVal HiWord As Integer _
) As Integer
Return MakeLong(CShort(LoWord), CShort(HiWord))
End Function
Public Shared Function LoWord(ByVal LongValue As Integer) As Short
m_DWord.LongValue = LongValue
Return m_DWord.LoWord
End Function
Public Shared Function HiWord(ByVal LongValue As Integer) As Short
m_DWord.LongValue = LongValue
Return m_DWord.HiWord
End Function
End Class
..
..
..
SendMessage( _
Me.Handle, _
WM_GETSYSMENU, _
0, _
WordConverter.MakeLong(Cursor.Position.X, Cursor.Position.Y) _
)
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>