| View previous topic :: View next topic |
| Author |
Message |
nikos Moderator


Joined: 07 Feb 2002 Posts: 12346 Location: UK
|
|
| Back to top |
|
 |
fgagnon Site Admin


Joined: 08 Sep 2003 Posts: 4271 Location: Springfield
|
Posted: Sun Jul 08, 2007 9:22 am Post subject: |
|
|
Straightforward, once you found enough of the puzzle pieces ---
even clever in spots. But, it's too bad that it took so much work slogging through the m$ morass to cobble together a solution.
So, I say, Good work, Sherlock!
(Yet, as satisfying as that was, I am sure you would have preferred to find a more elegant solution.) |
|
| Back to top |
|
 |
wasker Gold Member

Joined: 21 Oct 2005 Posts: 722 Location: NJ, USA
|
Posted: Sun Jul 08, 2007 12:32 pm Post subject: |
|
|
Oh boy... You da man!  _________________ You gotta hear that: http://www.getfugitive.com
I'm using Xplorer2 - the only file manager that does not suck. Actually, it rocks! |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Mon Aug 13, 2007 12:48 am Post subject: |
|
|
Hi nikos,
I have been struggling with this a bit. I actually was overriding the IShellFolder and returning my own IDataObject last year but I was missing the registry key piece of it. I have it all working... sort of. Are you 100% successful now? My problem is that when I call release on the Context menu that CDefFolderMenu_Create2 give me if I have too many keys in the key list it crashes RegCloseKey from within the release call of the IContextMenu object. I have not yet closed the keys before doing this so it is not from double closing them. I can't quite tell you exactly where the issue is. If it is greater then 5 or 7 registry key or if it is after 500 files with > 5 keys. I can get to a point where if I add just one more file to the list it will crash and if I remove that file from the list it will succeed.
Just wondering if you were having any strange issues such as this.
Jim Kueneman
P.S. It is not that my IShellFolder wrapper is being prematurely released I have checked all my reference counted objects during this and non of them are being freed before during or after the crash on the ContextMenu release occurs. |
|
| Back to top |
|
 |
fgagnon Site Admin


Joined: 08 Sep 2003 Posts: 4271 Location: Springfield
|
Posted: Mon Aug 13, 2007 8:30 am Post subject: |
|
|
Hi Jim,
Welcome to the board!
nikos is on vacation until the end of August.
(He may only check in at random until then.)
Your query sounds like it is a program development issue, rather than xplorer2-related.
Although you might get a constructive reply from nikos or our readers, you are likely to get more help sooner from the users at The Code Project: http://www.codeproject.com/
-fg-
Last edited by fgagnon on Mon Aug 13, 2007 9:08 am; edited 1 time in total |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Mon Aug 13, 2007 9:06 am Post subject: |
|
|
| Quote: | | Your query sounds like it is a program development issue, rather than xplorer2-related. |
Yup it is.
| Quote: | | Although you might get a constructive reply from nikos or our readers, you are likely to get more help sooner from the the users at The Code Project: http://www.codeproject.com/ |
Has nikos implemented the context menus for the scrap container and has it be working fine?
Jim |
|
| Back to top |
|
 |
fgagnon Site Admin


