CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2004
    Posts
    6

    Advanced (Shell)

    Is it possible to use
    1. IShellMenuCallback
    2. IShellMenu
    in Visual Basic ?
    If Yes, THEN how ?

    Any code suppliments would be appriciated.

    Thanks.

  2. #2
    Join Date
    Aug 2004
    Posts
    6

    MoreDetails

    Actually i want to trap the Start Menu, record what the user select through the start menu, I found the following information from MSDN

    Start Menu is implemented as MenuBand Object
    So we need Create this object by calling CoCreateInstance and obtain a pointer to IShellMenuCallback Interface by passing pointer to this MenuBand object to IShellMenu::Initialize .
    So that we can use the IShellMenuCallback::CallbackSM method to get the notification selection or the execution of program through the Start Menu.

    But all this , i am not able to do it in vb,
    How do i use IShellMenu, IShellMenuCallback
    VB.

    Thanks,

  3. #3
    Join Date
    Nov 2002
    Location
    Baby Land
    Posts
    646
    you might try Eduardo's site at http://www.mvps.org/emorcillo/, you will find the typelib to use in Shell programming along with some samples. You might want to check www.vbaccelerator.com for similar stuff.

  4. #4
    Join Date
    Aug 2004
    Posts
    6
    I have downloaded the SHLEXT.tlb from vbaccelarator.com
    Can u pl tell me how to use IShellExecuteHook 's Execute function in vb

    What i understand is Execute is called when any call to ShellExecute or ShellExecuteEx is made by other process
    But the i am getting it as a class and a function of the class .


    I actually want to trap the opening of the file (filename , program that opens it .etc) .

  5. #5
    Join Date
    Jan 2002
    Location
    somewhere between a variable and a string
    Posts
    214
    Here comes SubClassing.................. Hope you're not pressing for this project to be done cause you'll need to learn alot about subclassing and hooking
    How can anyone sell information when all the information that they sell is free at the library ?

    How come Doctors keep getting smarter yet they cannot cure the common cold ?

    If Scientist are right and man evolved from monkey then where did the monkeys' come from ?

    Man I love this little dude that waves => <= He just doesn't stop

  6. #6
    Join Date
    Aug 2004
    Posts
    6
    hmm.. Not Really, Since these functions are undocumented. the parameters and such thing are a bit confusing.
    Can someone tell me how to use the Execute function of the IShellExecuteHook
    in VB.

  7. #7
    Join Date
    Nov 2002
    Location
    Baby Land
    Posts
    646
    Have you check Edanmo link that I gave on my previous post?
    There's already an example of how to use the IShellExecuteHook interface.

    If you haven't then I suggest you download the sample (it's in windows installer msi format). Look under ShellExecute folder (obviously) in your installation folder, recompile the exechook.dll if you need to.

    Then register the dll in the registry. Don't forget to create the ShellExecuteHook a new REG_SZ entry in this location:

    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellExecuteHooks\

    and name it the GUID of the exechook.dll ( that's {E33EB92C-9A58-4524-8861-52E908D26E68} at least on my computer)

    You will notice that each time you launch an application from the explorer, the information about that application is log in SHLEXEC.Log file in your windows folder

  8. #8
    Join Date
    Aug 2004
    Posts
    6
    Thanks for your help,

    YES I LOOKED IT BEFORE AND DID THAT ,
    INFACT THE INSTALLER DOES ALL THE WORK,

    the log file is not created anywhere in the system.
    i checked all the the things in the registry.
    I don't know why ?
    Is there any way to debug the class ?

  9. #9
    Join Date
    Nov 2002
    Location
    Baby Land
    Posts
    646
    I use WinXP and it works, my log file is in c:\Windows\SHLEXEC.LOG"

    You can try the attachment which contain the same dll but have been recompiled with VB 6 SP 6. Just register the dll with RegSvr32.exe

    also merge the reg.reg file to make sure the correct GUID is placed on ShellExecute list (the msi installer does not do this)

    If it's not working then probably the original author can give you more info.

    As for debugging an IShell* implementation, well it's a painfull process, cause the Dll is in Explorer.exe process, so first of all you must kill all explorer.exe process.
    If you run WinNT/2000/XP then you must also change this registry value to '0' HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoRestartShell

    To run the project from IDE, set the project properties, within the Debugging tab, 'Start program:' to point to explorer.exe.

    Well at least the above steps works for VC, never tried it with VB though.
    Attached Files Attached Files
    Last edited by Luthv; August 12th, 2004 at 04:34 AM.

  10. #10
    Join Date
    Aug 2004
    Posts
    6
    Thanks a lot Luthv.
    Now its working,
    Infact uninstalled the whole thing,
    USED the project and comiled it to dll, manually edited the registry and its works,
    I use Win2k.

    So most of the things are over.
    Actually i want to trap the whole thing in my project, in an array that i am already using to capture other thing.

    So one way i will do to caputure info from this dll is use the SendMessage function to send custom message to my application. I will store the handle to my application dynamically in the registry and this dll will use this handle and send message to my application In this way i can get info to my application.

    Is there any better way of doing it ?

  11. #11
    Join Date
    Nov 2006
    Posts
    221

    Re: Advanced (Shell)

    Is there any example to do the same in vc++, Please tell me

    Thanks

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

Featured