Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Get Handle Of TaskBar's Menu?


I use API Getmenu(hwndOfTaskbar)but this declaration not return any MenuWhen I click right mouse on TaskBar a Menu appear how can I get it's handle ?------------------BlackRose




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Taskbar Problem (the Handle Of Toolbars Would Help)
does anyone knows what to do if your taskbar number of rows changes the size (clipped) of your vb deskband toolbars?
the handle seems to get little and that what clips the toolbar
is there a way to set the height of a toolbar hanle? maybe each time it resizes
thanks for any help

TaskBar Menu Overlapping Tray Icon Menu Problem
When i right click on the sys tray icon it with either display just the context menu or it will at the same time bring up the taskbar menu, this is getting very frustrating because i use this menu a lot.

here is the code i am using:

Code:
Option Explicit
Public Declare Function Shell_NotifyIcon Lib "shell32" Alias _
"Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Const NIM_ADD = &H0
Public Const NIM_MODIFY = &H1
Public Const NIM_DELETE = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_ICON = &H2
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_LBUTTONUP = &H202
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONDOWN = &H204
Public Const WM_RBUTTONUP = &H205
Public Const WM_RBUTTONDBLCLK = &H206
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_MBUTTONUP = &H208
Public Const WM_MBUTTONDBLCLK = &H209
Public Const HWND_TOPMOST = -1
Public nid As NOTIFYICONDATA
Public Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type

Code:
With nid
.cbSize = Len(nid)
.hWnd = Me.hWnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = "Loading"
End With
Shell_NotifyIcon NIM_ADD, nid

Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Sys
Case WM_RBUTTONDOWN:
If Me.Visible Then Me.SetFocus
MenuLocX = Pt.X
MenuLocY = Pt.Y
'MsgBox Pt.X & "-" & Pt.Y
Me.PopupMenu mnuSysTray
End Select
End Sub
here is a screen capture of the event:
Context Menu Issue

I use windows blinds as a skin program and a program for a custom clock but it still happens when i turn them both off

I don't get this problem with other applications
any ideas? cheers

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..

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

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?
How can i get the handle of the start menu?

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)

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.


How Do You Get Menu Control Handle
With most controls, you just read the Hwnd property. But when a menu control, there is now Hwnd property. Any idea on how to grab it?

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.

TaskBar Right-Click Menu!
When my application starts, an icon gets added to the systray (next to the clock). When the application is minimized, it gets minimized to the systray i.e. the Taskbar icon gets hidden. The systray icon pops-up a menu when it is clicked.

What I want is when the application gets minimized to the systray, a Maximize menu item should get added to the pop-up menu so that users can maximize the application again. I have already added the Maxmize menu item to the pop-up menu but the problem is in maximizing the application from the systray. The application gets maximized only when the menu item in the systray is clicked twice (not double-clicked). This is what I have tried:
VB Code:
Private Sub [b]Form_Resize()[/b]    If (Me.WindowState = vbMinimized) Then        Me.Hide        Me.WindowState = vbNormal        mnuPopMaximize.Visible = True    Else        mnuPopMaximize.Visible = False    End IfEnd SubPrivate Sub [b]mnuPopMaximize_Click()[/b]    If (Me.WindowState = vbMinimized) Then        Me.Show        Me.WindowState = vbMaximized    End IfEnd Sub
If either of the lines within the If condition in the sub-routine mnuPopMaximize_Click is commented, then the application doesn't maximize at all irrespective of how many times the Maximize menu in the systray is clicked. How do I maximize the application from the systray?

Thanks,

Arpan

Taskbar Icon Menu
how do you make a menu come up on the icon on the taskbar when you right click

Disable Taskbar 's Menu ?
hi...
how can i disable the Properties menuitem
when i click right-mouse on taskbar
it's class are #32768 , but the handle change each time you click right-mouse



------------------
BlackRose

TaskBar 's Menu ? (2sd Time)
hi...
how can i disable the Properties menuitem
when i click right-mouse on taskbar

it's class are #32768 , but the handle change each time you click right-mouse

so i need any info. about this menu ...



------------------
BlackRose

Taskbar Program Menu
I have a form that has rounded corners using MakeRoundRect (using the form as the control). The form can be resized using

