--- In [email protected], "brucexs" <[EMAIL PROTECTED]> wrote:
> Out of curiousity, how is GetCommandString supposed to behave?  Is it 
> related to the GCS_VALIDATE flag, which does not seem to have much 
> documentation?

Yes (and yes, the docs are skimpy and vague).  The shell may call
extensions until one accepts the job.  The 'validate' flags allow an
extension to accept or refuse the job.  'uFlags' will be **one of**
six values (not a combination).  In my 4NTHere extension, I have:

WCHAR szCommandW[] = L"4NTHere";        
CHAR szCommandA[] = "4NTHere";

HRESULT GetCommandString(...) {
  HRESULT hr = S_OK;
  switch (uFlags) {
    case GCS_HELPTEXTW :
      lstrcpynW((LPWSTR)pszName, szTipW, cchMax);
      break;
    case GCS_VERBW :
      lstrcpynW((LPWSTR)pszName, szCommandW, cchMax);           
      break;
    case GCS_VALIDATEW :
      if (lstrcmpiW((LPWSTR) pszName, szCommandW)) hr = S_FALSE;
      break;
    case GCS_HELPTEXTA :
      lstrcpynA(pszName, szTipA, cchMax);
      break;
    case GCS_VERBA :
      lstrcpynA(pszName, szCommandA, cchMax);
      break;
    case GCS_VALIDATEA :
      if (lstrcmpiA(pszName, szCommandA)) hr = S_FALSE;                 
      break;
  }
  return hr;
}

Returning S_FALSE when uFlags is one of the validate values means "You
don't want me; try another extension".

I'm sure it works this way because (1) before handling the 'validate'
flags at all, other context menu items were triggering my action, and
(2) before I switched to a case-insensitive test, "4NTHere" would
trigger my action and "4nthere" would not (I just discovered that when
testing file.doverb()).

> If, like Hex Workshop I suppose, the program wants to edit all files 
> which have no default editor, does the handler have to check for
> other programs that would handle this file type?

That seems like bad behavior and I hope it's not what HexWorkshop is
trying to do.  IMHO, a handler should only handle the request if the
command selected by the user matches the command it put on the menu. 
This is where the docs are skimpy.  Even Microsoft's example, Q298109,
has a shabby GetCommandString() function.  GetCommandString() has two
purposes: (1) to supply strings that are shown to the user (command
and help) and (2) to validate that the user has selected **its** command.

> PowerPro IContextMenu does nothing for this handler except return a 
> null string and I would if that would cause issues.

I don't know what you mean there.

 - Vince






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/JV_rlB/TM
--------------------------------------------------------------------~-> 

Attention: PowerPro's Web site has moved: http://www.ppro.org 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/power-pro/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to