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




****Menu U Bar Divider Lines


How do i add the dividers into a vb menu??

i know its there somewhere but buggered if i can see it




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Vertical Divider
In a lot of programs like Outlook and the VB design environment you can resize certain panels to set their width so that you can see all the text that appears in them. You do this just by simple dragging and dropping. As you do so a thin semi-transparent bar appears indicating where the edge of the panel will appear when you drop. Has anyone got any code for doing this? The difficulty I have is that I want the bar to appear over an MDI form's blank area and over its child forms, so I've really got to draw on the screen, and I don't know how to do this.

Text Divider
Yes, I am a newbie, and yes, I have searched the forum.
AND yes, I have checked the help-file.

Now, my question:

I want to start a new line in my text box, what is the code?

Can you out it in an easy example, so I can understand the whole thing and how to use it?

It would be great!

Divider In A Listbox
Hello

I am looking for a divder in a listbox control or something, I wish to have the same look as in Filemanager in win9x where you can move the display area of files, dates and such.

What control does that and how do I use it ?

tia

Menu Lines
simple question:
in programs you usually see lines between sets of options in a menu such as a line between 'load' and 'save' & 'save as'.
How do i put this line into a menu?

thanks for any and all help.

Menu Lines
how do i create those lines in the menus using vb6

3D Menu Lines
How do you make these 3D menu lines like the one used in IE, VB, Word and a lot of other programs? I couldn't find any properties for the normal line that did this. And I don't mean the ones that seperate groups of menu items. I mean the one that seperate all the menues from the toolbar and/or the rest of the program. The one under where it says File, Edit, View or what ever menues you have.
Thanks.

Divider Line In Menus
Hey there,

I have a sys tray icon with right-click menu, and I was wondering if I can put up some horizontal divider lines between some menu items, to make it look a little cleaner, or maybe just a space or something.

Any ideas? I searched but couldn't find anything (anyone know how to combine keywords with AND? For some reason it doesn't work in search...or is it just me?)

Christoph

How Do U Add A Gray Divider Line To An RTB?
How do you add a Gray divider line to an to a RichTextBox?
Like the ones you see between procedures in the VB6 IDE.

I did it once by accident but have no idea what I did

Horiz Lines In Menu.
In the menu editor, how do you get horizontal lines? For example, MS word uses them (just below close, and just above exit)
they seem like a nice handy separator, but I can't seem to get them there.

MAIN Caused Divider Error
Hi,

I get the below message while running my vb application on Windows 98.

MAIN caused a divide error in module <unknown> at 0000:00000204.
Registers:
EAX=00000000 CS=003b EIP=00000204 EFLGS=00000097
EBX=00000000 SS=3b6f ESP=00000fd0 EBP=00007772
ECX=00000001 DS=5b26 ESI=311777e2 FS=3117
EDX=00000000 ES=3117 EDI=00000000 GS=1fae
Bytes at CS:EIP:
cd 30 cd 30 cd 30 cd 30 cd 30 cd 30 cd 30 cd 30
Stack dump:
003b0204 c11d0004 02460347 3117772e 008e0002 1fae0000 16b70000 12c016b7 023717b7 022f01b7 00280032 003b0204 00000001 00000026 00000031 00000000

Once the program reaches this point, it ends the application or freezes the system. It is not caused by a run-time bug as all errors have been trapped in all the modules.

Could someone provide me with a solution to fix this problem.

Thanks

Kumaran

Right Click Menu Command Lines
My question is about the %1 in command lines in explorer and VB

Example: The command line for .cfg filetype: c:windowsNOTEPAD.EXE "%1"

Now if I made my own action for the file type .mp3, named "DeDash" and put my own command line:

"C:TestDeDash.exe" "%1"

How would I pass on the filename, or %1, to VB and use it in the code, like Len(%1) etc., and use it in VB, any ideas?

Trouble With 1000 Divider (number Formating)
hi,
i have text boxes where user suppose to enter numerical values, which are used for calculation.
to make it look nicer, i want to format content of text box into standart format #,##0.00 (usa/canada regional setting).
however, after this formating is done, the field with calculated result changes and uses only digits before 1000 separator. for example after 10000 is formated into 10,000.00 formula is recalculated with the value 10.

here is part of my code (sbttl2, other, etc are defined as double):

Private Sub txtOther_Change()
On Error Resume Next
other = Val(txtOther.Text)
sbttl2 = instal + other + sprep + sinst + permit + superv
txtSub2.Text = Format(sbttl2, "#,##0.00")
End Sub

Private Sub txtOther_LostFocus()
On Error Resume Next
txtOther.Text = Format(txtOther.Text, "#,##0.00")
If Len(txtOther.Text) < 1 Then
txtOther.Text = 0
End If
End Sub

