Link to home
Start Free TrialLog in
Avatar of amkarambelkar
amkarambelkar

asked on

Context Menu

Hi there
I am doing the application in Visual Basic 6.0 and I want to add context menu which can be be seen in
'Windows Explorer' on rigt clicking inside it.
I refered the MSDN Library for the same task but I didn't understand the contents If you know How to make the coding for the same Please let me know the full coding . The proper commentation will help me lot since I am fresher for VB6.0
Thank you.
Avatar of rspahitz
rspahitz
Flag of United States of America image

I'm assuming you want a "popup" menu.  Try this:

Private Sub SomeControl_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Button = vbRightButton Then
    PopupMenu mnuSomeMenu
  End If
End Sub

"SomeControl" is the name of the control which will receive the context menu.
"mnuSomeMenu" is a predefined menu created using the standard menu editor.  This will also include a set of sub-menu entries which will appear in the popup window.
Avatar of amkarambelkar
amkarambelkar

ASKER

I think you are getting confused with my Question
The context menu and Popup menu are two different things
Popup menu runs within application
Context menu is the menu which is appeared when  we right click on any file in  'windows explorer'  like Copy, paste, Delete, create shortcut etc.
ASKER CERTIFIED SOLUTION
Avatar of MELeBlanc
MELeBlanc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I understand you correctly, you want to add your application to the Windows explorer context menu for certain types of files. If this is the case, I don't know how to do it off-hand, but all you need to do is add some entries to the registry, there is no code involved. I am sure someone here knows what entries are required.

Zaphod.
hi Z_Beeblebrox
You have said rightly but whatyou are suggesting is only valid for Win9x In winNT or win2k we have to creat the Dll
and by registering it and also adding some values in registry we can have the menu in context menu
Hi MELeBlanc
I have followed your link and got the code file
I am very happy to say that it has worked very good
Thanks a lot.
You're most welcome.
Glad I could help.

-M