cGetFile en mi Dialogo

cGetFile en mi Dialogo

Postby antolin » Tue Mar 11, 2014 12:51 pm

Hola foreros, no se si lo que pregunto es una tontería, pero tengo la curiosidad.

Hay alguna manera de que cGetFile32 (o cGetFile ) se ejecute en un dialogo propio. Me gusta personalizar mis dialogos y como cGetFile32 muestra el típico de window, me gustaría que se ejecutara en uno mio. O alguna forma de capturar el handle del dialogo de cGetFile. O algún Shell autonomo que requiera de un dialogo ??? :roll:

Gracias

Un saludo.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: cGetFile en mi Dialogo

Postby jrestojeda » Tue Mar 18, 2014 1:25 pm

Hola...
Muy por arriba se me ocurre que con la función Directory() podrías hacer lo que quieras...
O sea, tu propio diálogo, tu propia ventana, tu tipo de broxse/xbrowse, tus propios filtros etc...
Espero te sirva la idea.
Saludos,
Ojeda Esteban Eduardo.
Buenos Aires - Argentina.
FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport
Skype: jreduojeda
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Re: cGetFile en mi Dialogo

Postby MarioG » Wed Mar 19, 2014 2:24 pm

Antolin
Alguien dejo esto en el Foro (pero no encuentro el post)
.prg
Code: Select all  Expand view
// Testing GETs

#include "FiveWin.ch"
#include "xbrowse.ch"

#define CSIDL_LOCAL_APPDATA          0x001c      // user\Local Settings\Application Data
#define CSIDL_PERSONAL               0x0005      // user\MyDocument
#define CSIDL_INTERNET_CACHE         0x0020
#define CSIDL_COOKIES                0x0021
#define CSIDL_HISTORY                0x0022
#define CSIDL_COMMON_APPDATA         0x0023      // All Users\Application Data
#define CSIDL_WINDOWS                0x0024      // GetWindowsDirectory()
#define CSIDL_SYSTEM                 0x0025      // GetSystemDirectory()
#define CSIDL_PROGRAM_FILES      0x0026      // C:\Program Files
#define CSIDL_MYPICTURES             0x0027      // My Pictures, new for Win2K
#define CSIDL_PROGRAM_FILES_COMMON   0x002b      // C:\Program Files\Common
#define CSIDL_COMMON_DOCUMENTS       0x002e      // All Users\Documents
#define CSIDL_RESOURCES              0x0038      // %windir%\Resources\, For

function Main()
   LOCAL oDlg, oGet
   LOCAL cCad1 := Space(64)
   LOCAL cCad2 := Space(64)
   LOCAL cCad3 := Space(64)
   LOCAL cCad4 := Space(64)

   Set century On
   Set Date Ansi
   Set Date format "mm/dd/yyyy"

   SET _3DLOOK ON

   DEFINE DIALOG oDlg TITLE "Test cFWGetDir(..)" SIZE 320, 200

   @ 1,    1 SAY "Completo:" OF oDlg
   @ 1.2,    6 GET oGet VAR cCad1 OF oDlg SIZE 100, 10 ACTION Self:cText(PADR(cFWGetDir(,,300,340,,,.F.,.F.,.F.,.F.,.T.),LEN(Self:VarGet()))) BITMAP "Folder" PICTURE "@K"

   @ 1.8,  1 SAY "Con PATH" OF oDlg
   @ 2,    6 GET oGet VAR cCad2 OF oDlg SIZE 100, 10 ACTION Self:cText(PADR(cFWGetDir(,,300,340,,cGetSpecialFolder( CSIDL_PERSONAL ),.F.,.F.,.F.,.F.,.T.),LEN(Self:VarGet()))) BITMAP "Folder" PICTURE "@K"

   @ 2.6,  1 SAY "Solo seleccionar" OF oDlg
   @ 3,    6 GET oGet VAR cCad3 OF oDlg SIZE 100, 10 ACTION Self:cText(PADR(cFWGetDir(,,300,340,,cGetSpecialFolder( CSIDL_PROGRAM_FILES ),.F.,.F.,.F.,.F.,.T.,,,.F.,.F.,.F.,.F.),LEN(Self:VarGet()))) BITMAP "Folder" PICTURE "@K"

   @ 3.4,  1 SAY "Ver archivos" OF oDlg
   @ 4,    6 GET oGet VAR cCad4 OF oDlg SIZE 100, 10 ACTION Self:cText(PADR(cFWGetDir(,,300,500,,,.T.,.T.,.T.,.T.,.F.,.T.,.T.,.F.,.F.,.F.,.F.),LEN(Self:VarGet()))) BITMAP "Folder" PICTURE "@K"

   @ 4,    7 BUTTON "&Ok" OF oDlg SIZE 30, 12 ACTION oDlg:End()
   @ 4,   16 BUTTON "&Cancel" SIZE 30, 12 OF oDlg ACTION oDlg:End() CANCEL

   // TGet():SetColorFocus( nRGB( 200, 120, 120 ) )

   ACTIVATE DIALOG oDlg CENTERED

