Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetFile()
Message
From
21/01/2003 02:46:09
 
 
To
17/12/2002 04:30:05
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00733555
Message ID:
00743664
Views:
13
Janusz,

You can also take the following code to do what you want. I have extracted the code of our personal library that does this (FOCUS.FLL). You can base your VFP code on this by DECLARE - DLL commands:


FUNCTION int fnFW_DLG_open( XBASE_PARAMETERS )
/*------------------------------------------*/
{
/* Documented */
// For multiple selects, we need a big buffer
char szFileName[8192];
OPENFILENAME ofn; // Passed to the File Open/save APIs
DWORD dwFlags;

FOCUSFncStart( "fnFW_DLG_open()" );

/* Initialize the 3 string parameters:
1 ... szFilter
2 ... Title of the dialog
3 ... Initial Directory
*/
_initparc(1); _initparc(2); _initparc(3);

dwFlags = (DWORD) _parnl( 4 );

szFileName[0] = 0;

ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = GetActiveWindow();
ofn.hInstance = GetModuleHandle(NULL);
ofn.lpstrFilter = _parc(1);
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileName;
ofn.nMaxFile = sizeof( szFileName );
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = _parc(3);
ofn.lpstrTitle = _parc(2);
ofn.Flags = dwFlags;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.lpfnHook = NULL;
ofn.lpTemplateName = NULL;

// This code can be used to tailor a given window
// SetWindowPos( hWnd,NULL,iHorPos,iVerPos,iWidth,iHeight,SWP_NOZORDER );

if ( GetOpenFileName( &ofn ) )
{
/* Return a string */
_retc( szFileName );
}
else
{
/* Return an empty string */
_retc( "" );
}

/* Unlock the 3 string parameters */
_deinitparc(1); _deinitparc(2); _deinitparc(3);

FOCUSFncReturn( "fnFW_DLG_open()" );
}


>Hi,
>
>There is a disabled "Code Page" button on GetFile() dialog. MS, please, remove it - it has no meaning to my customers, so I have to use CommDialog OCX instead of GetFile() function.
>
>Thanks,
>
>Janusz Czudek
>WORD Software
>http://www.wordsoft.com.pl
Previous
Reply
Map
View

Click here to load this message in the networking platform