Call ReleaseCapture
Call SendMessage(.hWnd, WM_NCLBUTTONDOWN, HTRIGHTBOTTOM, 0)

Here's the problem: My form's borderstyle = none and I want the taskbar menu (minimize, close alt+f4) to appear when you right click the program. I tried using

SetWindowLong Me.hWnd, GWL_STYLE, GetWindowLong(Me.hWnd, GWL_STYLE) + WS_DLGFRAME

to make the borderstyle = none, but to make it look the way I want (no border) with this code, the borderstyle = fixed single, which means I can no longer resize with the above code.
This problem is fixed if the borderstyle = sizable, but there is a border set around the form (don't want the border). I found a nasty way around this (change some of the MakeRoundRect settings) but it messes up my sizing code.

Anyone know a better way to do this. My goal is to have the menu for my program in the taskbar without having to change how the form looks.

How Would I Get The Handle To Menu Of Microsoft Word.
Hi
   My Problem is i want to add one more menu item into the Microsoft word, but i failed in getting handle to the menu of Ms-word. Will U please give me a solution to add menu into Ms-word. I will be very thankful to u.
Shirin Saxena

Custom Popup Menu In Taskbar
Hi there

I've seen programs wich have there onwn menu items in the popup when the user rightclicks the taskbar icon. How can I add my items to the popup?

The attachment shows this with winamp...

Popup Menu Showing In TaskBar
I am creating a composite control in .net to encapsulate the web browser control, for the purpose of encapsulating microsoft word. I have created a CommandBar with all of the menu items standardly displayed in word and I am able to display it, but the problem is when I click on the an item (File, Edit... etc.) the menu that is displayed shows up in the task bar. Command bars with buttons work fine.

The window has the following style bits set WS_POPUP, WS_VISIBLE, WS_SIBLING, WS_CLIPCHILDREN, WS_EX_LEFT, WS_EX_LTRREADING, WS_EX_RIGHSCROLLBAR, WS_EX_TOPMOST. I have read references to removing WS_EX_APPWINDOW style from windows as a way to get them out of the task bar, but this is not present in the style.

A call to GetParent shows no parent is set. Setting the parent to my control works, but after the window is clicked it remains visible. I know I could possibly use subclassing to get around this, but I am only familiar with this in theory, and am not certain that changing the parent and subclassing are the way to go.

Thanks...

Menu At Taskbar Status Area
This is the code which I have written. The problem with this is that it is

not functioning as it should function as all the other Icons in the Taskbar

fuctions.
If I right click on it, popup menu appears and does not disappear if I click

any other part of the desktop or windows on it. It only disappear if I click

it or I click on window which created it.
All the other popup menus which are displayed when icon is clicked destroyed

if anohter click is made in any part of the desktop or windows on it.



Code:
//to display icon
POINT point;
HINSTANCE hInst;

HMENU hMenu, hSubMenu,hMenu1;

::GetCursorPos(&point);

hInst = (HINSTANCE)::GetWindowLong (m_hWnd, GWL_HINSTANCE);

hMenu =CreatePopupMenu();
hMenu1 =CreatePopupMenu();

AppendMenu(hMenu1,MF_STRING, 1, "First");
AppendMenu(hMenu1,MF_STRING, 2, "Second");
AppendMenu(hMenu1,MF_STRING, 3, "Third");

InsertMenu(hMenu,1,MF_POPUP|MF_STRING,(UINT)hMenu1,"11");


hSubMenu = ::GetSubMenu(hMenu, 0);


::TrackPopupMenu(hSubMenu,
TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_LEFTALIGN,
point.x, point.y, 0, m_hWnd, NULL);

::DestroyMenu(hMenu);
::DestroyMenu(hMenu1);


`````````
//To display Icon in Taskbar Status Area
HICON hIcon;

char lpszTip[] = "Mouse is on the Icon !!";

HINSTANCE hInst =

AfxFindResourceHandle(MAKEINTRESOURCE(IDI_ICON1),RT_GROUP_ICON);

hIcon =

(HICON)LoadImage(hInst,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,LR_DEFAULT

COLOR);


NOTIFYICONDATA tnid;

tnid.cbSize = sizeof(NOTIFYICONDATA);
tnid.hWnd = m_hWnd;
tnid.uID = IDI_ICON1;
tnid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnid.uCallbackMessage = WM_TASKBAR; // my user message, you can have any

other message
tnid.hIcon = hIcon;

if (lpszTip)
lstrcpyn(tnid.szTip, lpszTip, sizeof(tnid.szTip));
else
tnid.szTip[0] = '';

Shell_NotifyIcon(NIM_ADD, &tnid);
This is the code which I have written. The problem with this is that it is

not function as it should function. and as all the other Icons in the Taskbar

fuctions.
If I right click on it, popup menu appears and does not disappear if I click

any other part of the desktop or windows on it. It only disappear if I click

it or I click on window which created it.
All the other popup menus which are displayed when icon is clicked destroyed

if anohter click is made in any part of the desktop or windows on it.

Show The Popup Menu On Taskbar
How can I show the popup menu when user right click application button on the taskbar.

Taskbar Menu In A Border-0 Form?
Ive been searching how to do this the entire day, actually found several related posts and even some examples, but none seem to work for me. Im using VB6.
Thats all i need, a way to activate the taskbar menu on a form with no borders.

Disable Taskbar's Menu ? (4th Time)
hi...
how can i disable the Properties menuitem
when i click right-mouse on taskbar
it's class are #32768 , but the handle change each time you click right-mouse

------------------
BlackRose

PopUp Menu In Taskbar On Borderless Form?
Hi All,

I have a borderless form...
But when I click on it in the taskbar, with the right mousebutton, it doesn't show the popup menu.

How can I force windows to display this menu? Is there a API Call for this?

Thanks!

Greetz Kevin,

Block Ctrl+Alt+Del, Alt+Tab, Start Menu And Taskbar
I would like to know how to do all that, like in the programs that prevent people from doing anything wrong in places with computers, in which one must enter a password and username to get in.
I'd heard that the Start Menu and Taskbar could be blocked from the registry, (but that would block both at the next system restart, no? Isn't there any API?)
And for the Crtl+Alt+Del and Alt+Tab I don't have a clue.
Thanks in advance

PD: BlockInput isn't useful for me, because prevents from moving the mouse or using the keyboard.

Retrieve Applications System Tray Menu Handle
How would i got about retrieving another applications System Tray Icon Menu Handle ? I want to be able to add items to a certain applications system tray icon menu. Lets say I have a program open and its displaying its icon in the system tray.. When you right click the icon in the system tray, a menu will popup.. How would I get the handle to that menu so that I can modify it..

Thanx,
AAG

Retrieving The Handle Of Windows' Default Context Menu
Hello people,
Does anyone know how to retrieve the handle of Windows' default context menu, you know, the one that says "Arrange Icons", "Line Up Icons", etc., no matter how hard I try I can not retrieve its handle. The GetMenu API doesn't seem to work for me, although I may be just doing it wrong can anybody help me??

Ignore Cascade/tile Windows From Taskbar Menu
i want to find some ways to avoid the affect of window arrange (cascade, tile window) by right click on taskbar, that is the bar at the bottom of desktop. when you right click on taskbar, a right click menu show a list of shortcut. how can i do to make my application windows not affected by Cascade, Tile window from the menu??

Attaching Handle Of Multiple Control To One Handle
i m associated with the project which required to process more then one controls at the time.
and we r using SendMessage api for that process. the problem is that we can give window handle of only one control to this api and not all. there is one solution in VC++ i suppose but i didnt able to find the solution in VB.

VC++ coding will be like this one
CWnd myWnd;
myWnd.Attach(hWnd1);
myWnd.Attach(hWnd2);
myWnd.Attach(hWnd3);

....... what ever process we have to execute

myWnd.Detach();


can any one solve my problem or can give vb code on the above vc++ code???

thanx in advance.
firoz

How To Convert A Cursor Handle To A BMP Handle?
how to convert a cursor handle to a BMP handle? When users are using another software, my program wants to know which cursor it is? There are two cursors in the 'another software', both are customized not system cursors. Is it possible to know current cursor is 'customized arrow' or 'customized flag'?

thanks

Getting A Window Handle From A Process Handle
I have the process handle of an external process
created from within my application. I know that the
process is windowed and has a parent/top-level window.
How do I get the window handle from the process
handle? Please suggest an API that gets the window
handle of the top-level window by taking a process
"handle" (clarified, not process ID).

Sathayish.

Get CabinetWClass Handle From SysListView32 Handle.
Get CabinetWClass handle from SysListView32 handle.
or how to get the path from a SysListView32 window.

I am trying to get the directory path from any Explorer window under the mouse pointer.
I have worked out how to get it when the mouse is over the titlebar (GetCabinetWClass)
but want to get the directory path when mouse is over the main (SysListView32) part of the window.

So is it possible to get the parent windows handle/name,
check if it's GetCabinetWClass, if not get parent window from parent
repeat until it is GetCabinetWClass or the top window.

My attached code gets the last window handle and not the parent window handle.

I am trying to save data from my program by dragging it to an Explorer window.
I don't want to use a CommonDialog to select the path.

The following code has been shortened to give you an idea how the code works. (See attachment)

Code:

' To get handle under pointer (See attached mod_WindowInfo.bas file)
Dim pt32 As POINTAPI
Call GetCursorPos(pt32)
ptx = pt32.X : pty = pt32.Y
hWndOver = WindowFromPointXY(ptx, pty)

' To get path from GetCabinetWClass (See attached Form1.frm file)
' Add reference to Microsoft Shell Controls and Automation
' and Microsoft Internet Controls
Private Function GetWindowsExplorerWindowFolder(hwnd As Long) As String
Dim myShell As Shell
Dim myExplorerWindow As WebBrowser
Set myShell = New Shell
Dim xxx As String
For Each myExplorerWindow In myShell.Windows
On Error Resume Next
If myExplorerWindow.hwnd = hwnd Then
If Err = 0 Then
xxx = myExplorerWindow.Document.Folder.Self.Path
Else
xxx = ""
End If
If xxx <> "" Then GetWindowsExplorerWindowFolder = GetWindowsExplorerWindowFolder + xxx + vbCrLf
End If
On Error GoTo 0
Next myExplorerWindow
Exit Function


It's quicker to drag than to use a CommonDialog tree.

Taskbar Item Not Leaving The Taskbar
Well, this may sound like a stupid question, but how do you get the dang thing out of the taskbar (by the clock)? When I end the program, it kills, but the icon still shows in the taskbar until I move the mouse over it; in which it immediately dissappears. If it makes any difference, I'm running WindowsXP pro.

Thanks!

Taskbar Question. A Label In Taskbar
How to put a form (with a label) in the tabkbar (between buttons and notify icons)

I need put in the taskbar a label with a number, ( this number is modify with a program in VB)


Thanks.
Ricard

Adding Menu Controls To Menu Without Using Menu Editor
I am trying to make a Visual Basic program that connects to an Access database and searches for its menu options! If there are any menu options that are added to the access database, then the program will automatically display them on the form after it searches for all the records within the database. Is there a thread that already exists that explains how to do this with VB Code? Is the following thread - something I can use in this regard:

http://www.xtremevbtalk.com/show...u+items+editor
on thinker's reply about using a resource file?

I wasn't sure...

Thanks,

Stephen

How Do You Create A Menu Under A Menu Under A Menu And So On.. ? Confused?
Ok right now im using a custom control to display my favorites in the menu at the top. I made the code but the control has a different way of featuring a fake menu at the top of the program that makes it easier to create sub items off of menu items. I want to know how would I go about creating multiple menu's under menus..

Like in the favorites of Internet Exploerer you have Favorites --> VisualBasic --> VB Sites --> VB World

Something like that... So you would click on Favorites and then on Visual Basic and then on VbSites and under vb sites is the link to VB world..I know you can create a menu array but that only does one level. I dont know how to do multiple levels. I do think there is a way to add menu items with api..Any help?

Disable MDI Parent's System Context Menu Right &amp; Left Click Menu Pop-up. How?
I am trying to do this without much luck, but managed to get rid-of the Min/Max buttons via an MS example at the link below.

http://support.microsoft.com/default.aspx?scid=kb;en-us;137033

However, when a user right clicks on-the MDI parent's Caption bar, a popup up menu appears - Woud like to prevent that.

Secondly, if a user "LEFT" Click on the top Left corner of the same Caption bar (where the Icon appears); it pops the same Pop-Up Menu - Like to stop that.

Thirdly, If a user double clicks on the same menu bar, form flickers, bobs down & up (Min & back to Max state), looks back at you and say's "fooled Ya!", as if it was possessed by some sort of strange evil code. Now I Would really, really, like to make it stop doing that.

Basically, like to prevent any mouse action on MDI Parent's Title Bar. Searched for couple of hours in vain (pain), but nothing turned up for what I am looking for. I can stop the right click on the form it-self by detecting mouse down button, but that’s not preventing the click event in MDI parent's title/caption bar.

Anyone know how or what needs to be done to get this to work? Any and all help, suggestions, etc. will be greatly appreciated!

Add Menu Item To System Menu Of Excel Imported Form [SOLVED]
I'm trying to achieve above 2 items but can't find out how. I've searched this forum already but also can't find anything relevant so am hoping that some of you might be able to kick me in the right direction.

I'm creating a combined VB6 and excel application. Basically VB6 controls excel. The forms used are imports from existing excel applications where I didn't feel like recreating them all over again. Part from that, the excel tab control is way better and easier to use then the VB6 one.

Progress timer:
When starting the program I want to show a progress timer because the program needs to initialize many items and arrays used. I thus created a simple progress timer which depending makes certain pictures visible which form a simple progress bar. The timer used is the VB6 timer option since there's nothing relevant like that from excel. This works well in itself but the problem is with display of the timer. During start it shows the form on which it was created but the timer only starts working after all has been initialized which basically defeats its purpose. Does anybody have any idea how to conquer this one.

Add item to top left window menu:
I want to add a About option to the top / left menu of my program window, the one also containing the minimize and maximize options. I've seen it done in other programs and since it is the only menu item I need I would prefer to do it this way also. I can't however find any information on how to go about this. Hope that someone can give me a push in the right direction for this one as well.

Thanks in advance for any suggestions.

Best regards,

Leon

How To Popup A Menu For The Menu Created By MenuEditor &amp; 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.

Clicking Picturebox Show Menu, Click Elsewhere Disappear Menu
Hello Everybody,

I've soem pictureboxes, and I want to show too command buttons when you click on on of the images but if you click somewhere else I want to make them dissappear, I tried the form_click event, and from_mousedown even, but they only work when you click on the form, but I've loads of other things on it, so the user must be "lucky" to click on the form, but to put the code to make them disappear in every object of the form would take a lot of time and I wonderd if there was another way to make them disappear again after clicking on something else???(its not that I don't want to ut the code there because of the work, but if I didn't search for a better methods then I would stay at the same level of programming)

How To Supress System Menu Popping Up Before User Defined Pop Up Menu
Hello,

Have a question concerning the following:

I have a textbox with the MouseUp event:


Code:
Private txtName_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button=vbRightButton Then

PopupMenu mnuEdit

End If

End Sub

My slight problem is that before you actually get the pop-up menu on the screen a system menu ( Undo/Cut/Copy... etc) pop ups

Is there any way to get rid of that system menu?

Thanks in advance for your help,

Shurik.

Remove Item From Menu And Add Code To Dynamic Menu Items
Hi.
I build my menu dynamically from a recordset.

Code:
While Not listTypes.EOF
Load mnufiles(mnufiles.UBound + 1)
With mnufiles(mnufiles.UBound)
.Caption = listTypes.Fields(1)
.Enabled = True
.Visible = True
.Checked = True
End With
listTypes.MoveNext
Wend


What happens is that i've got this menu, by default with one item (the first).
I wan't to remove it because it doesn't matter anymore after loading fields from DB.
How can I do this?

Another question:
How do I associate code to the dynamically generated menu items?
Thanks.

Adding Image To A Menu-item Thro Menu Editor
Hello,

Is it possible to add an image to menu-item thro Menu Editor in VB 6.0?

Thanks

Add Custom Menu Item To Windows Right Click Context Menu ????
Hi everyone

Earlier today there was a thread with this Q in it but it wasnt ever resolved. What i want to do is add my own custom entry to the windows menu that pops up when you right click on an something in particular to the edit menu. So when you select some text no matter what app your in it has my custom menu option in it along with the usual copy and paste and what not.

Can this be done

If so how and where do i start ??

Disable The Save Menu Item In The File Menu For Excel .
Hi all,
Please let me know how to disable the save menu item in the file menu when a excel sheet is opened.

Copyright © 2005-08 www.BigResource.com, All rights reserved