any suggestion, please?

Menu Editor Separator Lines (5 Sec. Question)
In the menu editor, I need to know how to put the separating line between Open & New and Save & Save As in my programs File drop down.

thanks

"Divider" Line In TreeView Control?
Hi Gurus,

I have a TreeView control in which the user can rearrange nodes at the same "level" by dragging and dropping them. For example, if I had the tree below...

[-] Parent1
|
+--- Child1
|
+--- Child2
|
+--- Child3



...the user could drag Child3 up to Child1 (but not past Parent1), which would then reorder the nodes as Child3, Child1, Child2.

Anyway, my real question is this: is there any way to use an API call or something to draw a line between the nodes indicating where the selected node will be dropped (similar to the line that is drawn when you drag a Favorites shortcut up and down in the Favorites menu of IE)?

Right now I just use the DropHighlight to indicate the node in front of which the dragged node will be dropped, but an "inter-nodal" line would be more intuitive, I think. If it's a big pain in the butt (or it can't even be done) then I'll just live with the way it is now.

Thanks!

Reading Certain Lines Of Files And Outputting Those Lines
This is what I am trying to do and I think I am going about it all wrong.

I am trying to read a log file (ascii) and only want to read in certain pieces of information (e.g. a failed request for a web page) and then I want that information written to a new file.

I wont even attempt to post thw code I have trying to work with, if someone can give me some pointers of post some example, I would really appreciate it.

Hmm - New Lines Arent Read As New Lines By Vb In A File
Heres the situation
im using urldownloadtofile to download a text file from the internet onto the harddrive. although the textfile on the net has 5 items, each on a single line, when i use that function the file saves as 5 items all on a single line.. and where a new line is supposed to be, i see a "box" in notepad..

needless to say, when i try to load the file into an array using Line Input, all 5 items are on a single array number, instead of one item in each array number..

heres what i mean..

text file online:
a
b
c
d
e

text file when downloaded to hd:
a[]b[]c[]d[]e

the box is interesting, if i copy the entire text from the file on my hd and paste it, they paste with all 5 items on seperate lines..

my question is, how can i load a[]b[]c[]d[]e with one item in each array with VB? line input wont work cause itll store a[]b[]c[]d[]e in one string

Read Lines And Count Lines From Txt File - Thank Ye All
hello again

im back for some more help, so i hope you guys can.

ive had a quick search on the forums for this but cant find anything that helps, so heres my problem:

i have this code:
Code:
Function random2()
Dim lines As Integer
Dim current As String
lines = 0
    Open "C:files.txt" For Append As #1
    Do While Not EOF(1)
        Line Input #1, current
            lines = lines + 1
            MsgBox (current)
    Loop
    Close #1
txtFILE = lines
End Function


but that code doesnt work, it does count the lines at all, i get no msgbox's, no count, no nothing.

any help would be much appreciated.

thanks.


Primary_Slave



----------------------------------------------------------------------------------------
I'm all wrapped up in my binary blanket and I'm coding on late into the night
----------------------------------------------------------------------------------------

Edited by - Primary_Slave on 11/4/2004 9:46:42 AM

Moving Lines In A Text Lines
I am creating a replay for a game and I am keeping the info for it in a text file but after 5 seconds I want to clear out anything over 5 seconds old and continue to add. I can figure most of it out cept for the whole part about it removing the first line and moving the rest of the lines up. I am adding to the file every 1/2 second for 5 seconds. Heres what I have so far....


VB Code:
Open "C:Game
eplay.txt" For Append As #1TotTime = Int(Timer) Print #1, Int(Timer); "lblbox(" & Index & ")"If Int(Timer) - TotTime = 5 Then


lol, not much but I can't figure out how do move the lines. Would I just kinda have a second file and copy the lines into the new file and just clear out the old one and so on? But that doesn't seem like an appropriate way to go. Any help with this situation would be muchly appreciated. Thank you and good day.

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 Many "visible" Lines (including Wrapped Lines) Are In A RTB?
I know I can get the "total" number of lines (including wrapped lines) in a RichTextBox by doing the following:

Code:SendMessage(RichTextBox1.hwnd, EM_GETLINECOUNT, 0&, ByVal 0&)

but, how can I get the total number of "visible" lines (including wrapped lines) in a RichTextBox only (ie: only the lines currently able to be seen in a RTB)?



Edited by - uncletr on 1/16/2007 5:27:03 AM

Lines Events Lines Ocx
I would like to create lines with vb6 and to change them when my program is runnig, but "line1" doesn't have any events, not mouse_clickmouseover.
I'm looking for solution for that problem or lines ocx instead.

Hope for answers...

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

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

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.

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.