return nil

//------------------------------------------------------------------------//

procedure appsys // XBase++ requirement
return

//-------------------------------------------------------------------------------------------------------------//
//Funcion cFWGetDir
//-------------------------------------------------------------------------------------------------------------//
function cFWGetDir(nTop, nLeft, nBottom, nRight, cCaption,;
                 cPath,;
         lVerColSize,lVerColDate,lVerColTime,lVerColAttr,;
         lSoloFolder,lHide,lSystem,;
         lBtnAdd,lBtnDuplicate,lBtnRename,lBtnDelete )

   local oDlg, oCtrl, oBrw, oTree, oItem, oFont, b
   local cNuevaCarpeta := Space(64)

   DEFAULT nTop:=10,;
           nLeft:=10,;
       nBottom:=640,;
       nRight:=440,;
           cCaption:="Seleccione una carpeta"
   DEFAULT lVerColSize:=.T.,;
           lVerColDate:=.T.,;
       lVerColTime:=.T.,;
       lVerColAttr:=.T.
   DEFAULT lSoloFolder := .T.,;
           lHide:= .F.,;
       lSystem:= .F.

   DEFAULT lBtnAdd := .T.,;
       lBtnDuplicate := .T.,;
       lBtnRename := .T.,;
       lBtnDelete := .T.

   oTree := MakeTree(cPath,lSoloFolder,lHide,lSystem)

   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-12
   DEFINE DIALOG oDlg SIZE nRight,nBottom PIXEL ;
      TITLE cCaption //;
      //FONT oFont

   @ 10,10 XBROWSE oBrw SIZE nRight/2-10-10,nBottom/2-10-10 -10 PIXEL OF oDlg //NOBORDER

   //oBrw:lHScroll := .F.
   oBrw:lHeader := lVerColSize .OR. lVerColDate .OR. lVerColTime .OR. lVerColAttr //.F.
   oBrw:lRecordSelector := .F.
   oBrw:nStretchCol := STRETCHCOL_LAST

   oBrw:SetTree( oTree, { ".\bitmaps\FolderO.bmp", ;
                          ".\bitmaps\folder.bmp", ;
                          ".\bitmaps\OnePage.bmp" } )
   oBrw:bKeyChar  := { |nKey| If( nKey == VK_RETURN .and. ! Empty( oBrw:oTreeItem:bAction ), ;
                                Eval( oBrw:oTreeItem:bAction, oBrw:oTreeItem ), nil ) }


   WITH OBJECT oBrw:aCols[ 1 ]

      :AddBmpFile( ".\bitmaps\hdrive.bmp" )
      :AddBmpFile( ".\bitmaps\hdriveLAN.bmp" )
      :AddBmpFile( ".\bitmaps\MiPC.bmp" )
      :AddBmpFile( ".\bitmaps\LAN.bmp" )
      :AddBmpFile( ".\bitmaps\Estacion.bmp" )
      :nWidth     := 200
      :cHeader    := 'File/Folder'
      b           := :bLDClickData

      :bLDClickData  := { |r,c,f,o| ToggleFolder( r,c,f,o,b ) }

      :bBmpData   := { || If( oBrw:oTreeItem:Cargo[ 6 ] == '', 6, ;
                          If( oBrw:oTreeItem:Cargo[ 6 ] == '
\\', 7, ;
                          If( '
E' = oBrw:oTreeItem:Cargo[ 5 ], 8, ;
                          If( '
:' $ oBrw:oTreeItem:Cargo[ 1 ], IF(NetDisk( oBrw:oTreeItem:Cargo[ 1 ] ),5,4), ;
                          If( '
D' $ oBrw:oTreeItem:Cargo[ 5 ], ;
                              If( oBrw:oTreeItem:lOpened, 1, 2 ), 3 ) ) ) ) ) }

      :bStrData   := { || oBrw:oTreeItem:cPrompt}

   END

   if lVerColSize
      ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 2 ] ;
         PICTURE '
