[python-win32] Context menu troubles
timr at probo.com
Fri Mar 2 21:16:41 CET 2012
Chris Ness wrote:
> I had decided not to use the command ID technique until I got things
> working, so TPM_RETURNCMD was commented out when I defines flags. From
> my understanding of MSDN and pywin32, this should make commands
> immediately execute and cause TrackPopupMenu to return an HRESULT?
Hmm, I should have read the doc more closely before I replied. My fault.
I doesn't work quite that automatically. TrackPopupMenu is a
general-purpose Windows API -- it doesn't have any connection to or
knowledge of Windows Explorer, so it cannot force Explorer to take
actions. If you don't specify TPM_RETURNCMD, then the final result of
selecting a menu item will be that a WM_COMMAND message sent to your
window. Your window doesn't know what to do with those command codes,
so nothing useful will happen. In this particular case, I think you
HAVE to use TPM_RETURNCMD.
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32