Adding Bitmap Images To Explorer Menu (sub-menu)
Hi, I'm using some code from a guy named MathImagics to add my application to the explorer right-click menu. The problem is that I can not add different bitmap images to the sub-menu. For some reason I can only add the same image to the sub-menu options and the main menu item.

This is the code of the main menu with the code to add a bitmap image. The bitmap image is stored in a resource file


Code:
Const Optiontext = "My Menu" ' menu item caption

Dim MenuItem As MENUITEMINFO
With MenuItem
.cbSize = Len(MenuItem)
.dwTypeData = Optiontext & Chr(0)
.fMask = MIIM_FTYPE Or MIIM_STRING Or MIIM_ID Or MIIM_SUBMENU
.fType = MFT_STRING
.wID = idCmdFirst
.cch = Len(.dwTypeData) - 1
.hSubMenu = CreateSubmenu(idCmdFirst)

' 5. (Optional) show a bitmap image next to my option text (like WinZip)
' if we do create bitmap handles, cMenu_Terminate should destroy them

Const LR_DEFAULTSIZE = &H40
.fMask = .fMask Or MIIM_CHECKMARKS
If hMyBitmapImage = 0 Then
hMyBitmapImage = LoadImage(App.hInstance, 101, 0&, 0&, 0&, LR_DEFAULTSIZE) '101 is the image number in the resource file
End If
.hbmpUnchecked = hMyBitmapImage
End With
'
' Insert the menu option, and tell Explorer that we added one item
' (separators do not get counted, only real options)
'

menuPos = menuPos + 1
InsertMenuItem hMenu, menuPos, 1&, MenuItem


Below is the code I have for the sub-menu. I assume that if I have a second bitmap image in the recource file with number "102" and also change that number in the code, then the new bitmap image should show in the sub-menu. This works, only there is a side-effect. If I use image "102" for the sub-menu, then the image of the main menu item gets changed to image "102" as well.


Code:
Private Function CreateSubmenu(ByVal idCmdFirst As Long) As Long
'
' demonstrate Submenu insertion
'
Const LR_DEFAULTSIZE = &H40
Dim SubItem As MENUITEMINFO

hMySubmenu = CreatePopupMenu() ' save handle of submenu (cMenu_Terminate should release it)

With SubItem
.cbSize = Len(SubItem)
.dwTypeData = "My Sub-Menu"
.fMask = MIIM_FTYPE Or MIIM_STRING Or MIIM_ID
.wID = idCmdFirst + 4 - m
.fType = MFT_STRING
.cch = Len(.dwTypeData) - 1

'Code for adding bitmap image to the sub-menu. If I change the bitmap number to 102, then the sub-menu
'gets the new image, but the image of the main menu item gets changed to image 102 as well.
Const LR_DEFAULTSIZE = &H40
.fMask = .fMask Or MIIM_CHECKMARKS
If hMyBitmapImage = 0 Then
hMyBitmapImage = LoadImage(App.hInstance, 102, 0&, 0&, 0&, LR_DEFAULTSIZE)
End If
.hbmpUnchecked = hMyBitmapImage
End With


InsertMenuItem hMySubmenu, n, 1&, SubItem

'----------------------------------------------------------------


CreateSubmenu = hMySubmenu
End Function
Does somebody know how to show different images for the main menu and the sub-menu options?

Screenshot: http://img100.imageshack.us/img100/4...nu555573te.png

This is the complete code for the ActiveX DLL.

Add A Custom Menu To File Menu Of Windows Explorer
Hi,

I have to develop a program which will add a menu item to windows explorer/IE file menu bar. My requirement is attached as a picture. It will work like similar to favourites in IE. But this i need to save the current folder in my menu as a favourite item, Please find attached picture to get more understanding.
if you have any links or sample, please post it.

I have to do this program in visual basic 6.

thankzzzzz

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

Adding Bitmap Images To Explorer Menu (sub-menu)
Hi, I'm using the code from MathImagics to add my application to the explorer right-click menu. The problem is that I can not add different bitmap images to the sub-menu. For some reason I can only add the same image to the sub-menu options and the main menu item.

This is the code of the main menu with the code to add a bitmap image. The bitmap image is stored in a resource file


VB Code:
Const Optiontext = "My Menu"   ' menu item caption      Dim MenuItem As MENUITEMINFO   With MenuItem      .cbSize = Len(MenuItem)      .dwTypeData = Optiontext & Chr(0)      .fMask = MIIM_FTYPE Or MIIM_STRING Or MIIM_ID Or MIIM_SUBMENU      .fType = MFT_STRING      .wID = idCmdFirst      .cch = Len(.dwTypeData) - 1      .hSubMenu = CreateSubmenu(idCmdFirst)            ' 5. (Optional) show a bitmap image next to my option text (like WinZip)      '    if we do create bitmap handles, cMenu_Terminate should destroy them            Const LR_DEFAULTSIZE = &H40      .fMask = .fMask Or MIIM_CHECKMARKS      If hMyBitmapImage = 0 Then         hMyBitmapImage = LoadImage(App.hInstance, 101, 0&, 0&, 0&, LR_DEFAULTSIZE) '101 is the image number in the resource file         End If      .hbmpUnchecked = hMyBitmapImage      End With   '   ' Insert the menu option, and tell Explorer that we added one item   '     (separators do not get counted, only real options)   '      menuPos = menuPos + 1   InsertMenuItem hMenu, menuPos, 1&, MenuItem



