user12384512
user12384512

Reputation: 3401

windows explorer context menu in java

Consider simple application, that display list of file. I would like to display context menu , when user click of file or folder, the same as, when user right mouse click in windows explorer (open, rename, edit etc.). I don't want to create my own context menu, I want to show windows os context menu, using some kind of winapi probably. This should works only on windows machine.

Is it possible to achieve it with Swing or SWT or any other UI controls ?

Upvotes: 6

Views: 1941

Answers (1)

Nathan Moinvaziri
Nathan Moinvaziri

Reputation: 5638

This MSDN article explains how it is done:

Windows Explorer calls a folder object's IShellFolder::GetUIObjectOf to request an interface for one of the objects.... When a user right-clicks an object, Windows Explorer requests an IContextMenu interface.

There is a full source code example in C here.

Upvotes: 1

Related Questions