|
-
Feb 9th, 2005, 08:45 PM
#1
Re: Global Shell menu extension
Thanks. But what about files? I have added it to the "*" and it still only worked for exe file...
-
Feb 10th, 2005, 11:52 AM
#2
Re: Global Shell menu extension
Anyone else have any ideas?
-
Feb 10th, 2005, 12:37 PM
#3
Re: Global Shell menu extension
How about:
HKEY_CLASSES_ROOT\*\OpenWithList\MyProg.exe
...
-
Feb 10th, 2005, 09:39 PM
#4
Re: Global Shell menu extension
Yes but that will subordinate it to the Open with item which does not always show. It only shows for unknown file types and for all when you hold Shift when opening the menu.
-
Feb 11th, 2005, 05:07 AM
#5
Re: Global Shell menu extension
I got it to work for all file types and folders by adding references to these keys:
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\AppName
HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\AppName
HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\AppName
HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers\AppName
Now, I just have to find a way to make it detect when multiple (a group) files are selected and I'm set
-
Mar 12th, 2005, 08:46 PM
#6
Re: Global Shell menu extension (almost resolved)
Ok... I've got it... the solution to multiple selections that is:
Use the code in the link RobDog posted... then, replace the existing procedure with this one:
VB Code:
Private Sub IShellExtInit_Initialize(ByVal pidlFolder As Long, ByVal lpdobj As Long, ByVal hKeyProgID As Long) Dim strVal As String Dim pIDataObj As IUnknown Dim oIDataObj As IDataObject Dim FmtEtc As FORMATETC Dim pMedium As STGMEDIUM Dim szTemp As String Dim iFile As Long Dim rc As Long CopyMemory pIDataObj, lpdobj, 4 Set oIDataObj = pIDataObj ' oIDataObj now stores the object required CopyMemory pIDataObj, 0&, 4 ' Set the format to get the data in... With FmtEtc .cfFormat = CF_HDROP .ptd = 0 .dwAspect = DVASPECT_CONTENT .lindex = -1 .tymed = TYMED_HGLOBAL End With ' ... and store it in our medium oIDataObj.GetData ByVal VarPtr(FmtEtc), ByVal VarPtr(pMedium) rc = Err.LastDllError 'Check for errors Dim filename As String 'the dropped filename Dim numOfDroppedFiles As Long 'the number of dropped files Dim curFile As Long 'the current file number SelectedFile = "" 'get the total number of files numOfDroppedFiles = DragQueryFile(pMedium.hGlobal, True, filename, Len(filename)) For curFile = 1 To numOfDroppedFiles 'get the file name filename = String(260, 0) rc = DragQueryFile(pMedium.hGlobal, curFile - 1, filename, Len(filename)) DoEvents 'at this pointer you can do what you want with the filename 'the filename will be a full qualified path If curFile = 1 Then SelectedFile = Left$(filename, rc) Else SelectedFile = SelectedFile & "|" & Left$(filename, rc) End If DoEvents Next curFile 'we are now done with the structure, tell windows to discard it DoEvents rc = ReleaseStgMedium(pMedium) Set oIDataObj = Nothing DoEvents End Sub
Thanks to everyone that helped.
Last edited by baja_yu; Nov 24th, 2009 at 10:39 PM.
-
Jun 19th, 2005, 06:24 PM
#7
New Member
Re: Global Shell menu extension [resolved]
The demo example posted here is wonderful! Thank you so much for making & posting it! This is totally awesome, I am so happy to have found this sample, it rocks!!
It is very easy to use. I was a bit confused about how you get a DLLs GUID and how to make my own project...(I have never made a dll before), but figured that out pretty soon when i googled for dll progid and had a general read about them.
Thanks a bunch for this demo.
Last edited by Clawsy; Jun 19th, 2005 at 06:33 PM.
-
Jan 9th, 2008, 05:53 PM
#8
Frenzied Member
Re: Global Shell menu extension (almost resolved)
 Originally Posted by baja_yu
Ok... I've got it... the solution to multiple selections that is:
Use the code in the link I posted... then, replace the existing procedure with this one:
VB Code:
Private Sub IShellExtInit_Initialize(ByVal pidlFolder As Long, ByVal lpdobj As Long, ByVal hKeyProgID As Long)
Dim strVal As String
Dim pIDataObj As IUnknown
Dim oIDataObj As IDataObject
Dim FmtEtc As FORMATETC
Dim pMedium As STGMEDIUM
Dim szTemp As String
Dim iFile As Long
Dim rc As Long
CopyMemory pIDataObj, lpdobj, 4
Set oIDataObj = pIDataObj
' oIDataObj now stores the object required
CopyMemory pIDataObj, 0&, 4
' Set the format to get the data in...
With FmtEtc
.cfFormat = CF_HDROP
.ptd = 0
.dwAspect = DVASPECT_CONTENT
.lindex = -1
.tymed = TYMED_HGLOBAL
End With
' ... and store it in our medium
oIDataObj.GetData ByVal VarPtr(FmtEtc), ByVal VarPtr(pMedium)
rc = Err.LastDllError 'Check for errors
Dim filename As String 'the dropped filename
Dim numOfDroppedFiles As Long 'the number of dropped files
Dim curFile As Long 'the current file number
SelectedFile = ""
'get the total number of files
numOfDroppedFiles = DragQueryFile(pMedium.hGlobal, True, filename, Len(filename))
For curFile = 1 To numOfDroppedFiles
'get the file name
filename = String(260, 0)
rc = DragQueryFile(pMedium.hGlobal, curFile - 1, filename, Len(filename))
DoEvents
'at this pointer you can do what you want with the filename
'the filename will be a full qualified path
If curFile = 1 Then
SelectedFile = Left$(filename, rc)
Else
SelectedFile = SelectedFile & "|" & Left$(filename, rc)
End If
DoEvents
Next curFile
'we are now done with the structure, tell windows to discard it
DoEvents
rc = ReleaseStgMedium(pMedium)
Set oIDataObj = Nothing
DoEvents
End Sub
Thanks to everyone that helped.
I am in need of similar to the same thing. I created an exe and am able to get it to work for context menu. Only problem is when it fires off, it fires off multiple instance of the same exe because multiple files are selected.
I posted a similar thread earlier today:
http://www.vbforums.com/showthread.php?t=503943
baja_yu or anyone, can you show me where to plug this procedure in and what to feed into it? I noticed pidlFolder and hKeyProgID are not used in the procedure.
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|