Joined: 08 Sep 2003 Posts: 4271 Location: Springfield
|
Posted: Mon Aug 13, 2007 9:23 am Post subject: |
|
|
| Yes and Yes (at least I have no problems with them) |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Tue Aug 14, 2007 2:34 pm Post subject: |
|
|
Hey Nikos,
Looks like Xplorer2 has the same problems I am having. It does weird things in Win2k if you have too many different kinds of file types and will crash. I am thinking the right thing to do is only put the file type of the currently focused node and then special types like "*", "AllSystemsFiles", etc.
I will keep you posted.
Jim |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Tue Aug 28, 2007 1:59 am Post subject: |
|
|
Wish I knew you were so close to me, we could have talked shell over a beer (ok a few hundred miles). I almost have it working in all versions of Windows. The only thing I would like to understand is the Copy/Cut menu items. I had to override GetAttribuitesOf as well and test if each item was SHAGO_CANMOVE/CANCOPY as with fully qualified PIDLs the desktop IShellFolder fails. Did you have to do this?
Also it looks like win2k and 9x need either HKCR/Directory OR HKCR/Folder and not both when using a folder as the "focused" item in a list. I am only running the registry on the extension of the item the use clicked over and that fixes the duplicate menu items and crashes I had and also see in xplorer2 on Win2k and 9x.
The keys I am using on the focused item are:
For Files:
HKCR\*
HKCR\AllFIleSystemObjects
HKCR\{.ext}
HKCR\\{FileClass} (pointed to by default string of above, also checked for CurVer string)
HKCR\FileSystemAssociations\{.ext}
reading HKCR\{.ext}\PerceivedType and opening
HKCR\FileSystemAssociations\{PerceivedType}
if the extension is not found then using
HKCR\Unknown
For Directories:
HKCR\Folder
HKCR\Directory
Again this does not work right for Win2k and 9x, it seems to double up the "Main" verbs (Open, Explorer, Print, etc) I will let you know what do do for those OS's when I get some time to figure it out.
Jim |
|
| Back to top |
|
 |
nikos Moderator


Joined: 07 Feb 2002 Posts: 12346 Location: UK
|
Posted: Thu Aug 30, 2007 7:38 am Post subject: |
|
|
haven't tried on win2K recently, but for XP i just tried a context menu on 2500 files (various) and both the menu and the execution of commands was pronto
perhaps for w2000 there are the same problems as with multi file properties, and this patch may be useful:
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B330040
finally i don't use these keys at all:
HKCR\FileSystemAssociations\{.ext}
HKCR\FileSystemAssociations\{PerceivedType}
hth
nikos
ps
| Quote: | | Wish I knew you were so close to me, we could have talked shell over a beer |
you're in belgium right, the best beer in the world
why don't you come to this year's ESWC ? |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Thu Aug 30, 2007 11:03 pm Post subject: |
|
|
Here is what it looks like on Win2k
www.mustangpeak.net/2xplorer.bmp
| Quote: | | haven't tried on win2K recently, but for XP i just tried a context menu on 2500 files (various) and both the menu and the execution of commands was pronto |
Yes it work on Vista and XP (though I did get it to crash and vanish on XP).
It does not "feel" like that is the problem.
| Quote: | finally i don't use these keys at all:
HKCR\FileSystemAssociations\{.ext}
HKCR\FileSystemAssociations\{PerceivedType} |
Then how do you get the "Print" menu item? That was the only way I could get it. I use RegMon to look at what the Explorer Search window was opening and it uses these keys.
| Quote: | you're in belgium right, the best beer in the world Smile
why don't you come to this year's ESWC ? |
Nope that is Cyber (www.cubicreality.com). I live in Arizona.
Jim |
|
| Back to top |
|
 |
nikos Moderator


Joined: 07 Feb 2002 Posts: 12346 Location: UK
|
Posted: Fri Aug 31, 2007 7:00 am Post subject: |
|
|
i managed to crash it on 2000 and more worryingly on vista for huge file collections
how many files did you have selected in that x2 snapshot you sent with the gazillion open/print menu commands?
then we lost the opportunity for beer last week when i was crossing arizona (driving from las vegas to jackson hole). Nice rugged country! |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Fri Aug 31, 2007 9:38 am Post subject: |
|
|
| Quote: | | i managed to crash it on 2000 and more worryingly on vista for huge file collections |
My experience as well.
| Quote: | | how many files did you have selected in that x2 snapshot you sent with the gazillion open/print menu commands? |
You can see in the shot. Less than a dozen.
Can you share how you are loading the PHKEY structure, with what keys? I have it work 100% now on all version of windows (did not try NT or 95). No crashes and no duplicate items.
Jim |
|
| Back to top |
|
 |
nikos Moderator


Joined: 07 Feb 2002 Posts: 12346 Location: UK
|
Posted: Fri Aug 31, 2007 10:06 am Post subject: |
|
|
i think i got most of the keys from one of your delphi samples that i dug up from google, so no surprises there! It is as I described in the blog with the addition of:
folder
directory
AllFilesystemObjects
so how did you stop crashes and duplicates? |
|
| Back to top |
|
 |
JimKueneman New Member