@EZ 999,999,999' HEADER 'Bytes' SIZE 60 PIXELS
   endif
   if lVerColDate
      ADD TO oBrw DATA IF(EMPTY(oBrw:oTreeItem:Cargo[ 3 ]),"",oBrw:oTreeItem:Cargo[ 3 ]) HEADER '
Date' SIZE 70 PIXELS CENTERED
   endif
   if lVerColTime
      ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 4 ] HEADER '
Time' SIZE 50 PIXELS CENTERED
   endif
   if lVerColAttr
      ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 5 ] HEADER '
Attr' SIZE 30 PIXELS CENTERED
   endif

   oBrw:CreateFromCode()

   @ nBottom/2-10-5, nRight/2-10-35 BUTTONBMP oCtrl;
     SIZE 35, 12 OF oDlg;
     ACTION oDlg:End(0);
     PROMPT SPACE(3)+"Cancel";
     BITMAP '
EXIT'PIXEL CANCEL TEXTRIGHT

   @ oCtrl:nTop, oCtrl:nLeft-35-1 BUTTONBMP oCtrl;
     SIZE 35, 12 OF oDlg;
     ACTION oDlg:End(1);
     PROMPT SPACE(3)+"Select";
     BITMAP '
Select' PIXEL DEFAULT TEXTRIGHT

   if lBtnDelete
   @ oCtrl:nTop, oCtrl:nLeft-14-1 BUTTONBMP oCtrl;
     SIZE 14, 12 OF oDlg;
     ACTION (if(MsgNoYes("Eliminar carpeta: "+oBrw:oTreeItem:Cargo[1]),;
            if(DirRemove(oBrw:oTreeItem:Cargo[6])=0,;
           oBrw:oTreeItem:Delete(oBrw:oTreeItem:Parent():oTree),;
           MsgStop("NO se pudo eliminar: "+oBrw:oTreeItem:Cargo[1])),;
            NIL),;
         oBrw:SetFocus());
      BITMAP '
Del' PIXEL UPDATE
      oCtrl:cToolTip:="Elimina la carpeta seleccionada"
   endif

   if lBtnRename
   @ oCtrl:nTop, oCtrl:nLeft-14-1 BUTTONBMP oCtrl;
     SIZE 14, 12 OF oDlg;
     ACTION (cNuevaCarpeta:=PADR(oBrw:oTreeItem:Cargo[1],64),;
             if(MsgGet( "System", "Renombrar: "+oBrw:oTreeItem:Cargo[1], @cNuevaCarpeta ),;
            if(!(UPPER(ALLTRIM(oBrw:oTreeItem:Cargo[6]))==UPPER(cFilePath(oBrw:oTreeItem:Cargo[6])+ALLTRIM(cNuevaCarpeta))).AND.;
           FRename(ALLTRIM(oBrw:oTreeItem:Cargo[6]),cFilePath(oBrw:oTreeItem:Cargo[6])+ALLTRIM(cNuevaCarpeta))=0,;
           (oBrw:oTreeItem:SetText( RTRIM(cNuevaCarpeta) ),;
            oBrw:oTreeItem:Cargo[1]:=RTRIM(cNuevaCarpeta),;
            oBrw:oTreeItem:Cargo[6]:=cFilepath(oBrw:oTreeItem:Cargo[6])+ALLTRIM(cNuevaCarpeta)),;
           MsgStop("NO se pudo renombrar: "+oBrw:oTreeItem:Cargo[1])),;
            NIL),;
         oBrw:SetFocus());
      BITMAP '
