FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to start explorer with more than 1 file selected?
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
How to start explorer with more than 1 file selected?
Posted: Tue Mar 08, 2016 08:04 AM
To start explorer with 1 file selected, I successfully use 'explorer /select, <cFile>'.

How to start it with multiple files selected instead? I read here we can use SHOpenFolderAndSelectItems but how to call it from FWH?

TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: How to start explorer with more than 1 file selected?
Posted: Tue Mar 08, 2016 10:11 AM
Hua,

This is compiling fine but the resulting EXE does nothing:

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   SHOpenFolderAndSelectItems()

return nil

#pragma BEGINDUMP

#include <windows.h>
#include <shlobj.h>
#include <hbapi.h>

HB_FUNC( SHOPENFOLDERANDSELECTITEMS )
{
   //Directory to open
   ITEMIDLIST *dir = ILCreateFromPath( "C:\\" );

   //Items in directory to select
   ITEMIDLIST * item1 = ILCreateFromPath( "C:\\Program Files\\" );
   ITEMIDLIST * item2 = ILCreateFromPath( "C:\\Windows\\" );
   ITEMIDLIST * list[ 3 ];
   UINT count = 2;

   list[ 0 ] = item1;
   list[ 1 ] = item2;
   list[ 2 ] = 0;

   //Perform selection
   SHOpenFolderAndSelectItems( dir, count, ( PCUITEMID_CHILD_ARRAY ) list, 0 );

   //Free resources
   ILFree( dir );
   ILFree( item1 );
   ILFree( item2 );
}

#pragma ENDDUMP
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion