PathCompactPath
Posted: Fri Jan 13, 2017 3:00 pm
e.g. "C:\Program...\Adobe"
The GRID headers give the same effect, but we do not have this function available to the user in HMG yet.
It would be useful as in these cases:

We would need to convert this code to UNICODE/ANSI and I imagine we need to use HMG_DEFINE_DLL_FUNC but I do not know how to adapt it to HMG.
IMHO, first option is better doing in pixels not in pixel considering GetFontSize.
I think it would be useful to have a solution where prevent texts from being truncated.
The GRID headers give the same effect, but we do not have this function available to the user in HMG yet.

It would be useful as in these cases:

- Here is a solution: https://www.codeproject.com/articles/36 ... it-control
- In Minigui Extended there is another solution, like as this code:
Code: Select all
// Jacek Kubica <kubica@wssk.wroc.pl> HMG 1.1 Experimental Build 11a // cFile - string to be compacted (may be for example fullpath, path or file name) // nMax - required string size (characters count) // _GetCompactPath("C:\Program Files\Adobe",20) -> "C:\Program...\Adobe" FUNCTION _GetCompactPath ( cFile, nMax ) LOCAL cShort := Space( hb_IsNumeric( nMax, nMax + 1, 64 ) ) Return iif( GetCompactPath( @cShort, cFile, hb_IsNumeric( nMax, nMax, 63 ), NIL ) > 0, cShort, cFile )
Code: Select all
// Grigory Filatov <gfilatov@inbox.ru> HMG 1.1 Experimental Build 11a typedef INT ( WINAPI * _GETCOMPACTPATH )( LPTSTR pszOut, LPTSTR pszSrc, INT cchMax, DWORD dwFlags ); HB_FUNC( GETCOMPACTPATH ) { HINSTANCE handle = LoadLibrary( "shlwapi.dll" ); if( handle ) { _GETCOMPACTPATH pFunc; pFunc = ( _GETCOMPACTPATH ) GetProcAddress( handle, "PathCompactPathExA" ); hb_retni( pFunc( ( LPTSTR ) hb_parc( 1 ), ( LPTSTR ) hb_parc( 2 ), ( INT ) hb_parni( 3 ), ( DWORD ) hb_parnl( 4 ) ) ); FreeLibrary( handle ); } }
We would need to convert this code to UNICODE/ANSI and I imagine we need to use HMG_DEFINE_DLL_FUNC but I do not know how to adapt it to HMG.

IMHO, first option is better doing in pixels not in pixel considering GetFontSize.

I think it would be useful to have a solution where prevent texts from being truncated.