Windows context menu

This forum is for general support of Xbase++
Message
Author
Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Windows context menu

#1 Post by Piotr D »

Hi,
In my application I must send XML files generated from Xbase program signed with an electronic signature (XAdES).
These I can add with another, installed on computer, program. In this case I must run this program, choice directory
and file, and add signature. However, this program add to the Windows context menu option "Sign", which is
available, when I right click on this file. In this case signature program is already invoked for this file. My question is:
how, if is possible, can I implement/add these context menu in Xbase program (or run this, what is made under "Sign"
option)?

Regards
Piotr

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Windows context menu

#2 Post by rdonnay »

I don't know what you mean by "Windows context menu"
The eXpress train is coming - and it has more cars.

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: Windows context menu

#3 Post by Piotr D »

Roger,
I mean "Menu which is displayed under Windows on Desktop or disk explorer, when right click on file"
here is screenshot:
https://onedrive.live.com/redir?resid=D ... hoto%2cpng

Piotr

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Windows context menu

#4 Post by Auge_Ohr »

hi,

when left click on Desktop and than right click -> Menu.
Menu Item are in Registry under

Code: Select all

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\
you have to create a new Item e.g. "USB Eject" and add "Command".

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\USB Eject]
"ICON"="hotplug.dll,-100"

[HKEY_CLASSES_ROOT\DesktopBackground\Shell\USB Eject\Command]
@="D:\\ALASKA\\USB\\LBDRIVE.EXE"
USB_Eject_Kontext-Menu.jpg
USB_Eject_Kontext-Menu.jpg (101.06 KiB) Viewed 18918 times
edit : have re-read your Msg ... you already have that Menu Entry as you say.

so look at your HKEY_CLASSES_ROOT\DesktopBackground\Shell\ for your search Key and if it have a "Command" String which can use with Runshell()
greetings by OHR
Jimmy

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: Windows context menu

#5 Post by Piotr D »

Jimmy,
thanks for your answer. In registry these options don't have a command - in this case I don't know an command for RunShell().
When I use XbpFileDialog(), I can display this menu, but... don't have all option. This Windows component is not so "rich" like f.e. explorer.exe. Using explorer.exe the menu is the same like on desktop. It's possible make XbpFileDialog() more "rich"?

Piotr

User avatar
Tom
Posts: 1170
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Windows context menu

#6 Post by Tom »

Hi, Piotr.
It's possible make XbpFileDialog() more "rich"?
1. Create your own with Directory() and so on.

2. Use a component.

The XbpFileDialog uses the standard API dialog and shows different behaviours depending on the OS.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Windows context menu

#7 Post by rdonnay »

You could write your own replacement for XbpFileDialog() but that would take some time.

Do you need all the functionality of XbpFileDialog()?

Does it need to provide navigation to any folder?
The eXpress train is coming - and it has more cars.

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: Windows context menu

#8 Post by Piotr D »

Roger,
I don't need navigation. All I need, is only select file (files) from one directory (using pattern, like Test_*.XML) and
have possibility run (with right mouse button) full "context menu" which is available normally on desktop with this right button.
The directory and file (files pattern) is know before.

Piotr

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Windows context menu

#9 Post by rdonnay »

This can easily be written using @..DCBROWSE.. RBSELECT .. RBDOWN

Code: Select all

FUNCTION MyFolderBrowse()

LOCAL GetList[0], GetOptions, aDir, aHeadings, i, oBrowse

DC_AutoRestoreWindow( { HKEY_LOCAL_MACHINE, ;
aDir := Directory()

aHeadings := { 'File;Name', ;
               'File;Size', ;
               'Date;Last;Write', ;
               'Time;Last;Write', ;
               'File;Attr', ;
               'Size;Extend;Attr', ;
               'Create;Date', ;
               'Create;Time', ;
               'Date;Last;Access', ;
               'Time;Last;Access' }

@ 0,0 DCSAY 'Click Right Button in a Column for menu' ;
      SAYSIZE 50 COLOR GRA_CLR_BLUE

@ 1,0 DCBROWSE oBrowse DATA aDir PRESENTATION DC_BrowPres() ;
      SIZE 40,20 FIT ;
      ID 'DIRECTORY_BROWSE' ;
      HEADLINES 3 ;
      RBSELECT ;
      RBDOWN BrowseMenuBlock(@oBrowse)

FOR i := 1 TO Len(aHeadings)
  DCBROWSECOL ELEMENT i HEADER aHeadings[i] ;
     WIDTH 6 PARENT oBrowse ;
     SORT _SortBlock(i,aDir)
NEXT

DCGETOPTIONS ;
   NOMINBUTTON ;
   NOMAXBUTTON ;
   AUTORESIZE ;
   BUTTONALIGN DCGUI_BUTTONALIGN_CENTER

DCREAD GUI ;
   FIT ;
   BUTTONS DCGUI_BUTTON_OK ;
   OPTIONS GetOptions ;
   TITLE 'Directory Browse' ;
   MODAL ;
   SETAPPWINDOW

RETURN nil

* -------------

STATIC FUNCTION _SortBlock( i, aDir )

RETURN {||ASort(aDir,,,{|a,b|a[1]<b[1]})}

* -------------

STATIC FUNCTION BrowseMenu( oBrowse )

STATIC soMenu, soBrowse

LOCAL GetList[0], i

IF Valtype(soMenu) # 'O' .OR. soMenu:status()<=0 .OR. soBrowse # oBrowse

  IF Valtype(soMenu) = 'O'
    soMenu := nil
  ENDIF

  soBrowse := oBrowse

  DCSUBMENU soMenu

    DCMENUITEM 'Run a program' PARENT soMenu ACTION {||RunShell(oBrowse:dataSource[oBrowse:arrayElement[1]],'MyProgram.Exe')}

  DCREAD GUI ;
    PARENT oBrowse ;
    EXIT

ENDIF

RETURN soMenu

* --------------

STATIC FUNCTION BrowseMenuBlock( oBrowse )

RETURN {|x,y,z,o|o := BrowseMenu( oBrowse ), ;
                                o:popup( nil, x, 1 , ;
                                XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1406
Joined: Wed Feb 24, 2010 3:44 pm

Re: Windows context menu

#10 Post by Auge_Ohr »

Piotr D wrote:thanks for your answer. In registry these options don't have a command - in this case I don't know an command for RunShell().
how does it look like ?
Piotr D wrote:When I use XbpFileDialog(), I can display this menu, but... don't have all option. This Windows component is not so "rich" like f.e. explorer.exe. Using explorer.exe the menu is the same like on desktop. It's possible make XbpFileDialog() more "rich"?
XbParts often does not offer "all" Property ... try this Ot4xb Version.
GetOpenFileName.zip
need ot4xb
(1.39 KiB) Downloaded 831 times
greetings by OHR
Jimmy

Post Reply