Edit' PIXEL UPDATE
      oCtrl:cToolTip:="Cambia el nombre de la carpeta seleccionada"
   endif

   if lBtnDuplicate
   @ oCtrl:nTop, oCtrl:nLeft-14-1 BUTTONBMP oCtrl;
     SIZE 14, 12 OF oDlg;
     ACTION (if(DirDuplicate(oBrw:oTreeItem:Cargo[6]),;
        oBrw:oTreeItem:Parent( ):SetTree( SubTree( oBrw:oTreeItem:Parent( ), lSoloFolder,lHide,lSystem ) ),;
        MsgStop("NO se pudo duplicar: "+oBrw:oTreeItem:Cargo[1])),;
         oBrw:SetFocus());
      BITMAP '
Duplicate' PIXEL  UPDATE
      oCtrl:cToolTip:="Duplica la carpeta seleccionada"
   endif

   if lBtnAdd
   @ oCtrl:nTop, oCtrl:nLeft-14-1 BUTTONBMP oCtrl;
     SIZE 14, 12 OF oDlg;
     ACTION (cNuevaCarpeta:=PADR(oBrw:oTreeItem:Cargo[1],64),;
             if(MsgGet( "System", "Nueva carpeta", @cNuevaCarpeta ),;
            if(MakeDir( oBrw:oTreeItem:Cargo[ 6 ] + Chr(92) + ALLTRIM(cNuevaCarpeta))=0,;
           (oBrw:oTreeItem:SetTree( SubTree( oBrw:oTreeItem, lSoloFolder,lHide,lSystem ) ),;
            oBrw:oTreeItem:bAction:=0,;
            if(oBrw:oTreeItem:lOpened,;
               NIL,;
               oBrw:oTreeItem:Toggle() )),;
           MsgStop("NO se pudo crear: "+ALLTRIM(cNuevaCarpeta))),;
            NIL),;
         oBrw:SetFocus());
      BITMAP '
Add' PIXEL UPDATE
      oCtrl:cToolTip:="Crea una nueva carpeta"

   endif

   ACTIVATE DIALOG oDlg CENTER

return if(oDlg:nResult=0,NIL,oBrw:oTreeItem:Cargo[ 6 ])

//----------------------------------------------------------------------------//
static function ToggleFolder( r, c, f, oCol, b )

   local oBrw  := oCol:oBrw
   local oItem := oBrw:oTreeItem

   If ! oItem:lOpened .and. ! Empty( oItem:bAction )
      Eval( oItem:bAction, oItem )
   endif

   if b != nil
      Eval( b, r, c, f, oCol )
   endif

return nil

