NetEZ.com NetEZ Community
Enter City & State or US Zip Code:
Change your local weather options
Google
WWW NetEZ.com

NetEZ.com Forum Index  
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

blog: riddles in programming
Goto page 1, 2  Next
 
Post new topic   Reply to topic    NetEZ.com Forum Index -> xplorer˛ Professional
View previous topic :: View next topic  
Author Message
nikos
Moderator
Moderator


Joined: 07 Feb 2002
Posts: 12346
Location: UK

PostPosted: Sun Jul 08, 2007 4:46 am    Post subject: blog: riddles in programming Reply with quote

here's the comment area for today's blog entry found at:
http://www.zabkat.com/blog/08Jul07.htm
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
fgagnon
Site Admin
Site Admin


Joined: 08 Sep 2003
Posts: 4271
Location: Springfield

PostPosted: Sun Jul 08, 2007 9:22 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
wasker
Gold Member
Gold Member


Joined: 21 Oct 2005
Posts: 722
Location: NJ, USA

PostPosted: Sun Jul 08, 2007 12:32 pm    Post subject: Reply with quote

Oh boy... Shocked You da man! beer
_________________
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
View user's profile Send private message Visit poster's website
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Mon Aug 13, 2007 12:48 am    Post subject: Reply with quote

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
View user's profile Send private message
fgagnon
Site Admin
Site Admin


Joined: 08 Sep 2003
Posts: 4271
Location: Springfield

PostPosted: Mon Aug 13, 2007 8:30 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Mon Aug 13, 2007 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
fgagnon
Site Admin
Site Admin


Joined: 08 Sep 2003
Posts: 4271
Location: Springfield

PostPosted: Mon Aug 13, 2007 9:23 am    Post subject: Reply with quote

Yes and Yes (at least I have no problems with them)
Back to top
View user's profile Send private message Send e-mail
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Tue Aug 14, 2007 2:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Tue Aug 28, 2007 1:59 am    Post subject: Reply with quote

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
View user's profile Send private message
nikos
Moderator
Moderator


Joined: 07 Feb 2002
Posts: 12346
Location: UK

PostPosted: Thu Aug 30, 2007 7:38 am    Post subject: Reply with 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

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 Smile
why don't you come to this year's ESWC ?
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Thu Aug 30, 2007 11:03 pm    Post subject: Reply with quote

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).


Quote:
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


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
View user's profile Send private message
nikos
Moderator
Moderator


Joined: 07 Feb 2002
Posts: 12346
Location: UK

PostPosted: Fri Aug 31, 2007 7:00 am    Post subject: Reply with quote

i managed to crash it on 2000 and more worryingly on vista for huge file collections Sad

how many files did you have selected in that x2 snapshot you sent with the gazillion open/print menu commands?

Quote:
I live in Arizona


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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Fri Aug 31, 2007 9:38 am    Post subject: Reply with quote

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
View user's profile Send private message
nikos
Moderator
Moderator


Joined: 07 Feb 2002
Posts: 12346
Location: UK

PostPosted: Fri Aug 31, 2007 10:06 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
JimKueneman
New Member
New Member


Joined: 13 Aug 2007
Posts: 13

PostPosted: Fri Aug 31, 2007 10:43 am    Post subject: Reply with quote

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  Embarassed

Anyway the way I show seems to be working.

Jim
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetEZ.com Forum Index -> xplorer˛ Professional All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP