Página 1 de 1
NOme verdadeiro do arquivo
Enviado: 30 Jul 2012 11:29
por Mário Isa
Bom dia,
Alguem sabe alguma função que retorne o nome-DOS do arquivo ou da pasta ?
Tipo
origem =
c:\Documents and settings\usuario 1\desktop
retorna =
c:\docume~1\usuari~1\desktop
:xau
NOme verdadeiro do arquivo
Enviado: 31 Jul 2012 17:08
por bencz
NOme verdadeiro do arquivo
Enviado: 31 Jul 2012 19:57
por Mário Isa
deu página não encontrada.
mesmo eu acrescentando o .aspx no final
:%
NOme verdadeiro do arquivo
Enviado: 02 Ago 2012 22:31
por Pablo César
Aqui tem dois exemplos de códigos, acho que o segundo está mais condizente com a atual versão do Harbour.
Código: Selecionar todos
HB_FUNC( WAPI_GETSHORTPATHNAME )
{
void * hLongPath;
DWORD length = 0;
LPCTSTR lpszLongPath = HB_PARSTR( 1, &hLongPath, NULL );
if( lpszLongPath )
{
if( HB_ISBYREF( 2 ) )
{
TCHAR buffer[ HB_PATH_MAX ];
DWORD cchBuffer = ( DWORD ) HB_SIZEOFARRAY( buffer );
LPTSTR lpszShortPath = buffer;
HB_BOOL fSize = HB_ISNUM( 3 );
if( fSize ) /* the size of buffer is limited by user */
{
cchBuffer = ( DWORD ) hb_parnl( 3 );
if( cchBuffer == 0 )
lpszShortPath = NULL;
else if( cchBuffer > ( DWORD ) HB_SIZEOFARRAY( buffer ) )
lpszShortPath = ( LPTSTR ) hb_xgrab( cchBuffer * sizeof( TCHAR )
);
}
length = GetShortPathName( lpszLongPath, lpszShortPath, cchBuffer );
if( !fSize && length > cchBuffer ) /* default buffer size was too
small */
{
cchBuffer = length;
lpszShortPath = ( LPTSTR ) hb_xgrab( cchBuffer * sizeof( TCHAR ) );
length = GetShortPathName( lpszLongPath, lpszShortPath, cchBuffer );
}
hbwapi_SetLastError( GetLastError() );
HB_STORSTRLEN( lpszShortPath, length > cchBuffer ? 0 : length, 2 );
if( lpszShortPath && lpszShortPath != buffer )
hb_xfree( lpszShortPath );
}
else
{
length = GetShortPathName( lpszLongPath, NULL, 0 );
hbwapi_SetLastError( GetLastError() );
}
}
hb_retnl( length );
hb_strfree( hLongPath );
}
Código: Selecionar todos
#include "hbwapi.h"
HB_FUNC( WAPI_GETSHORTPATHNAME )
{
#if !defined( HB_OS_WIN_CE )
s_getPathName( GetShortPathName );
#else
{
HB_SIZE nSize = hb_parclen( 1 );
hb_storclen( hb_parc( 1 ), nSize, 2 );
hb_retns( nSize );
}
#endif
}
Em Minigui tem _GetShortPathName e na pasta C:\MiniGUI\SAMPLES\BASIC\Paths tem um bom exemplo de uso inclusive de uso de modo sintético, aquele com ... (pontinhos). Deixo aqui o executável com o fonte em anexo, espero que sirva de exemplo.
NOme verdadeiro do arquivo
Enviado: 06 Ago 2012 21:52
por Mário Isa
Qual .LIB está a função
_GETSHORTNAME ?
Seria a libminigui.a ?
Esse .a é a .LIB no HMG ?
Mário
:-´
NOme verdadeiro do arquivo
Enviado: 07 Ago 2012 10:21
por Pablo César
Qual .LIB está a função
_GETSHORTNAME ?
É da Harbour MiniGUI Extended e está em minigui.lib
Esse .a é a .LIB no HMG ?
A lib que HMG possui a função é libhbwin.a e utiliza o
WAPI_GETSHORTPATHNAME, eis um exemplo:
Código: Selecionar todos
#include <hmg.ch>
Function Main
Local fns:=""
WAPI_GETSHORTPATHNAME("C:\Arquivos de programas\Mozilla Maintenance Service",@fns)
MsgInfo(fns)
Return
NOme verdadeiro do arquivo
Enviado: 07 Ago 2012 18:43
por Mário Isa
fui na pasta
c:\hmg
e suas sub's
nao achei nem o hmg.ch
nem o
libhbwin.a
Vc sabe onde conseguir ?
;-*
NOme verdadeiro do arquivo
Enviado: 07 Ago 2012 19:43
por Pablo César
Não sei qual é a versão que possui, mas eu achei em: C:\hmg.3.0.41\HARBOUR\lib\win\mingw
Anexei a biblioteca para a sua comidade.