Below is the code I have for the sub-menu. I assume that if I have a second bitmap image in the recource file with number "102" and also change that number in the code, then the new bitmap image should show in the sub-menu. This works, only there is a side-effect. If I use image "102" for the sub-menu, then the image of the main menu item gets changed to image "102" as well.


VB Code:
Private Function CreateSubmenu(ByVal idCmdFirst As Long) As Long   '   ' demonstrate Submenu insertion   '   Const LR_DEFAULTSIZE = &H40   Dim SubItem As MENUITEMINFO      hMySubmenu = CreatePopupMenu() ' save handle of submenu (cMenu_Terminate should release it)       With SubItem         .cbSize = Len(SubItem)         .dwTypeData = "My Sub-Menu"         .fMask = MIIM_FTYPE Or MIIM_STRING Or MIIM_ID         .wID = idCmdFirst + 4 - m         .fType = MFT_STRING         .cch = Len(.dwTypeData) - 1              'Code for adding bitmap image to the sub-menu. If I change the bitmap number to 102, then the sub-menu      'gets the new image, but the image of the main menu item gets changed to image 102 as well.      Const LR_DEFAULTSIZE = &H40      .fMask = .fMask Or MIIM_CHECKMARKS      If hMyBitmapImage = 0 Then         hMyBitmapImage = LoadImage(App.hInstance, 102, 0&, 0&, 0&, LR_DEFAULTSIZE)          End If      .hbmpUnchecked = hMyBitmapImage      End With             InsertMenuItem hMySubmenu, n, 1&, SubItem            '----------------------------------------------------------------          CreateSubmenu = hMySubmenu   End Function

Does somebody know how to show different images for the main menu and the sub-menu options?

Runtime Menu/Right Click Menu/No Border Form
Ok, I am trying to make a form as small as possible. I turned on the boreders and its just the way I want it. Now I would like create a popup menu (to save space, instead of puting command buttons). The problem is, when I add an invislbe menu in the menu editor and try to use Popupmenu, borders and the title bar appear on my form even though borders are still set to none.

From the search I did there seems to be no way to create a run time menu without some APIs. Is there any other way to accomplish a right click menu in this situation? Thanks.

Disable The START Menu And All Its Menu Items Of WINDOWS 98 OS
Hi,
During the execution of a visual basic .exe file ,I want to disable the START menu and all its menu items of WINDOWS 98 OS.Also i want to trap the key hits , CTRL + ESC and the windows keys.Ultimately,a user should not access the START menu or any of its menu items under any circumstances, once the exe gets loaded .
Help would be highly appreciated.
Aju.

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

Adding Custom Menu To Excel 2000 Menu
Dear All,

I have recently started developing Excel 2000 macro. Can anyone give me a idea or a small piece of code regarding how can i add a new menu to the custom menu bar at top of the Excel Menu and also to the popup menu that appears when we right-click any cell on the worksheet.

Regards
Amarjit

Adding Menu's In Windows Explorer Right Click Menu
Could anyone tell me how you can put a menu item of your own in, for example, the right click menu in windows explorer? I know it's possible , is anyone there listening to me ????? PLEASE HELP !!!!!!!

How To Add Menu Item To The Windows Explorer Context Menu Using Vb6
Hi,

Can anyone please let me know,
How to add my application item "Run My application" to the windows explorer context menu and on right click-> click on this item , i need to run my application. How can i do this using VB6? its exactly like winzip and other programs doing. First thing is i want to add to the context menu of windows explorer and on click my item, i need to know on whick item user selected this option. I need to do this in VB6. Please help me in this regard.

thanking you

Praveen

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

Bold Menu Items In Menu Editor
Ok, this may sound like a stupid question but if anyone knows how can they please help. When you use the menu editor how can you make a menu item/text about from the menu editor or using code.

For example if I wanted to make mnuAbout bold or something. Help is greatly appreciated. Thanks.

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?

How Easy Is It To Add To Context Menu (right Click Menu)
I'd like to be able to add to the context menu (right click menu), how is this possible? and is it restricted to the application i.e I'd like to add one to an Excel sheet and one to normal windows operations

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