|
-
Apr 26th, 2001, 10:47 AM
#1
Thread Starter
Registered User
Yet another question
Does anyone of you guys know how to popup the titlebar menu (the menu that pops up when you click onto the program icon or rightclick onto the taskbar) anywhere on the form, for example under a button when you press it?
thx in advance
Last edited by Olly; Apr 26th, 2001 at 10:51 AM.
-
Apr 26th, 2001, 03:39 PM
#2
Fanatic Member
Code:
Const TPM_LEFTALIGN = &H0&
Const TPM_RETURNCMD = &H100&
Const WM_SYSCOMMAND = &H112
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, ByVal lprc As Any) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim Pt As POINTAPI
Dim retval As Long
'Get the position of the mouse cursor
GetCursorPos Pt
retval = TrackPopupMenu(GetSystemMenu(Me.hwnd, False), TPM_LEFTALIGN Or TPM_RETURNCMD, Pt.x, Pt.y, 0, Me.hwnd, ByVal 0&)
PostMessage Me.hwnd, WM_SYSCOMMAND, retval, 0&
End Sub
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Apr 26th, 2001, 03:54 PM
#3
Thread Starter
Registered User
excellent! Although I use the api-viewer and know some of these api calls I still need more praxis using them thx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|