How Do I Get The Handle Of A Popup Menu?
Hi,
How do i get the handle of a popup menu? I need to show a menu that was created with the menu editor using the TrackPopupMenu api. I want to show the popmenu created with the menu editor on other objects then just on a form.
Thanks
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Popup Menu Handle
How can I get the Windows Handle of a Popup Menu ? I want to change the properties of some menu items (to cut the menu into two or more columns). Following the examples found elsewhere it works fine with a "static" menu, the menu of a form - I can ask Windows for the menu handle of a window. But I have no idea how to get from VB the handle of a popup menu.
Quickie Popup Menu - TextBox Popup Inhibit
I did a quick popup menu (a four item listbox) for a stand-alone form
(no MDI parent). I want it to respond to a right-click, but it gets
overlaid by the Textbox popup menu.
How can I inhibit the Textbox popup?
Thanks,
John
Making A Popup Menu, Popup A Menu
Hi
I have a popupmenu that gets used extensivly in my app. On every menu item that is clicked, a new submenu should be shown, but i need to reuse that submenu over and over again on most of my menu items.
So what i thought was making another menu that will act as the submenu that needs to be shown, and calling
VB Code:
Private Sub mnuOpen_Click() '-- Need this menu to popup another menu Me.PopupMenu Me.mnuSubmenuEnd Sub
But that simply doesnt work
Any thoughts on how i can do this?
Thanks
Working With Web Popup Window Using Its Handle
Hi All..
After a long time I am back again..
How to access items in a web window using its window handle only?
Like we do with webbrowser control like
objIE.document.all.Item("btnsmall").Click
some background.. I am working on automating some web reports using Excel. Reports from Web (web based inhouse tool) are the input for further processing.
Since it was using server side session variables I am using a web browser control. I am providing input (mostly names) and clicking buttons through my code.. Every thing is working fine until i have some data which results in multiple entries and I have to choose one. The webpage pops up a new window with the possible values in a list. I have to choose one entry in that and click a button through my code. As of now I am able to find the window handle of the pop up. How will i access the items in the pou up..
Reagards,
Adarsha
508-357-0333
How To Popup A Menu For The Menu Created By MenuEditor && Populated At Runtime On RCli
How to Popup a Menu for the Menu created by MenuEditor & populated at runtime, the Popup should be shown when the user right click the Menu.
Hi,
I need to show the PopuMenu for populated Menu, either its created by API as below or by MenuObject. The below
is the way i created the Menu through API based on the sample of ROB in this Forum.
The below is the code in the General Declaration Section in the Form.
VB Code:
Const MF_CHECKED = &H8&Const MF_APPEND = &H100&Const TPM_LEFTALIGN = &H0&Const MF_DISABLED = &H2&Const MF_GRAYED = &H1&Const MF_SEPARATOR = &H800&Const MF_STRING = &H0&Private Type POINTAPI X As Long Y As LongEnd TypePrivate Declare Function CreatePopupMenu Lib "user32" () As LongPrivate 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 LongPrivate Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As LongPrivate Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As LongPrivate Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As LongPrivate Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As LongDim hMenu As Long Private Type MSG hwnd As Long message As Long wParam As Long lParam As Long time As Long pt As POINTAPIEnd Type
I am using a Grid control, that is populated at runtime with AreaName, In that GridControl's MouseUp Event, I
am loading the Equipment for the Cicked Area is populated and displayed in a Menu and shown to the user. By using
the below code. It works fine. All Equipments are added to the Menu created by the Menu Editor at runtime.
VB Code:
Private Sub JanfpSpr_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim CurSprVal As Variant Dim DtVal As Variant Dim oMenu As Menu Dim rstSi As New ADODB.Recordset Dim ShtType As String Dim JanCritTyp As Variant If Button = vbLeftButton Then JanfpSpr.GetText 4, JanfpSpr.ActiveRow, JanCritTyp JanfpSpr.GetText 1, JanfpSpr.ActiveRow, CurSprVal JanfpSpr.GetText 3, JanfpSpr.ActiveRow, DtVal ShtType = Mid(CurSprVal, Len(CurSprVal) - 4, Len(CurSprVal)) CurSprVal = Mid(CurSprVal, 1, Len(CurSprVal) - 9) If JanCritTyp = "Area" Then SQL = "select * from EquipMaster where ArName='" & Mid(CurSprVal, 7, Len(CurSprVal)) & "' And Nextti Between #" & DtVal & "# And #" & DtVal & "# And ShtTp='" & ShtType & "' order by ENo" If rstSi.State = 1 Then rstSi.Close rstSi.Open SQL, cnnNew, adOpenStatic, adLockReadOnly, adCmdText Call UnloadMenuItems mnuLstSubItms(0).Caption = Mid(CurSprVal, 7, Len(CurSprVal)) mnuLstSubItms(0).Enabled = False While Not rstSi.EOF Load mnuLstSubItms(mnuLstSubItms.Count + 1) mnuLstSubItms(mnuLstSubItms.UBound).Caption = rstSi.Fields("ENo") mnuLstSubItms(mnuLstSubItms.UBound).Enabled = True rstSi.MoveNext Wend mnuLstEqp.Enabled = True Call PopupMenu(mnuInfo) ElseIf JanCritTyp = "Equipment" Then Call UnloadMenuItems mnuLstEqp.Enabled = False Call PopupMenu(mnuInfo) End If End If' End IfEnd Sub
Just in the Above code I added the Equipment Names in the Menu, If the User Right Click any
1 of the Equipment from the Menu then i need to show a Popup Menu with Update,Report etc.
for this Popup from the Equipment I added the Below Code in Form_Load() and mnuLstSubItms_Click()
VB Code:
Private Sub Form_Load() hMenu = CreatePopupMenu() AppendMenu hMenu, MF_STRING, ByVal 0&, "&Update" AppendMenu hMenu, MF_SEPARATOR, ByVal 0&, ByVal 0& AppendMenu hMenu, MF_STRING, ByVal 0&, "&Delete" AppendMenu hMenu, MF_SEPARATOR, ByVal 0&, ByVal 0& AppendMenu hMenu, MF_STRING, ByVal 0&, "&Report"End Sub Private Sub mnuLstSubItms_Click(Index As Integer) Dim pt As POINTAPI GetCursorPos pt TrackPopupMenu hMenu, TPM_LEFTALIGN, pt.X, pt.Y, 0, Me.hwnd, ByVal 0&End Sub
What happens for this code is, The Popup menu is Show, but as soon as this Popup Menu is shown
the existing PopuMenu disappears, i need both to be visible as we can see in Windows Menus
Requirements:
How to find which MouseButton is Clicked in the mnuLstSubItms_Click Event.
How to and where to write the Events for the PopupMenu created through API (for Menu Update,Report)
How to protect without the Menu disappears, when the user right click the Equipment.
As (Moderator) Rob said i posted here this issue in the New Thread. Hope any VBForums member
might have faced the same scenario. Kindly check this and reply me.
The picture of the Menus on runtime and design time are also attached here for your reference.
Thankyou,
Chock.
How To Handle Custom Popup Window With Newwindow2
Hi,
How to open a New custom popup Window in webbroser! just like the Internet explorer
I tried following code to open new window:
Private Sub WebBrowser1_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim myNewFrame As Form1
Set myNewFrame = New frame1
myNewFrame.WebBrowser1.RegisterAsBrowser = True
Set ppDisp = myNewFrame.WebBrowser1.Object
myNewFrame.Visible = True
End Sub
But I'm unable to show custom pop up windows, eg: No Addressbox, No toolbar, no statusbar etc.
How To Popup A Menu For The Menu Created By MenuEditor && Populated At Runtime
How to Popup a Menu for the Menu created by MenuEditor & populated at runtime, the Popup should be shown when the user right click the Menu.
Hi,
I need to show the PopuMenu for populated Menu, either its created by API as below or by MenuObject. The below is the way i created the Menu through API based on a sample given in VBForums by Rob.
My Project Current status.
The below is the code in the General Declaration Section in the Form.
Code:
Const MF_CHECKED = &H8&
Const MF_APPEND = &H100&Const TPM_LEFTALIGN = &H0&
Const MF_DISABLED = &H2&
Const MF_GRAYED = &H1&
Const MF_SEPARATOR = &H800&Const MF_STRING = &H0&
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function CreatePopupMenu Lib "user32" () As Long
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 AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Private Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim hMenu As Long
Private Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
I am using a Grid control, that is populated at runtime with AreaName, In that GridControl's MouseUp Event, I am loading the Equipment for the Cicked Area is populated and displayed in a Menu and shown to the user. By using the below code. It works fine. All Equipments are added to the Menu created by the Menu Editor at runtime.
Code:
Private Sub JanfpSpr_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim CurSprVal As Variant
Dim DtVal As Variant
Dim oMenu As Menu
Dim rstSi As New ADODB.Recordset
Dim ShtType As String
Dim JanCritTyp As Variant
If Button = vbLeftButton Then
JanfpSpr.GetText 4, JanfpSpr.ActiveRow, JanCritTyp
JanfpSpr.GetText 1, JanfpSpr.ActiveRow, CurSprVal
JanfpSpr.GetText 3, JanfpSpr.ActiveRow, DtVal
ShtType = Mid(CurSprVal, Len(CurSprVal) - 4, Len(CurSprVal))
CurSprVal = Mid(CurSprVal, 1, Len(CurSprVal) - 9)
If JanCritTyp = "Area" Then
SQL = "select * from EquipMaster where ArName='" & Mid(CurSprVal, 7, Len(CurSprVal)) & "' And Nextti Between #" & DtVal & "# And #" & DtVal & "# And ShtTp='" & ShtType & "' order by ENo"
If rstSi.State = 1 Then rstSi.Close
rstSi.Open SQL, cnnNew, adOpenStatic, adLockReadOnly, adCmdText
Call UnloadMenuItems
mnuLstSubItms(0).Caption = Mid(CurSprVal, 7, Len(CurSprVal))
mnuLstSubItms(0).Enabled = False
While Not rstSi.EOF
Load mnuLstSubItms(mnuLstSubItms.Count + 1)
mnuLstSubItms(mnuLstSubItms.UBound).Caption = rstSi.Fields("ENo")
mnuLstSubItms(mnuLstSubItms.UBound).Enabled = True
rstSi.MoveNext
Wend
mnuLstEqp.Enabled = True
Call PopupMenu(mnuInfo)
ElseIf JanCritTyp = "Equipment" Then
Call UnloadMenuItems
mnuLstEqp.Enabled = False
Call PopupMenu(mnuInfo)
End If
End If
' End If
End Sub
Just in the Above code I added the Equipment Names in the Menu, If the User Right Click any 1 of the Equipment from the Menu then i need to show a Popup Menu with Update,Report etc. for this Popup from the Equipment I added the Below Code in Form_Load() and mnuLstSubItms_Click()
Code:
Private Sub Form_Load()
hMenu = CreatePopupMenu()
AppendMenu hMenu, MF_STRING, ByVal 0&, "&Update"
AppendMenu hMenu, MF_SEPARATOR, ByVal 0&, ByVal 0&
AppendMenu hMenu, MF_STRING, ByVal 0&, "&Delete"
AppendMenu hMenu, MF_SEPARATOR, ByVal 0&, ByVal 0&
AppendMenu hMenu, MF_STRING, ByVal 0&, "&Report"
End Sub
Private Sub mnuLstSubItms_Click(Index As Integer)
Dim pt As POINTAPI
GetCursorPos pt
TrackPopupMenu hMenu, TPM_LEFTALIGN, pt.X, pt.Y, 0, Me.hwnd, ByVal 0&
End Sub
What happens for this code is, The Popup menu is Show, but as soon as this Popup Menu is shown
the existing PopuMenu disappears, i need both to be visible as we can see in Windows Menus
Requirements:
How to find which MouseButton is Clicked in the mnuLstSubItms_Click Event.
How to and where to write the Events for the PopupMenu created through API (for Menu Update,Report)
How to protect without the Menu disappears, when the user right click the Equipment.
Hope any member here might have faced the same scenario. Kindly check this and reply me.
The picture of the Menus on runtime and design time are also attached here for your reference.
Thankyou,
Chock.
Popup Menu, Context Menu Dynamic Creation?
Hi everyone,
i used the google search and the forum search but i didnt find any suitable result.
What i want to do:
i want to display a popup menu which is dynamic created from an xml file. i read the xml file to my own private type structure and now i want to display a popup menu. the only, as i think very ugly way i found is sevpopup menu active x. the problem with that menu is, that in every way there is a space for icons in menu which i dont have and the other problem is that i want to copy and not to install the application.
Really important for me is that i can create submenus!
Thank you all for help!
buechse
How To Add A Menu Item To The Windows Explorer Popup Menu?
Hi,
I have a feeling that this is going to be an API question, but I thought I start with this forum first..
Basically, what I want to do is to create a little VB app which I can launch by using the popup menu in the Windows Explorer. When I right-click on a folder, I want to be able to launch my program.
Any examples and ideas on how to do this would be greatly appreciated..
Dan
Hide Menu Line When Creating Popup Menu
I have a program that I created a PopupMenu for so when the user does a right click - there are options they can select.
The question is :
In order to create the PopupMenu, I created a menu for my form and then made parent for the menu options disabled and not visible.
When the form is launched however there is a seperation line where a menu should be.
Is there a way to remove this ?
Thanks in advance,
Kflasph
In A Popup Menu Witch Menu Item Is Slected
How do I find out what menu item was clicked
str = popMenu.Name
Select Case str
Case "mCut"
MsgBox "cut"
Case "mPaste"
MsgBox "paste"
Case "mProperties"
MsgBox "pro"
End Select
Popup (right-click) Menu From Standard Menu
I've searched and searched and cannot find any information on how to get a pop-up menu to appear when you right-click on a standard menu item. A classic example of this is in Internet Explorer's Favorites menu. If you right-click on a favorite, a popup menu appears and you can rename, delete, etc. the highlighted favorite. In VB6, accessing a menu item does not appear to fire the MouseUp or MouseDown events. Any thoughts?
Coding A Popup Menu Instead Of Using Menu Editor :S
Ok this might sound wierd but i want to add pop up menus to my form without using the menu editor and without showing them in the form itself (only when i want them to pop up). I have a frameless form and as soon as i add menus the frame will be there again. and i hoped i could just program a menu that is also pretty editable of some sort
How Do I Design A Context Menu (Popup Menu) In VB?
Hi,
I want to design a popup menu for a form in VB. I already have a menu for the form. This menu is displayed below the title bar. When I try to use the Menu Editor, it only lets me edit this menu. I want to design a new menu which will popup like a context menu. How do I do this?
Any help would be greatly appreciated.
How To Get A Handle For Menu That....
hello,
I've a question here
Is it possible to get a handle (hWnd) for a menu that created by API
functions?
If yes, could u show me how to do it
Note:The menu is created with combination these API funtions:
CreatePopupMenu,....,finally,trackPopupMenu to display the menu.
Thanks, and Sorry for my English
Invalid Menu Handle
I am getting this error when loading and unloading a couple of MAXIMIZED MDIChild forms. Note that each time a form gets the focus, the MDIForm menu is updated, and it is in this function ( Line : mnuSave.Visible=True ) that it is crashing.
Anybody got this error before ?
Start Menu Handle
Hi, I need to know, how can I get START Menu handle (some API...).
Thank you.
Popuo Menu && Handle
Hi all
can someone show me how i can obtain the handle of a popup menu that appears in an external application's window after i've simulated, trought API, the right-click mouse button.
I need this 'cause i would send on this popup menu a string message (Alt + N), but the popup menu handle change anytime it appears.
Thanks.
Luppolo.
How To Get The Handle On A Floating Menu Bar
Hi all i got a floating menu bar. could any one show me how to get the handle on a floating menu bar? This is the manue i am talk about but not sure if it called floating or not.It apperas when i double click a listview item. i attached its pic.thanks
Desktop Menu Handle
Hello !
Could you please help me to get a Handle on the desktop properties Menu.
Looking forward..
UserControl Menu Handle
Hello,
Does anybody know how get a menu handle of a UserControl?
Following code returns menuhandle as 0. What am I doing wrong?
lhMenu = GetMenu(hWnd)
Thanks in advance.
Start Menu Handle?
I looked at this thread
http://forums.vb-world.net/showthrea...threadid=40282
And thought - cool, maybe I can add to it and disable the start menu off the Windows key too - thus completely disabling the start menu. I can do this using various registry hacks in NT, but not 98 e.t.c e.t.c
What I really want to do is get a handle to the start menu, and either Destroy the menu or set it to be invisible...
I looked at it using Spy++ and it (windows) seems to create the menu each time, I can't subclass the shell cause its not my process, I think im all outta ideas on this one - anyone got any?
(no real business need for this - just thought it might be a challenge)
Get Handle Of TaskBar's Menu?
I use API Getmenu(hwndOfTaskbar)
but this declaration not return any Menu
When I click right mouse on TaskBar a Menu appear how can I get it's handle ?
------------------
BlackRose
Get Start Menu 's Handle?
I want Start Menu to popup exactly where I click the mouse, but I don't know its class name so so that I can
"FindWindow" and get its handle. Anyone know how to get the Start Menu 's handle (not Start button) please help me. Thanks in advance.
Popup Menu.
I have a form with 6 diffrent labels on it.
I want to make a popup menu when a user moves the mouse over it.
Thanks for the help
a
Popup Menu But...
We know, we can popup menus. Ok.
But am trying to make a button that when pressed, a menu will appear and, in this period (when menu is visible) button must be look pressed and when menu disappears, button must be look normal.
Is there any way to detect if menu is still poped ?
thanx.
Popup Menu ??
Hi,
I have a combobox.
When I push rightclick in Combobox, I want to open a popupmenu, but I don't how to.
please help me.
Popup Menu
I am running access 97 to run VBA. Is there any way to have a popup menu similar to autolist member in Microsoft VB? If so, please let me know the code. Thanks.
Popup Menu
I have not done this before so thanks to anyone that will help me out. I have creating a popup menu. It pops up when I right click, so that is working ok. What I need to know is do I put the code to the menu items in the mousedown sub?
Code:
Private Sub VendorGrid_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbRightButton Then
Me.PopupMenu mnuContext
End If
' Menu item code here?
End Sub
Own Right/popup Menu??
hey, how is everyone??
ok does anyone know how i can get my own right click menu?? what im doing is making my own 'CLSID' id. this is basically going to be used to password protect certain folders (encrypted and such). now i have the whole changing of the icon and all that done, but what i need help in is making a 'special' right click/popup menu for that object so when someone right clicks on the folder it doesnt just say open and allow you to go to that dir. so is there a way i could make a popupmenu for my clsid class/id (through the registry or soemthing)???
thanks
Popup Menu Help
didnt know where else i should post this but here goes. when i run my program i have a help menu and an option called about. can someoen give me the code so taht when i click this a box pops up that i can write things about the program in thank you in advance
Popup Menu
Hey All,
I have a short query. I need to make a customised popup menu and i don't know how to go about it. It would be great if you could assist me here. I have made a scheduler and want to create a pop up menu to add, delete, or modify the items in these textboxes. It should occur when i right click.
Please Help.
Cheers,
~john~
Popup Menu Help Please
Hi there,
I'm looking for some help with a popup menu that I'd like to create. I don't even know if what I want to do is possible....
I need to know how to create a menu at runtime (if that is even possible) and how to add items to the menu during runtime. Is this possible? I don't want the menu to be displayed up the top of the screen as it is a popup menu.
THanks for any help.
Spadge
Popup Menu
Hi all,
Does anybody know of a way of using popup menus on a model form? When I am using the form, if I open it using 'vbmodal', the popup menu does not appear as it does if the form is not modal.
Thanks in advance
Al.
VB Popup Menu Bug ?
I've asked this before but I didn't get any good answer.
It seems that VB has a "bug" whith tray popup menus.
If you want to have a menu for your app from a tray icon then this menu does not dissapear unless you choose something from this menu.If you click outside the menu, it just stays there.This is very annoying.Is there a way to fix this ?
I hope you understand what I'm talking about.
Popup Menu
I am referring to your article http://support.microsoft.com/support.../Q191/6/70.ASP
"HOWTO: Suppress Default Pop-up Menu When You Use Custom Menu". I have a program that by right-clicking on the text-box, a cusom menu (instead of the context menu) appears and by clicking one of the options another form with a text-box is loaded. On the loaded form, I would like to be able to right-click on the text-box and have another cusom menu displayed instead of the default context menu. I am able to supress the text-box context menu and display the custom menu on the first form but not able to display the custom menu on the second form. Can anyone please look into this and help. Thanks
PopUp Menu...again...
Let's sing everyone : PopUp sucks ! PopUp sucks !
Anyway, still stuck with the same problem...Suppose I make a menu appears on RightClick mouse, it WON'T disappears if I RghtClick somewhere else on my Grid ( MSFlexGRid here ). It just DON'T trap the mousedown event when a PopUp menu is already displayed AND you rightclick. In the Help file, they say :
"In addition, only one pop-up menu can be displayed at a time; therefore, calls to this method are IGNORED if a pop-up menu is already displayed or if a pull-down menu is open.."
Big deal. Sounds more like a limitations than an ingenuous way to handle the problem...
Popup Menu Bug ?
Ok, I've got my app running as an icon in the system tray.
I right click it for the popup menu to show.
However if I don't want to choose something from the menu and I click somewhere else, the popup menu does not close.I HAVE to select any option from the menu so that it closes.
Is there a solution to that ?
Popup Menu
Can someone show me an example of a popup menu? Example: on a form.
<P ID="edit"><FONT class="small"><EM>Edited by robot313 on 09/04/01 03:46 PM.</EM></FONT></P>
Popup Menu
how can i make my menus in VB as a POPUP Menu Tnx..
Popup Menu
Hello,
I want to popup a menu when the user right clicks on a listitem. I already have to code to do this and I also know I have to create a menu which i can get popped up.
The problem is that the form in question already has a menu.
How can I get two menu's (one invisible, just for popup purpose) in a form?
Thanks in advance,
Patrick.
Popup Menu
When i click on the right button, I have popup menu that has a sub menu. I would like to make this sub menu to appear without clicking on the item that open it. How should i do?
Popup Menu Help!
Hi guys,
I can make a form show when i click on the system try icon for that program, but i want to make the form show where the icon is located in the system tray, like a menu would.
this involves adjusting the Left and Top values for the form and then showing it.
i've tried using GetCursorPos but i can't seam to get it to display in the right position.
could someone please help me with this one. its really bugging me now.
thanks
chris
Popup Menu
I have been trying for several hours now to add Icons to my API Popup menu with no results. Rather than show various trys in my code I will attach all of Popup code minus image code. Any help will be greatly appreciated. Thanks!
Private Type MENUITEMINFO
cbSize As Long
fMask As Long
fType As Long
fState As Long
wID As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As String
cch As Long
End Type
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function CreatePopupMenu Lib _
"user32" () As Long
Private Declare Function GetCursorPos Lib "user32" _
(lpPoint As POINTAPI) As Long
Private Declare Function TrackPopupMenuEx Lib "user32" _
(ByVal hMenu As Long, ByVal un As Long, _
ByVal n1 As Long, ByVal n2 As Long, _
ByVal hWnd As Long, lpTPMParams As Any) As Long
Private Declare Function InsertMenuItem Lib "user32" _
Alias "InsertMenuItemA" (ByVal hMenu As Long, _
ByVal un As Long, ByVal bool As Long, _
lpcMenuItemInfo As MENUITEMINFO) As Long
Private Declare Function DestroyMenu Lib "user32" _
(ByVal hMenu As Long) As Long
Private Const MF_STRING = &H0&
Private Const TPM_RETURNCMD = &H100&
Private Const MIIM_ID = &H2
Private Const MIIM_TYPE = &H10
Private Const MIIM_DATA = &H20
Private lngMnu As Long
Private lngHwnd As Long
Private lngID As Long
Private PT As POINTAPI
Private objMNU As MENUITEMINFO
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim strArray(1 To 4) As String
Dim lngCnt As Long
strArray(1) = "Open"
strArray(2) = "Close"
strArray(4) = "Exit"
lngMnu = CreatePopupMenu()
lngHwnd = Me.hWnd
For lngCnt = 1 To 4
With objMNU
.cbSize = Len(objMNU)
.fMask = MIIM_TYPE Or MIIM_ID Or MIIM_DATA
.dwTypeData = strArray(lngCnt)
.cch = Len(strArray(lngCnt))
.fType = MF_STRING
.wID = lngCnt
End With
Call InsertMenuItem(lngMnu, lngCnt, 1, objMNU)
Next lngCnt
If Button = 2 Then
GetCursorPos PT
lngID = TrackPopupMenuEx(lngMnu, TPM_RETURNCMD, PT.X, PT.Y, lngHwnd, ByVal 0&)
Select Case lngID
Case 1
MsgBox "1"
Case 2
MsgBox "2"
Case 4
MsgBox "4"
End Select
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call DestroyMenu(lngMnu)
End Sub
Popup Menu
I need codes for Webbrowser about: Save Background As..., Save Picture As..., View source, Properties, Expot to Microsoft Excel, Coding, Create Shortcut and Add To Favorites. Please, help me! All command are from Internet Explorer. Is somthing like WebBrowser1.ExecWB ... ?
Add Popup Menu VB6
Hi
Can anyone help me? I am using a popup menu and would like to add data from the form into mysql database when I click the save button. I am using visual basic 6 with mysql version 5.0. This is the code below. Visual basic complains about the save item on the code line 'Adodc1.Recordset.Addnew. I get the error message "Cannot jump to 'AddNew' because it is hidden" However I use the same line of code to update fields in the modify command and that works fine.
Private Sub Command2_Click()
If Command2.Caption = "Options" Then
PopupMenu mnuPopup, 1, (Command2.Left), (Command2.Top + Command2.Height), mnuAdd
ElseIf Command2.Caption = "Modify" Then
Call ModifyItem
ElseIf Command2.Caption = "Save" Then
Call SaveItem
End If
End Sub
Private Sub mnuAdd_Click()
Command2.Caption = "Save"
Call SaveItem
End Sub
Private Sub SaveItem()
If txtFields(15) = "" Then
MsgBox "Application ID Should Not Be Blank", , "ApplicationID"
End If
Adodc1.Recordset.AddNew
Exit Sub
End Sub
Modify Command.
Private Sub mnuModify_Click()
Command2.Caption = "Modify"
End Sub
Private Sub ModifyItem()
If txtFields(1) = "" Then Exit Sub
Adodc1.Recordset.UpdateBatch
MsgBox "Details Modified Successfully.", , "Modify"
Command2.Caption = "Options"
End Sub
Regards
Vanita
|