//----------------------------------------------------------------------------//
static function MakeTree(cFolder,lSoloFolder,lHide,lSystem)

   local oTree, oItem, n, nItems := 0

   TREE oTree

   if EMPTY(cFolder)// = NIL
      TREEITEM oItem PROMPT "Mi PC"
      oItem:Cargo := { '
Mi PC', 0, CtoD( '' ), Space( 8 ), '', '\' }
      oItem:bAction := { |o| o:SetTree( SubTreeHDrive( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }

      if Network()
         TREEITEM oItem PROMPT "Red local"
         oItem:Cargo := { '
Red local', 0, CtoD( '' ), Space( 8 ), '', '\\' }
         oItem:bAction := { |o| o:SetTree( SubTreeLAN( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }
      endif

   else
      TREEITEM oItem PROMPT cFileNoPath(cFolder)

      oItem:Cargo := { cFileNoPath(cFolder), 0, CtoD( '
' ), Space( 8 ), 'D', ;
                        cFolder }

      oItem:bAction := { |o| o:SetTree( SubTree( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }
      oItem:SetTree( SubTree( oItem, lSoloFolder,lHide,lSystem ) )
      oItem:Toggle()

   endif

   ENDTREE

return oTree

//----------------------------------------------------------------------------//

static function SubTreeHDrive( oParent, lSoloFolder,lHide,lSystem )

   local oTree, n, oItem, nLevel
   local aDrives  := aDrives( 2 )   // Hard disks
   local cNDrive,cEstacion

   nLevel := oParent:nLevel + 1

   TREE oTree
   for n := 1 to Len( aDrives )

      IF NetDisk( aDrives[ n ] ) //DriveType( aDrives[ n ] )=5 //Unidad de RED
     cNDrive:=NetRmtName( aDrives[ n ] )
         TREEITEM oItem PROMPT cFileNoPath(cNDrive) + '
en " ('+Token(cNDrive,'',1)+')" ' +" ("+ aDrives[ n ] +")"
      ELSE
         cNDrive:=GetVolInfo( aDrives[ n ]+"\" )
         TREEITEM oItem PROMPT if( EMPTY(cNDrive),"Disco local",cNDrive ) +" ("+ aDrives[ n ] +")"
      ENDIF

      oItem:nlevel := nLevel
      oItem:Cargo := { aDrives[ n ], 0, CtoD( '
' ), Space( 8 ), 'D', ;
                       aDrives[ n ] }

      oItem:bAction  := { |o| o:SetTree( SubTree( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }

   next
   ENDTREE

return oTree

//----------------------------------------------------------------------------//

static function SubTreeLAN( oParent, lSoloFolder,lHide,lSystem )

   local oTree, n, oItem, nLevel
   local aPCs  := aNetName_CMD()

   nLevel := oParent:nLevel + 1

   TREE oTree
   for n := 1 to Len( aPCs )

      TREEITEM oItem PROMPT aPCs[ n ][ 2 ] +" ("+ aPCs[ n ][ 1 ] +")"

      oItem:nlevel := nLevel
      oItem:Cargo := { aPCs[ n ][ 1 ], 0, CtoD( '
' ), Space( 8 ), 'E', ;
                       aPCs[ n ][ 1 ] }

      oItem:bAction  := { |o| o:SetTree( SubTreeRecursos( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }

   next
   ENDTREE

return oTree

//----------------------------------------------------------------------------//

static function SubTreeRecursos( oParent, lSoloFolder,lHide,lSystem )

   local oTree, n, oItem, nLevel
   local aRecursos  := aNetRecursos_CMD(oParent:Cargo[6])

   nLevel := oParent:nLevel + 1

   TREE oTree
   for n := 1 to Len( aRecursos )

      TREEITEM oItem PROMPT aRecursos[ n ]

      oItem:nlevel := nLevel
      oItem:Cargo := { aRecursos[ n ], 0, CtoD( '
' ), Space( 8 ), 'D', ;
                       oParent:Cargo[6]+"\"+aRecursos[ n ] }

      oItem:bAction  := { |o| o:SetTree( SubTree( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }

   next
   ENDTREE

return oTree

//----------------------------------------------------------------------------//

static function SubTree( oParent,lSoloFolder,lHide,lSystem )

   local oTree, n, oItem, nLevel, nItems := 0
   local cFolder := oParent:Cargo[ 6 ]
   local aDir := Directory( cFolder + '
\*.*', 'D' + if(lHide,"H","") + if(lSystem,"S","") )

   nLevel := oParent:nLevel + 1

   TREE oTree
   for n := 1 to Len( aDir )
      if ! ( aDir[ n ][ 1 ] = '
.' ) .AND. (!lSoloFolder .OR. 'D' $ aDir[ n ][ 5 ] )

         TREEITEM oItem PROMPT aDir[ n ][ 1 ]

         oItem:nlevel := nLevel
         oItem:Cargo  := aDir[ n ]

         AAdd( oItem:Cargo, cFolder + Chr(92) + aDir[ n ][ 1 ] )

         if '
D' $ aDir[ n ][ 5 ]
            oItem:bAction  := { |o| o:SetTree( SubTree( o, lSoloFolder,lHide,lSystem ) ), o:bAction := nil }
         else
            oItem:bAction  := { |o| NIL /*MsgInfo( o:cPrompt )*/ }
         endif
         nItems++
      endif
   next
   /*
   if nItems == 0
      n--
      TREEITEM oItem PROMPT '
'
      oItem:nlevel := nLevel
      aDir[ n ][ 5 ] := '
A'
      oItem:Cargo  := { '
', 0, CToD( '' ), Space(8), ' ', '' }
      AAdd( oItem:Cargo, cFolder + Chr(92) + aDir[ n ][ 1 ] )
   endif
   */
   ENDTREE

return oTree

//----------------------------------------------------------------------------//
function DirDuplicate( cPath )
local cPathOrg,cFolder,cFolderCpy,cCpy, aFiles, n:=0

   cPath:=RTRIM(cPath)
   if Right(cPath,1)="/"
      cPath:=Left(cPath,len(cPath)-1)
   endif
   cPathOrg:=cPath

   cFolder:=cFileNoPath(cPath)
   cPath:=cFilePath(cPath)

   WHILE .T.
      cCpy := " (Copia " + cValToChar( ++n ) + ")"
      cFolderCpy := cFolder + cCpy
      if !IsDirectory( cPath + cFolderCpy ) .OR. n > 1000
         EXIT
      ENDIF
   END

   cPath := cPath + cFolderCpy

   IF MakeDir( cPath )=0
      aDir( cPathOrg + "\*.*", aFiles:=ARRAY( aDir(cPathOrg + "\*.*") ) )
      aEval( aFiles, {|cFile| FileCopy(cPathOrg + "\" + cFile, cPath + "\" + cFile) } )
   else
      MsgStop("No se puede crear la carpeta de la Base de Datos copiada","DirDuplicate(..)")
      Return .F.
   EndIf

Return .T.

//----------------------------------------------------------------------------//
function aNetName() //NO la estamos usando por el momento

   local oLoc := CreateObject ( "wbemScripting.SwbemLocator" )
   local oWMI := oLoc:ConnectServer()
   local aPCs := oWMI:ExecQuery( "Select * FROM Win32_NetworkLoginProfile" )
   local oPC

   MsgInfo( Len( aPCS ) )

   for each oPC in aPCs
      MsgInfo( oPC:Caption )
   next

return aPCs

//----------------------------------------------------------------------------//

#define LEN_LINE    128
#define LEN_NETNAME  23

//aNetName_CMD: Retorna un arreglo bidimencional {cNombre,cDescripcion}
function aNetName_CMD()
local i,cFile,cTxt,cLine,nLines
local aPCs := {}

   if Network()
      cFile := cTempFile()
      WAITRUN("COMMAND.COM /C net view > "+cFile ,0)
      if file(cFile)
         cTxt := MemoRead( cFile )
         nLines := MLCount( cTxt, LEN_LINE)//, nTabSize, lWrap )
         FOR i:=1 TO nLines
            cLine := MemoLine( cTxt, LEN_LINE, i)//, nTabSize, lWrap )
            if left(cLine,2)=="\\"
               AADD(aPCs,{LEFT(cLine,AT(" ",cLine)-1),ALLTRIM(RIGHT(cLine,LEN(cLine)-AT(" ",cLine) ))})//,LEN_NETNAME))
            endif
         NEXT
         FERASE(cFile)
      endif
   endif

Return aPCs

//----------------------------------------------------------------------------//

#define LEN_NOMBRE_DE_RECURSO_COMPARTIDO  30
#define LEN_TIPO_DE_RECURSO_COMPARTIDO     4

function aNetRecursos_CMD(cEstacion)
local i,cFile,cTxt,cLine,nLines
local aRecursos := {}

   if !EMPTY(cEstacion)
      cFile := cTempFile()
      WAITRUN("COMMAND.COM /C net view "+cEstacion+" > "+cFile ,0)
      if file(cFile)
         cTxt := MemoRead( cFile )
         nLines := MLCount( cTxt, LEN_LINE )//, nTabSize, lWrap )
         FOR i:=1 TO nLines
            cLine := MemoLine( cTxt, LEN_LINE, i)//, nTabSize, lWrap )
            if UPPER(SubStr(cLine,LEN_NOMBRE_DE_RECURSO_COMPARTIDO+1,LEN_TIPO_DE_RECURSO_COMPARTIDO))=="DISC"
               AADD(aRecursos,RTRIM(LEFT(cLine,LEN_NOMBRE_DE_RECURSO_COMPARTIDO)))
            endif
         NEXT
         FERASE(cFile)
      endif
   endif

Return aRecursos

//FIN Funcion cFWGetDir ----------------------------------------------------------------------------//

//-------------------------------------------------------------------------------------------------------------//
//Folders especiales de Windows
//-------------------------------------------------------------------------------------------------------------//

Function cGetSpecialFolderTMP()
   RETURN IF(!EMPTY(GETENV("TMP")),GETENV("TMP"),IF(!EMPTY(GETENV("TEMP")),GETENV("TEMP"),""))

//Funciones API Windows (Folders especiales de Windows)
/* Ejemplo
FUNCTION fWindows()

   ?cGetSpecialFolder( CSIDL_LOCAL_APPDATA ) + "\local\temp"
   ?cGetSpecialFolder( CSIDL_PERSONAL )
   ?cGetSpecialFolder( CSIDL_INTERNET_CACHE)
   ?cGetSpecialFolder( CSIDL_COOKIES)
   ?cGetSpecialFolder( CSIDL_HISTORY)
   ?cGetSpecialFolder( CSIDL_COMMON_APPDATA )
   ?cGetSpecialFolder( CSIDL_WINDOWS)
   ?cGetSpecialFolder( CSIDL_SYSTEM)
   ?cGetSpecialFolder( CSIDL_PROGRAM_FILES)
   ?cGetSpecialFolder( CSIDL_MYPICTURES )
   ?cGetSpecialFolder( CSIDL_PROGRAM_FILES_COMMON)
   ?cGetSpecialFolder( CSIDL_COMMON_DOCUMENTS)
   ?cGetSpecialFolder( CSIDL_RESOURCES)

return nil
*/

/*-------------------------------------------------------------------------------------------------*/
#pragma BEGINDUMP

#ifndef __BORLANDC__
#define WINVER 5
#endif

#include "hbapi.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbdate.h"

#include "shlobj.h"
#include "windows.h"


HB_FUNC( CGETSPECIALFOLDER )
{
   char *lpBuffer = (char*) hb_xgrab( MAX_PATH + 1 );

   LPITEMIDLIST pidlBrowse;

   SHGetSpecialFolderLocation( GetActiveWindow(), hb_parni(1) , &pidlBrowse );
   SHGetPathFromIDList( pidlBrowse, lpBuffer );

   hb_retc(  lpBuffer );
   hb_xfree( lpBuffer );
}
#pragma ENDDUMP
//FIN Funciones API Windows (Foldes especiales de Windows) ----------------------------------------------------------------------------//

.rc
Code: Select all  Expand view
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 5.00".
#ifdef __FLAT__
  1 24 "WindowsXP.Manifest"
#endif

#ifdef __64__
  1 24 "winxp\WindowsXP.Manifest64"
#endif

Folder BITMAP "./bitmaps/folder.bmp"

exit BITMAP "./bitmaps/exit.bmp"
select BITMAP "./bitmaps/Select.bmp"

Del BITMAP "./bitmaps/del.bmp"
Edit BITMAP "./bitmaps/edit.bmp"
Duplicate BITMAP "./bitmaps/duplicate.bmp"
Add BITMAP "./bitmaps/add.bmp"
 
Resistencia - "Ciudad de las Esculturas"
Chaco - Argentina
User avatar
MarioG
 
Posts: 1380
Joined: Fri Oct 14, 2005 1:28 pm
Location: Resistencia - Chaco - AR

Re: cGetFile en mi Dialogo

Postby antolin » Thu Mar 20, 2014 10:13 am

Gracias a todos. Voy a ver lo que puedo aprovechar
.
Saludos.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 19 guests