ShGetFileInfo helps us in finding out whether a given path is shared or not. A wrapper function is given below… [sourcecode language=’cpp’]bool IsPathShared( LPCTSTR lpctszPath_i ) { SHFILEINFO shFileInfo = { 0 }; return ( SHGetFileInfo( lpctszPath_i, 0, &shFileInfo, sizeof( shFileInfo ), SHGFI_ATTRIBUTES ) && ( shFileInfo.dwAttributes & SFGAO_SHARE ) == SFGAO_SHARE ); […]
Continue reading…
Posts tagged with 'ShGetFileInfo'
Is a given file shortcut to some other file?
ShGetFileInfo is the API that helps in finding out whether a file is a shortcut to some other file. Here is wrapper function… [sourcecode language=’cpp’]bool IsShortcut( LPCTSTR lpctszPath_i ) { SHFILEINFO shFileInfo = { 0 }; return (( SHGetFileInfo( lpctszPath_i, 0, &shFileInfo, sizeof( shFileInfo ), SHGFI_ATTRIBUTES )) && ( shFileInfo.dwAttributes & SFGAO_LINK ) == SFGAO_LINK […]
Continue reading…
How to resolve a shortcut!
Ever wondered how to resolve a shortcut! There is a hidden helper function if you are using MFC, it’s called AfxResolveShortcut. I customized it a bit, so that we can use it independently without MFC, and here is the finished product. 😉 [sourcecode language=’cpp’]BOOL ResolveShortcut( HWND hWnd_i, LPCTSTR lpctszFileIn_i, LPTSTR lptszFileOut_o, const int nPathLength_i […]
Continue reading…
Type of Exe(Console, Windows, MS-DOS application).
How to find out the type of an executable file, i.e. whether it’s a windows application or a console application or an MS-DOS application… [sourcecode language=’cpp’]void GetFileType( LPCTSTR lpctszFilePath_i, CString& csFileType_o ) { // Get exe file type const DWORD dwRetVal = SHGetFileInfo( lpctszFilePath_i, FILE_ATTRIBUTE_NORMAL, 0, 0, SHGFI_EXETYPE ); […]
Continue reading…