Getfolder()
Moderator: Rathinagiri
-
- Posts: 12
- Joined: Thu Jan 03, 2013 11:46 am
- Location: Etloe, UK
Getfolder()
When using Getfolder() on my system it always reverts to displaying Mycomputer and from there one has to click from folder to folder to get down to a buried sub folder.
Is there any way of using Curdir() or something else so that instead of starting from the top every time the machine remembers your last starting point and enables you to change from there.
Is there any way of using Curdir() or something else so that instead of starting from the top every time the machine remembers your last starting point and enables you to change from there.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Getfolder()
Look at this: http://hmgforum.com/viewtopic.php?p=22824#p22824 probably is what you are looking for...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
-
- Posts: 12
- Joined: Thu Jan 03, 2013 11:46 am
- Location: Etloe, UK
Re: Getfolder()
THANK YOU VERY MUCH - YOU HAVE MADE SOMEONE VERY HAPPY.
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Getfolder()
Nice and probably some more...sunningdale wrote:THANK YOU VERY MUCH - YOU HAVE MADE SOMEONE VERY HAPPY.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
-
- Posts: 22
- Joined: Wed Dec 20, 2017 8:29 am
- DBs Used: DBF
- Location: Belgium
Re: Getfolder()
Hello,
I have the same problem with getfolder().
Does anyone have a solution to this getfolder () that does not take into account the initpath?
I tried to compile the "getfolder sample" posted a long time ago by gfilatov (via Pablo César), but I have a 'multiple definition' linker error :
Can someone help me with that?
Dominique
I have the same problem with getfolder().
Does anyone have a solution to this getfolder () that does not take into account the initpath?
I tried to compile the "getfolder sample" posted a long time ago by gfilatov (via Pablo César), but I have a 'multiple definition' linker error :
Code: Select all
Harbour 3.2.0dev (r1601151502)
Copyright (c) 1999-2015, http://harbour-project.org/
C:/hmg.3.4.3/lib/libhmg.a(c_dialogs.o):c_dialogs.c:(.text+0x0): multiple definition of `BrowseCallbackProc@16'
C:/Users/GEBRUI~1/AppData/Local/Temp/hbmk_vtu0e5.dir/example_browseforfolder.o:example_browseforfolder.c:(.text+0x230): first defined here
collect2.exe: error: ld returned 1 exit status
hbmk2[browsefolder]: Error: Running linker. 1
gcc.exe C:/Users/GEBRUI~1/AppData/Local/Temp/hbmk_vtu0e5.dir/example_browseforfolder.o C:/Users/GEBRUI~1/AppData/Local/Temp/hbmk_vtu0e5.dir/hbmk_vrhpuh.o C:/hmg.3.4.3/SAMPLES/Functions/GETFILE/_temp.o -mwindows -Wl,--start-group -lhmg -lcrypt -ledit -leditex -lgraph -lini -lreport -lhfcl -lmsvfw32 -lvfw32 -lhbct -lhbwin -lhbmzip -lminizip -lhbmemio -lhbmisc -lhbmysql -lmysql -lhbtip -lsqlite3 -lhbsqlit3 -lsddodbc -lrddsql -lsddmy -lhbodbc -lodbc32 -lhbhpdf -lhbfimage -lhbpgsql -lhbnetio -lxhb -lpng -llibhpdf -lhbvpdf -lhbzebra -lhbextern -lhbdebug -lhbvmmt -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lhbmainwin -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -liphlpapi -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib -Wl,--end-group -obrowsefolder.exe -LC:/hmg.3.4.3/harbour/lib/win/mingw -LC:/hmg.3.4.3/lib
Dominique
- serge_girard
- Posts: 3176
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Getfolder()
Hi Dominique,
Please attach the prg !
Serge
Please attach the prg !
Serge
There's nothing you can do that can't be done...
-
- Posts: 22
- Joined: Wed Dec 20, 2017 8:29 am
- DBs Used: DBF
- Location: Belgium
Re: Getfolder()
Hello Serge,
Here is the 'getfolder' sample prg I tried to compile :
Dominique
Here is the 'getfolder' sample prg I tried to compile :
Code: Select all
#include "minigui.ch"
Procedure Main()
DEFINE WINDOW Form_1 ;
AT 0,0 WIDTH 200 HEIGHT 150 ;
MAIN ;
TITLE "GetFolder Sample" ;
NOSIZE
DEFINE MAIN MENU
DEFINE POPUP 'Test'
MENUITEM 'BrowseForFolder()' ACTION MsgInfo(BrowseForFolder('Select Folder', GetCurrentFolder()),"Result")
MENUITEM 'Exit' ACTION Form_1.Release
END POPUP
END MENU
END WINDOW
Form_1.Center
Form_1.Activate
Return
*-----------------------------------------------------------------------------*
Static Function BrowseForFolder( cTitle, cInitPath )
*-----------------------------------------------------------------------------*
Return HMG_BrowseForFolder( NIL, cTitle, NIL, NIL, cInitPath )
*------------------------------------------------------------------------------*
* Low Level C Routines
*------------------------------------------------------------------------------*
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include <commdlg.h>
#include <shlobj.h>
#include <commctrl.h>
int CALLBACK BrowseCallbackProc ( HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData )
{
TCHAR szPath[ MAX_PATH ];
switch( uMsg )
{
case BFFM_INITIALIZED: if( lpData )
SendMessage( hWnd, BFFM_SETSELECTION, TRUE, lpData );
break;
case BFFM_SELCHANGED: SHGetPathFromIDList( ( LPITEMIDLIST ) lParam, szPath ); SendMessage( hWnd, BFFM_SETSTATUSTEXT, 0, ( LPARAM ) szPath );
}
return 0;
}
HB_FUNC( HMG_BROWSEFORFOLDER ) // Syntax: HMG_BROWSEFORFOLDER([<hWnd>],[<cTitle>],[<nFlags>],[<nFolderType>],[<cInitPath>])
{
HWND hWnd = HB_ISNIL( 1 ) ? GetActiveWindow() : ( HWND ) hb_parnl( 1 );
BROWSEINFO BrowseInfo;
char *lpBuffer = ( char * ) hb_xgrab( MAX_PATH + 1 );
LPITEMIDLIST pidlBrowse;
SHGetSpecialFolderLocation( hWnd, HB_ISNIL(4) ? CSIDL_DRIVES : hb_parni(4), &pidlBrowse );
BrowseInfo.hwndOwner = hWnd;
BrowseInfo.pidlRoot = pidlBrowse;
BrowseInfo.pszDisplayName = lpBuffer;
BrowseInfo.lpszTitle = HB_ISNIL( 2 ) ? "Select a Folder" : hb_parc( 2 );
BrowseInfo.ulFlags = HB_ISCHAR( 5 ) ? BIF_STATUSTEXT : hb_parni( 3 );
BrowseInfo.lpfn = HB_ISCHAR( 5 ) ? BrowseCallbackProc : NULL;
BrowseInfo.lParam = HB_ISCHAR( 5 ) ? ( LPARAM ) ( char * ) hb_parc( 5 ) : 0;
BrowseInfo.iImage = 0;
pidlBrowse = SHBrowseForFolder( &BrowseInfo );
if( pidlBrowse )
{
SHGetPathFromIDList( pidlBrowse, lpBuffer );
hb_retc( lpBuffer );
}
else
hb_retc( "" );
hb_xfree( lpBuffer );
}
#pragma ENDDUMP
- serge_girard
- Posts: 3176
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Getfolder()
Hi Dominique,
This sample is a minigui sample.
You can use :
cFOLDER := GetFolder()
MSGINFO(cFOLDER)
Serge
This sample is a minigui sample.
You can use :
cFOLDER := GetFolder()
MSGINFO(cFOLDER)
Serge
There's nothing you can do that can't be done...
-
- Posts: 22
- Joined: Wed Dec 20, 2017 8:29 am
- DBs Used: DBF
- Location: Belgium
Re: Getfolder()
Hi Serge,
Thanks for your answer.
It's a minigui, indeed.
I saw minigui.ch in the hmg\include folder, so I thought it was possible ... I like miracles.
So, my problem is :
Syntax of getfolder() is :
GetFolder ( [<cTitle>] , [<cInitPath>], [<cInvalidDataMsg>], [<lNewFolderButton>] , [<lIncludeFiles>] , [<nCSIDL_FolderType>] , [<nBIF_Flags>] )--> cSelectedFolderName
Code sample (with Img_path1 = "C:\Users\Gebruiker\Documents\Photos\") :
My problem : GetFolder does not take into account the parameter Img_path1 and always give me 'Mycomputer' as initial path in the browse for folder window.
I make a mistake ? Or maybe is a bug in getfolder? In this case is there a patch?
Anyway I am looking for a solution : another function, a patch...
Have a nice weekend,
Dominique
Thanks for your answer.
It's a minigui, indeed.
I saw minigui.ch in the hmg\include folder, so I thought it was possible ... I like miracles.
So, my problem is :
Syntax of getfolder() is :
GetFolder ( [<cTitle>] , [<cInitPath>], [<cInvalidDataMsg>], [<lNewFolderButton>] , [<lIncludeFiles>] , [<nCSIDL_FolderType>] , [<nBIF_Flags>] )--> cSelectedFolderName
Code sample (with Img_path1 = "C:\Users\Gebruiker\Documents\Photos\") :
Code: Select all
msginfo('Le dossier des photos actuel est : '+Img_path1)
Img_path1 := GetFolder("Dossier de l'album photos",Img_path1,"nom invalide !",.F.,.F.,,)+"\"
msginfo('Le dossier des photos est maintenant : '+Img_path1)
I make a mistake ? Or maybe is a bug in getfolder? In this case is there a patch?
Anyway I am looking for a solution : another function, a patch...
Have a nice weekend,
Dominique
- serge_girard
- Posts: 3176
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Getfolder()
Dominique,
First check if folder "C:\Users\Gebruiker\Documents\Photos\" exists.
In my PC it is called c:\gebruikers\gebruiker\....
The sample works with c:\test
Serge
First check if folder "C:\Users\Gebruiker\Documents\Photos\" exists.
In my PC it is called c:\gebruikers\gebruiker\....
The sample works with c:\test
Serge
There's nothing you can do that can't be done...