Joined: 13 Aug 2007 Posts: 13
|
Posted: Fri Aug 31, 2007 10:43 am Post subject: |
|
|
| Quote: | | so how did you stop crashes and duplicates? |
I don't know. I do know that somehow we are doing something different as I said I could not get the "Print" item until I used this:
HKCR\FileSystemAssociations\{.ext}
HKCR\FileSystemAssociations\{PerceivedType}
In a nut shell this is what I am doing:
Load and array with the AbsolutePIDLs for all selected items then prepare what keys to load:
| Code: | procedure TCommonShellMultiParentContextMenu.LoadRegistryKeyStrings(Focused: TNamespace);
begin
KeyStrings.Clear;
Extensions := [cmeShellDefault, cmeAsterik, cmeAllFilesystemObjects, cmeFileSystemAssociations];
// Only add the menu handlers for the focused item class
if Assigned(Focused) then
begin
if Focused.Folder then
Extensions := [cmeShellDefault, cmeFolder]
else
AddMenuKey(WideExtractFileExt(Focused.NameForParsing));
end
end; |
KeyStrings here is a string list that is a hold over from when I was loading ALL extensions that were selected. No ALL that is in it is the extension of the item that the user right clicked over (the "Focused" node in my terminology here)
Now when I show the menu I do this:
| Code: | if cmeDirectory in Extensions then
AddMenuKey('Directory');
if cmeDirBackground in Extensions then
AddMenuKey('Directory\Background');
if cmeFolder in Extensions then
AddMenuKey('Folder');
if cmeAsterik in Extensions then
AddMenuKey('*');
if cmeAllFilesystemObjects in Extensions then
AddMenuKey('AllFilesystemObjects'); |
Now the KeyStrings string list contains
1) the extension of the "Focused" node
2) '*'
3) 'AllFilesystemObjects'
IF the Focused item was a file ELSE it contains
1) 'Folder'
What cmeShellDefault does is cause DFM_MERGECONTEXTMENU to return S_OK in the callback
Now with the reg key list all loaded I start drilling into the hive.
| Code: | UnknownAdded := False;
Reg := TTntRegistry.Create;
try
Reg.Access := KEY_READ;
Reg.RootKey := HKEY_CLASSES_ROOT;
for i := 0 to KeyStrings.Count - 1 do
begin
if (KeyStrings[i] <> '') then
begin
if Reg.OpenKey(KeyStrings[i], False) then
begin
// The extension key is open {.ext}
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
WS := Reg.ReadString('');
Reg.CloseKey;
if WS <> '' then
begin
if Reg.OpenKey(WS, False) then
begin
// The FileClass is open, see if there is mulitiple version and a current version
if Reg.KeyExists('CurVer') then
begin
if Reg.OpenKey('CurVer', False) then
begin
CurVer := Reg.ReadString('');
if Reg.OpenKey('\' + CurVer, False) then
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
end;
Reg.CloseKey;
end else
begin
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
Reg.CloseKey;
end
end
end
end else
begin
if not UnknownAdded and Reg.OpenKey('Unknown', False) then
begin
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
Reg.CloseKey;
UnknownAdded := True
end
end;
if cmeFileSystemAssociations in Extensions then
begin
if Reg.OpenKey('SystemFileAssociations\' + KeyStrings[i], False) then
begin
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
Reg.CloseKey;
end
end;
if cmePerceivedType in Extensions then
begin
if Reg.OpenKey(KeyStrings[i], False) then
begin
WS := Reg.ReadString('PerceivedType');
if WS <> '' then
begin
if Reg.OpenKey('\SystemFileAssociations\' + WS, False) then
AddKey(DuplicateKey(Reg.CurrentKey), Keys);
end;
Reg.CloseKey;
end
end
end
end
finally
Reg.CloseKey;
Reg.Free
end; |
I think that is self explanatory if not let me know. The main thing is searching for the right file class through the CurVal key and if the extension is not found using the "Unknown" key. What I just noticed is I now have the "Print" item but I am not defining cmePerceivedType so that key is not being used..... I don't know now. I have tried and experimented so much over the last few weeks I am getting myself confused
Anyway the way I show seems to be working.
Jim |
|
| Back to top |
|
 |
|