Results 1 to 30 of 30

Thread: Context Menu kicks ass

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's some unanswered qwestions:

    I rightclick a file in explorer and a context menu shows up:

    1. How do i create submenus in a context menu

    2. How do i put an icon (bitmap) next to my menu item in a context menu

    3. How can i make files can be drag and dropped on another file (not application) like winzip does with files dropped on zip files?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    Member
    Join Date
    Jun 2000
    Location
    In front of Computer
    Posts
    37
    sorry that i cant remember which one, but there is an API call to place icons by the text in menu/context bars

  3. #3
    Guest
    kedaman
    Fanatic Member

    Registered: Mar 2000
    Posts: 1288


    ----------


    Come on smart kedaman, your telling me you dunno how to do that? Visit http://www.planetsourcecode.com to know all the answers .

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, if the other gurus didn't know, why should i know? Smart and smart, where did you get that from? That doesn't mean i don't know the answers. Thanks anyway i thought this would be a typical 0 replies post. I'm not sure if ever could find it at planetsourcecode as i have already searched it before about filetypes
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ok! i found the one with making bitmaps added to context menus, but yet there are two Q's:
    Submenus in context menu and drag and drop files on another file type...
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    Would you mind posting a link to were you found out how to do that for other people that might be wondering the same thing

  7. #7

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well i lost it, i don't remember what i searched for
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    Guest
    Well kedaman, you still have http://www.vb-world.net to search. And you can also search http://www.vbcode.com . Usually, the forums on vb-world is my last resort. I search for the code and if I cannot find it anywhere, I ask on the forums...which they don't always get answered so I'm screwed until some smart person comes up with a code . That's just the way it is.

    A lot of people are the same I realize. I bet you, for about a few times a day, just keep refreshing forums.vb-world.net and new threads keep coming for you to answer. And you just want your numbers to go higher so you can become a Guru. Not that Guru's are any different. They could be as smart as a Fanatic Member or a Lively Member. Aaron Young is higher than everyone. A Guru. Have you ever seen him ask a question? Even someone asks a question that no one understands. He still seems to answer it. How the hell is that? So I wonder what comes after Guru? Genius? Guess we'll have to wait and see what Aaron becomes .

    Damn, I typed a lot. Not that I even made it so you could understand what I wrote .

    Kedaman, it seems like you and Megatron are competing. hehe . May I ask, do you feel smart when you answer a post? Especially when you exactly right? Does it make you feel good? lol. Tell me these things. I wanna know everything!

  9. #9
    Guest
    Let me answer this. How do you think we're competing? Because our numbers are close? Well if that's the case, I can find many people with posts close to yours.

    Look at the date i was registered. MARCH 1999. It seems pretty reasonable that I should be this high.

  10. #10
    Guest
    Ok...I know that there are posts close to mine. Didn't mean to offend you. Both your names I see the most. I see your names so much, when I sleep..I see a sign that has the words "Kedaman" and "Megatron". lol...be honored, hehe

  11. #11

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Matthew, Actually I could have been Guru, like those others if i just joined in a bit earlier, if I only had over 1000 posts at that time when Gurus where chosen. I know, Aaron Young most be the Vb-God of this site, And what about Serge? He is also great.

    No, i'm not competing, i like posting things, go look at the evolution threads, you see millions of posts, and each of them took me ten to hundred times more to write than a simple answer here in Q and A. And i haven't got a single post counted of them, but still i'm posting there.
    Kedaman, it seems like you and Megatron are competing. hehe . May I ask, do you feel smart when you answer a post? Especially when you exactly right? Does it make you feel good? lol. Tell me these things. I wanna know everything!
    Heh, Matthew, where do you want to get me? You can't possibly be helping people for another reason!!!!!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12
    Guest
    [quote]Both your names I see the most. I see your names so much, when I sleep..I see a sign that has the words "Kedaman" and "Megatron". lol...be honored,[/code]

    No offense taken. You see our names because we have knowledge. Something some people don't have. Hint. Hint.

  13. #13
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Lightbulb

    kedaman

    try

    http://www.vbcode.com/asp/showzip.as...ZIP&theID=1860


    Might get you sub-context menus...


    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

  14. #14
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Lightbulb

    kedaman

    you might also be interested in

    http://www.vbcode.com/asp/showzip.as...zip&theID=1850

    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

  15. #15
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    dropping files on a ICON or program is easy. use the command$ command for grabbing the files names.

    To test it, chuck a label on a form and have the form load or sub main write Label1.caption = command$. I think the system throws the " chr around the path and file name. then compile and drag a file onto it, it opens and displays the file name. haven't tried multiple files but probably just delimited, easy to test.

    Isn't a context menu just displaying a popup menu which is not displayed as a normal menu?

    For bitmaps on menus, take a shortcut and get the controls from vbaccellerator (pardon the spelling) they have controls with source for popup menus too.

    I thought you knew all this? is this an old post or something????

    maybe I'm not understanding your questions, please re-write!

    Why aren't you a GURU yet? I've seen other Guru's with only 1200 posts!




    [Edited by Paul282 on 06-07-2000 at 04:34 AM]
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  16. #16
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237
    I'll just poke a stick in the hornet's nest and comment on Gurus

    There are 4 or 5 members with guru status and they really are.

    How many of Aaron's 2000+ postings are questions?
    How many of Clunietp's 1400+ postings are?
    How many are idle chit chat?

    I'd have a guess tht the total of these 3 questions can be shown on the fingers on one hand!




  17. #17
    Guest
    [QUOTE]Originally posted by Megatron
    No offense taken. You see our names because we have knowledge. Something some people don't have. Hint. Hint.
    Hey hey!! I know all! I hear all! I see all! Everyones mind is different. You may know more than me on certain subjects, but not all of them.

  18. #18
    New Member
    Join Date
    Jun 2000
    Posts
    9
    Megatron= Megadeth fan??
    blah

  19. #19

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Judd, i that wasn't what i was searching for - Context menu is the menu that popups in explorer when you click a file.

    Paul, Hehe, either i was too bad at explaining or you missed it:

    You see the zip file: you drag another file over it, and it shows a plus on the cursor. When you drop, it will launch winzip. The problem is (yeah i know that command stuff and how to make my file launched from explorer) that i need to the exactly same thing. In registry, root classes, you will find those shellex keys, i tried to copy all that but nothing worked. If anyone know what i'm talking about, please reply

    Guru: HEre's all gurus:
    http://forums.vb-world.net/memberlis...ers&perpage=10
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  20. #20
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155
    You can also design a menu using the "Menu Editor" in VB and then on the proper event Form_MouseDown, Form_Click, etc. you can use the [b]PopupMenu[/p] statment to display your menu.

  21. #21

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    CONTEXT MENU, Jason this must be done in registry
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  22. #22
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Try this for the Drag/Drop Operation:

    In an ActiveX DLL Project:

    In a Class Module:
    Code:
    Public sFilename As String
    
    'Must be Implemented by Drag/Drop Handlers
    Implements IPersistFile
    Implements IDropTarget
    
    Private Sub IPersistFile_Load(ByVal pszFileName As Long, ByVal dwMode As Long)
        'Get the name of the File being Dropped on
        sFilename = String(lstrlenW(ByVal pszFileName), 0)
        MoveMemory ByVal StrPtr(sFilename), ByVal pszFileName, LenB(sFilename)
    End Sub
    
    Private Function IPersistFile_GetCurFile() As Long
        '
    End Function
    
    Private Sub IPersistFile_IsDirty()
        '
    End Sub
    
    Private Sub IPersistFile_Save(ByVal pszFileName As Long, ByVal fRemember As Long)
        '
    End Sub
    
    Private Sub IPersistFile_SaveCompleted(ByVal pszFileName As Long)
        '
    End Sub
    
    Private Function IDropTarget_DragEnter(ByVal pDataObj As shlext.IDataObject, ByVal grfKeyState As Long, ByVal ptX As Long, ByVal pyY As Long) As shlext.DROPEFFECTS
        Dim tFORMAT As FORMATETC
        Dim tMEDIUM As STGMEDIUM
        Dim nIndex As Long
        Dim nFileCount As Long
    
        On Error Resume Next
        
        ' Erase the array
        Erase sFiles()
        
        ' Set the Format of the Data to Retrieve
        With tFORMAT
            .cfFormat = CF_HDROP
            .TYMED = TYMED_HGLOBAL
            .dwAspect = DVASPECT_CONTENT
        End With
        
        ' Get the Data
        pDataObj.GetData tFORMAT, tMEDIUM
        
        ' Get No. of Files
        nFileCount = DragQueryFile(tMEDIUM.Data, -1, vbNullString, 0) - 1
        ReDim Preserve sFiles(nFileCount)
        
        ' Get the File Names
        For nIndex = 0 To nFileCount
            sFiles(nIndex) = String$(260, 0)
            DragQueryFile tMEDIUM.Data, nIndex, sFiles(nIndex), Len(sFiles(nIndex))
            If InStr(sFiles(nIndex), vbNullChar) > 0 Then sFiles(nIndex) = Left$(sFiles(nIndex), InStr(sFiles(nIndex), vbNullChar) - 1)
        Next
        
        IDropTarget_DragEnter = DROPEFFECT_MOVE
        
        ' Release memory used by the Medium Type
        ReleaseStgMedium tMEDIUM
            
    End Function
    
    Private Sub IDropTarget_DragLeave()
        Erase sFiles
    End Sub
    
    Private Function IDropTarget_DragOver(ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long) As shlext.DROPEFFECTS
        IDropTarget_DragOver = DROPEFFECT_MOVE
    End Function
    
    Private Function IDropTarget_Drop(ByVal pDataObj As shlext.IDataObject, ByVal grfKeyState As Long, ByVal ptX As Long, ByVal ptY As Long) As shlext.DROPEFFECTS
        Dim nIndex As Long
        Dim sFileList As String
        
        'Do Whatever with the Dropped File(s)
        sFileList = "Drop Target File: " & sFilename & vbCrLf & vbCrLf
        For nIndex = 0 To UBound(sFiles)
            sFileList = sFileList & sFiles(nIndex) & vbCrLf
        Next
        MsgBox sFileList, vbOKOnly, "File(s)"
        
        IDropTarget_Drop = DROPEFFECT_MOVE
    End Function
    In a standard Module:
    Code:
    Public sFiles() As String
    
    Public Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal L As Long)
    Public Declare Function lstrlenW Lib "kernel32" (lpString As Any) As Long
    You'll need a reference to a Type Library that has these Interfaces, (Thanks to Eduardo Morcillo for this) you can download it from VBAccelerator.com, he also has a site, but it wasn't coming up when I tried it.

    Compile the DLL and Register it.

    To use, add a key under your Registry Entry for the Extension as follows:
    Code:
    .Ext ----> {Default} = "Extension App Name"
    
    Extension App Name
       '---> ShellEx
               '---> DropHandler - {Default} = "{CLSID}"
    Where "{CLSID}" is the CLSID of your ActiveX DLL.

    I believe the same concept would be how you'd achieve the Icons on the context Menu too, but I haven't explored the Context Interface as yet.

    If you couldn't get it to work from the code I posted, let me know and I'll send you the project files.

    - Aaron.

  23. #23

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Cool

    Aaron Young! I knew it! If there is anyone that can answer it it must be him. Thanks!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  24. #24
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237

    Aaron Young! I knew it! If there is anyone that can answer it it must be him. Thanks!
    That is exactly what I mean when commenting on Gurus!

  25. #25
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Talking Kedaman...

    ...so the menu thing wasn't what you were after, how about the lyric scroller (I heard you were doing somthing like that...?)


    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

  26. #26

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    That's right, I haven't still done that scroller, if anyone is interested and want to get credit, just ask me and i'll send you the sample
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  27. #27
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Sedgefield
    Posts
    337

    Lightbulb Kedaman...again!

    kedaman,

    I was just looking at the ContextMenuHandlers in my registry, which point at various shell extensions etc (i.e. the dll or exe). So if the context menu is part of the exe or dll, surely that's where a sub menu would be defined too..

    If you know how to add a ContextMenu is it really that hard to add a sub menu?

    Dan

    Outside of a dog, a book is a man's best friend.
    Inside of a dog, it's too dark to read.

  28. #28

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Judd
    Nope, it's adding items to the menu, the context menu popups always. Well, i guess it's not that important to have a submenu, but the drag and drop is really needed.

    AARON!
    It highlights:
    Private Function IPersistFile_GetCurFile() As Long
    And says:
    Procedure declaration does not match description of event or procedure having the same name
    when i try to compile it.
    What's wrong?!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  29. #29
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Hmmmm, perhaps I pointed you to the wrong version of the Type Library, when I return from Work, I will Email you my copy of it.

    - Aaron.

  30. #30

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Thanks in advance!
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width